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_GENERIC_PLAYER_TASK_FACTORY_H_
21 : #define FIREBOLT_RIALTO_SERVER_GENERIC_PLAYER_TASK_FACTORY_H_
22 :
23 : #include "IGenericPlayerTaskFactory.h"
24 : #include "IGlibWrapper.h"
25 : #include "IGstGenericPlayerClient.h"
26 : #include "IGstTextTrackSinkFactory.h"
27 : #include "IGstWrapper.h"
28 : #include "IMediaPipeline.h"
29 : #include <memory>
30 : #include <string>
31 :
32 : namespace firebolt::rialto::server
33 : {
34 : class GenericPlayerTaskFactory : public IGenericPlayerTaskFactory
35 : {
36 : public:
37 : GenericPlayerTaskFactory(
38 : IGstGenericPlayerClient *client, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
39 : const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
40 : const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
41 : const std::shared_ptr<IGstTextTrackSinkFactory> &gstTextTrackSinkFactory);
42 41 : ~GenericPlayerTaskFactory() override = default;
43 :
44 : std::unique_ptr<IPlayerTask> createAttachSamples(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
45 : const IMediaPipeline::MediaSegmentVector &mediaSegments) const override;
46 : std::unique_ptr<IPlayerTask>
47 : createAttachSource(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
48 : const std::unique_ptr<IMediaPipeline::MediaSource> &source) const override;
49 : std::unique_ptr<IPlayerTask> createDeepElementAdded(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
50 : GstBin *pipeline, GstBin *bin,
51 : GstElement *element) const override;
52 : std::unique_ptr<IPlayerTask> createEnoughData(GenericPlayerContext &context, GstAppSrc *src) const override;
53 : std::unique_ptr<IPlayerTask> createEos(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
54 : const firebolt::rialto::MediaSourceType &type) const override;
55 : std::unique_ptr<IPlayerTask> createFinishSetupSource(GenericPlayerContext &context,
56 : IGstGenericPlayerPrivate &player) const override;
57 : std::unique_ptr<IPlayerTask> createHandleBusMessage(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
58 : GstMessage *message) const override;
59 : std::unique_ptr<IPlayerTask> createNeedData(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
60 : GstAppSrc *src) const override;
61 : std::unique_ptr<IPlayerTask> createPause(GenericPlayerContext &context,
62 : IGstGenericPlayerPrivate &player) const override;
63 : std::unique_ptr<IPlayerTask> createPlay(IGstGenericPlayerPrivate &player) const override;
64 : std::unique_ptr<IPlayerTask>
65 : createReadShmDataAndAttachSamples(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
66 : const std::shared_ptr<IDataReader> &dataReader) const override;
67 : std::unique_ptr<IPlayerTask> createRemoveSource(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
68 : const firebolt::rialto::MediaSourceType &type) const override;
69 : std::unique_ptr<IPlayerTask> createReportPosition(GenericPlayerContext &context) const override;
70 : std::unique_ptr<IPlayerTask> createCheckAudioUnderflow(GenericPlayerContext &context,
71 : IGstGenericPlayerPrivate &player) const override;
72 : std::unique_ptr<IPlayerTask> createSetPlaybackRate(GenericPlayerContext &context, double rate) const override;
73 : std::unique_ptr<IPlayerTask> createSetPosition(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
74 : std::int64_t position) const override;
75 : std::unique_ptr<IPlayerTask> createSetupElement(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
76 : GstElement *element) const override;
77 : std::unique_ptr<IPlayerTask> createSetupSource(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
78 : GstElement *source) const override;
79 : std::unique_ptr<IPlayerTask> createSetVideoGeometry(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
80 : const Rectangle &rectangle) const override;
81 : std::unique_ptr<IPlayerTask> createSetVolume(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
82 : double targetVolume, uint32_t volumeDuration,
83 : firebolt::rialto::EaseType easeType) const override;
84 : std::unique_ptr<IPlayerTask> createSetMute(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
85 : const MediaSourceType &mediaSourceType, bool mute) const override;
86 : std::unique_ptr<IPlayerTask> createSetTextTrackIdentifier(GenericPlayerContext &context,
87 : const std::string &textTrackIdentifier) const override;
88 : std::unique_ptr<IPlayerTask> createSetLowLatency(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
89 : bool lowLatency) const override;
90 : std::unique_ptr<IPlayerTask> createSetSync(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
91 : bool sync) const override;
92 : std::unique_ptr<IPlayerTask> createSetSyncOff(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
93 : bool syncOff) const override;
94 : std::unique_ptr<IPlayerTask> createSetStreamSyncMode(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
95 : const firebolt::rialto::MediaSourceType &type,
96 : int32_t streamSyncMode) const override;
97 : std::unique_ptr<IPlayerTask> createShutdown(IGstGenericPlayerPrivate &player) const override;
98 : std::unique_ptr<IPlayerTask> createStop(GenericPlayerContext &context,
99 : IGstGenericPlayerPrivate &player) const override;
100 : std::unique_ptr<IPlayerTask> createUnderflow(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
101 : bool underflowEnable, MediaSourceType sourceType) const override;
102 : std::unique_ptr<IPlayerTask> createUpdatePlaybackGroup(GenericPlayerContext &context,
103 : IGstGenericPlayerPrivate &player, GstElement *typefind,
104 : const GstCaps *caps) const override;
105 : std::unique_ptr<IPlayerTask> createRenderFrame(GenericPlayerContext &context,
106 : IGstGenericPlayerPrivate &player) const override;
107 : std::unique_ptr<IPlayerTask> createPing(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) const override;
108 : std::unique_ptr<IPlayerTask> createFlush(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
109 : const firebolt::rialto::MediaSourceType &type,
110 : bool resetTime) const override;
111 : std::unique_ptr<IPlayerTask> createSetSourcePosition(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
112 : const firebolt::rialto::MediaSourceType &type,
113 : std::int64_t position, bool resetTime, double appliedRate,
114 : uint64_t stopPosition) const override;
115 : std::unique_ptr<IPlayerTask> createProcessAudioGap(GenericPlayerContext &context, std::int64_t position,
116 : std::uint32_t duration, std::int64_t discontinuityGap,
117 : bool audioAac) const override;
118 : std::unique_ptr<IPlayerTask> createSetImmediateOutput(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
119 : const firebolt::rialto::MediaSourceType &type,
120 : bool immediateOutput) const override;
121 : std::unique_ptr<IPlayerTask> createSetBufferingLimit(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
122 : std::uint32_t limit) const override;
123 : std::unique_ptr<IPlayerTask> createSetUseBuffering(GenericPlayerContext &context, IGstGenericPlayerPrivate &player,
124 : bool useBuffering) const override;
125 : std::unique_ptr<IPlayerTask>
126 : createSwitchSource(IGstGenericPlayerPrivate &player,
127 : const std::unique_ptr<IMediaPipeline::MediaSource> &source) const override;
128 :
129 : private:
130 : IGstGenericPlayerClient *m_client;
131 : std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
132 : std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> m_glibWrapper;
133 : std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> m_rdkGstreamerUtilsWrapper;
134 : std::shared_ptr<IGstTextTrackSinkFactory> m_gstTextTrackSinkFactory;
135 : };
136 : } // namespace firebolt::rialto::server
137 :
138 : #endif // FIREBOLT_RIALTO_SERVER_GENERIC_PLAYER_TASK_FACTORY_H_
|