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 2022 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_SERVER_SERVICE_I_MEDIA_PIPELINE_SERVICE_H_
21 : #define FIREBOLT_RIALTO_SERVER_SERVICE_I_MEDIA_PIPELINE_SERVICE_H_
22 :
23 : #include "IHeartbeatProcedure.h"
24 : #include "IMediaPipeline.h"
25 : #include "MediaCommon.h"
26 : #include <cstdint>
27 : #include <memory>
28 : #include <string>
29 : #include <vector>
30 :
31 : namespace firebolt::rialto::server::service
32 : {
33 : class IMediaPipelineService
34 : {
35 : public:
36 233 : IMediaPipelineService() = default;
37 233 : virtual ~IMediaPipelineService() = default;
38 :
39 : IMediaPipelineService(const IMediaPipelineService &) = delete;
40 : IMediaPipelineService(IMediaPipelineService &&) = delete;
41 : IMediaPipelineService &operator=(const IMediaPipelineService &) = delete;
42 : IMediaPipelineService &operator=(IMediaPipelineService &&) = delete;
43 :
44 : virtual bool createSession(int sessionId, const std::shared_ptr<IMediaPipelineClient> &mediaPipelineClient,
45 : std::uint32_t maxWidth, std::uint32_t maxHeight) = 0;
46 : virtual bool destroySession(int sessionId) = 0;
47 : virtual bool load(int sessionId, MediaType type, const std::string &mimeType, const std::string &url) = 0;
48 : virtual bool attachSource(int sessionId, const std::unique_ptr<IMediaPipeline::MediaSource> &source) = 0;
49 : virtual bool removeSource(int sessionId, std::int32_t sourceId) = 0;
50 : virtual bool allSourcesAttached(int sessionId) = 0;
51 : virtual bool play(int sessionId) = 0;
52 : virtual bool pause(int sessionId) = 0;
53 : virtual bool stop(int sessionId) = 0;
54 : virtual bool setPlaybackRate(int sessionId, double rate) = 0;
55 : virtual bool setPosition(int sessionId, std::int64_t position) = 0;
56 : virtual bool getPosition(int sessionId, std::int64_t &position) = 0;
57 : virtual bool setImmediateOutput(int sessionId, int32_t sourceId, bool immediateOutput) = 0;
58 : virtual bool getImmediateOutput(int sessionId, int32_t sourceId, bool &immediateOutput) = 0;
59 : virtual bool getStats(int sessionId, int32_t sourceId, uint64_t &renderedFrames, uint64_t &droppedFrames) = 0;
60 : virtual bool setVideoWindow(int sessionId, std::uint32_t x, std::uint32_t y, std::uint32_t width,
61 : std::uint32_t height) = 0;
62 : virtual bool haveData(int sessionId, MediaSourceStatus status, std::uint32_t numFrames,
63 : std::uint32_t needDataRequestId) = 0;
64 : virtual bool renderFrame(int sessionId) = 0;
65 : virtual bool setVolume(int sessionId, double targetVolume, uint32_t volumeDuration, EaseType easeType) = 0;
66 : virtual bool getVolume(int sessionId, double &volume) = 0;
67 : virtual bool setMute(int sessionId, std::int32_t sourceId, bool mute) = 0;
68 : virtual bool getMute(int sessionId, std::int32_t sourceId, bool &mute) = 0;
69 : virtual bool setTextTrackIdentifier(int sessionId, const std::string &textTrackIdentifier) = 0;
70 : virtual bool getTextTrackIdentifier(int sessionId, std::string &textTrackIdentifier) = 0;
71 : virtual bool setLowLatency(int sessionId, bool lowLatency) = 0;
72 : virtual bool setSync(int sessionId, bool sync) = 0;
73 : virtual bool getSync(int sessionId, bool &sync) = 0;
74 : virtual bool setSyncOff(int sessionId, bool syncOff) = 0;
75 : virtual bool setStreamSyncMode(int sessionId, int32_t sourceId, int32_t streamSyncMode) = 0;
76 : virtual bool getStreamSyncMode(int sessionId, int32_t &streamSyncMode) = 0;
77 : virtual bool flush(int sessionId, std::int32_t sourceId, bool resetTime) = 0;
78 : virtual bool setSourcePosition(int sessionId, int32_t sourceId, int64_t position, bool resetTime,
79 : double appliedRate, uint64_t stopPosition) = 0;
80 : virtual bool processAudioGap(int sessionId, int64_t position, uint32_t duration, int64_t discontinuityGap,
81 : bool audioAac) = 0;
82 : virtual bool setBufferingLimit(int sessionId, uint32_t limitBufferingMs) = 0;
83 : virtual bool getBufferingLimit(int sessionId, uint32_t &limitBufferingMs) = 0;
84 : virtual bool setUseBuffering(int sessionId, bool useBuffering) = 0;
85 : virtual bool getUseBuffering(int sessionId, bool &useBuffering) = 0;
86 : virtual std::vector<std::string> getSupportedMimeTypes(MediaSourceType type) = 0;
87 : virtual bool isMimeTypeSupported(const std::string &mimeType) = 0;
88 : virtual std::vector<std::string> getSupportedProperties(MediaSourceType mediaType,
89 : const std::vector<std::string> &propertyNames) = 0;
90 : virtual void ping(const std::shared_ptr<IHeartbeatProcedure> &heartbeatProcedure) = 0;
91 : virtual bool switchSource(int sessionId, const std::unique_ptr<IMediaPipeline::MediaSource> &source) = 0;
92 : };
93 : } // namespace firebolt::rialto::server::service
94 :
95 : #endif // FIREBOLT_RIALTO_SERVER_SERVICE_I_MEDIA_PIPELINE_SERVICE_H_
|