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 :
28 : #include "MediaPipeline.h"
29 :
30 : namespace firebolt::rialto::client
31 : {
32 : class MediaPipelineProxy : public IMediaPipelineAndIControlClient
33 : {
34 : public:
35 : MediaPipelineProxy(const std::shared_ptr<IMediaPipelineAndIControlClient> &mediaPipeline,
36 : client::IClientController &clientController);
37 : virtual ~MediaPipelineProxy();
38 :
39 1 : std::weak_ptr<IMediaPipelineClient> getClient() override { return m_mediaPipeline->getClient(); }
40 :
41 1 : bool load(MediaType type, const std::string &mimeType, const std::string &url) override
42 : {
43 1 : return m_mediaPipeline->load(type, mimeType, url);
44 : }
45 :
46 1 : bool attachSource(const std::unique_ptr<MediaSource> &source) override
47 : {
48 1 : return m_mediaPipeline->attachSource(source);
49 : }
50 :
51 1 : bool removeSource(int32_t id) override { return m_mediaPipeline->removeSource(id); }
52 :
53 1 : bool allSourcesAttached() override { return m_mediaPipeline->allSourcesAttached(); }
54 :
55 1 : bool play() override { return m_mediaPipeline->play(); }
56 :
57 1 : bool pause() override { return m_mediaPipeline->pause(); }
58 :
59 1 : bool stop() override { return m_mediaPipeline->stop(); }
60 :
61 1 : bool setPlaybackRate(double rate) override { return m_mediaPipeline->setPlaybackRate(rate); }
62 :
63 1 : bool setPosition(int64_t position) override { return m_mediaPipeline->setPosition(position); }
64 :
65 1 : bool getPosition(int64_t &position) override { return m_mediaPipeline->getPosition(position); }
66 :
67 1 : bool setImmediateOutput(int32_t sourceId, bool immediateOutput)
68 : {
69 1 : return m_mediaPipeline->setImmediateOutput(sourceId, immediateOutput);
70 : }
71 1 : bool getImmediateOutput(int32_t sourceId, bool &immediateOutput)
72 : {
73 1 : return m_mediaPipeline->getImmediateOutput(sourceId, immediateOutput);
74 : }
75 :
76 1 : bool getStats(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames)
77 : {
78 1 : return m_mediaPipeline->getStats(sourceId, renderedFrames, droppedFrames);
79 : }
80 :
81 1 : bool setVideoWindow(uint32_t x, uint32_t y, uint32_t width, uint32_t height) override
82 : {
83 1 : return m_mediaPipeline->setVideoWindow(x, y, width, height);
84 : }
85 :
86 1 : bool haveData(MediaSourceStatus status, uint32_t needDataRequestId) override
87 : {
88 1 : return m_mediaPipeline->haveData(status, needDataRequestId);
89 : }
90 :
91 1 : AddSegmentStatus addSegment(uint32_t needDataRequestId, const std::unique_ptr<MediaSegment> &mediaSegment) override
92 : {
93 1 : return m_mediaPipeline->addSegment(needDataRequestId, mediaSegment);
94 : }
95 :
96 1 : bool renderFrame() override { return m_mediaPipeline->renderFrame(); }
97 :
98 1 : bool setVolume(double targetVolume, uint32_t volumeDuration, EaseType easeType) override
99 : {
100 1 : return m_mediaPipeline->setVolume(targetVolume, volumeDuration, easeType);
101 : }
102 :
103 1 : bool getVolume(double ¤tVolume) override { return m_mediaPipeline->getVolume(currentVolume); }
104 :
105 1 : bool setMute(int32_t sourceId, bool mute) override { return m_mediaPipeline->setMute(sourceId, mute); }
106 :
107 1 : bool getMute(int32_t sourceId, bool &mute) override { return m_mediaPipeline->getMute(sourceId, mute); }
108 :
109 1 : bool setTextTrackIdentifier(const std::string &textTrackIdentifier) override
110 : {
111 1 : return m_mediaPipeline->setTextTrackIdentifier(textTrackIdentifier);
112 : }
113 :
114 1 : bool getTextTrackIdentifier(std::string &textTrackIdentifier) override
115 : {
116 1 : return m_mediaPipeline->getTextTrackIdentifier(textTrackIdentifier);
117 : }
118 :
119 1 : bool setLowLatency(bool lowLatency) override { return m_mediaPipeline->setLowLatency(lowLatency); }
120 :
121 1 : bool setSync(bool sync) override { return m_mediaPipeline->setSync(sync); }
122 :
123 1 : bool getSync(bool &sync) override { return m_mediaPipeline->getSync(sync); }
124 :
125 1 : bool setSyncOff(bool syncOff) override { return m_mediaPipeline->setSyncOff(syncOff); }
126 :
127 1 : bool setStreamSyncMode(int32_t sourceId, int32_t streamSyncMode) override
128 : {
129 1 : return m_mediaPipeline->setStreamSyncMode(sourceId, streamSyncMode);
130 : }
131 :
132 1 : bool getStreamSyncMode(int32_t &streamSyncMode) override
133 : {
134 1 : return m_mediaPipeline->getStreamSyncMode(streamSyncMode);
135 : }
136 :
137 1 : bool flush(int32_t sourceId, bool resetTime) override { return m_mediaPipeline->flush(sourceId, resetTime); }
138 :
139 1 : bool setSourcePosition(int32_t sourceId, int64_t position, bool resetTime, double appliedRate,
140 : uint64_t stopPosition) override
141 : {
142 1 : return m_mediaPipeline->setSourcePosition(sourceId, position, resetTime, appliedRate, stopPosition);
143 : }
144 :
145 1 : bool processAudioGap(int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac) override
146 : {
147 1 : return m_mediaPipeline->processAudioGap(position, duration, discontinuityGap, audioAac);
148 : }
149 :
150 1 : bool setBufferingLimit(uint32_t limitBufferingMs) override
151 : {
152 1 : return m_mediaPipeline->setBufferingLimit(limitBufferingMs);
153 : }
154 :
155 1 : bool getBufferingLimit(uint32_t &limitBufferingMs) override
156 : {
157 1 : return m_mediaPipeline->getBufferingLimit(limitBufferingMs);
158 : }
159 :
160 1 : bool setUseBuffering(bool useBuffering) override { return m_mediaPipeline->setUseBuffering(useBuffering); }
161 :
162 1 : bool getUseBuffering(bool &useBuffering) override { return m_mediaPipeline->getUseBuffering(useBuffering); }
163 :
164 1 : bool switchSource(const std::unique_ptr<MediaSource> &source) override
165 : {
166 1 : return m_mediaPipeline->switchSource(source);
167 : }
168 :
169 1 : void notifyApplicationState(ApplicationState state) override { m_mediaPipeline->notifyApplicationState(state); }
170 :
171 : private:
172 : std::shared_ptr<IMediaPipelineAndIControlClient> m_mediaPipeline;
173 : client::IClientController &m_clientController;
174 : };
175 :
176 : }; // namespace firebolt::rialto::client
177 :
178 : #endif // FIREBOLT_RIALTO_CLIENT_MEDIA_PIPELINE_PROXY_H_
|