Line data Source code
1 : /*
2 : * Copyright (C) 2022 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 <IMediaPipeline.h>
22 : #include <gst/gst.h>
23 :
24 : #include <string>
25 :
26 : namespace firebolt::rialto::client
27 : {
28 : class MediaPlayerClientBackendInterface
29 : {
30 : public:
31 279 : virtual ~MediaPlayerClientBackendInterface() = default;
32 : virtual void createMediaPlayerBackend(std::weak_ptr<IMediaPipelineClient> client, uint32_t maxWidth,
33 : uint32_t maxHeight) = 0;
34 : virtual bool isMediaPlayerBackendCreated() const = 0;
35 : virtual bool attachSource(std::unique_ptr<firebolt::rialto::IMediaPipeline::MediaSource> &source) = 0;
36 : virtual bool removeSource(int32_t id) = 0;
37 : virtual bool allSourcesAttached() = 0;
38 : virtual bool load(firebolt::rialto::MediaType type, const std::string &mimeType, const std::string &url) = 0;
39 : virtual bool play() = 0;
40 : virtual bool pause() = 0;
41 : virtual bool stop() = 0;
42 : virtual bool haveData(firebolt::rialto::MediaSourceStatus status, unsigned int needDataRequestId) = 0;
43 : virtual bool setPlaybackRate(double rate) = 0;
44 : virtual bool setVideoWindow(unsigned int x, unsigned int y, unsigned int width, unsigned int height) = 0;
45 : virtual firebolt::rialto::AddSegmentStatus
46 : addSegment(unsigned int needDataRequestId,
47 : const std::unique_ptr<firebolt::rialto::IMediaPipeline::MediaSegment> &mediaSegment) = 0;
48 : virtual bool getPosition(int64_t &position) = 0;
49 : virtual bool setImmediateOutput(int32_t sourceId, bool immediateOutput) = 0;
50 : virtual bool getImmediateOutput(int32_t sourceId, bool &immediateOutput) = 0;
51 : virtual bool getStats(int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames) = 0;
52 : virtual bool renderFrame() = 0;
53 : virtual bool setVolume(double targetVolume, uint32_t volumeDuration, EaseType easeType) = 0;
54 : virtual bool getVolume(double ¤tVolume) = 0;
55 : virtual bool setMute(bool mute, int sourceId) = 0;
56 : virtual bool getMute(bool &mute, int sourceId) = 0;
57 : virtual bool setTextTrackIdentifier(const std::string &textTrackIdentifier) = 0;
58 : virtual bool getTextTrackIdentifier(std::string &textTrackIdentifier) = 0;
59 : virtual bool setLowLatency(bool lowLatency) = 0;
60 : virtual bool setSync(bool sync) = 0;
61 : virtual bool getSync(bool &sync) = 0;
62 : virtual bool setSyncOff(bool syncOff) = 0;
63 : virtual bool setStreamSyncMode(int32_t sourceId, int32_t streamSyncMode) = 0;
64 : virtual bool getStreamSyncMode(int32_t &streamSyncMode) = 0;
65 : virtual bool flush(int32_t sourceId, bool resetTime, bool &async) = 0;
66 : virtual bool setSourcePosition(int32_t sourceId, int64_t position, bool resetTime, double appliedRate = 1.0,
67 : uint64_t stopPosition = GST_CLOCK_TIME_NONE) = 0;
68 : virtual bool processAudioGap(int64_t position, uint32_t duration, int64_t discontinuityGap, bool audioAac) = 0;
69 : virtual bool setBufferingLimit(uint32_t limitBufferingMs) = 0;
70 : virtual bool getBufferingLimit(uint32_t &limitBufferingMs) = 0;
71 : virtual bool setUseBuffering(bool useBuffering) = 0;
72 : virtual bool getUseBuffering(bool &useBuffering) = 0;
73 : virtual bool switchSource(const std::unique_ptr<firebolt::rialto::IMediaPipeline::MediaSource> &source) = 0;
74 : };
75 : } // namespace firebolt::rialto::client
|