/* * Copyright (C) 2024 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #include "common/AdaptiveCencSampleDecrypter.h" #include "decrypters/IDecrypter.h" #include class CClearKeyDecrypter; class CClearKeyCencSingleSampleDecrypter : public Adaptive_CencSingleSampleDecrypter { public: CClearKeyCencSingleSampleDecrypter(std::string_view licenseUrl, const std::map& licenseHeaders, const std::vector& defaultKeyId, CClearKeyDecrypter* host); CClearKeyCencSingleSampleDecrypter(const std::vector& initdata, const std::vector& defaultKeyId, const std::map& keys, CClearKeyDecrypter* host); virtual ~CClearKeyCencSingleSampleDecrypter(){}; void AddSessionKey(const std::vector& keyId); bool HasKeyId(const std::vector& keyid); virtual AP4_Result SetFragmentInfo(AP4_UI32 pool_id, const std::vector& key, const AP4_UI08 nal_length_size, AP4_DataBuffer& annexb_sps_pps, AP4_UI32 flags, CryptoInfo cryptoInfo) override { return AP4_SUCCESS; } virtual AP4_Result DecryptSampleData(AP4_UI32 pool_id, AP4_DataBuffer& data_in, AP4_DataBuffer& data_out, const AP4_UI08* iv, unsigned int subsample_count, const AP4_UI16* bytes_of_cleartext_data, const AP4_UI32* bytes_of_encrypted_data) override; std::string CreateLicenseRequest(const std::vector& defaultKeyId); bool ParseLicenseResponse(std::string data); void SetDefaultKeyId(const std::vector& keyId) override{}; void AddKeyId(const std::vector& keyId) override{}; bool HasKeys() { return !m_keyIds.empty(); } private: AP4_CencSingleSampleDecrypter* m_singleSampleDecrypter{nullptr}; std::string m_strSession; std::string m_licenceDefaultKeyId; std::vector> m_keyIds; std::map m_keyPairs; CClearKeyDecrypter* m_host; };