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