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 set_n_sound_receiver(int num_sound_receiver);
53 
54  void set_current_volume(double volume) override;
55  double get_current_volume() const override;
56 
57  GstElement* get_source() const override;
58  GstElement* pipeline() const override;
59 
60  void force_about_to_finish();
61 
62  void set_spectrum_enabled(bool b);
63  void set_level_enabled(bool b);
64 
65 
66  public slots:
67  void play() override;
68  void stop() override;
69 
70  void set_eq_band(int band_name, int val);
71  void set_streamrecorder_path(const QString& session_path);
72 
73  NanoSeconds seek_rel(double percent, NanoSeconds ref_ns);
74  NanoSeconds seek_abs(NanoSeconds ns );
75 
76  private:
77  void init_equalizer();
78  bool create_elements() override;
79  GstElement* create_audio_sink(const QString& name);
80  bool add_and_link_elements() override;
81  bool configure_elements() override;
82  MilliSeconds get_about_to_finish_time() const override;
83 
84  void fade_in_handler() override;
85  void fade_out_handler() override;
86 
87  protected slots:
88  void s_vol_changed();
89  void s_show_level_changed();
90  void s_show_spectrum_changed();
91  void s_mute_changed();
92  void s_speed_active_changed();
93  void s_speed_changed();
94  void s_sink_changed();
95  };
96 }
97 
98 #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:61
The Engine class.
Definition: AbstractEngine.h:51
The CrossFader class.
Definition: Crossfader.h:35
void set_current_volume(double volume) override
set current volume of pipeline
The ChangeablePipeline class.
Definition: ChangeablePipeline.h:32
Definition: DelayedPlayHandler.h:31