2121#include < rapidjson/document.h>
2222
2323using namespace UTILS ;
24+ using namespace ADP ::KODI_PROPS;
2425
2526namespace
2627{
@@ -280,11 +281,20 @@ void ADP::KODI_PROPS::CCompKodiProps::InitStage1(const std::map<std::string, std
280281 else
281282 {
282283 auto first = m_drmConfigs.begin ();
283- first->second .license .serverUrl = licenseUrl;
284+ first->second .license .serverUri = licenseUrl;
284285 }
285286 }
286287}
287288
289+ const ADP::KODI_PROPS::DrmCfg ADP::KODI_PROPS::CCompKodiProps::GetDrmConfig (
290+ std::string_view keySystem) const
291+ {
292+ if (STRING::KeyExists (m_drmConfigs, keySystem))
293+ return m_drmConfigs.at (keySystem.data ());
294+
295+ return {}; // default values
296+ }
297+
288298void ADP::KODI_PROPS::CCompKodiProps::ParseConfig (const std::string& data)
289299{
290300 /*
@@ -314,6 +324,38 @@ void ADP::KODI_PROPS::CCompKodiProps::ParseConfig(const std::string& data)
314324 {
315325 m_config.internalCookies = jDictVal.GetBool ();
316326 }
327+ else if (configName == " check_hdcp" && jDictVal.IsString ())
328+ {
329+ std::string_view value = jDictVal.GetString ();
330+
331+ if (value.empty () || value == " default" )
332+ m_config.hdcpCheck = HdcpCheckType::DEFAULT;
333+ else if (value == " license" )
334+ m_config.hdcpCheck = HdcpCheckType::LICENSE;
335+ else
336+ LOG::LogF (LOGERROR, " Value \" %s\" isnt supported on \" %s\" config of \" %s\" property" ,
337+ value.data (), configName.c_str (), PROP_MANIFEST_CONFIG.data ());
338+ }
339+ else if (configName == " resolution_limit" && jDictVal.IsString ())
340+ {
341+ std::string_view value = jDictVal.GetString ();
342+ if (!value.empty ())
343+ {
344+ auto pos = value.find (' x' );
345+ if (pos != std::string_view::npos)
346+ {
347+ const int width = STRING::ToInt32 (value.substr (0 , pos));
348+ const int height = STRING::ToInt32 (value.substr (pos + 1 ));
349+ m_config.resolutionLimit = width * height;
350+ }
351+ else
352+ {
353+ LOG::LogF (LOGERROR,
354+ " Invalid resolution format \" %s\" on \" %s\" config of \" %s\" property" ,
355+ value.data (), configName.c_str (), PROP_MANIFEST_CONFIG.data ());
356+ }
357+ }
358+ }
317359 else
318360 {
319361 LOG::LogF (LOGERROR, " Unsupported \" %s\" config or wrong data type on \" %s\" property" ,
@@ -379,9 +421,7 @@ void ADP::KODI_PROPS::CCompKodiProps::ParseDrmOldProps(
379421
380422 if (!STRING::KeyExists (props, PROP_LICENSE_TYPE))
381423 return ;
382- /*
383- *! @todo: TO UNCOMMENT WHEN DRM AUTO-SELECTION WILL BE FULL IMPLEMENTED
384- *
424+
385425 LOG::Log (LOGWARNING, " <<<<<<<<< DEPRECATION NOTICE >>>>>>>>>\n "
386426 " DEPRECATED PROPERTIES HAS BEEN USED TO SET THE DRM CONFIGURATION.\n "
387427 " THE FOLLOWING PROPERTIES WILL BE REMOVED FROM FUTURE KODI VERSIONS:\n "
@@ -392,11 +432,11 @@ void ADP::KODI_PROPS::CCompKodiProps::ParseDrmOldProps(
392432 " - inputstream.adaptive.server_certificate\n "
393433 " - inputstream.adaptive.pre_init_data\n "
394434 " YOU SHOULD CONSIDER MIGRATING TO THE NEW PROPERTIES:\n "
395- "- inputstream.adaptive.drm\n"
396435 " - inputstream.adaptive.drm_legacy\n "
436+ " - inputstream.adaptive.drm\n "
397437 " FOR MORE INFO, PLEASE READ THE WIKI PAGE: "
398438 " https://github.com/xbmc/inputstream.adaptive/wiki/Integration-DRM" );
399- */
439+
400440 std::string drmKeySystem{DRM::KS_NONE};
401441 if (STRING::KeyExists (props, PROP_LICENSE_TYPE))
402442 drmKeySystem = props.at (PROP_LICENSE_TYPE.data ());
@@ -485,7 +525,7 @@ void ADP::KODI_PROPS::CCompKodiProps::ParseDrmOldProps(
485525 {
486526 // Field 1: License server url
487527 if (fieldCount >= 1 )
488- drmCfg.license .serverUrl = fields[0 ];
528+ drmCfg.license .serverUri = fields[0 ];
489529
490530 // Field 2: HTTP request headers
491531 if (fieldCount >= 2 )
@@ -567,8 +607,8 @@ void ADP::KODI_PROPS::CCompKodiProps::ParseDrmOldProps(
567607 // Position 2: The dict Key name to get HDCP value (optional)
568608 if (jPaths.size () >= 2 )
569609 {
570- drmCfg.license .unwrapperParams [" path_hdcp_traverse " ] = " true" ;
571- drmCfg.license .unwrapperParams [" path_hdcp " ] = jPaths[1 ];
610+ drmCfg.license .unwrapperParams [" path_hdcp_res_traverse " ] = " true" ;
611+ drmCfg.license .unwrapperParams [" path_hdcp_res " ] = jPaths[1 ];
572612 }
573613 }
574614 }
@@ -608,7 +648,7 @@ bool ADP::KODI_PROPS::CCompKodiProps::ParseDrmConfig(const std::string& data)
608648 continue ;
609649 }
610650
611- DrmCfg& drmCfg = m_drmConfigs[keySystem];
651+ DrmCfg& drmCfg = m_drmConfigs[keySystem]; // create new configuration
612652 auto & jDictVal = jChildObj.value ;
613653
614654 if (!jDictVal.IsObject ())
@@ -663,7 +703,7 @@ bool ADP::KODI_PROPS::CCompKodiProps::ParseDrmConfig(const std::string& data)
663703 drmCfg.license .serverCert = jDictLic[" server_certificate" ].GetString ();
664704
665705 if (jDictLic.HasMember (" server_url" ) && jDictLic[" server_url" ].IsString ())
666- drmCfg.license .serverUrl = jDictLic[" server_url" ].GetString ();
706+ drmCfg.license .serverUri = jDictLic[" server_url" ].GetString ();
667707
668708 if (jDictLic.HasMember (" use_http_get_request" ) && jDictLic[" use_http_get_request" ].IsBool ())
669709 drmCfg.license .isHttpGetRequest = jDictLic[" use_http_get_request" ].GetBool ();
@@ -704,9 +744,6 @@ bool ADP::KODI_PROPS::CCompKodiProps::ParseDrmConfig(const std::string& data)
704744 }
705745 }
706746 }
707-
708- // ! @todo: temporary support only one DRM config, must be reworked the CSession for DRM auto-selection
709- break ;
710747 }
711748
712749 return true ;
@@ -752,9 +789,9 @@ bool ADP::KODI_PROPS::CCompKodiProps::ParseDrmLegacyConfig(const std::string& da
752789
753790 if (!licenseStr.empty ())
754791 {
755- if (URL::IsValidUrl (licenseStr)) // License server URL
792+ if (URL::IsValidUrl (licenseStr) || URL::IsValidUri (licenseStr)) // License server URI
756793 {
757- drmCfg.license .serverUrl = licenseStr;
794+ drmCfg.license .serverUri = licenseStr;
758795 }
759796 else // Assume are keyid's for ClearKey DRM
760797 {
0 commit comments