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/StreamRecordable.h"
25#include "Utils/typedefs.h"
26#include <gst/gst.h>
27#include <memory>
28
29#include <QObject>
30
31namespace Engine
32{
33 class Engine;
34
35 class Pipeline :
36 public QObject,
38 {
39 Q_OBJECT
40 signals:
41 void sigAboutToFinishMs(MilliSeconds ms);
42 void sigPositionChangedMs(MilliSeconds ms);
43 void sigDataAvailable(const QByteArray& data);
44
45 public:
46 ~Pipeline() override;
47
48 virtual bool init(Engine* engine) = 0;
49 virtual bool prepare(const QString& uri, const QString& userAgent = QString()) = 0;
50
51 [[nodiscard]] virtual bool hasElement(GstElement* e) const = 0;
52 virtual void checkPosition() = 0;
53
54 [[nodiscard]] virtual GstState state() const = 0;
55
56 virtual void setVisualizerEnabled(bool isLevelActive, bool isSpectrumActive) = 0;
57 [[nodiscard]] virtual bool isLevelVisualizerEnabled() const = 0;
58 [[nodiscard]] virtual bool isSpectrumVisualizerEnabled() const = 0;
59
60 virtual void setBroadcastingEnabled(bool b) = 0;
61 [[nodiscard]] virtual bool isBroadcastingEnabled() const = 0;
62
63 virtual void fadeIn() = 0;
64 virtual void fadeOut() = 0;
65
66 virtual void startDelayedPlayback(MilliSeconds ms) = 0;
67
68 virtual void seekRelative(double percent, MilliSeconds duration) = 0;
69 virtual void seekAbsoluteMs(MilliSeconds ms) = 0;
70 virtual void seekRelativeMs(MilliSeconds ms) = 0;
71 [[nodiscard]] virtual MilliSeconds duration() const = 0;
72 [[nodiscard]] virtual MilliSeconds timeToGo() const = 0;
73
74 virtual void setEqualizerBand(int band, int value) = 0;
75
76 static std::shared_ptr<Pipeline> create(const QString& name, QObject* parent = nullptr);
77
78 public slots: // NOLINT(readability-redundant-access-specifiers)
79 virtual void play() = 0;
80 virtual void stop() = 0;
81 virtual void pause() = 0;
82
83 protected:
84 explicit Pipeline(QObject* parent);
85 };
86} // SAYONARA_PLAYER_PIPELINE_H
87
88#endif
Definition Engine.h:53
Definition StreamRecordable.h:28