diff --git a/src/Session.cpp b/src/Session.cpp index 4187a611b..f22ef36f1 100644 --- a/src/Session.cpp +++ b/src/Session.cpp @@ -737,7 +737,7 @@ bool SESSION::CSession::PrepareStream(CStream& stream) if (!drmSession) return false; - isDrmSecure = drmSession->capabilities.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH; + isDrmSecure = drmSession->capabilities.HasFlag(DRM::Capabilities::SECURE_PATH); reader->SetDecrypter(drmSession); } diff --git a/src/common/AdaptiveDecrypter.h b/src/common/AdaptiveDecrypter.h index 3216a3a14..d82820e89 100644 --- a/src/common/AdaptiveDecrypter.h +++ b/src/common/AdaptiveDecrypter.h @@ -45,7 +45,7 @@ class Adaptive_CencSingleSampleDecrypter : public AP4_CencSingleSampleDecrypter const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities caps, CryptoInfo cryptoInfo) = 0; virtual AP4_Result DecryptSampleData(AP4_UI32 poolId, diff --git a/src/decrypters/DrmEngine.cpp b/src/decrypters/DrmEngine.cpp index a60e3067a..701d034cb 100644 --- a/src/decrypters/DrmEngine.cpp +++ b/src/decrypters/DrmEngine.cpp @@ -82,11 +82,11 @@ bool GetCapabilities(const std::optional isForceSecureDecoder, auto& caps = session.capabilities; session.drm->GetCapabilities(session.decrypter, defaultKid, caps, session.mediaType); - if (caps.flags & DRM::DecrypterCapabilites::SSD_INVALID) + if (caps.flags & DRM::Capabilities::INVALID_STATUS) { return false; } - else if (caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) + else if (caps.flags & DRM::Capabilities::SECURE_PATH) { // Allow to disable the secure decoder bool disableSecureDecoder = CSrvBroker::GetSettings().IsDisableSecureDecoder(); @@ -99,7 +99,7 @@ bool GetCapabilities(const std::optional isForceSecureDecoder, if (disableSecureDecoder) { LOG::Log(LOGDEBUG, "DRM configured with secure decoder disabled"); - caps.flags &= ~DRM::DecrypterCapabilites::SSD_SECURE_DECODER; + caps.flags &= ~DRM::Capabilities::SECURE_DECODER; } } @@ -632,7 +632,7 @@ const std::shared_ptr DRM::CDRMEngine::InitializeSession( //! since audio streams that require Secure path decoder cannot be played //! we have no way to distinguish which ones they are other than to do a KID test with the DRM if (!session->drm->IsSecureDecoderAudioSupported() && session->mediaType == DRMMediaType::AUDIO && - caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) + caps.flags & DRM::Capabilities::SECURE_PATH) { LOG::Log(LOGWARNING, "Secure decoder on audio stream is not supported"); m_status = EngineStatus::NOT_SUPPORTED; @@ -644,11 +644,11 @@ const std::shared_ptr DRM::CDRMEngine::InitializeSession( cryptoSession.SetSessionId(session->id); // Set the key system will enable the crypto session to kodi decoders (e.g. ffmpeg) - if (caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) + if (caps.flags & DRM::Capabilities::SECURE_PATH) cryptoSession.SetKeySystem(KSToCryptoKeySystem(m_keySystem)); - if (caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH && - caps.flags & DRM::DecrypterCapabilites::SSD_SUPPORTS_DECODING) + if (caps.flags & DRM::Capabilities::SECURE_PATH && + caps.flags & DRM::Capabilities::SUPPORTS_DECODING) { LOG::Log(LOGDEBUG, "Secure crypto session enabled to DRM session (ID: %s)", session->id.c_str()); @@ -657,8 +657,8 @@ const std::shared_ptr DRM::CDRMEngine::InitializeSession( else streamInfo.SetFeatures(INPUTSTREAM_FEATURE_NONE); - if (caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH && - caps.flags & DRM::DecrypterCapabilites::SSD_SECURE_DECODER) + if (caps.flags & DRM::Capabilities::SECURE_PATH && + caps.flags & DRM::Capabilities::SECURE_DECODER) { // Enable the ISA VideoCodecAdaptive decoder LOG::Log(LOGDEBUG, "Secure crypto decoder enabled to DRM session (ID: %s)", diff --git a/src/decrypters/DrmEngineDefines.h b/src/decrypters/DrmEngineDefines.h index d162fb262..c52f9c667 100644 --- a/src/decrypters/DrmEngineDefines.h +++ b/src/decrypters/DrmEngineDefines.h @@ -30,17 +30,19 @@ namespace DRM constexpr uint16_t HDCP_V_NONE = 0; constexpr uint16_t HDCP_V_MAX = 9999; -struct DecrypterCapabilites +// \brief Decrypter capabilities +struct Capabilities { - static const uint32_t SSD_SUPPORTS_DECODING = 1; - static const uint32_t SSD_SECURE_PATH = 2; - static const uint32_t SSD_ANNEXB_REQUIRED = 4; - static const uint32_t SSD_HDCP_RESTRICTED = 8; - static const uint32_t SSD_SINGLE_DECRYPT = 16; - static const uint32_t SSD_SECURE_DECODER = 32; - static const uint32_t SSD_INVALID = 64; + static const uint32_t SUPPORTS_DECODING = 1; + static const uint32_t SECURE_PATH = 2; + static const uint32_t ANNEXB_REQUIRED = 4; + static const uint32_t HDCP_RESTRICTED = 8; + static const uint32_t SINGLE_DECRYPT = 16; + static const uint32_t SECURE_DECODER = 32; + static const uint32_t INVALID_STATUS = 64; uint16_t flags{0}; + bool HasFlag(uint32_t cap) const { return (flags & cap) != 0; } /* The following 2 fields are set as followed: - If licenseresponse return hdcp information, hdcpversion is 0 and @@ -145,7 +147,7 @@ struct DRMSession std::string id; // DRM session ID std::shared_ptr drm; // DRM instance std::shared_ptr decrypter; // DRM Decrypter instance - DRM::DecrypterCapabilites capabilities; + DRM::Capabilities capabilities; std::string kid; std::string challenge; // Key request (Challenge) as base64 DRMMediaType mediaType{DRMMediaType::UNKNOWN}; diff --git a/src/decrypters/IDecrypter.h b/src/decrypters/IDecrypter.h index c59a91151..fc33636a7 100644 --- a/src/decrypters/IDecrypter.h +++ b/src/decrypters/IDecrypter.h @@ -110,7 +110,7 @@ class IDecrypter : public IDecrypterDecoder */ virtual void GetCapabilities(std::shared_ptr decrypter, const std::vector& keyId, - DecrypterCapabilites& caps, + Capabilities& caps, DRMMediaType mediaType) = 0; /* diff --git a/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.cpp b/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.cpp index 52fef38fa..8deb5d0d9 100644 --- a/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.cpp +++ b/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.cpp @@ -122,12 +122,13 @@ void CClearKeyCencSingleSampleDecrypter::RemovePool(AP4_UI32 poolId) m_pool.erase(poolId); } -AP4_Result CClearKeyCencSingleSampleDecrypter::SetFragmentInfo(AP4_UI32 poolId, - const std::vector& keyId, - const AP4_UI08 nalLengthSize, - const std::vector& annexbSpsPps, - AP4_UI32 flags, - CryptoInfo cryptoInfo) +AP4_Result CClearKeyCencSingleSampleDecrypter::SetFragmentInfo( + AP4_UI32 poolId, + const std::vector& keyId, + const AP4_UI08 nalLengthSize, + const std::vector& annexbSpsPps, + DRM::Capabilities flags, + CryptoInfo cryptoInfo) { if (!STRING::KeyExists(m_pool, poolId)) { diff --git a/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.h b/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.h index 9f36fc5de..efe04b494 100644 --- a/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.h +++ b/src/decrypters/clearkey/ClearKeyCencSingleSampleDecrypter.h @@ -34,7 +34,7 @@ class CClearKeyCencSingleSampleDecrypter : public Adaptive_CencSingleSampleDecry const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities flags, CryptoInfo cryptoInfo) override; virtual AP4_Result DecryptSampleData(AP4_UI32 poolId, AP4_DataBuffer& dataIn, diff --git a/src/decrypters/clearkey/ClearKeyDecrypter.h b/src/decrypters/clearkey/ClearKeyDecrypter.h index f5892fb72..f7d5c716f 100644 --- a/src/decrypters/clearkey/ClearKeyDecrypter.h +++ b/src/decrypters/clearkey/ClearKeyDecrypter.h @@ -28,7 +28,7 @@ class CClearKeyDecrypter : public IDecrypter virtual void GetCapabilities(std::shared_ptr decrypter, const std::vector& keyid, - DRM::DecrypterCapabilites& caps, + DRM::Capabilities& caps, DRMMediaType mediaType) override { } diff --git a/src/decrypters/widevine/WVCencSingleSampleDecrypter.cpp b/src/decrypters/widevine/WVCencSingleSampleDecrypter.cpp index 4ad316514..80c1c0db7 100644 --- a/src/decrypters/widevine/WVCencSingleSampleDecrypter.cpp +++ b/src/decrypters/widevine/WVCencSingleSampleDecrypter.cpp @@ -149,7 +149,7 @@ SResult CWVCencSingleSampleDecrypter::CreateSession(const std::vector& } void CWVCencSingleSampleDecrypter::GetCapabilities(const std::vector& keyId, - DecrypterCapabilites& caps, + Capabilities& caps, DRMMediaType mediaType) { caps = {0, m_hdcpVersion, m_hdcpLimit}; @@ -157,16 +157,16 @@ void CWVCencSingleSampleDecrypter::GetCapabilities(const std::vector& k if (m_strSession.empty()) { LOG::LogF(LOGDEBUG, "Session empty"); - caps.flags = DecrypterCapabilites::SSD_INVALID; + caps.flags = Capabilities::INVALID_STATUS; return; } - caps.flags = DecrypterCapabilites::SSD_SUPPORTS_DECODING; + caps.flags = Capabilities::SUPPORTS_DECODING; if (m_keys.empty()) { LOG::LogF(LOGDEBUG, "Keys empty"); - caps.flags = DecrypterCapabilites::SSD_INVALID; + caps.flags = Capabilities::INVALID_STATUS; return; } @@ -174,16 +174,14 @@ void CWVCencSingleSampleDecrypter::GetCapabilities(const std::vector& k caps.hdcpLimit = m_resolutionLimit; #ifdef TARGET_WEBOS - LOG::LogF(LOGDEBUG, - "Overriding settings to: SSD_SECURE PATH | SSD_ANNEXB_REQUIRED | SSD_SECURE_DECODER"); - caps = {DRM::DecrypterCapabilites::SSD_SECURE_PATH | - DRM::DecrypterCapabilites::SSD_ANNEXB_REQUIRED, - DRM::DecrypterCapabilites::SSD_SECURE_DECODER}; + LOG::LogF(LOGDEBUG, "Overriding settings to: SECURE_PATH | ANNEXB_REQUIRED | SECURE_DECODER"); + caps = {DRM::Capabilities::SECURE_PATH | DRM::Capabilities::ANNEXB_REQUIRED, + DRM::Capabilities::SECURE_DECODER}; caps.hdcpVersion = DRM::HDCP_V_MAX; return; #endif - if ((caps.flags & DecrypterCapabilites::SSD_SUPPORTS_DECODING) != 0) + if (caps.HasFlag(Capabilities::SUPPORTS_DECODING)) { AP4_UI32 poolId(AddPool()); m_fragmentPool[poolId].m_key = keyId.empty() ? m_keys.front().kid : keyId; @@ -211,13 +209,12 @@ void CWVCencSingleSampleDecrypter::GetCapabilities(const std::vector& k AP4_SUCCESS) { LOG::LogF(LOGDEBUG, "Single decrypt failed, secure path only"); - caps.flags |= - (DecrypterCapabilites::SSD_SECURE_PATH | DecrypterCapabilites::SSD_ANNEXB_REQUIRED); + caps.flags |= (Capabilities::SECURE_PATH | Capabilities::ANNEXB_REQUIRED); } else { LOG::LogF(LOGDEBUG, "Single decrypt possible"); - caps.flags |= DecrypterCapabilites::SSD_SINGLE_DECRYPT; + caps.flags |= Capabilities::SINGLE_DECRYPT; caps.hdcpVersion = DRM::HDCP_V_MAX; caps.hdcpLimit = m_resolutionLimit; } @@ -227,15 +224,14 @@ void CWVCencSingleSampleDecrypter::GetCapabilities(const std::vector& k catch (const std::exception& e) { LOG::LogF(LOGDEBUG, "Decrypt error, assuming secure path: %s", e.what()); - caps.flags |= (DecrypterCapabilites::SSD_SECURE_PATH | - DecrypterCapabilites::SSD_ANNEXB_REQUIRED); + caps.flags |= (Capabilities::SECURE_PATH | Capabilities::ANNEXB_REQUIRED); } RemovePool(poolId); } else { LOG::LogF(LOGDEBUG, "Decoding not supported"); - caps.flags = DecrypterCapabilites::SSD_INVALID; + caps.flags = Capabilities::INVALID_STATUS; } } @@ -458,7 +454,7 @@ AP4_Result CWVCencSingleSampleDecrypter::SetFragmentInfo(AP4_UI32 poolId, const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities caps, CryptoInfo cryptoInfo) { if (poolId >= m_fragmentPool.size()) @@ -467,7 +463,7 @@ AP4_Result CWVCencSingleSampleDecrypter::SetFragmentInfo(AP4_UI32 poolId, m_fragmentPool[poolId].m_key = keyId; m_fragmentPool[poolId].m_nalLengthSize = nalLengthSize; m_fragmentPool[poolId].m_annexbSpsPps = annexbSpsPps; - m_fragmentPool[poolId].m_decrypterFlags = flags; + m_fragmentPool[poolId].capabilities = caps; m_fragmentPool[poolId].m_cryptoInfo = cryptoInfo; return AP4_SUCCESS; @@ -581,8 +577,7 @@ AP4_Result CWVCencSingleSampleDecrypter::DecryptSampleData(AP4_UI32 poolId, FINFO& fragInfo(m_fragmentPool[poolId]); - if (fragInfo.m_decrypterFlags & - DecrypterCapabilites::SSD_SECURE_PATH) //we can not decrypt only + if (fragInfo.capabilities.HasFlag(Capabilities::SECURE_PATH)) //we can not decrypt only { if (fragInfo.m_nalLengthSize > 4) { @@ -592,8 +587,7 @@ AP4_Result CWVCencSingleSampleDecrypter::DecryptSampleData(AP4_UI32 poolId, AP4_DataBuffer payload; std::vector rebuiltSubs; - bool convertAnnexB = - (fragInfo.m_decrypterFlags & DecrypterCapabilites::SSD_ANNEXB_REQUIRED) != 0; + const bool convertAnnexB = fragInfo.capabilities.HasFlag(Capabilities::ANNEXB_REQUIRED); // Convert only when safe to look at clear_bytes[0] if (fragInfo.m_nalLengthSize && (!iv || (subsampleCount > 0 && bytesOfCleartextData[0] > 0))) diff --git a/src/decrypters/widevine/WVCencSingleSampleDecrypter.h b/src/decrypters/widevine/WVCencSingleSampleDecrypter.h index dd4f50ece..4b0004b03 100644 --- a/src/decrypters/widevine/WVCencSingleSampleDecrypter.h +++ b/src/decrypters/widevine/WVCencSingleSampleDecrypter.h @@ -39,7 +39,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypter : public Adaptive_CencSingleSa bool skipSessionMessage) override; void GetCapabilities(const std::vector& keyId, - DecrypterCapabilites& caps, + Capabilities& caps, DRMMediaType mediaType); virtual std::string GetSessionId() override; void CloseSessionId(); @@ -53,7 +53,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypter : public Adaptive_CencSingleSa const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities caps, CryptoInfo cryptoInfo) override; virtual AP4_UI32 AddPool() override; virtual void RemovePool(AP4_UI32 poolId) override; @@ -113,7 +113,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypter : public Adaptive_CencSingleSa { std::vector m_key; AP4_UI08 m_nalLengthSize; - AP4_UI16 m_decrypterFlags; + DRM::Capabilities capabilities; std::vector m_annexbSpsPps; CryptoInfo m_cryptoInfo; }; diff --git a/src/decrypters/widevine/WVDecrypter.cpp b/src/decrypters/widevine/WVDecrypter.cpp index cc60e431b..bb0156626 100644 --- a/src/decrypters/widevine/WVDecrypter.cpp +++ b/src/decrypters/widevine/WVDecrypter.cpp @@ -89,7 +89,7 @@ std::shared_ptr CWVDecrypter::CreateSingleSa void CWVDecrypter::GetCapabilities(std::shared_ptr decrypter, const std::vector& keyId, - DRM::DecrypterCapabilites& caps, + DRM::Capabilities& caps, DRMMediaType mediaType) { if (!decrypter) diff --git a/src/decrypters/widevine/WVDecrypter.h b/src/decrypters/widevine/WVDecrypter.h index ceb3b1455..f6f957ad0 100644 --- a/src/decrypters/widevine/WVDecrypter.h +++ b/src/decrypters/widevine/WVDecrypter.h @@ -31,7 +31,7 @@ class ATTR_DLL_LOCAL CWVDecrypter : public DRM::IDecrypter virtual void GetCapabilities(std::shared_ptr decrypter, const std::vector& keyId, - DRM::DecrypterCapabilites& caps, + DRM::Capabilities& caps, DRM::DRMMediaType mediaType) override; virtual std::optional HasLicenseKey( std::shared_ptr decrypter, diff --git a/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.cpp b/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.cpp index 84afd63d0..c3ae7f652 100644 --- a/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.cpp +++ b/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.cpp @@ -202,11 +202,10 @@ bool CWVCencSingleSampleDecrypterA::HasKeyId(const std::vector& keyid) } void CWVCencSingleSampleDecrypterA::GetCapabilities(const std::vector& keyId, - DRM::DecrypterCapabilites& caps) + DRM::Capabilities& caps) { - caps = {DRM::DecrypterCapabilites::SSD_SECURE_PATH | - DRM::DecrypterCapabilites::SSD_ANNEXB_REQUIRED, - m_hdcpVersion, m_hdcpLimit}; + caps = {DRM::Capabilities::SECURE_PATH | DRM::Capabilities::ANNEXB_REQUIRED, m_hdcpVersion, + m_hdcpLimit}; if (caps.hdcpLimit == 0) caps.hdcpLimit = m_resolutionLimit; @@ -217,7 +216,7 @@ void CWVCencSingleSampleDecrypterA::GetCapabilities(const std::vector& if (m_cdmAdapter->GetCDM()->getPropertyString("securityLevel") == "L1") { caps.hdcpLimit = m_resolutionLimit; //No restriction - caps.flags |= DRM::DecrypterCapabilites::SSD_SECURE_DECODER; + caps.flags |= DRM::Capabilities::SECURE_DECODER; } LOG::LogF(LOGDEBUG, "hdcpLimit: %i", caps.hdcpLimit); } @@ -526,7 +525,7 @@ AP4_Result CWVCencSingleSampleDecrypterA::SetFragmentInfo(AP4_UI32 poolId, const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities caps, CryptoInfo cryptoInfo) { if (poolId >= m_fragmentPool.size()) @@ -535,7 +534,7 @@ AP4_Result CWVCencSingleSampleDecrypterA::SetFragmentInfo(AP4_UI32 poolId, m_fragmentPool[poolId].m_key = keyId; m_fragmentPool[poolId].m_nalLengthSize = nalLengthSize; m_fragmentPool[poolId].m_annexbSpsPps = annexbSpsPps; - m_fragmentPool[poolId].m_decrypterFlags = flags; + m_fragmentPool[poolId].capabilities = caps; if (m_isKeyUpdateRequested) KeyUpdateRequest(false, false); @@ -585,7 +584,7 @@ AP4_Result CWVCencSingleSampleDecrypterA::DecryptSampleData(AP4_UI32 poolId, AP4_DataBuffer payload; std::vector rebuiltSubs; - bool convertAnnexB = (fragInfo.m_decrypterFlags & DRM::DecrypterCapabilites::SSD_ANNEXB_REQUIRED) != 0; + const bool convertAnnexB = fragInfo.capabilities.HasFlag(DRM::Capabilities::ANNEXB_REQUIRED); // Convert only when safe to look at clear_bytes[0] if (fragInfo.m_nalLengthSize && (!iv || (subsampleCount > 0 && bytesOfCleartextData[0] > 0))) diff --git a/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.h b/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.h index 37dea0890..a5bdc9fdb 100644 --- a/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.h +++ b/src/decrypters/widevineandroid/WVCencSingleSampleDecrypter.h @@ -40,7 +40,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypterA : public Adaptive_CencSingleS const std::vector& keyId, const AP4_UI08 nalLengthSize, const std::vector& annexbSpsPps, - AP4_UI32 flags, + DRM::Capabilities caps, CryptoInfo cryptoInfo) override; virtual AP4_UI32 AddPool() override; virtual void RemovePool(AP4_UI32 poolId) override; @@ -63,7 +63,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypterA : public Adaptive_CencSingleS const AP4_UI32* bytesOfEncryptedData, DRM::DRMMediaType streamType) override; - void GetCapabilities(const std::vector& keyId, DRM::DecrypterCapabilites& caps); + void GetCapabilities(const std::vector& keyId, DRM::Capabilities& caps); void RequestNewKeys() { m_isKeyUpdateRequested = true; }; @@ -77,7 +77,7 @@ class ATTR_DLL_LOCAL CWVCencSingleSampleDecrypterA : public Adaptive_CencSingleS { std::vector m_key; AP4_UI08 m_nalLengthSize; - AP4_UI16 m_decrypterFlags; + DRM::Capabilities capabilities; std::vector m_annexbSpsPps; }; diff --git a/src/decrypters/widevineandroid/WVDecrypter.cpp b/src/decrypters/widevineandroid/WVDecrypter.cpp index c6169e7a1..ff51be336 100644 --- a/src/decrypters/widevineandroid/WVDecrypter.cpp +++ b/src/decrypters/widevineandroid/WVDecrypter.cpp @@ -92,7 +92,7 @@ std::shared_ptr CWVDecrypterA::CreateSingleS void CWVDecrypterA::GetCapabilities(std::shared_ptr decrypter, const std::vector& keyId, - DRM::DecrypterCapabilites& caps, + DRM::Capabilities& caps, DRM::DRMMediaType mediaType) { if (!decrypter) diff --git a/src/decrypters/widevineandroid/WVDecrypter.h b/src/decrypters/widevineandroid/WVDecrypter.h index 8ac554193..27372aa4e 100644 --- a/src/decrypters/widevineandroid/WVDecrypter.h +++ b/src/decrypters/widevineandroid/WVDecrypter.h @@ -54,7 +54,7 @@ class ATTR_DLL_LOCAL CWVDecrypterA : public DRM::IDecrypter virtual void GetCapabilities(std::shared_ptr decrypter, const std::vector& keyId, - DRM::DecrypterCapabilites& caps, + DRM::Capabilities& caps, DRM::DRMMediaType mediaType) override; virtual std::optional HasLicenseKey( diff --git a/src/samplereader/FragmentedSampleReader.cpp b/src/samplereader/FragmentedSampleReader.cpp index 0a68b6a7b..046bc0dc7 100644 --- a/src/samplereader/FragmentedSampleReader.cpp +++ b/src/samplereader/FragmentedSampleReader.cpp @@ -220,7 +220,6 @@ void CFragmentedSampleReader::SetDecrypter(std::shared_ptr drmS if (drmSession) { m_poolId = drmSession->decrypter->AddPool(); - m_decrypterCaps = drmSession->capabilities; m_drmSession = drmSession; } } @@ -279,7 +278,7 @@ AP4_Result CFragmentedSampleReader::ReadSample() //Protection could have changed in ProcessMoof bool useDecryptingDecoder = - m_drmSession && (m_decrypterCaps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) != 0; + m_drmSession && (m_drmSession->capabilities.HasFlag(DRM::Capabilities::SECURE_PATH)); if (m_decrypter) { @@ -355,7 +354,7 @@ uint64_t CFragmentedSampleReader::GetDuration() const bool CFragmentedSampleReader::IsEncrypted() const { - return (m_decrypterCaps.flags & DRM::DecrypterCapabilites::SSD_SECURE_PATH) != 0 && m_decrypter; + return m_decrypter && m_drmSession->capabilities.HasFlag(DRM::Capabilities::SECURE_PATH); } bool CFragmentedSampleReader::GetInformation(kodi::addon::InputstreamInfo& info) @@ -376,7 +375,8 @@ bool CFragmentedSampleReader::GetInformation(kodi::addon::InputstreamInfo& info) std::vector extraData = info.GetExtraData(); if (m_codecHandler->CheckExtraData( - extraData, (m_decrypterCaps.flags & DRM::DecrypterCapabilites::SSD_ANNEXB_REQUIRED) != 0)) + extraData, + (m_drmSession && m_drmSession->capabilities.HasFlag(DRM::Capabilities::ANNEXB_REQUIRED)))) { m_codecHandler->m_extraData = extraData; info.SetExtraData(extraData); @@ -526,8 +526,8 @@ AP4_Result CFragmentedSampleReader::ProcessMoof(AP4_ContainerAtom* moof, std::vector extradata = m_codecHandler->m_extraData; if (m_codecHandler->CheckExtraData( - extradata, - (m_decrypterCaps.flags & DRM::DecrypterCapabilites::SSD_ANNEXB_REQUIRED) != 0)) + extradata, (m_drmSession && + m_drmSession->capabilities.HasFlag(DRM::Capabilities::ANNEXB_REQUIRED)))) { m_codecHandler->m_extraData = extradata; } @@ -633,7 +633,7 @@ AP4_Result CFragmentedSampleReader::ProcessMoof(AP4_ContainerAtom* moof, if (AP4_FAILED(m_drmSession->decrypter->SetFragmentInfo( m_poolId, kid, m_codecHandler->m_naluLengthSize, m_codecHandler->m_extraData, - m_decrypterCaps.flags, m_readerCryptoInfo))) + m_drmSession->capabilities, m_readerCryptoInfo))) { return AP4_ERROR_INVALID_FORMAT; } diff --git a/src/samplereader/FragmentedSampleReader.h b/src/samplereader/FragmentedSampleReader.h index 631e51d58..4a60606af 100644 --- a/src/samplereader/FragmentedSampleReader.h +++ b/src/samplereader/FragmentedSampleReader.h @@ -141,7 +141,6 @@ class ATTR_DLL_LOCAL CFragmentedSampleReader : public ISampleReader, public CLin AP4_Track* m_track; AP4_UI32 m_poolId{0}; AP4_UI32 m_sampleDescIndex{1}; - DRM::DecrypterCapabilites m_decrypterCaps; unsigned int m_failCount{0}; bool m_bSampleDescChanged{false}; bool m_eos{false};