New DRM Config property implementation rework
Description
I remind everyone that the DRM configuration transition is designed to be backward compatible, with some particular exceptions, specified on "breaking changes" section.
New inputstream.adaptive.drm property
The property has been for now limited to support only a unique DRM configuration. Support to multiple DRM configurations, will be implemented at later time, with future PR's
Since there is no automatic drm selection yet, it is necessary for now to always add the keysystem with protected streams, even with empty parameters if there is no need to change the default values.
JSON structure example (just a unique key system for now):
{
"[key system string]": {
"persistent_storage": bool,
"secure_decoder_disabled": bool,
"init_data": str,
"optional_key_req_params": dict,
...
"license": {
"server_certificate": str,
"server_url": str,
"req_headers": str,
...
}
}
}
In order not to do double work for the documentation, I will write directly on the wiki integration page the instructions on how to use it
Here is an example of a working STRM to compare the old with the new:
OLD PROPERTIES:
#KODIPROP:mimetype=application/dash+xml
#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.license_type=com.widevine.alpha
#KODIPROP:inputstream.adaptive.license_key=https://cwip-shaka-proxy.appspot.com/no_auth||R{SSM}|R
https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd
NEW DRM PROPERTY:
#KODIPROP:mimetype=application/dash+xml
#KODIPROP:inputstream=inputstream.adaptive
#KODIPROP:inputstream.adaptive.drm={"com.widevine.alpha": {"license": {"server_url": "https://cwip-shaka-proxy.appspot.com/no_auth"}}}
https://bitmovin-a.akamaihd.net/content/art-of-motion_drm/mpds/11331.mpd
ofc python addons can take the advantage to use python dict and use json.dumps to set the "drm" property value
Add XML license wrapper support
License wrapper term i mean the things that are set in to inputstream.adaptive.license_key [Response-Data] field, where we currently support base64 and JSON, wrappers
Since here the code that manage the license wrapper has been reworked (for widevine), add the XML wrapper support its a very small change, so is included here fix #267
Breaking changes
-
Removed old undocumented specific use case of
inputstream.adaptive.license_datato injectPRCustomDatato the Playready DRM. This was available only for smoothstreaming manifest Playready protected, this old feature has been never documented, because confusing. Currently im not aware of addons that could use it. This use case will not works anymore frominputstream.adaptive.license_data, but same feature can be used with the newinputstream.adaptive.drmproperty, with an appropriate configuration (seeoptional_key_req_params). -
HLS "renew license url" add-on callbacks, has been removed. This was an old undocumented feature, that seem to allow addons to provide an updated license url for the AES128 encryption. Currently im not aware of addons that could use it, also im not aware of possible HLS use cases that could use it. I am not even aware if this functionality really works since i have no pratical test case. If anyone is using it, please mention, and also link its python implementation. The code was however only commented on, for future removal or reintroduction.
-
On inputstream.adaptive.license_key property in the
[Response-Data]field, theHBtype has been removed. This because we have no info about this addition, i have not found info on web, nor addon that use it, therefore if in future someone will complain about this removal, we can obtain more info about it to reimplement it.
Other changes, due to cleanups
1) Changes on behaviours to disable the secure decoder. This is currently partially documented on wiki, anyway the change is backward compatible:
Old behaviour: only the Try avoiding the use of secure decoder ISA setting can allow to disable secure decoder, but its applied globally (to all addons), and so each single addon that require decoder must find a way to disable this setting, there are 3 ways:
1] set inputstream.adaptive.license_flags with force_secure_decoder flag
2] if dash, can use a proxy to add a custom ContentProtection tag (hard to do)
3] "brute force" to modify ISA addon setting
New behaviour: You can use Try avoiding the use of secure decoder ISA setting to disable secure decoder, its always applied globally, but now each addon can use following ways to override ISA setting (enable or disable as they wish):
1] with inputstream.adaptive.drm property set to "license" dict, the following item:
"secure_decoder_disabled" : [bool] set to True/False the bool value to enable or disable secure decoder
2] for DASH manifest the custom ISA ContentProtection tag:
<widevine:license robustness_level="[value]">
[value] can be: HW_SECURE_CODECS_REQUIRED to enable secure decoder (existing behaviour)
[value] can be: HW_SECURE_CODECS_NOT_ALLOWED to disable secure decoder (new)
3] set inputstream.adaptive.license_flags with force_secure_decoder flag (deprecated, and only to enable it)
4] "brute force" to modify ISA addon setting
Motivation and context
This is a first partial implementation of #1415 that concern only the new DRM config, and not the drm auto-selection
this step is a first transition to adapt the existing code to the new drm config, because there is too much source code that need to be changed, more likely part of the code implemented here could also be revisited more times with future PR's
How has this been tested?
partially tested
Screenshots (if appropriate):
Types of change
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] Clean up (non-breaking change which removes non-working, unmaintained functionality)
- [ ] Improvement (non-breaking change which improves existing functionality)
- [x] New feature (non-breaking change which adds functionality)
- [x] Breaking change (fix or feature that will cause existing functionality to change)
- [ ] Cosmetic change (non-breaking change that doesn't touch code)
- [ ] None of the above (please explain below)
Checklist:
- [ ] I have read the Contributing document
- [ ] My code follows the Code Guidelines of this project
- [ ] My change requires a change to the Wiki documentation
- [ ] I have updated the documentation accordingly