Deployed 7a5bac78 with MkDocs version: 1.6.1

This commit is contained in:
2026-12-02 02:20:28 +00:00
parent eaaad30b12
commit 5d4ac1c97a
9 changed files with 71 additions and 52 deletions
+1 -1
View File
@@ -3070,7 +3070,7 @@ current <code>title</code> and <code>track</code>:</p>
</tr>
</tbody>
</table>
<p>A license callback can also declare optional keyword arguments. <code>get_widevine_license</code> can ask for <code>pssh</code> and <code>session_id</code>. <code>get_playready_license</code> can ask for <code>pssh_b64</code> and <code>session_id</code>. <code>session_id</code> is the open CDM session. A callback gets only the arguments that its signature declares.</p>
<p>A license callback can also declare optional keyword arguments. <code>get_widevine_license</code> can ask for <code>pssh</code> and <code>session_id</code>. <code>get_playready_license</code> can ask for <code>pssh_b64</code> and <code>session_id</code>. <code>session_id</code> is the open CDM session. A callback gets only the arguments that its signature declares. When a <code>--remote</code> client licenses with its own CDM, the callback on the server gets <code>pssh</code> or <code>pssh_b64</code> for the header the client licenses, but no <code>session_id</code>.</p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-21-1"><a id="__codelineno-21-1" name="__codelineno-21-1" href="#__codelineno-21-1"></a><span class="k">def</span><span class="w"> </span><span class="nf">get_widevine_license</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">challenge</span><span class="p">:</span> <span class="nb">bytes</span><span class="p">,</span> <span class="n">title</span><span class="p">,</span> <span class="n">track</span><span class="p">):</span>
</span><span id="__span-21-2"><a id="__codelineno-21-2" name="__codelineno-21-2" href="#__codelineno-21-2"></a> <span class="n">response</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">post</span><span class="p">(</span>
</span><span id="__span-21-3"><a id="__codelineno-21-3" name="__codelineno-21-3" href="#__codelineno-21-3"></a> <span class="bp">self</span><span class="o">.</span><span class="n">license_data</span><span class="p">[</span><span class="s2">"url"</span><span class="p">],</span>
+1 -1
View File
@@ -5452,7 +5452,7 @@ A slow answer arrives as a <a href="#slow-responses">slow response</a>.</p>
</tr>
<tr>
<td><code>pssh</code></td>
<td>Base64 PSSH (server-CDM mode).</td>
<td>Base64 PSSH. Server-CDM mode licenses this PSSH. Proxy mode gives it to the service licence callback as <code>pssh</code> (Widevine) or <code>pssh_b64</code> (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.</td>
</tr>
<tr>
<td><code>drm_type</code></td>
+21 -7
View File
@@ -3140,8 +3140,9 @@ least one and no track is left.</p>
<h3 id="segment-filtering-hooks">Segment-filtering hooks<a class="headerlink" href="#segment-filtering-hooks" title="Permanent link">&para;</a></h3>
<ul>
<li><strong>HLS</strong>: set <code>track.OnSegmentFilter(segment)</code> to drop unwanted segments (ads/bumpers).
An <code>EXT-X-KEY</code> applies to each later segment until the next <code>EXT-X-KEY</code>, also when the
filter or <code>--sample</code> drops the segment that carries it. unshackle ignores an <code>EXT-X-KEY</code> that
An <code>EXT-X-KEY</code> applies to each later segment until the next <code>EXT-X-KEY</code> with the same
<code>KEYFORMAT</code>, or with another <code>METHOD</code>, also when the filter or <code>--sample</code> drops the segment
that carries it. <code>METHOD=NONE</code> ends every <code>EXT-X-KEY</code>. unshackle ignores an <code>EXT-X-KEY</code> that
applies to dropped segments only: no licence, no request and no new decryption. It also
ignores the <code>EXT-X-DISCONTINUITY</code> of a dropped segment. A dropped ad break thus does not
disturb decryption when the playlist repeats the <code>EXT-X-KEY</code> of the title after the break.
@@ -3289,21 +3290,33 @@ these conditions are true:</p>
<ul>
<li>The track has no DRM object.</li>
<li>Every <code>EXT-X-KEY</code> of its media playlist is <code>SAMPLE-AES</code> or <code>SAMPLE-AES-CTR</code> for a DRM system
unshackle cannot license.</li>
unshackle cannot license, or <code>METHOD=NONE</code>. A segment under <code>METHOD=NONE</code> must have an init segment
that no encrypted segment uses: a decrypter that reads the encrypted init segment decrypts the clear
samples too. A tag with <code>KEYFORMAT="identity"</code>, or with no <code>KEYFORMAT</code>, names no DRM system: each
encrypted segment also needs a tag of a DRM system.</li>
<li>The configured CDM is a PlayReady or Widevine CDM.</li>
<li>The init segment (<code>EXT-X-MAP</code>) of the track names a key ID in its <code>tenc</code> box. When the <code>tenc</code> key ID is all
zeros, its <code>pssh</code> boxes must name exactly one key ID, and the encrypted segments must have one init
segment and the playlist one key URI. MPEG-TS media has no init segment.</li>
zeros, the playlist must have one key URI, and each init segment under the key tag must give the same
key ID: its <code>tenc</code> key ID, or else the one key ID that its <code>pssh</code> boxes name. A clear init segment,
such as the one of a clear lead or tail, does not count. MPEG-TS media has no init segment.</li>
<li>The init segment does not change without an <code>EXT-X-DISCONTINUITY</code>.</li>
</ul>
<p>The download reads the key ID from the init segment, builds a DRM object for the DRM system of the
CDM with <code>drm_stub</code>, and sends the challenge to the licence callback of the service. Over <code>--remote</code>
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.</p>
<p>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 <code>tenc</code> key ID, after an
<code>EXT-X-DISCONTINUITY</code>. When the first key ID is real, the download also reads the <code>tenc</code> 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 <code>drm_stub</code> 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.</p>
<p>A service that must choose the DRM system itself, or one that knows the key ID, puts the DRM object
on the track:</p>
<ol>
<li>Read the key ID from the init segment of the track. <code>HLS.get_track_kid_from_init</code> returns it.</li>
<li>Read the key ID from the init segment of the track. <code>HLS.get_track_kid_from_init</code> returns it. It reads
the first init segment of the playlist, unless you give it the init segment of the encrypted segments.</li>
<li>Put a DRM object that names the key ID on the track: <code>drm_stub</code> from <code>unshackle.core.drm.cenc</code>
with <code>"playready"</code> or <code>"widevine"</code> and the key ID. When only one of the two systems issues the
content key, also set <code>track.drm_preference</code> to it.</li>
@@ -3313,7 +3326,8 @@ on the track:</p>
by the key ID, not with one that checks a header a packager signed. A platform can issue the
content key of one package of a title and refuse another. When a track carries a Widevine or PlayReady DRM
object and every <code>EXT-X-KEY</code> of its playlist is <code>SAMPLE-AES</code> or <code>SAMPLE-AES-CTR</code> for a key system
unshackle cannot license, <code>HLS.drop_unsupported_keys</code> removes the tags from the parsed playlist.
unshackle cannot license, or <code>METHOD=NONE</code> under the same condition, <code>HLS.drop_unsupported_keys</code> removes the
tags from the parsed playlist.
The download then licenses and decrypts the track with the DRM object of the track. This works for
one content key per track: the key changes of the playlist go with the tags. This limit also
applies to a DRM object that the download builds. Any other track stops with