LCOV - code coverage report
Current view: top level - media/server/gstplayer/include - GstCapabilities.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 1 1
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 1 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 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              : #ifndef FIREBOLT_RIALTO_SERVER_GST_CAPABILITIES_H_
      21              : #define FIREBOLT_RIALTO_SERVER_GST_CAPABILITIES_H_
      22              : 
      23              : #include "IGlibWrapper.h"
      24              : #include "IGstCapabilities.h"
      25              : #include "IGstInitialiser.h"
      26              : #include "IGstWrapper.h"
      27              : #include "IRdkGstreamerUtilsWrapper.h"
      28              : 
      29              : #include <memory>
      30              : #include <string>
      31              : #include <unordered_set>
      32              : #include <vector>
      33              : 
      34              : namespace firebolt::rialto::server
      35              : {
      36              : /**
      37              :  * @brief GstCapabilities factory class, returns a concrete implementation of GstCapabilities
      38              :  */
      39              : class GstCapabilitiesFactory : public IGstCapabilitiesFactory
      40              : {
      41              : public:
      42              :     /**
      43              :      * @brief Weak pointer to the singleton factory object.
      44              :      */
      45              :     static std::weak_ptr<IGstCapabilitiesFactory> m_factory;
      46              : 
      47              :     /**
      48              :      * @brief Creates a IGstCapabilities object.
      49              :      *
      50              :      * @retval the new gstreamer capabilities instance or null on error.
      51              :      */
      52              :     std::unique_ptr<IGstCapabilities> createGstCapabilities() override;
      53              : };
      54              : 
      55              : class GstCapabilities : public IGstCapabilities
      56              : {
      57              : public:
      58              :     explicit GstCapabilities(
      59              :         const std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> &gstWrapper,
      60              :         const std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> &glibWrapper,
      61              :         const std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> &rdkGstreamerUtilsWrapper,
      62              :         const IGstInitialiser &gstInitialiser);
      63           38 :     ~GstCapabilities() = default;
      64              : 
      65              :     GstCapabilities(const GstCapabilities &) = delete;
      66              :     GstCapabilities &operator=(const GstCapabilities &) = delete;
      67              :     GstCapabilities(GstCapabilities &&) = delete;
      68              :     GstCapabilities &operator=(GstCapabilities &&) = delete;
      69              : 
      70              :     /**
      71              :      * @brief Gets vector of mime types supported by gstreamer
      72              :      *
      73              :      * @retval vector of mime types supported by gstreamer
      74              :      */
      75              :     std::vector<std::string> getSupportedMimeTypes(MediaSourceType sourceType) override;
      76              : 
      77              :     /**
      78              :      * @brief Checks is \a mimeType is supported by gstreamer
      79              :      *
      80              :      * @retval True if mime type is supported by gstreamer
      81              :      */
      82              :     bool isMimeTypeSupported(const std::string &mimeType) override;
      83              : 
      84              :     /**
      85              :      * @brief  Check sinks and decoders for supported properties
      86              :      *
      87              :      * @param[in] mediaType     : The media type to search. If set to UNKNOWN then both AUDIO and VIDEO are searched
      88              :      * @param[in] propertyNames : A vector of property names to look for
      89              :      *
      90              :      * @retval Returns the subset of propertyNames that are supported by the mediaType
      91              :      */
      92              :     std::vector<std::string> getSupportedProperties(MediaSourceType mediaType,
      93              :                                                     const std::vector<std::string> &propertyNames) override;
      94              : 
      95              : private:
      96              :     /**
      97              :      * @brief Sets list of supported mime types
      98              :      */
      99              :     void fillSupportedMimeTypes();
     100              : 
     101              :     /**
     102              :      * @brief Appends all unique caps from parser->decoders chains' sink pads to \a supportedCaps
     103              :      */
     104              :     void appendLinkableCapsFromParserDecoderChains(std::vector<GstCaps *> &supportedCaps);
     105              : 
     106              :     /**
     107              :      * @brief Appends all unique caps from \a type pads to \a supportedCaps
     108              :      */
     109              :     void appendSupportedCapsFromFactoryType(const GstElementFactoryListType &type, std::vector<GstCaps *> &supportedCaps);
     110              : 
     111              :     /**
     112              :      * @brief Adds unique sink pads from \a padTemplates list to \a capsVector
     113              :      */
     114              :     void addAllUniqueSinkPadsCapsToVector(std::vector<GstCaps *> &capsVector, const GList *padTemplates);
     115              : 
     116              :     /**
     117              :      * @brief Checks if any src pad of parser can be connected to decoder
     118              :      *
     119              :      * @retval True if it's possible
     120              :      */
     121              :     bool canCreateParserDecoderChain(GstCaps *decoderCaps, const GList *parserPadTemplates);
     122              : 
     123              :     /**
     124              :      * @brief Checks if caps equal to \a caps is already in \a capsVector
     125              :      *
     126              :      * @retval True if there is equal caps
     127              :      */
     128              :     bool isCapsInVector(const std::vector<GstCaps *> &capsVector, GstCaps *caps) const;
     129              : 
     130              :     /**
     131              :      * @brief Set of mime types which are supported by gstreamer
     132              :      */
     133              :     std::unordered_set<std::string> m_supportedMimeTypes;
     134              : 
     135              :     /**
     136              :      * @brief The gstreamer wrapper object.
     137              :      */
     138              :     std::shared_ptr<firebolt::rialto::wrappers::IGstWrapper> m_gstWrapper;
     139              :     std::shared_ptr<firebolt::rialto::wrappers::IGlibWrapper> m_glibWrapper;
     140              :     std::shared_ptr<firebolt::rialto::wrappers::IRdkGstreamerUtilsWrapper> m_rdkGstreamerUtilsWrapper;
     141              : };
     142              : 
     143              : }; // namespace firebolt::rialto::server
     144              : 
     145              : #endif // FIREBOLT_RIALTO_SERVER_GST_CAPABILITIES_H_
        

Generated by: LCOV version 2.0-1