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 2023 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_WEB_AUDIO_PLAYER_TASK_FACTORY_H_
21 : #define FIREBOLT_RIALTO_SERVER_WEB_AUDIO_PLAYER_TASK_FACTORY_H_
22 :
23 : #include "IGlibWrapper.h"
24 : #include "IGstWebAudioPlayerClient.h"
25 : #include "IGstWrapper.h"
26 : #include "IWebAudioPlayerTaskFactory.h"
27 : #include <memory>
28 : #include <string>
29 :
30 : namespace firebolt::rialto::server
31 : {
32 : class WebAudioPlayerTaskFactory : public IWebAudioPlayerTaskFactory
33 : {
34 : public:
35 : WebAudioPlayerTaskFactory(IGstWebAudioPlayerClient *client,
36 : const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
37 : const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper);
38 12 : ~WebAudioPlayerTaskFactory() override = default;
39 :
40 : std::unique_ptr<IPlayerTask> createShutdown(IGstWebAudioPlayerPrivate &player) const override;
41 : std::unique_ptr<IPlayerTask> createStop(IGstWebAudioPlayerPrivate &player) const override;
42 : std::unique_ptr<IPlayerTask> createPlay(IGstWebAudioPlayerPrivate &player) const override;
43 : std::unique_ptr<IPlayerTask> createPause(IGstWebAudioPlayerPrivate &player) const override;
44 : std::unique_ptr<IPlayerTask> createSetCaps(WebAudioPlayerContext &context, const std::string &audioMimeType,
45 : std::weak_ptr<const WebAudioConfig> config) const override;
46 : std::unique_ptr<IPlayerTask> createEos(WebAudioPlayerContext &context) const override;
47 : std::unique_ptr<IPlayerTask> createSetVolume(WebAudioPlayerContext &context, double volume) const override;
48 : std::unique_ptr<IPlayerTask> createWriteBuffer(WebAudioPlayerContext &context, uint8_t *mainPtr, uint32_t mainLength,
49 : uint8_t *wrapPtr, uint32_t wrapLength) const override;
50 : std::unique_ptr<IPlayerTask> createHandleBusMessage(WebAudioPlayerContext &context, IGstWebAudioPlayerPrivate &player,
51 : GstMessage *message) const override;
52 : std::unique_ptr<IPlayerTask> createPing(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) const override;
53 :
54 : private:
55 : IGstWebAudioPlayerClient *m_client;
56 : std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
57 : std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> m_glibWrapper;
58 : };
59 : } // namespace firebolt::rialto::server
60 :
61 : #endif // FIREBOLT_RIALTO_SERVER_WEB_AUDIO_PLAYER_TASK_FACTORY_H_
|