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 % 25 25
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 11 11

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

Generated by: LCOV version 2.0-1