File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -433,7 +433,7 @@ bool DRM::CDRMEngine::ConfigureClearKey(std::vector<DRM::DRMInfo>& drmInfos)
433433
434434 const ADP::KODI_PROPS::DrmCfg& drmCfg = kodiProps.GetDrmConfig (KS_CLEARKEY);
435435
436- // The ClearKey configuration will replace all DRMInfo when
436+ // The ClearKey configuration can add (or replace) CK DRMInfo when
437437 // it finds a custom license uri or keys
438438 if (drmCfg.license .serverUri .empty () && drmCfg.license .keys .empty ())
439439 return false ;
@@ -442,7 +442,17 @@ bool DRM::CDRMEngine::ConfigureClearKey(std::vector<DRM::DRMInfo>& drmInfos)
442442 const CryptoMode cryptoMode = drmInfos[0 ].cryptoMode ;
443443 const std::string defaultKid = drmInfos[0 ].defaultKid ;
444444
445- drmInfos.clear ();
445+ if (kodiProps.GetDrmConfigs ().size () == 1 ) // Single config (CK)
446+ {
447+ // Delete all the DRMInfo, so you can force CK even if the manifest uses a different DRM
448+ drmInfos.clear ();
449+ }
450+ else // More configs, behavior based on "priority" its needed to preserve DRMInfos
451+ {
452+ drmInfos.erase (std::remove_if (drmInfos.begin (), drmInfos.end (), [](const DRM::DRMInfo& info)
453+ { return info.keySystem == KS_CLEARKEY; }),
454+ drmInfos.end ());
455+ }
446456
447457 std::string licenseUri;
448458
@@ -488,7 +498,6 @@ bool DRM::CDRMEngine::ConfigureClearKey(std::vector<DRM::DRMInfo>& drmInfos)
488498 drmInfo.cryptoMode = cryptoMode;
489499 drmInfo.defaultKid = defaultKid;
490500 drmInfo.licenseServerUri = licenseUri;
491-
492501 drmInfos.emplace_back (drmInfo);
493502
494503 return true ;
You can’t perform that action at this time.
0 commit comments