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