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(uint32_t br, GstElement* src) override;
66  void update_duration(int64_t duration_ms, GstElement* src) override;
67 
68  void set_track_ready(GstElement* src) override;
69  void set_track_almost_finished(int64_t time2go) override;
70  void set_track_finished(GstElement* src) override;
71 
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(uint64_t pos_ms) override;
92  void jump_rel_ms(uint64_t 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(char* 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(int64_t pos_ms);
117  };
118 }
119 
120 #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:35
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