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 : #include <string>
26 :
27 : class IPlaybackDelegate
28 : {
29 : public:
30 : enum class Property
31 : {
32 : // PullModePlaybackDelegate Properties
33 : IsSinglePathStream,
34 : NumberOfStreams,
35 : HasDrm,
36 : Stats,
37 : EnableLastSample,
38 : LastSample,
39 :
40 : // PullModeAudioPlaybackDelegate Properties
41 : Volume,
42 : Mute,
43 : Gap,
44 : LowLatency,
45 : Sync,
46 : SyncOff,
47 : StreamSyncMode,
48 : AudioFade,
49 : FadeVolume,
50 : LimitBufferingMs,
51 : UseBuffering,
52 : Async,
53 :
54 : // PullModeVideoPlaybackDelegate Properties
55 : WindowSet,
56 : MaxVideoWidth,
57 : MaxVideoHeight,
58 : FrameStepOnPreroll,
59 : ImmediateOutput,
60 : SyncmodeStreaming,
61 : ShowVideoWindow,
62 : VideoPts,
63 : ReportDecodeErrors,
64 : QueuedFrames,
65 :
66 : // PullModeSubtitlePlaybackDelegate Properties
67 : TextTrackIdentifier,
68 : WindowId,
69 :
70 : // PushModeAudioPlaybackDelegate Properties
71 : TsOffset,
72 : };
73 :
74 518 : IPlaybackDelegate() = default;
75 518 : virtual ~IPlaybackDelegate() = default;
76 :
77 : IPlaybackDelegate(const IPlaybackDelegate &) = delete;
78 : IPlaybackDelegate(IPlaybackDelegate &&) = delete;
79 : IPlaybackDelegate &operator=(const IPlaybackDelegate &) = delete;
80 : IPlaybackDelegate &operator=(IPlaybackDelegate &&) = delete;
81 :
82 : virtual void handleEos() = 0;
83 : virtual void handleStateChanged(firebolt::rialto::PlaybackState state) = 0;
84 : virtual void handleError(const std::string &message, gint code = 0) = 0;
85 : virtual void handleQos(uint64_t processed, uint64_t dropped) const = 0;
86 :
87 : virtual GstStateChangeReturn changeState(GstStateChange transition) = 0;
88 : virtual void postAsyncStart() = 0;
89 : virtual void setProperty(const Property &type, const GValue *value) = 0;
90 : virtual void getProperty(const Property &type, GValue *value) = 0;
91 : virtual std::optional<gboolean> handleQuery(GstQuery *query) const = 0;
92 : virtual gboolean handleSendEvent(GstEvent *event) = 0;
93 : virtual gboolean handleEvent(GstPad *pad, GstObject *parent, GstEvent *event) = 0;
94 : virtual GstFlowReturn handleBuffer(GstBuffer *buffer) = 0;
95 : };
|