fix(hls): apply each key tag to the wanted segments that it governs

This commit is contained in:
imSp4rky
2026-11-30 20:49:35 -07:00
parent b907069eb5
commit 33645b8c96
5 changed files with 553 additions and 55 deletions
+7 -3
View File
@@ -387,9 +387,13 @@ least one and no track is left.
### Segment-filtering hooks
- **HLS**: set `track.OnSegmentFilter(segment)` to drop unwanted segments (ads/bumpers).
A dropped segment is invisible to the whole download: unshackle ignores its `EXT-X-KEY`
and its `EXT-X-DISCONTINUITY`, so a clear ad break inside an encrypted track does
not disturb decryption.
An `EXT-X-KEY` applies to each later segment until the next `EXT-X-KEY`, also when the
filter or `--sample` drops the segment that carries it. unshackle ignores an `EXT-X-KEY` that
applies to dropped segments only: no licence, no request and no new decryption. It also
ignores the `EXT-X-DISCONTINUITY` of a dropped segment. A dropped ad break thus does not
disturb decryption when the playlist repeats the `EXT-X-KEY` of the title after the break.
Without the repeat, the segments after the break take the `EXT-X-KEY` of the ads, and
`METHOD=NONE` there makes them clear.
- **DASH**: pass a `period_filter` callable to `to_tracks` to drop whole periods.
unshackle automatically drops the caching-breadth periods that some services send, and the non-`content` segment types.