Skip to content

Commit

Permalink
[DashTree] Workaround to always get KID for ClearKey
Browse files Browse the repository at this point in the history
  • Loading branch information
CastagnaIT committed Aug 19, 2024
1 parent 6ad80b5 commit 3a93291
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/parser/DASHTree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 3a93291

Please sign in to comment.