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_I_WEB_AUDIO_PLAYER_SERVER_INTERNAL_H_
21 : #define FIREBOLT_RIALTO_SERVER_I_WEB_AUDIO_PLAYER_SERVER_INTERNAL_H_
22 :
23 : /**
24 : * @file IWebAudioPlayerServerInternal.h
25 : *
26 : * The definition of the IWebAudioPlayerServerInternal interface.
27 : *
28 : * This interface defines the server internal APIs for playback of AV content.
29 : */
30 :
31 : #include <stdint.h>
32 :
33 : #include <memory>
34 : #include <string>
35 : #include <vector>
36 :
37 : #include "IDecryptionService.h"
38 : #include "IGstWebAudioPlayer.h"
39 : #include "IHeartbeatHandler.h"
40 : #include "IMainThread.h"
41 : #include "ISharedMemoryBuffer.h"
42 : #include "ITimer.h"
43 : #include "IWebAudioPlayer.h"
44 : #include "MediaCommon.h"
45 :
46 : namespace firebolt::rialto::server
47 : {
48 : class IWebAudioPlayerServerInternal;
49 : /**
50 : * @brief IWebAudioPlayer factory class, returns a concrete implementation of IWebAudioPlayer for internal server use
51 : */
52 : class IWebAudioPlayerServerInternalFactory : public IWebAudioPlayerFactory
53 : {
54 : public:
55 44 : virtual ~IWebAudioPlayerServerInternalFactory() = default;
56 :
57 : /**
58 : * @brief Create a IWebAudioPlayerServerInternalFactory instance.
59 : *
60 : * @retval the factory instance or null on error.
61 : */
62 : static std::shared_ptr<IWebAudioPlayerServerInternalFactory> createFactory();
63 :
64 : /**
65 : * @brief IWebAudioPlayerServerInternalFactory method, returns a concrete implementation of IWebAudioPlayer for
66 : * internal server use
67 : *
68 : * @param[in] client : The Web Audio Player client
69 : * @param[in] audioMimeType : The audio encoding format, currently only "audio/x-raw" (PCM)
70 : * @param[in] priority : Priority value for this pipeline.
71 : * @param[in] config : Additional type dependent configuration data or nullptr
72 : * @param[in] shmBuffer : The shared buffer object.
73 : * @param[in] handle : The handle for this WebAudioPlayer.
74 : *
75 : * @retval the new backend instance or null on error.
76 : */
77 : virtual std::unique_ptr<IWebAudioPlayerServerInternal> createWebAudioPlayerServerInternal(
78 : std::weak_ptr<IWebAudioPlayerClient> client, const std::string &audioMimeType, const uint32_t priority,
79 : std::weak_ptr<const WebAudioConfig> config, const std::shared_ptr<ISharedMemoryBuffer> &shmBuffer, int handle,
80 : const std::shared_ptr<firebolt::rialto::server::IMainThreadFactory> &mainThreadFactory,
81 : const std::shared_ptr<firebolt::rialto::server::IGstWebAudioPlayerFactory> &gstPlayerFactory,
82 : std::weak_ptr<common::ITimerFactory> timerFactory) const = 0;
83 : };
84 :
85 : /**
86 : * @brief The definition of the IWebAudioPlayerServerInternal interface.
87 : *
88 : * This interface defines the public API of Rialto for mixing PCM audio with
89 : * current audio output. It should be implemented by both Rialto Client &
90 : * Rialto Server.
91 : */
92 : class IWebAudioPlayerServerInternal : public IWebAudioPlayer
93 : {
94 : public:
95 : /**
96 : * @brief Checks if WebAudioPlayer threads are not deadlocked
97 : *
98 : * @param[out] heartbeatHandler : The heartbeat handler instance
99 : */
100 : virtual void ping(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) = 0;
101 : };
102 : }; // namespace firebolt::rialto::server
103 :
104 : #endif // FIREBOLT_RIALTO_SERVER_I_WEB_AUDIO_PLAYER_SERVER_INTERNAL_H_
|