PSSH: Remove from_key_ids, use new() instead

This commit is contained in:
rlaphoenix 2022-08-05 05:39:22 +01:00
parent 9d7eaf4949
commit 10fb954097
1 changed files with 0 additions and 20 deletions

View File

@ -214,26 +214,6 @@ class PSSH:
return cls(box) return cls(box)
@staticmethod @staticmethod
def from_key_ids(key_ids: list[UUID]) -> Container:
"""
Craft a new PSSH Box from just Key IDs.
This should only be used as a very last measure.
"""
cenc_header = WidevinePsshData()
for key_id in key_ids:
cenc_header.key_ids.append(key_id.bytes)
cenc_header.algorithm = 1 # 0=Clear, 1=AES-CTR
box = Box.parse(Box.build(dict(
type=b"pssh",
version=0,
flags=0,
system_ID=PSSH.SystemId.Widevine,
init_data=cenc_header.SerializeToString()
)))
return box
@staticmethod
def get_key_ids(box: Container) -> list[UUID]: def get_key_ids(box: Container) -> list[UUID]:
""" """
Get Key IDs from a PSSH Box from within the Box or Init Data where possible. Get Key IDs from a PSSH Box from within the Box or Init Data where possible.