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 2024 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_WEB_AUDIO_PLAYER_PROXY_H_
21 : #define FIREBOLT_RIALTO_WEB_AUDIO_PLAYER_PROXY_H_
22 :
23 : #include <memory>
24 : #include <stdint.h>
25 :
26 : #include "WebAudioPlayer.h"
27 :
28 : namespace firebolt::rialto
29 : {
30 : class WebAudioPlayerProxy : public client::IWebAudioPlayerAndIControlClient
31 : {
32 : public:
33 : WebAudioPlayerProxy(const std::shared_ptr<IWebAudioPlayerAndIControlClient> &webAudioPlayer,
34 : client::IClientController &clientController);
35 : virtual ~WebAudioPlayerProxy();
36 :
37 1 : bool play() override { return m_webAudioPlayer->play(); }
38 :
39 1 : bool pause() override { return m_webAudioPlayer->pause(); }
40 :
41 1 : bool setEos() override { return m_webAudioPlayer->setEos(); }
42 :
43 1 : bool getBufferAvailable(uint32_t &availableFrames, std::shared_ptr<WebAudioShmInfo> &webAudioShmInfo) override
44 : {
45 1 : return m_webAudioPlayer->getBufferAvailable(availableFrames, webAudioShmInfo);
46 : }
47 :
48 1 : bool getBufferDelay(uint32_t &delayFrames) override { return m_webAudioPlayer->getBufferDelay(delayFrames); }
49 :
50 1 : bool writeBuffer(const uint32_t numberOfFrames, void *data) override
51 : {
52 1 : return m_webAudioPlayer->writeBuffer(numberOfFrames, data);
53 : }
54 :
55 1 : bool getDeviceInfo(uint32_t &preferredFrames, uint32_t &maximumFrames, bool &supportDeferredPlay) override
56 : {
57 1 : return m_webAudioPlayer->getDeviceInfo(preferredFrames, maximumFrames, supportDeferredPlay);
58 : }
59 :
60 1 : bool setVolume(double volume) override { return m_webAudioPlayer->setVolume(volume); }
61 :
62 1 : bool getVolume(double &volume) override { return m_webAudioPlayer->getVolume(volume); }
63 :
64 1 : std::weak_ptr<IWebAudioPlayerClient> getClient() override { return m_webAudioPlayer->getClient(); }
65 :
66 1 : void notifyApplicationState(ApplicationState state) override { m_webAudioPlayer->notifyApplicationState(state); }
67 :
68 : private:
69 : std::shared_ptr<IWebAudioPlayerAndIControlClient> m_webAudioPlayer;
70 : client::IClientController &m_clientController;
71 : };
72 :
73 : }; // namespace firebolt::rialto
74 :
75 : #endif // FIREBOLT_RIALTO_WEB_AUDIO_PLAYER_PROXY_H_
|