diff --git a/src/parser/DASHTree.cpp b/src/parser/DASHTree.cpp index a0cd6b022..efb2a47ed 100644 --- a/src/parser/DASHTree.cpp +++ b/src/parser/DASHTree.cpp @@ -12,6 +12,7 @@ #include "PRProtectionParser.h" #include "SrvBroker.h" #include "common/Period.h" +#include "decrypters/Helpers.h" #include "utils/Base64Utils.h" #include "utils/CurlUtils.h" #include "utils/StringUtils.h" @@ -1336,6 +1337,34 @@ bool adaptive::CDashTree::GetProtectionData( } } + // Workaround for ClearKey: + // if license type ClearKey is set and a manifest dont contains ClearKey protection scheme + // in any case the KID is required to allow decryption (with clear keys or license URLs provided by Kodi props) + //! @todo: this should not be a task of parser, moreover missing an appropriate KID extraction from mp4 box + auto& kodiProps = CSrvBroker::GetKodiProps(); + ProtectionScheme ckProtScheme; + if (!protSelected && !protCommon && kodiProps.GetLicenseType() == DRM::KS_CLEARKEY) + { + for (const ProtectionScheme& protScheme : reprProtSchemes) + { + if (!protScheme.kid.empty()) + { + ckProtScheme.kid = protScheme.kid; + break; + } + } + if (ckProtScheme.kid.empty()) + { + for (const ProtectionScheme& protScheme : adpProtSchemes) + { + ckProtScheme.kid = protScheme.kid; + break; + } + } + if (!ckProtScheme.kid.empty()) + protCommon = &ckProtScheme; + } + bool isEncrypted{false}; std::string selectedKid; std::string selectedPssh;