LCOV - code coverage report
Current view: top level - media/server/gstplayer/source/tasks/webAudio - WebAudioPlayerTaskFactory.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 23 23
Test Date: 2025-06-30 09:40:50 Functions: 100.0 % 10 10

            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              : #include "tasks/webAudio/WebAudioPlayerTaskFactory.h"
      20              : #include "tasks/webAudio/Eos.h"
      21              : #include "tasks/webAudio/HandleBusMessage.h"
      22              : #include "tasks/webAudio/Pause.h"
      23              : #include "tasks/webAudio/Ping.h"
      24              : #include "tasks/webAudio/Play.h"
      25              : #include "tasks/webAudio/SetCaps.h"
      26              : #include "tasks/webAudio/SetVolume.h"
      27              : #include "tasks/webAudio/Stop.h"
      28              : #include "tasks/webAudio/WriteBuffer.h"
      29              : 
      30              : namespace firebolt::rialto::server
      31              : {
      32           10 : WebAudioPlayerTaskFactory::WebAudioPlayerTaskFactory(
      33              :     IGstWebAudioPlayerClient *client, const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
      34           10 :     const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper)
      35           10 :     : m_client{client}, m_gstWrapper{gstWrapper}, m_glibWrapper{glibWrapper}
      36              : {
      37              : }
      38              : 
      39            2 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createStop(IGstWebAudioPlayerPrivate &player) const
      40              : {
      41            2 :     return std::make_unique<tasks::webaudio::Stop>(player);
      42              : }
      43              : 
      44            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createPlay(IGstWebAudioPlayerPrivate &player) const
      45              : {
      46            1 :     return std::make_unique<tasks::webaudio::Play>(player, m_client);
      47              : }
      48              : 
      49            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createPause(IGstWebAudioPlayerPrivate &player) const
      50              : {
      51            1 :     return std::make_unique<tasks::webaudio::Pause>(player, m_client);
      52              : }
      53              : 
      54            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createEos(WebAudioPlayerContext &context) const
      55              : {
      56            1 :     return std::make_unique<tasks::webaudio::Eos>(context, m_gstWrapper);
      57              : }
      58              : 
      59            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createSetCaps(WebAudioPlayerContext &context,
      60              :                                                                       const std::string &audioMimeType,
      61              :                                                                       std::weak_ptr<const WebAudioConfig> config) const
      62              : {
      63            1 :     return std::make_unique<tasks::webaudio::SetCaps>(context, m_gstWrapper, m_glibWrapper, audioMimeType, config);
      64              : }
      65              : 
      66            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createSetVolume(WebAudioPlayerContext &context, double volume) const
      67              : {
      68            1 :     return std::make_unique<tasks::webaudio::SetVolume>(context, m_gstWrapper, volume);
      69              : }
      70              : 
      71            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createWriteBuffer(WebAudioPlayerContext &context,
      72              :                                                                           uint8_t *mainPtr, uint32_t mainLength,
      73              :                                                                           uint8_t *wrapPtr, uint32_t wrapLength) const
      74              : {
      75            2 :     return std::make_unique<tasks::webaudio::WriteBuffer>(context, m_gstWrapper, mainPtr, mainLength, wrapPtr,
      76            2 :                                                           wrapLength);
      77              : }
      78              : 
      79            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createHandleBusMessage(WebAudioPlayerContext &context,
      80              :                                                                                IGstWebAudioPlayerPrivate &player,
      81              :                                                                                GstMessage *message) const
      82              : {
      83            2 :     return std::make_unique<tasks::webaudio::HandleBusMessage>(context, player, m_client, m_gstWrapper, m_glibWrapper,
      84            2 :                                                                message);
      85              : }
      86              : 
      87            1 : std::unique_ptr<IPlayerTask> WebAudioPlayerTaskFactory::createPing(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) const
      88              : {
      89            1 :     return std::make_unique<tasks::webaudio::Ping>(std::move(heartbeatHandler));
      90              : }
      91              : } // namespace firebolt::rialto::server
        

Generated by: LCOV version 2.0-1