Skip tenc boxes that are not version 0 or 1

It seems tenc boxes should only be 0 or 1, yet sometimes it can be above that. It seems some services accidentally use the `tenc` atom code over another. E.g., Netflix sometimes using `tenc` instead of `avc1`.
This commit is contained in:
rlaphoenix 2023-03-28 21:27:43 +01:00
parent eb39c8eba6
commit 62965f8e21
1 changed files with 2 additions and 2 deletions

View File

@ -121,14 +121,14 @@ class Track:
# look for track encryption mp4 boxes
for tenc in get_boxes(init_data, b"tenc"):
if tenc.key_ID.int != 0:
if tenc.version <= 1 and tenc.key_ID.int != 0:
return tenc.key_ID
# look for UUID mp4 boxes holding track encryption mp4 boxes
for uuid_box in get_boxes(init_data, b"uuid"):
if uuid_box.extended_type == UUID("8974dbce-7be7-4c51-84f9-7148f9882554"):
tenc = uuid_box.data
if tenc.key_ID.int != 0:
if tenc.version <= 1 and tenc.key_ID.int != 0:
return tenc.key_ID
def get_init_segment(