Line data Source code
1 : /*
2 : * If not stated otherwise in this file or this component's LICENSE file the
3 : * following copyright and licenses apply:
4 : *
5 : * Copyright 2024 Sky UK
6 : *
7 : * Licensed under the Apache License, Version 2.0 (the "License");
8 : * you may not use this file except in compliance with the License.
9 : * You may obtain a copy of the License at
10 : *
11 : * http://www.apache.org/licenses/LICENSE-2.0
12 : *
13 : * Unless required by applicable law or agreed to in writing, software
14 : * distributed under the License is distributed on an "AS IS" BASIS,
15 : * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 : * See the License for the specific language governing permissions and
17 : * limitations under the License.
18 : */
19 :
20 : #ifndef FIREBOLT_RIALTO_CLIENT_MEDIA_PIPELINE_PROXY_H_
21 : #define FIREBOLT_RIALTO_CLIENT_MEDIA_PIPELINE_PROXY_H_
22 :
23 : #include <stdint.h>
24 :
25 : #include <memory>
26 : #include <string>
27 : #include <vector>
28 :
29 : #include "MediaPipeline.h"
30 :
31 : namespace firebolt::rialto::client
32 : {
33 : class MediaPipelineProxy : public IMediaPipelineAndIControlClient
34 : {
35 : public:
36 : MediaPipelineProxy(const std::shared_ptr<IMediaPipelineAndIControlClient> &mediaPipeline,
37 : client::IClientController &clientController);
38 : virtual ~MediaPipelineProxy();
39 :
40 1 : std::weak_ptr<IMediaPipelineClient> getClient() override { return m_mediaPipeline->getClient(); }
41 :
42 1 : bool load(MediaType type, const std::string &mimeType, const std::string &url, bool isLive) override
43 : {
44 1 : return m_mediaPipeline->load(type, mimeType, url, isLive);
45 : }
46 :
47 1 : bool attachSource(const std::unique_ptr<MediaSource> &source) override
48 : {
49 1 : return m_mediaPipeline->attachSource(source);
50 : }
51 :
52 1 : bool removeSource(int32_t id) override { return m_mediaPipeline->removeSource(id); }
53 :
54 1 : bool allSourcesAttached() override { return m_mediaPipeline->allSourcesAttached(); }
55 :
56 1 : bool play(bool &async) override { return m_mediaPipeline->play(async); }
57 :
58 1 : bool pause() override { return m_mediaPipeline->pause(); }
59 :
60 1 : bool stop() override { return m_mediaPipeline->stop(); }
61 :
62 1 : bool setPlaybackRate(double rate) override { return m_mediaPipeline->setPlaybackRate(rate); }
63 :
64 1 : bool setPosition(int64_t position) override { return m_mediaPipeline->setPosition(position); }
65 :
66 1 : bool getPosition(int64_t &position) override { return m_mediaPipeline->getPosition(position); }
67 :
68 1 : bool setImmediateOutput(int32_t sourceId, bool immediateOutput)
69 : {
70 1 : return m_mediaPipeline->setImmediateOutput(sourceId, immediateOutput);
71 : }
72 1 : bool setReportDecodeErrors(int32_t sourceId, bool reportDecodeErrors)
73 : {
74 1 : return m_mediaPipeline->setReportDecodeErrors(sourceId, reportDecodeErrors);
75 : }
76 1 : bool setMetricSubscription(const std::vector<MetricType> &types)
77 : {
78 1 : return m_mediaPipeline->setMetricSubscription(types);
79 : }
80 1 : bool getQueuedFrames(int32_t sourceId, uint32_t &queuedFrames)
81 : {
82 1 : return m_mediaPipeline->getQueuedFrames(sourceId, queuedFrames);
83 : }
84 1 : bool getImmediateOutput(int32_t sourceId, bool &immediateOutput)
85 : {
86 1 : return m_mediaPipeline->getImmediateOutput(sourceId, immediateOutput);
87 : }
88 :
89 1 : bool getStats(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames)
90 : {
91 1 : return m_mediaPipeline->getStats(sourceId, renderedFrames, droppedFrames);
92 : }
93 :
94 2 : bool getFrameCounters(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames,
95 : uint64_t &corruptedFrames, uint64_t ×tamp) override
96 : {
97 2 : return m_mediaPipeline->getFrameCounters(sourceId, renderedFrames, droppedFrames, corruptedFrames, timestamp);
98 : }
99 :
100 1 : bool setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override
101 : {
102 1 : return m_mediaPipeline->setVideoWindow(x, y, width, height);
103 : }
104 :
105 1 : bool haveData(MediaSourceStatus status, uint32_t needDataRequestId) override
106 : {
107 1 : return m_mediaPipeline->haveData(status, needDataRequestId);
108 : }
109 :
110 1 : AddSegmentStatus addSegment(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment) override
111 : {
112 1 : return m_mediaPipeline->addSegment(needDataRequestId, mediaSegment);
113 : }
114 :
115 1 : bool renderFrame() override { return m_mediaPipeline->renderFrame(); }
116 :
117 1 : bool setVolume(double targetVolume, uint32_t volumeDuration, EaseType easeType) override
118 : {
119 1 : return m_mediaPipeline->setVolume(targetVolume, volumeDuration, easeType);
120 : }
121 :
122 1 : bool getVolume(double ¤tVolume) override { return m_mediaPipeline->getVolume(currentVolume); }
123 :
124 1 : bool setMute(int32_t sourceId, bool mute) override { return m_mediaPipeline->setMute(sourceId, mute); }
125 :
126 1 : bool getMute(int32_t sourceId, bool &mute) override { return m_mediaPipeline->getMute(sourceId, mute); }
127 :
128 1 : bool setTextTrackIdentifier(const std::string &textTrackIdentifier) override
129 : {
130 1 : return m_mediaPipeline->setTextTrackIdentifier(textTrackIdentifier);
131 : }
132 :
133 1 : bool getTextTrackIdentifier(std::string &textTrackIdentifier) override
134 : {
135 1 : return m_mediaPipeline->getTextTrackIdentifier(textTrackIdentifier);
136 : }
137 :
138 1 : bool setLowLatency(bool lowLatency) override { return m_mediaPipeline->setLowLatency(lowLatency); }
139 :
140 1 : bool setSync(bool sync) override { return m_mediaPipeline->setSync(sync); }
141 :
142 1 : bool getSync(bool &sync) override { return m_mediaPipeline->getSync(sync); }
143 :
144 1 : bool setSyncOff(bool syncOff) override { return m_mediaPipeline->setSyncOff(syncOff); }
145 :
146 1 : bool setStreamSyncMode(int32_t sourceId, int32_t streamSyncMode) override
147 : {
148 1 : return m_mediaPipeline->setStreamSyncMode(sourceId, streamSyncMode);
149 : }
150 :
151 1 : bool getStreamSyncMode(int32_t &streamSyncMode) override
152 : {
153 1 : return m_mediaPipeline->getStreamSyncMode(streamSyncMode);
154 : }
155 :
156 1 : bool flush(int32_t sourceId, bool resetTime, bool &async) override
157 : {
158 1 : return m_mediaPipeline->flush(sourceId, resetTime, async);
159 : }
160 :
161 1 : bool setSourcePosition(int32_t sourceId, int64_t position, bool resetTime, double appliedRate,
162 : uint64_t stopPosition) override
163 : {
164 1 : return m_mediaPipeline->setSourcePosition(sourceId, position, resetTime, appliedRate, stopPosition);
165 : }
166 :
167 0 : bool setSubtitleOffset(int32_t sourceId, int64_t position) override
168 : {
169 0 : return m_mediaPipeline->setSubtitleOffset(sourceId, position);
170 : }
171 :
172 1 : bool processAudioGap(int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac) override
173 : {
174 1 : return m_mediaPipeline->processAudioGap(position, duration, discontinuityGap, audioAac);
175 : }
176 :
177 1 : bool setBufferingLimit(uint32_t limitBufferingMs) override
178 : {
179 1 : return m_mediaPipeline->setBufferingLimit(limitBufferingMs);
180 : }
181 :
182 1 : bool getBufferingLimit(uint32_t &limitBufferingMs) override
183 : {
184 1 : return m_mediaPipeline->getBufferingLimit(limitBufferingMs);
185 : }
186 :
187 1 : bool setUseBuffering(bool useBuffering) override { return m_mediaPipeline->setUseBuffering(useBuffering); }
188 :
189 1 : bool getUseBuffering(bool &useBuffering) override { return m_mediaPipeline->getUseBuffering(useBuffering); }
190 :
191 1 : bool switchSource(const std::unique_ptr<MediaSource> &source) override
192 : {
193 1 : return m_mediaPipeline->switchSource(source);
194 : }
195 :
196 1 : bool getDuration(int64_t &duration) override { return m_mediaPipeline->getDuration(duration); }
197 :
198 1 : void notifyApplicationState(ApplicationState state) override { m_mediaPipeline->notifyApplicationState(state); }
199 :
200 : private:
201 : std::shared_ptr<IMediaPipelineAndIControlClient> m_mediaPipeline;
202 : client::IClientController &m_clientController;
203 : };
204 :
205 : }; // namespace firebolt::rialto::client
206 :
207 : #endif // FIREBOLT_RIALTO_CLIENT_MEDIA_PIPELINE_PROXY_H_
|