LCOV - code coverage report
Current view: top level - media/server/main/source - MediaPipelineCapabilities.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 85.7 % 28 24
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 7 7

            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              : #include <stdexcept>
      21              : 
      22              : #include "MediaPipelineCapabilities.h"
      23              : #include "RialtoServerLogging.h"
      24              : #include <MediaCommon.h>
      25              : 
      26              : namespace firebolt::rialto
      27              : {
      28            1 : std::shared_ptr<IMediaPipelineCapabilitiesFactory> IMediaPipelineCapabilitiesFactory::createFactory()
      29              : {
      30            1 :     std::shared_ptr<IMediaPipelineCapabilitiesFactory> factory;
      31              : 
      32              :     try
      33              :     {
      34            1 :         factory = std::make_shared<MediaPipelineCapabilitiesFactory>();
      35              :     }
      36            0 :     catch (const std::exception &e)
      37              :     {
      38            0 :         RIALTO_SERVER_LOG_ERROR("Failed to create the media pipeline capabilities factory, reason: %s", e.what());
      39              :     }
      40              : 
      41            1 :     return factory;
      42              : }
      43              : 
      44            1 : std::unique_ptr<IMediaPipelineCapabilities> MediaPipelineCapabilitiesFactory::createMediaPipelineCapabilities() const
      45              : {
      46            1 :     std::unique_ptr<IMediaPipelineCapabilities> mediaPipelineCapabilities;
      47              :     try
      48              :     {
      49              :         mediaPipelineCapabilities =
      50            1 :             std::make_unique<server::MediaPipelineCapabilities>(server::IGstCapabilitiesFactory::getFactory());
      51              :     }
      52            0 :     catch (const std::exception &e)
      53              :     {
      54            0 :         RIALTO_SERVER_LOG_ERROR("Failed to create the media pipeline capabilities, reason: %s", e.what());
      55              :     }
      56              : 
      57            1 :     return mediaPipelineCapabilities;
      58              : }
      59              : 
      60              : }; // namespace firebolt::rialto
      61              : 
      62              : namespace firebolt::rialto::server
      63              : {
      64            5 : MediaPipelineCapabilities::MediaPipelineCapabilities(std::shared_ptr<IGstCapabilitiesFactory> gstCapabilitiesFactory)
      65            5 :     : m_kGstCapabilitiesFactory{gstCapabilitiesFactory}
      66              : {
      67            5 :     RIALTO_SERVER_LOG_DEBUG("entry:");
      68              : 
      69            5 :     m_gstCapabilities = m_kGstCapabilitiesFactory->createGstCapabilities();
      70            5 :     if (!m_gstCapabilities)
      71              :     {
      72            1 :         throw std::runtime_error("Gstreamer capabilities could not be created");
      73              :     }
      74            7 : }
      75              : 
      76           12 : MediaPipelineCapabilities::~MediaPipelineCapabilities()
      77              : {
      78            4 :     RIALTO_SERVER_LOG_DEBUG("entry:");
      79            8 : }
      80              : 
      81            1 : std::vector<std::string> MediaPipelineCapabilities::getSupportedMimeTypes(MediaSourceType sourceType)
      82              : {
      83            1 :     return m_gstCapabilities->getSupportedMimeTypes(sourceType);
      84              : }
      85              : 
      86            1 : bool MediaPipelineCapabilities::isMimeTypeSupported(const std::string &mimeType)
      87              : {
      88            1 :     return m_gstCapabilities->isMimeTypeSupported(mimeType);
      89              : }
      90              : 
      91            1 : std::vector<std::string> MediaPipelineCapabilities::getSupportedProperties(MediaSourceType mediaType,
      92              :                                                                            const std::vector<std::string> &propertyNames)
      93              : {
      94            1 :     return m_gstCapabilities->getSupportedProperties(mediaType, propertyNames);
      95              : }
      96              : 
      97              : }; // namespace firebolt::rialto::server
        

Generated by: LCOV version 2.0-1