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 :
63 : // PullModeSubtitlePlaybackDelegate Properties
64 : TextTrackIdentifier,
65 : WindowId,
66 :
67 : // PushModeAudioPlaybackDelegate Properties
68 : TsOffset,
69 : };
70 :
71 466 : IPlaybackDelegate() = default;
72 466 : virtual ~IPlaybackDelegate() = default;
73 :
74 : IPlaybackDelegate(const IPlaybackDelegate &) = delete;
75 : IPlaybackDelegate(IPlaybackDelegate &&) = delete;
76 : IPlaybackDelegate &operator=(const IPlaybackDelegate &) = delete;
77 : IPlaybackDelegate &operator=(IPlaybackDelegate &&) = delete;
78 :
79 : virtual void handleEos() = 0;
80 : virtual void handleStateChanged(firebolt::rialto::PlaybackState state) = 0;
81 : virtual void handleError(const std::string &message, gint code = 0) = 0;
82 : virtual void handleQos(uint64_t processed, uint64_t dropped) const = 0;
83 :
84 : virtual GstStateChangeReturn changeState(GstStateChange transition) = 0;
85 : virtual void postAsyncStart() = 0;
86 : virtual void setProperty(const Property &type, const GValue *value) = 0;
87 : virtual void getProperty(const Property &type, GValue *value) = 0;
88 : virtual std::optional<gboolean> handleQuery(GstQuery *query) const = 0;
89 : virtual gboolean handleSendEvent(GstEvent *event) = 0;
90 : virtual gboolean handleEvent(GstPad *pad, GstObject *parent, GstEvent *event) = 0;
91 : virtual GstFlowReturn handleBuffer(GstBuffer *buffer) = 0;
92 : };
|