Sayonara Player
PlaybackPipeline.h
1 /* PlaybackPipeline.h */
2 
3 /* Copyright (C) 2011-2016 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 
23 #ifndef GSTPLAYBACKPIPELINE_H_
24 #define GSTPLAYBACKPIPELINE_H_
25 
26 #include "Components/Engine/AbstractPipeline.h"
27 
28 #include <gst/app/gstappsink.h>
29 
30 struct StreamRecorderData;
31 class Engine;
32 
34 {
35  Q_OBJECT
36 
37 
38 public:
39  PlaybackPipeline(Engine* engine, QObject *parent=nullptr);
40  virtual ~PlaybackPipeline();
41 
42  bool init(GstState state=GST_STATE_NULL) override;
43  bool set_uri(gchar* uri) override;
44 
45  void set_n_sound_receiver(int num_sound_receiver);
46 
47  GstElement* get_source() const override;
48 
49 
50 
51 
52 public slots:
53 
54  void play() override;
55  void pause() override;
56  void stop() override;
57 
58  void set_eq_band(const QString& band_name, double val);
59 
60  void set_speed(float f);
61 
62  void set_streamrecorder_path(const QString& session_path);
63 
64  gint64 seek_rel(double percent, gint64 ref_ns);
65  gint64 seek_abs(gint64 ns );
66 
67 
68 private:
69 
70  int _vol;
71  bool _speed_active;
72  float _speed_val;
73  QString _sr_path;
74  StreamRecorderData* _sr_data=nullptr;
75 
76 
77  GstElement* _audio_src=nullptr;
78  GstElement* _audio_convert=nullptr;
79  GstElement* _tee=nullptr;
80 
81  GstElement* _eq_queue=nullptr;
82  GstElement* _equalizer=nullptr;
83  GstElement* _speed=nullptr;
84  GstElement* _volume=nullptr;
85 
86  GstElement* _audio_sink=nullptr;
87 
88  GstElement* _spectrum_queue=nullptr;
89  GstElement* _spectrum=nullptr;
90  GstElement* _spectrum_sink=nullptr;
91 
92  GstElement* _level_queue=nullptr;
93  GstElement* _level=nullptr;
94  GstElement* _level_sink=nullptr;
95 
96  GstElement* _lame_queue=nullptr;
97  GstElement* _lame_converter=nullptr;
98  GstElement* _lame_resampler=nullptr;
99  GstElement* _lame=nullptr;
100  GstElement* _lame_app_sink=nullptr;
101 
102  GstElement* _file_queue=nullptr;
103  GstElement* _file_sink=nullptr;
104  GstElement* _file_resampler=nullptr;
105  GstElement* _file_lame=nullptr;
106 
107  GstState _saved_state;
108 
109  gulong _level_probe, _spectrum_probe, _lame_probe, _file_probe;
110  bool _show_level, _show_spectrum, _run_broadcast, _run_sr;
111 
112  bool _seek(gint64 ns);
113  bool tee_connect(GstPadTemplate* tee_src_pad_template,
114  GstElement* queue,
115  const QString& queue_name
116  );
117 
118  bool create_elements() override;
119  bool add_and_link_elements() override;
120  bool configure_elements() override;
121 
122  void init_equalizer();
123 
124 
125 protected slots:
126 
127  void _sl_vol_changed();
128  void _sl_show_level_changed();
129  void _sl_show_spectrum_changed();
130  void _sl_mute_changed();
131 
132 };
133 
134 #endif
Definition: PipelineProbes.h:30
Definition: AbstractEngine.h:38
Definition: PlaybackPipeline.h:33
Definition: AbstractPipeline.h:46