LCOV - code coverage report
Current view: top level - media/server/main/interface - IMediaKeysServerInternal.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 2 2
Test Date: 2025-02-18 13:13:53 Functions: 100.0 % 2 2

            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_I_MEDIA_KEYS_SERVER_INTERNAL_H_
      21              : #define FIREBOLT_RIALTO_SERVER_I_MEDIA_KEYS_SERVER_INTERNAL_H_
      22              : 
      23              : /**
      24              :  * @file IMediaKeysServerInternal.h
      25              :  *
      26              :  * The definition of the IMediaKeys interface.
      27              :  *
      28              :  * This interface defines the server internal API of Rialto for EME decryption of AV content.
      29              :  */
      30              : 
      31              : #include "IHeartbeatHandler.h"
      32              : #include "IMediaKeys.h"
      33              : #include "MediaCommon.h"
      34              : #include <cstdint>
      35              : #include <gst/gst.h>
      36              : #include <memory>
      37              : #include <string>
      38              : #include <vector>
      39              : 
      40              : namespace firebolt::rialto::server
      41              : {
      42              : class IMediaKeysServerInternal;
      43              : /**
      44              :  * @brief IMediaKeysServerInternal factory class, returns a concrete implementation of IMediaKeysServerInternal
      45              :  */
      46              : class IMediaKeysServerInternalFactory : public IMediaKeysFactory
      47              : {
      48              : public:
      49           92 :     IMediaKeysServerInternalFactory() = default;
      50           92 :     ~IMediaKeysServerInternalFactory() override = default;
      51              : 
      52              :     /**
      53              :      * @brief Create a IMediaKeysServerInternalFactory instance.
      54              :      *
      55              :      * @retval the factory instance or null on error.
      56              :      */
      57              :     static std::shared_ptr<IMediaKeysServerInternalFactory> createFactory();
      58              : 
      59              :     /**
      60              :      * @brief IMediaKeysServerInternal factory method, returns a concrete implementation of IMediaKeysServerInternal
      61              :      *
      62              :      * @param[in] keySystem : The key system for which to create a Media Keys instance
      63              :      *
      64              :      * @retval the new media keys instance or null on error.
      65              :      */
      66              :     virtual std::unique_ptr<IMediaKeysServerInternal> createMediaKeysServerInternal(const std::string &keySystem) const = 0;
      67              : };
      68              : 
      69              : /**
      70              :  * @brief The definition of the IMediaKeysServerInternal interface.
      71              :  *
      72              :  * This interface defines the public API of Rialto for EME decryption of AV content
      73              :  * which should be implemented by Rialto Server.
      74              :  */
      75              : class IMediaKeysServerInternal : public IMediaKeys
      76              : {
      77              : public:
      78              :     /**
      79              :      * @brief Decrypts the buffer.
      80              :      *
      81              :      * Encryption metadata shall be attached to the encrypted buffer as protection meta prior to this call.
      82              :      *
      83              :      * @param[in] keySessionId    : The session id for the session.
      84              :      * @param[in] encrypted       : Gstreamer buffer containing encrypted data and related meta data. If applicable,
      85              :      *                              decrypted data will be stored here after this call returns.
      86              :      * @param[in] caps            : The gst caps of buffer.
      87              :      *
      88              :      * @retval an error status.
      89              :      */
      90              :     virtual MediaKeyErrorStatus decrypt(int32_t keySessionId, GstBuffer *encrypted, GstCaps *caps) = 0;
      91              : 
      92              :     /**
      93              :      * @brief Checks if session with given id is handled by this MediaKeys instance
      94              :      *
      95              :      * @param[in] keySessionId    : The session id for the session.
      96              :      *
      97              :      * @retval true if session is handled by this MediaKeys instance
      98              :      */
      99              :     virtual bool hasSession(int32_t keySessionId) const = 0;
     100              : 
     101              :     /**
     102              :      * @brief Checks, if key system of media key session is Netflix Playready.
     103              :      *
     104              :      * @param[in] keySessionId    : The session id for the session.
     105              :      *
     106              :      * @retval true if key system is Playready
     107              :      */
     108              :     virtual bool isNetflixPlayreadyKeySystem(int32_t keySessionId) const = 0;
     109              : 
     110              :     /**
     111              :      * @brief Increments number of buffers using keySessionId
     112              :      *
     113              :      * @param[in] keySessionId    : The session id for the session.
     114              :      *
     115              :      */
     116              : 
     117              :     virtual void incrementSessionIdUsageCounter(int32_t keySessionId) = 0;
     118              :     /**
     119              :      * @brief Decrements number of buffers using keySessionId
     120              :      *
     121              :      * @param[in] keySessionId    : The session id for the session.
     122              :      *
     123              :      */
     124              :     virtual void decrementSessionIdUsageCounter(int32_t keySessionId) = 0;
     125              : 
     126              :     /**
     127              :      * @brief Checks, if MediaKeys main thread is not deadlocked
     128              :      *
     129              :      * @param[in] heartbeatHandler    : The heartbeat handler instance.
     130              :      *
     131              :      */
     132              :     virtual void ping(std::unique_ptr<IHeartbeatHandler> &&heartbeatHandler) = 0;
     133              : };
     134              : } // namespace firebolt::rialto::server
     135              : 
     136              : #endif // FIREBOLT_RIALTO_SERVER_I_MEDIA_KEYS_SERVER_INTERNAL_H_
        

Generated by: LCOV version 2.0-1