PSSH: Simplify the PSSH Data conversion function names
This commit is contained in:
parent
c9f55c6e6b
commit
ddc66f0a2b
|
@ -303,7 +303,7 @@ class PSSH:
|
||||||
"""Export the PSSH object as a full PSSH box in base64 form."""
|
"""Export the PSSH object as a full PSSH box in base64 form."""
|
||||||
return base64.b64encode(self.dump()).decode()
|
return base64.b64encode(self.dump()).decode()
|
||||||
|
|
||||||
def playready_to_widevine(self) -> None:
|
def to_widevine(self) -> None:
|
||||||
"""
|
"""
|
||||||
Convert PlayReady PSSH data to Widevine PSSH data.
|
Convert PlayReady PSSH data to Widevine PSSH data.
|
||||||
|
|
||||||
|
@ -311,8 +311,8 @@ class PSSH:
|
||||||
can be used in a Widevine PSSH Header. The converted data may or may not result
|
can be used in a Widevine PSSH Header. The converted data may or may not result
|
||||||
in an accepted PSSH. It depends on what the License Server is expecting.
|
in an accepted PSSH. It depends on what the License Server is expecting.
|
||||||
"""
|
"""
|
||||||
if self.system_id != PSSH.SystemId.PlayReady:
|
if self.system_id == PSSH.SystemId.Widevine:
|
||||||
raise ValueError(f"This is not a PlayReady PSSH, {self.system_id}")
|
raise ValueError("This is already a Widevine PSSH")
|
||||||
|
|
||||||
cenc_header = WidevinePsshData()
|
cenc_header = WidevinePsshData()
|
||||||
cenc_header.algorithm = 1 # 0=Clear, 1=AES-CTR
|
cenc_header.algorithm = 1 # 0=Clear, 1=AES-CTR
|
||||||
|
@ -326,7 +326,7 @@ class PSSH:
|
||||||
self.init_data = cenc_header.SerializeToString()
|
self.init_data = cenc_header.SerializeToString()
|
||||||
self.system_id = PSSH.SystemId.Widevine
|
self.system_id = PSSH.SystemId.Widevine
|
||||||
|
|
||||||
def widevine_to_playready(
|
def to_playready(
|
||||||
self,
|
self,
|
||||||
la_url: Optional[str] = None,
|
la_url: Optional[str] = None,
|
||||||
lui_url: Optional[str] = None,
|
lui_url: Optional[str] = None,
|
||||||
|
@ -358,8 +358,8 @@ class PSSH:
|
||||||
element. Microsoft code does not act on any data contained inside
|
element. Microsoft code does not act on any data contained inside
|
||||||
this element. The Syntax of this params XML is not validated.
|
this element. The Syntax of this params XML is not validated.
|
||||||
"""
|
"""
|
||||||
if self.system_id != PSSH.SystemId.Widevine:
|
if self.system_id == PSSH.SystemId.PlayReady:
|
||||||
raise ValueError(f"This is not a Widevine PSSH, {self.system_id}")
|
raise ValueError("This is already a PlayReady PSSH")
|
||||||
|
|
||||||
key_ids_xml = ""
|
key_ids_xml = ""
|
||||||
for key_id in self.key_ids:
|
for key_id in self.key_ids:
|
||||||
|
|
Loading…
Reference in New Issue