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 #include "CrossFader.h"
28 
29 #include <gst/app/gstappsink.h>
30 #include <QTimer>
31 
32 struct StreamRecorderData;
33 class Engine;
34 
36  public AbstractPipeline,
37  public CrossFader
38 {
39  Q_OBJECT
40 
41 
42 public:
43 
44  PlaybackPipeline(Engine* engine, QObject *parent=nullptr);
45  virtual ~PlaybackPipeline();
46 
47  bool init(GstState state=GST_STATE_NULL) override;
48  bool set_uri(gchar* uri) override;
49 
50  void set_n_sound_receiver(int num_sound_receiver);
51 
52  void set_current_volume(double volume) override;
53  double get_current_volume() const override;
54 
55  GstElement* get_source() const override;
56 
57 
58 public slots:
59 
60  void play() override;
61  void pause() override;
62  void stop() override;
63 
64  void set_eq_band(const QString& band_name, double val);
65  void set_speed(float f) override;
66  void set_streamrecorder_path(const QString& session_path);
67 
68  gint64 seek_rel(double percent, gint64 ref_ns);
69  gint64 seek_abs(gint64 ns );
70 
71 
72 private:
73 
74  int _vol;
75  bool _speed_active;
76  float _speed_val;
77  QString _sr_path;
78  StreamRecorderData* _sr_data=nullptr;
79 
80 
81  GstElement* _audio_src=nullptr;
82  GstElement* _audio_convert=nullptr;
83  GstElement* _tee=nullptr;
84 
85  GstElement* _eq_queue=nullptr;
86  GstElement* _equalizer=nullptr;
87  GstElement* _speed=nullptr;
88  GstElement* _volume=nullptr;
89 
90  GstElement* _audio_sink=nullptr;
91 
92  GstElement* _spectrum_queue=nullptr;
93  GstElement* _spectrum=nullptr;
94  GstElement* _spectrum_sink=nullptr;
95 
96  GstElement* _level_queue=nullptr;
97  GstElement* _level=nullptr;
98  GstElement* _level_sink=nullptr;
99 
100  GstElement* _lame_queue=nullptr;
101  GstElement* _lame_converter=nullptr;
102  GstElement* _lame_resampler=nullptr;
103  GstElement* _lame=nullptr;
104  GstElement* _lame_app_sink=nullptr;
105 
106  GstElement* _file_queue=nullptr;
107  GstElement* _file_sink=nullptr;
108  GstElement* _file_resampler=nullptr;
109  GstElement* _file_lame=nullptr;
110 
111  gulong _level_probe, _spectrum_probe, _lame_probe, _file_probe;
112  bool _show_level, _show_spectrum, _run_broadcast, _run_sr;
113 
114  bool _seek(gint64 ns);
115 
116 
117  bool create_elements() override;
118  bool add_and_link_elements() override;
119  bool configure_elements() override;
120  quint64 get_about_to_finish_time() const 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: CrossFader.h:33
Definition: AbstractEngine.h:40
Definition: PlaybackPipeline.h:35
Definition: AbstractPipeline.h:46