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