Sayonara Player
PlaybackPipeline.h
1 /* PlaybackPipeline.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 GSTPLAYBACKPIPELINE_H_
22 #define GSTPLAYBACKPIPELINE_H_
23 
24 #include "ChangeablePipeline.h"
25 #include "Crossfader.h"
26 #include "DelayedPlayHandler.h"
27 #include "Components/Engine/AbstractPipeline.h"
28 #include "Utils/Pimpl.h"
29 
30 namespace Pipeline
31 {
36  class Playback :
37  public Base,
38  public CrossFader,
39  public Changeable,
40  public DelayedPlayHandler
41  {
42  Q_OBJECT
43  PIMPL(Playback)
44 
45  public:
46  explicit Playback(Engine::Base* engine, QObject *parent=nullptr);
47  virtual ~Playback();
48 
49  bool init(GstState state=GST_STATE_NULL) override;
50  bool set_uri(gchar* uri) override;
51 
52  void enable_broadcasting(bool b);
53  void enable_streamrecorder(bool b);
54  void set_streamrecorder_path(const QString& session_path);
55 
56  void enable_visualizer(bool b);
57 
58  void set_current_volume(double volume) override;
59  double get_current_volume() const override;
60 
61 
62  GstElement* get_source() const override;
63  GstElement* pipeline() const override;
64 
65  public slots:
66  void play() override;
67  void stop() override;
68 
69  void set_eq_band(int band_name, int val);
70 
71  NanoSeconds seek_rel(double percent, NanoSeconds ref_ns);
72  NanoSeconds seek_abs(NanoSeconds ns );
73 
74  private:
75  bool create_source(gchar* uri);
76  void remove_source();
77 
78  void init_equalizer();
79  bool init_visualizer();
80  bool init_broadcasting();
81  bool init_streamrecorder();
82 
83  bool create_elements() override;
84  GstElement* create_audio_sink(const QString& name);
85  bool add_and_link_elements() override;
86  bool configure_elements() override;
87  MilliSeconds get_about_to_finish_time() const override;
88 
89  void fade_in_handler() override;
90  void fade_out_handler() override;
91 
92  protected slots:
93  void s_vol_changed();
94  void s_show_visualizer_changed();
95  void s_mute_changed();
96  void s_speed_active_changed();
97  void s_speed_changed();
98  void s_sink_changed();
99  };
100 }
101 
102 #endif
double get_current_volume() const override
get current volume of pipeline
The PlaybackPipeline class.
Definition: PlaybackPipeline.h:36
The AbstractPipeline class.
Definition: AbstractPipeline.h:53
The Engine class.
Definition: AbstractEngine.h:51
The CrossFader class.
Definition: Crossfader.h:34
void set_current_volume(double volume) override
set current volume of pipeline
Definition: AbstractPipeline.h:37
The ChangeablePipeline class.
Definition: ChangeablePipeline.h:32
Definition: DelayedPlayHandler.h:31