Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DRM][ClearKey] Add license url by DRM config, CK as DRM replacement #1638

Merged
merged 12 commits into from
Aug 19, 2024

Conversation

CastagnaIT
Copy link
Collaborator

@CastagnaIT CastagnaIT commented Aug 15, 2024

Description

  1. Add support to set license server url from property, example:
    #KODIPROP:inputstream.adaptive.drm_legacy=org.w3.clearkey|https://server/AcquireLicense

  2. Add support to pass http headers to license server request

  3. Tested DASH Widevine stream, used with ClearKey as DRM replacement, as requested on Support for clearkey #811 and [Feature request] Add support for fetching keys from Licence Server #1637.
    The only limitation is that the manifest must provide the ContentProtection with urn:mpeg:dash:mp4protection:2011 containing the default_KID

  4. Add support "ClearKey as DRM replacement" for HLS, but not tested since i havent found any stream

  5. Add code to prevent a mixed misuse of DRM properties

  6. Some code cleanups

Motivation and context

closes #1637
closes #811

How has this been tested?

Tested MPD widevine protected by using ClearKey license server url provided by DRM config property, the tested MPD does not provide the ClearKey ContentProtection tag, as follow:

        <ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="**7B7D**-565C-4**3-B**F-**C33**654**" xmlns:cenc="urn:mpeg:cenc:2013"/>
        <ContentProtection schemeIdUri="urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed">
          <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">redacted</cenc:pssh>
        </ContentProtection>
        <ContentProtection schemeIdUri="urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95" value="MSPR 2.0">
          <cenc:pssh xmlns:cenc="urn:mpeg:cenc:2013">redacted</cenc:pssh>
        </ContentProtection>

i cant publish here the test stream used

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)
  • New feature (non-breaking change which adds functionality)
  • 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

@CastagnaIT CastagnaIT added Backport: Needed Type: Improvement non-breaking change which improves existing functionality v22 Piers DRM: ClearKey Wiki: Needed labels Aug 15, 2024
@CastagnaIT CastagnaIT marked this pull request as ready for review August 16, 2024 13:56
@Uukrull
Copy link

Uukrull commented Aug 18, 2024

Description

  1. Tested DASH Widevine stream, used with ClearKey as DRM replacement, as requested on Support for clearkey #811 and [Feature request] Add support for fetching keys from Licence Server #1637.
    The only limitation is that the manifest must provide the ContentProtection with urn:mpeg:dash:mp4protection:2011 containing the default_KID

What about extracting the default_KID from the urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed PSSH if the default_KID doesn't exist?

@CastagnaIT
Copy link
Collaborator Author

Description

  1. Tested DASH Widevine stream, used with ClearKey as DRM replacement, as requested on Support for clearkey #811 and [Feature request] Add support for fetching keys from Licence Server #1637.
    The only limitation is that the manifest must provide the ContentProtection with urn:mpeg:dash:mp4protection:2011 containing the default_KID

What about extracting the default_KID from the urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed PSSH if the default_KID doesn't exist?

iirc dash specs say default_KID should be placed on urn:mpeg:dash:mp4protection:2011 scheme, if not exists it must be extracted from the mp4box, so services that place default_KID e.g. on urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed scheme, are not conform to dash standards

an improvement would be when not found extract it from the mp4box, but this is a change that i want left after the DRM config rework

to do what you propose currently its needed add a workaround that in theory can be avoided after the rework
so is the reason why i havent add it on the code changes, but i will try take a look

@CastagnaIT CastagnaIT added the Don't merge PR that should not be merged (yet) label Aug 18, 2024
@CastagnaIT CastagnaIT merged commit cfd3d66 into xbmc:Piers Aug 19, 2024
10 checks passed
@CastagnaIT CastagnaIT deleted the clearkey_improvs branch August 19, 2024 16:15
@moszkowski97

This comment was marked as off-topic.

@CastagnaIT
Copy link
Collaborator Author

@moszkowski97 your problems are because you are using wrong ISA properties and wrong url pipe "|" along the URL is not supported on ISA and not specified on Wiki, i suggest you for full read the Wiki integration page and recheck what you are doing,
if after this you still have problems, open a new Issue thread and dont report to the development PR's

@CastagnaIT
Copy link
Collaborator Author

@alannl thanks i have saved it, your comment deleted as requested, to avoid keep comment history
i will take a look on next days

@xbmc xbmc deleted a comment from alannl Aug 21, 2024
@basilgello
Copy link
Contributor

@CastagnaIT FYI, via actibity API all "deleted" comments (even from "deleted" accounts!) are visible just fine :)

@alannl
Copy link

alannl commented Aug 26, 2024

@CastagnaIT
Were you able to get the video link to play? It does work with IS, Widevine and proxy.
Clearkey with altered manifest tru proxy so that KID is detected, gives this error, if this check is ignored, maybe it will work with clearkey:
ClearKeyDecrypter::CreateSingleSampleDecrypter: Cannot initialize ClearKey DRM. Only "cenc" encryption supported.
Hope it's ok to address it in this thread

@CastagnaIT
Copy link
Collaborator Author

Hope it's ok to address it in this thread

no, dont use development PR's for discussions
i verified your video but is done with cbcs encryption, and so cannot be played
this encryption is not supported atm, maybe in future

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backport: Done DRM: ClearKey Type: Improvement non-breaking change which improves existing functionality v22 Piers Wiki: Done
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature request] Add support for fetching keys from Licence Server Support for clearkey
5 participants