forked from kenzuya/unshackle
feat(drm): bridge a FairPlay-only HLS track only for a service with get_fairplay_bridge_license
This commit is contained in:
@@ -403,6 +403,8 @@ class DownloadContext:
|
||||
"""Called by the HLS step with a track and its wanted media segments, before they download."""
|
||||
sample_decrypter: Callable[[int], bytes | SampleDecrypter] | None = None
|
||||
"""The service's key or `cbcs.SampleDecrypter` for a 1-based `stsd` entry, for a track it decrypts itself."""
|
||||
fairplay_bridge: bool = False
|
||||
"""The service has a FairPlay bridge hook, so the HLS step may license a FairPlay-only track as PlayReady or Widevine."""
|
||||
|
||||
def ensure_session(self) -> AnySession:
|
||||
"""Return the HTTP session, or a new ``Session`` if none was set."""
|
||||
@@ -732,12 +734,13 @@ class Track:
|
||||
download_processes: int = 1,
|
||||
on_segments: Callable[["Track", list[Any]], None] | None = None,
|
||||
sample_decrypter: Callable[[int], bytes | SampleDecrypter] | None = None,
|
||||
fairplay_bridge: bool = False,
|
||||
) -> None:
|
||||
"""Download and optionally Decrypt this Track, then emit TRACK_DOWNLOADED.
|
||||
|
||||
For a URL-descriptor Video or Audio track with no `drm` set, unshackle probes the DRM from the
|
||||
track's init data and stores it on the track, so a service need not declare `drm` itself.
|
||||
`sample_decrypter` decrypts a track the service decrypts itself (see DownloadContext).
|
||||
`sample_decrypter` and `fairplay_bridge` go on the DownloadContext.
|
||||
"""
|
||||
from unshackle.core.manifests import DASH, HLS, ISM, url
|
||||
from unshackle.core.manifests.segment_pipeline import licensing
|
||||
@@ -814,6 +817,7 @@ class Track:
|
||||
cdm=cdm,
|
||||
on_segments=on_segments,
|
||||
sample_decrypter=sample_decrypter,
|
||||
fairplay_bridge=fairplay_bridge,
|
||||
)
|
||||
if self.descriptor in manifest_parsers:
|
||||
manifest_parsers[self.descriptor].download_track(track=self, ctx=ctx)
|
||||
|
||||
Reference in New Issue
Block a user