LCOV - code coverage report
Current view: top level - media/client/main/include - MediaKeys.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_CLIENT_MEDIA_KEYS_H_
      21              : #define FIREBOLT_RIALTO_CLIENT_MEDIA_KEYS_H_
      22              : 
      23              : #include "IMediaKeys.h"
      24              : #include "IMediaKeysIpcFactory.h"
      25              : #include <memory>
      26              : #include <string>
      27              : #include <vector>
      28              : 
      29              : namespace firebolt::rialto
      30              : {
      31              : /**
      32              :  * @brief IMediaKeys factory class definition.
      33              :  */
      34              : class MediaKeysFactory : public IMediaKeysFactory
      35              : {
      36              : public:
      37            2 :     MediaKeysFactory() = default;
      38            2 :     ~MediaKeysFactory() override = default;
      39              : 
      40              :     std::unique_ptr<IMediaKeys> createMediaKeys(const std::string &keySystem) const override;
      41              : 
      42              :     /**
      43              :      * @brief IMediaKeys factory method with factory parameters for mock injection.
      44              :      *
      45              :      * @param[in] keySystem           : The key system for which to create a Media Keys instance
      46              :      * @param[in] mediaKeysIpcFactory : This was added for the test environment where a mock object needs to be passed in.
      47              :      *
      48              :      * @retval the new media keys instance or null on error.
      49              :      */
      50              :     std::unique_ptr<IMediaKeys>
      51              :     createMediaKeys(const std::string &keySystem,
      52              :                     std::weak_ptr<firebolt::rialto::client::IMediaKeysIpcFactory> mediaKeysIpcFactory) const;
      53              : };
      54              : 
      55              : }; // namespace firebolt::rialto
      56              : 
      57              : namespace firebolt::rialto::client
      58              : {
      59              : /**
      60              :  * @brief The definition of the MediaKeys.
      61              :  */
      62              : class MediaKeys : public IMediaKeys
      63              : {
      64              : public:
      65              :     /**
      66              :      * @brief The constructor.
      67              :      *
      68              :      * @param[in] keySystem           : The key system for which to create a Media Keys instance.
      69              :      * @param[in] mediaKeysIpcFactory : The media keys ipc factory.
      70              :      */
      71              :     explicit MediaKeys(const std::string &keySystem, const std::shared_ptr<IMediaKeysIpcFactory> &mediaKeysIpcFactory);
      72              : 
      73              :     /**
      74              :      * @brief Virtual destructor.
      75              :      */
      76              :     virtual ~MediaKeys();
      77              : 
      78              :     MediaKeyErrorStatus selectKeyId(int32_t keySessionId, const std::vector<uint8_t> &keyId) override;
      79              : 
      80              :     bool containsKey(int32_t keySessionId, const std::vector<uint8_t> &keyId) override;
      81              : 
      82              :     MediaKeyErrorStatus createKeySession(KeySessionType sessionType, std::weak_ptr<IMediaKeysClient> client, bool isLDL,
      83              :                                          int32_t &keySessionId) override;
      84              : 
      85              :     MediaKeyErrorStatus generateRequest(int32_t keySessionId, InitDataType initDataType,
      86              :                                         const std::vector<uint8_t> &initData) override;
      87              : 
      88              :     MediaKeyErrorStatus loadSession(int32_t keySessionId) override;
      89              : 
      90              :     MediaKeyErrorStatus updateSession(int32_t keySessionId, const std::vector<uint8_t> &responseData) override;
      91              : 
      92              :     MediaKeyErrorStatus setDrmHeader(int32_t keySessionId, const std::vector<uint8_t> &requestData) override;
      93              : 
      94              :     MediaKeyErrorStatus closeKeySession(int32_t keySessionId) override;
      95              : 
      96              :     MediaKeyErrorStatus removeKeySession(int32_t keySessionId) override;
      97              : 
      98              :     MediaKeyErrorStatus deleteDrmStore() override;
      99              : 
     100              :     MediaKeyErrorStatus deleteKeyStore() override;
     101              : 
     102              :     MediaKeyErrorStatus getDrmStoreHash(std::vector<unsigned char> &drmStoreHash) override;
     103              : 
     104              :     MediaKeyErrorStatus getKeyStoreHash(std::vector<unsigned char> &keyStoreHash) override;
     105              : 
     106              :     MediaKeyErrorStatus getLdlSessionsLimit(uint32_t &ldlLimit) override;
     107              : 
     108              :     MediaKeyErrorStatus getLastDrmError(int32_t keySessionId, uint32_t &errorCode) override;
     109              : 
     110              :     MediaKeyErrorStatus getDrmTime(uint64_t &drmTime) override;
     111              : 
     112              :     MediaKeyErrorStatus getCdmKeySessionId(int32_t keySessionId, std::string &cdmKeySessionId) override;
     113              : 
     114              :     MediaKeyErrorStatus releaseKeySession(int32_t keySessionId) override;
     115              : 
     116              : private:
     117              :     /**
     118              :      * @brief The media keys ipc object.
     119              :      */
     120              :     std::unique_ptr<IMediaKeys> m_mediaKeysIpc;
     121              : 
     122              :     /**
     123              :      * @brief The key system.
     124              :      */
     125              :     std::string m_keySystem;
     126              : };
     127              : 
     128              : }; // namespace firebolt::rialto::client
     129              : 
     130              : #endif // FIREBOLT_RIALTO_CLIENT_MEDIA_KEYS_H_
        

Generated by: LCOV version 2.0-1