Sayonara Player
AbstractEngine.h
1 /* Engine.h */
2 
3 /* Copyright (C) 2012 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 #ifndef ENGINE_H_
23 #define ENGINE_H_
24 
25 #include "Helper/Settings/SayonaraClass.h"
26 #include "Helper/MetaData/MetaData.h"
27 
28 #define PLAYBACK_ENGINE "playback_engine"
29 #define CONVERT_ENGINE "convert_engine"
30 
31 enum class EngineName : quint8 {
32  Undefined=0,
35 };
36 
37 
38 class Engine :
39  public QObject,
40  protected SayonaraClass
41 {
42 
43  Q_OBJECT
44 
45 
46 public:
47 
48  Engine(QObject* parent=nullptr);
49  virtual EngineName get_name() const final;
50 
51  virtual bool init()=0;
52 
53  virtual void set_track_finished();
54 
55  virtual void async_done();
56  virtual void update_md(const MetaData&);
57  virtual void update_duration();
58  virtual void update_bitrate(quint32 br);
59  virtual void update_time(qint32 time);
60 
61  void set_level(float right, float left);
62  void set_spectrum(QVector<float>& lst );
63 
64 signals:
65  void sig_md_changed(const MetaData&);
66  void sig_dur_changed(const MetaData&);
67  void sig_br_changed(const MetaData&);
68 
69  void sig_pos_changed_ms(quint64);
70  void sig_pos_changed_s(quint32);
71 
72  void sig_buffering(int progress);
73 
74  void sig_track_ready();
75  void sig_track_finished();
76 
77  void sig_download_progress(int);
78 
79 
80 protected slots:
81 
82  virtual void set_about_to_finish(qint64 ms);
83  virtual void set_cur_position_ms(qint64 ms);
84 
85 
86 
87 public slots:
88  virtual void play()=0;
89  virtual void stop()=0;
90  virtual void pause()=0;
91 
92  virtual void jump_abs_ms(quint64 ms)=0;
93  virtual void jump_rel_ms(quint64 ms)=0;
94  virtual void jump_rel(double ms)=0;
95 
96  virtual void change_track(const MetaData&)=0;
97  virtual void change_track(const QString&)=0;
98 
99  virtual void set_track_ready();
100  virtual void buffering(int);
101 
102 
103 protected:
104 
105  char* _uri=nullptr;
106 
107  EngineName _name;
108 
109  MetaData _md;
110  qint64 _cur_pos_ms;
111  bool _playing_stream;
112  bool _broadcast_active;
113 
114 };
115 
116 extern Engine* gst_obj_ref;
117 
118 #endif
119 
The SayonaraClass class provides access to Settings and notifications.
Definition: SayonaraClass.h:31
Definition: MetaData.h:49
Definition: AbstractEngine.h:38
Definition: PlaybackEngine.h:50
Definition: ConvertEngine.h:31