Sayonara Player
Pipeline.h
1 /* PlaybackPipeline.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (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 "PipelineExtensions/Changeable.h"
25 #include "PipelineExtensions/Fadeable.h"
26 #include "PipelineExtensions/DelayedPlayable.h"
27 #include "PipelineExtensions/BroadcastBin.h"
28 #include "PipelineExtensions/PositionAccessible.h"
29 #include "PipelineExtensions/Pitchable.h"
30 #include "PipelineExtensions/EqualizerAccesible.h"
31 #include "Utils/Pimpl.h"
32 
33 #include <QObject>
34 
35 namespace Engine
36 {
37  class Engine;
38 
43  class Pipeline :
44  public QObject,
52  {
53  Q_OBJECT
54  PIMPL(Pipeline)
55 
56  signals:
57  void sigAboutToFinishMs(MilliSeconds ms);
58  void sigPositionChangedMs(MilliSeconds ms);
59  void sigDataAvailable(const QByteArray& data);
60 
61  public:
62  explicit Pipeline(const QString& name, QObject* parent=nullptr);
63  ~Pipeline() override;
64 
65  bool init(Engine* engine);
66  bool prepare(const QString& uri);
67 
68  bool hasElement(GstElement* e) const;
69  GstState state() const;
70 
71  void checkPosition();
72  void checkAboutToFinish();
73 
74  void setVisualizerEnabled(bool levelEnabled, bool spectrumEnabled);
75  bool isLevelVisualizerEnabled() const;
76  bool isSpectrumVisualizerEnabled() const;
77 
78  void setBroadcastingEnabled(bool b);
79  bool isBroadcastingEnabled() const;
80 
81  void record(bool b);
82  void setRecordingPath(const QString& session_path);
83 
84  MilliSeconds timeToGo() const;
85 
86  void setRawData(const QByteArray& data) override; // BroadcastDataReceiver
87 
88  public slots:
89  void play() override; // Crossfader
90  void stop() override; // Crossfader
91  void pause();
92 
93  private slots:
94  void volumeChanged();
95  void muteChanged();
96  void speedActiveChanged();
97  void sppedChanged();
98  void sinkChanged();
99 
100  private:
101  bool createElements();
102  bool addAndLinkElements();
103  void configureElements();
104 
105  void postProcessFadeIn() override; // Crossfader
106  void postProcessFadeOut() override; // Crossfader
107  void setInternalVolume(double volume) override; // Crossfader
108  double internalVolume() const override; // Crossfader
109 
110  GstElement* positionElement() const override;
111  GstElement* pitchElement() const override;
112  GstElement* equalizerElement() const override;
113  };
114 }
115 
116 #endif
PipelineExtensions::BroadcastDataReceiver
Definition: BroadcastBin.h:30
PipelineExtensions::PositionAccessible
The Seeker class.
Definition: PositionAccessible.h:35
Engine::Pipeline
The PlaybackPipeline class.
Definition: Pipeline.h:52
PipelineExtensions::Fadeable
The CrossFader class.
Definition: Fadeable.h:60
PipelineExtensions::DelayedPlayable
The DelayedPlayable class.
Definition: DelayedPlayable.h:34
PipelineExtensions::Pitchable
The Pitcher class.
Definition: Pitchable.h:34
PipelineExtensions::EqualizerAccessible
The Equalizer class.
Definition: EqualizerAccesible.h:34
PipelineExtensions::Changeable
The ChangeablePipeline class.
Definition: Changeable.h:33
Engine::Engine
The PlaybackEngine class.
Definition: Engine.h:49