LCOV - code coverage report
Current view: top level - media/server/main/include - MediaCapabilitiesServerInternal.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 33.3 % 3 1
Test Date: 2026-09-29 14:28:21 Functions: 33.3 % 3 1

            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 2026 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_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
      21              : #define FIREBOLT_RIALTO_SERVER_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
      22              : 
      23              : #include "IMediaCapabilitiesServerInternal.h"
      24              : #include <memory>
      25              : #include <mutex>
      26              : #include <optional>
      27              : 
      28              : namespace firebolt::rialto::server
      29              : {
      30              : /**
      31              :  * @brief Server-internal factory implementation.
      32              :  *
      33              :  * Used by RialtoServer to create MediaCapabilitiesServerInternal instances.
      34              :  * Preloaded capabilities are not supplied here - the caller sets them later via
      35              :  * IMediaCapabilitiesServerInternal::setPreloadedCapabilities() once ServerManager's
      36              :  * configuration arrives.
      37              :  */
      38              : class MediaCapabilitiesServerInternalFactory : public IMediaCapabilitiesServerInternalFactory
      39              : {
      40              : public:
      41            0 :     MediaCapabilitiesServerInternalFactory() = default;
      42            0 :     ~MediaCapabilitiesServerInternalFactory() override = default;
      43              : 
      44              :     std::shared_ptr<IMediaCapabilitiesServerInternal> createMediaCapabilitiesServerInternal() const override;
      45              : };
      46              : 
      47              : /**
      48              :  * @brief The definition of the MediaCapabilitiesServerInternal.
      49              :  *
      50              :  * Orchestrates capability queries between preloaded YAML data (Path 0, highest priority,
      51              :  * set by ServerManager via setPreloadedCapabilities()) and GStreamer discovery (Path B,
      52              :  * fallback used when no preloaded data is available).
      53              :  */
      54              : class MediaCapabilitiesServerInternal : public IMediaCapabilitiesServerInternal
      55              : {
      56              : public:
      57              :     /**
      58              :      * @brief Constructor
      59              :      *
      60              :      * @param[in] gstCapabilities GStreamer capabilities handler (fallback for queries)
      61              :      *                           Ownership is transferred to MediaCapabilitiesServerInternal
      62              :      */
      63              :     explicit MediaCapabilitiesServerInternal(std::unique_ptr<IGstCapabilities> gstCapabilities);
      64              : 
      65              :     /**
      66              :      * @brief Virtual destructor.
      67              :      */
      68           17 :     ~MediaCapabilitiesServerInternal() override = default;
      69              : 
      70              :     firebolt::rialto::common::AudioDecoderCapabilities getSupportedAudioCapabilities() override;
      71              : 
      72              :     firebolt::rialto::common::VideoDecoderCapabilities getSupportedVideoCapabilities() override;
      73              : 
      74              :     void setPreloadedCapabilities(
      75              :         const std::optional<firebolt::rialto::common::AudioDecoderCapabilities> &audioCapabilities,
      76              :         const std::optional<firebolt::rialto::common::VideoDecoderCapabilities> &videoCapabilities) override;
      77              : 
      78              : private:
      79              :     /**
      80              :      * @brief The GStreamer capabilities handler (fallback for queries)
      81              :      *        Owned exclusively by MediaCapabilitiesServerInternal
      82              :      */
      83              :     std::unique_ptr<IGstCapabilities> m_gstCapabilities;
      84              : 
      85              :     /**
      86              :      * @brief Preloaded capabilities from ServerManager (Path 0 - highest priority)
      87              :      */
      88              :     std::optional<firebolt::rialto::common::AudioDecoderCapabilities> m_preloadedAudioCapabilities;
      89              :     std::optional<firebolt::rialto::common::VideoDecoderCapabilities> m_preloadedVideoCapabilities;
      90              : 
      91              :     /**
      92              :      * @brief Protects access to preloaded capabilities
      93              :      */
      94              :     std::mutex m_preloadedCapabilitiesMutex;
      95              : };
      96              : 
      97              : } // namespace firebolt::rialto::server
      98              : 
      99              : #endif // FIREBOLT_RIALTO_SERVER_MEDIA_CAPABILITIES_SERVER_INTERNAL_H_
        

Generated by: LCOV version 2.0-1