PSSH: Add dump and dumps methods
This commit is contained in:
parent
76c7a402eb
commit
2a87d55e20
|
@ -213,6 +213,21 @@ class PSSH:
|
|||
|
||||
return cls(box)
|
||||
|
||||
def dump(self) -> bytes:
|
||||
"""Export the PSSH object as a full PSSH box in bytes form."""
|
||||
return Box.build(dict(
|
||||
type=b"pssh",
|
||||
version=self.version,
|
||||
flags=self.flags,
|
||||
system_ID=self.system_id,
|
||||
key_IDs=self.key_ids,
|
||||
init_data=self.init_data
|
||||
))
|
||||
|
||||
def dumps(self) -> str:
|
||||
"""Export the PSSH object as a full PSSH box in base64 form."""
|
||||
return base64.b64encode(self.dump()).decode()
|
||||
|
||||
@staticmethod
|
||||
def get_key_ids(box: Container) -> list[UUID]:
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue