Sayonara Player
PlaybackEngine.h
1 /* PlaybackEngine.h */
2 
3 /* Copyright (C) 2011-2019 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 #ifndef GSTPLAYBACKENGINE_H_
22 #define GSTPLAYBACKENGINE_H_
23 
24 #include "Components/Engine/AbstractEngine.h"
25 #include "SoundOutReceiver.h"
26 
27 class QTimer;
28 class QString;
29 
30 class SpectrumReceiver;
31 class LevelReceiver;
32 
33 namespace StreamRecorder
34 {
35  class StreamRecorder;
36 }
37 
38 namespace Pipeline
39 {
40  class Playback;
41 }
42 
43 namespace Engine
44 {
49  class Playback :
50  public Base
51  {
52  Q_OBJECT
53  PIMPL(Playback)
54 
55  signals:
56  void sig_data(const unsigned char* data, uint64_t n_bytes);
57 
58  public:
59  explicit Playback(QObject* parent=nullptr);
60  ~Playback();
61 
62  bool init() override;
63 
64  void update_bitrate(Bitrate br, GstElement* src) override;
65  void update_duration(MilliSeconds duration_ms, GstElement* src) override;
66 
67  void set_track_ready(GstElement* src) override;
68  void set_track_almost_finished(MilliSeconds time2go) override;
69  void set_track_finished(GstElement* src) override;
70 
71  bool is_streamrecroder_recording() const;
72  void set_streamrecorder_recording(bool b);
73 
74  int get_spectrum_bins() const;
75  void set_spectrum(const SpectrumList& vals);
76  void add_spectrum_receiver(SpectrumReceiver* receiver);
77 
78  void set_level(float left, float right);
79  void add_level_receiver(LevelReceiver* receiver);
80 
81  void set_n_sound_receiver(int num_sound_receiver);
82 
83  void set_equalizer(int band, int value);
84 
85 
86  public slots:
87  void play() override;
88  void stop() override;
89  void pause() override;
90 
91  void jump_abs_ms(MilliSeconds pos_ms) override;
92  void jump_rel_ms(MilliSeconds pos_ms) override;
93  void jump_rel(double percent) override;
94  void update_metadata(const MetaData& md, GstElement* src) override;
95  void update_cover(const QImage& img, GstElement* src) override;
96 
97  bool change_track(const MetaData& md) override;
98 
99  void set_buffer_state(int progress, GstElement* src) override;
100 
101  private:
102  bool init_pipeline(Pipeline::Playback** pipeline);
103 
104  bool change_uri(const QString& uri) override;
105  bool change_metadata(const MetaData& md) override;
106 
107  bool change_track_crossfading(const MetaData& md);
108  bool change_track_gapless(const MetaData& md);
109  bool change_track_immediatly(const MetaData& md);
110 
111 
112  private slots:
113  void s_gapless_changed();
114  void s_streamrecorder_active_changed();
115 
116  void cur_pos_ms_changed(MilliSeconds pos_ms);
117  };
118 }
119 
120 #endif /* GSTENGINE_H_ */
The LevelReceiver class.
Definition: SoundOutReceiver.h:32
The MetaData class.
Definition: MetaData.h:44
Definition: AbstractEngine.h:32
The PlaybackPipeline class.
Definition: PlaybackPipeline.h:36
The PlaybackEngine class.
Definition: PlaybackEngine.h:49
The Engine class.
Definition: AbstractEngine.h:50
The SpectrumReceiver class.
Definition: SoundOutReceiver.h:46
Definition: AbstractPipeline.h:36
Definition: PipelineProbes.h:26