mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-02 05:55:08 +00:00
feat(hls): license every content key of a FairPlay bridge playlist that rotates its key
This commit is contained in:
@@ -637,7 +637,7 @@ current `title` and `track`:
|
||||
| `get_playready_license` | PlayReady | The license response. Defaults to delegating to `get_widevine_license`. |
|
||||
| `get_clearkey_license` | DASH `org.w3.clearkey` | The JWK Set (dict/JSON/bytes), or `None` to let the framework POST the challenge to the manifest's Laurl. |
|
||||
|
||||
A license callback can also declare optional keyword arguments. `get_widevine_license` can ask for `pssh` and `session_id`. `get_playready_license` can ask for `pssh_b64` and `session_id`. `session_id` is the open CDM session. A callback gets only the arguments that its signature declares.
|
||||
A license callback can also declare optional keyword arguments. `get_widevine_license` can ask for `pssh` and `session_id`. `get_playready_license` can ask for `pssh_b64` and `session_id`. `session_id` is the open CDM session. A callback gets only the arguments that its signature declares. When a `--remote` client licenses with its own CDM, the callback on the server gets `pssh` or `pssh_b64` for the header the client licenses, but no `session_id`.
|
||||
|
||||
```python
|
||||
def get_widevine_license(self, *, challenge: bytes, title, track):
|
||||
|
||||
@@ -1246,7 +1246,7 @@ A slow answer arrives as a [slow response](#slow-responses).
|
||||
| --- | --- |
|
||||
| `track_id` / `track_ids` | Single track, or a batch of tracks. |
|
||||
| `challenge` | Base64 CDM challenge (proxy mode). |
|
||||
| `pssh` | Base64 PSSH (server-CDM mode). |
|
||||
| `pssh` | Base64 PSSH. Server-CDM mode licenses this PSSH. Proxy mode gives it to the service licence callback as `pssh` (Widevine) or `pssh_b64` (PlayReady), the PSSH of the header the challenge is for. A proxy-mode PSSH that names a KID the track does not carry goes to no callback. |
|
||||
| `drm_type` | `widevine` (default) or `playready`. In server-CDM mode the server's `cdm` mapping for the service decides the DRM system and the response `drm_type` names the system that licensed. A mapping with a device for each system takes the system of the device the remote session loaded. With no mapping, the client's value decides when the track carries that system; else a system the track carries decides, PlayReady first. The tracks response `server_cdm_type` names the system the same order gives for the title's tracks. A track whose DRM is a whole-file cipher takes `clearkeyctr` with no `pssh`: the service on the server licenses it. |
|
||||
| `mode` | `proxy` (default) or `server_cdm`. |
|
||||
| `clear_tracks` (response) | Requested track ids that carry no DRM, so they have no keys. Absent when every requested track is encrypted. |
|
||||
|
||||
@@ -499,6 +499,14 @@ CDM with `drm_stub`, and sends the challenge to the licence callback of the serv
|
||||
the server reads the same key ID at the licence step, so it accepts the DRM object of the client. A
|
||||
licence that gives no content key stops the track before it downloads a segment.
|
||||
|
||||
unshackle reads one key ID from each init segment. So it licenses a playlist that changes its content key
|
||||
correctly only when each content key has its own init segment with a real `tenc` key ID, after an
|
||||
`EXT-X-DISCONTINUITY`. When the first key ID is real, the download also reads the `tenc` key ID of
|
||||
each other init segment of the encrypted segments, and licenses each real key ID in its own licence step. A
|
||||
PlayReady DRM object then has one header for each key ID, because the header of `drm_stub` holds
|
||||
one key ID. A key ID that gets no content key stops the track before it downloads a segment. An
|
||||
init segment that gives no real key ID does not count.
|
||||
|
||||
A service that must choose the DRM system itself, or one that knows the key ID, puts the DRM object
|
||||
on the track:
|
||||
|
||||
|
||||
@@ -80,7 +80,9 @@ appropriate one for each track.
|
||||
!!! note "HLS tracks with only a FairPlay key tag"
|
||||
unshackle has no FairPlay CDM. When each `EXT-X-KEY` of an fMP4 playlist is sample encryption
|
||||
for a DRM system that unshackle cannot license, such as FairPlay, unshackle reads the key ID from
|
||||
the init segment and asks for the licence with your PlayReady or Widevine device. This works
|
||||
the init segment and asks for the licence with your PlayReady or Widevine device. unshackle reads one
|
||||
key ID from each init segment. So it licenses a playlist that changes its content key correctly only
|
||||
when each content key has its own init segment with a real key ID, after an `EXT-X-DISCONTINUITY`. This works
|
||||
only when the licence server of the platform also issues that content key for that DRM system. MPEG-TS SAMPLE-AES stops with an error.
|
||||
Each key ID must name one content key: a playlist that encrypts two blocks with two content keys under
|
||||
one key ID gives wrong frames. A clear part under `METHOD=NONE` must have its own init segment, or the
|
||||
|
||||
Reference in New Issue
Block a user