Sayonara Player
Loading...
Searching...
No Matches
Pipeline.h
1/* PlaybackPipeline.h */
2
3/* Copyright (C) 2011-2024 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 SAYONARA_PLAYER_PIPELINE_H
22#define SAYONARA_PLAYER_PIPELINE_H
23
24#include "PipelineExtensions/Broadcasting.h"
25#include "PipelineExtensions/PipelineInterfaces.h"
26#include "PipelineExtensions/Changeable.h"
27#include "PipelineExtensions/StreamRecordable.h"
28
29#include "Utils/Pimpl.h"
30
31#include <QObject>
32
33namespace Engine
34{
35 class Engine;
36
37 class Pipeline :
38 public QObject,
44 {
45 Q_OBJECT
46 PIMPL(Pipeline)
47
48 signals:
49 void sigAboutToFinishMs(MilliSeconds ms);
50 void sigPositionChangedMs(MilliSeconds ms);
51 void sigDataAvailable(const QByteArray& data);
52
53 public:
54 explicit Pipeline(const QString& name, QObject* parent = nullptr);
55 ~Pipeline() override;
56
57 bool init(Engine* engine);
58 bool prepare(const QString& uri);
59
60 bool hasElement(GstElement* e) const;
61 [[nodiscard]] GstState state() const;
62
63 void checkPosition();
64 void checkAboutToFinish();
65
66 void setVisualizerEnabled(bool levelEnabled, bool spectrumEnabled);
67 [[nodiscard]] bool isLevelVisualizerEnabled() const;
68 [[nodiscard]] bool isSpectrumVisualizerEnabled() const;
69
70 void setBroadcastingEnabled(bool b) override;
71 [[nodiscard]] bool isBroadcastingEnabled() const override;
72
73 void prepareForRecording() override;
74 void finishRecording() override;
75 void setRecordingPath(const QString& targetPath) override;
76
77 void fadeIn();
78 void fadeOut();
79
80 void startDelayedPlayback(MilliSeconds ms);
81
82 void seekRelative(double percent, MilliSeconds duration);
83 void seekAbsoluteMs(MilliSeconds ms);
84 void seekRelativeMs(MilliSeconds ms);
85 [[nodiscard]] MilliSeconds duration() const;
86 [[nodiscard]] MilliSeconds timeToGo() const;
87
88 void setEqualizerBand(int band, int value);
89
90 public slots: // NOLINT(readability-redundant-access-specifiers)
91 void play() override;
92 void stop() override;
93 void pause() override;
94
95 private slots:
96 void volumeChanged();
97 void muteChanged();
98 void speedActiveChanged();
99 void sppedChanged();
100 void sinkChanged();
101
102 private: // NOLINT(readability-redundant-access-specifiers)
103 bool createElements();
104 bool addAndLinkElements();
105 void configureElements();
106
107 void setVolume(double volume) override;
108 [[nodiscard]] double volume() const override;
109 };
110} // SAYONARA_PLAYER_PIPELINE_H
111
112#endif
Definition: Engine.h:52
Definition: Pipeline.h:44
Definition: Broadcasting.h:41
Definition: Changeable.h:29
Definition: PipelineInterfaces.h:27
Definition: StreamRecordable.h:28
Definition: PipelineInterfaces.h:36