Line data Source code
1 : /*
2 : * Copyright (C) 2025 Sky UK
3 : *
4 : * This library is free software; you can redistribute it and/or
5 : * modify it under the terms of the GNU Lesser General Public
6 : * License as published by the Free Software Foundation;
7 : * version 2.1 of the License.
8 : *
9 : * This library is distributed in the hope that it will be useful,
10 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 : * Lesser General Public License for more details.
13 : *
14 : * You should have received a copy of the GNU Lesser General Public
15 : * License along with this library; if not, write to the Free Software
16 : * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 : */
18 :
19 : #pragma once
20 :
21 : #include "GStreamerUtils.h"
22 : #include "MediaCommon.h"
23 : #include <gst/gst.h>
24 : #include <memory>
25 :
26 : class IPlaybackDelegate
27 : {
28 : public:
29 : enum class Property
30 : {
31 : // PullModePlaybackDelegate Properties
32 : IsSinglePathStream,
33 : NumberOfStreams,
34 : HasDrm,
35 : Stats,
36 :
37 : // PullModeAudioPlaybackDelegate Properties
38 : Volume,
39 : Mute,
40 : Gap,
41 : LowLatency,
42 : Sync,
43 : SyncOff,
44 : StreamSyncMode,
45 : AudioFade,
46 : FadeVolume,
47 : LimitBufferingMs,
48 : UseBuffering,
49 : Async,
50 :
51 : // PullModeVideoPlaybackDelegate Properties
52 : WindowSet,
53 : MaxVideoWidth,
54 : MaxVideoHeight,
55 : FrameStepOnPreroll,
56 : ImmediateOutput,
57 : SyncmodeStreaming,
58 : ShowVideoWindow,
59 :
60 : // PullModeSubtitlePlaybackDelegate Properties
61 : TextTrackIdentifier,
62 : WindowId,
63 : };
64 :
65 367 : IPlaybackDelegate() = default;
66 367 : virtual ~IPlaybackDelegate() = default;
67 :
68 : IPlaybackDelegate(const IPlaybackDelegate &) = delete;
69 : IPlaybackDelegate(IPlaybackDelegate &&) = delete;
70 : IPlaybackDelegate &operator=(const IPlaybackDelegate &) = delete;
71 : IPlaybackDelegate &operator=(IPlaybackDelegate &&) = delete;
72 :
73 : virtual void setSourceId(int32_t sourceId) = 0;
74 :
75 : virtual void handleEos() = 0;
76 : virtual void handleFlushCompleted() = 0;
77 : virtual void handleStateChanged(firebolt::rialto::PlaybackState state) = 0;
78 : virtual void handleError(firebolt::rialto::PlaybackError error) = 0;
79 : virtual void handleQos(uint64_t processed, uint64_t dropped) const = 0;
80 :
81 : virtual GstStateChangeReturn changeState(GstStateChange transition) = 0;
82 : virtual void postAsyncStart() = 0;
83 : virtual void setProperty(const Property &type, const GValue *value) = 0;
84 : virtual void getProperty(const Property &type, GValue *value) = 0;
85 : virtual std::optional<gboolean> handleQuery(GstQuery *query) const = 0;
86 : virtual gboolean handleSendEvent(GstEvent *event) = 0;
87 : virtual gboolean handleEvent(GstEvent *event) = 0;
88 : virtual GstFlowReturn handleBuffer(GstBuffer *buffer) = 0;
89 : virtual GstRefSample getFrontSample() const = 0;
90 : virtual void popSample() = 0;
91 : virtual bool isEos() const = 0;
92 : virtual void lostState() = 0;
93 : virtual bool attachToMediaClientAndSetStreamsNumber(const uint32_t maxVideoWidth = 0,
94 : const uint32_t maxVideoHeight = 0) = 0;
95 : };
|