mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-02 05:55:08 +00:00
fix(hls): bridge a stitched one-key FairPlay playlist with an all-zero tenc KID
This commit is contained in:
@@ -20,7 +20,7 @@ from unshackle.core.config import config
|
||||
from unshackle.core.constants import AnyTrack
|
||||
from unshackle.core.drm import key_args as drm_key_args
|
||||
from unshackle.core.drm.decrypters import decrypt_cenc, mp4decrypt, shaka_decrypt
|
||||
from unshackle.core.drm.verify import PIFF_TENC
|
||||
from unshackle.core.drm.verify import PIFF_TENC, TENC, has_encrypted_entry, walk
|
||||
from unshackle.core.session import AnySession, utf8_text
|
||||
from unshackle.core.utilities import get_boxes
|
||||
from unshackle.core.utils import run_proxy
|
||||
@@ -121,6 +121,12 @@ def init_pssh_kid(init_data: bytes) -> UUID | None:
|
||||
return kids.pop() if len(kids) == 1 else None
|
||||
|
||||
|
||||
def is_clear_init(init_data: bytes) -> bool:
|
||||
"""True when a complete init segment names no encrypted sample entry and no tenc."""
|
||||
complete = any(kind == b"stsd" for kind, _, _ in walk(init_data))
|
||||
return complete and not has_encrypted_entry(init_data) and not any(tenc in init_data for tenc in TENC)
|
||||
|
||||
|
||||
def hls_key_drm(key: Any, kid: UUID | None = None) -> Widevine | PlayReady | None:
|
||||
"""The Widevine or PlayReady DRM of an EXT-X-KEY, or None for another KEYFORMAT.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user