in src/key_server_common.py [0:0]
def fixup_document(self, drm_system, system_id, content_id, kid):
"""
Update the returned XML document based on the specified system ID
"""
# DRMSystem for WIDEVINE_SYSTEM_ID
if system_id.lower() == DASH_CENC_SYSTEM_ID.lower():
pssh_box = drm_system.find("{urn:dashif:org:cpix}PSSH")
if pssh_box is not None:
pssh_box.text = WIDEVINE_PSSH_BOX
content_protection_data = drm_system.find("{urn:dashif:org:cpix}ContentProtectionData")
if content_protection_data is not None:
content_protection_data.text = WIDEVINE_CONTENT_PROTECTION_DATA
hls_signalling_data_elems = drm_system.findall("{urn:dashif:org:cpix}HLSSignalingData")
if hls_signalling_data_elems:
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='media']").text = WIDEVINE_HLS_SIGNALING_DATA_MEDIA
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='master']").text = WIDEVINE_HLS_SIGNALING_DATA_MASTER
# DRMSystem for PLAYREADY_SYSTEM_ID
elif system_id.lower() == PLAYREADY_SYSTEM_ID.lower():
pssh_box = drm_system.find("{urn:dashif:org:cpix}PSSH")
if pssh_box is not None:
pssh_box.text = PLAYREADY_PSSH_BOX
content_protection_data = drm_system.find("{urn:dashif:org:cpix}ContentProtectionData")
if content_protection_data is not None:
content_protection_data.text = PLAYREADY_CONTENT_PROTECTION_DATA
hls_signalling_data_elems = drm_system.findall("{urn:dashif:org:cpix}HLSSignalingData")
if hls_signalling_data_elems:
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='media']").text = PLAYREADY_HLS_SIGNALING_DATA_MEDIA
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='master']").text = PLAYREADY_HLS_SIGNALING_DATA_MASTER
self.safe_remove(drm_system, "{urn:dashif:org:cpix}SmoothStreamingProtectionHeaderData")
self.use_playready_content_key = True
# DRMSystem for FAIRPLAY_SYSTEM_ID
elif system_id.lower() == HLS_SAMPLE_AES_SYSTEM_ID.lower():
self.safe_remove(drm_system, "{urn:dashif:org:cpix}ContentProtectionData")
self.safe_remove(drm_system, "{urn:dashif:org:cpix}PSSH")
self.safe_remove(drm_system, "{urn:dashif:org:cpix}SmoothStreamingProtectionHeaderData")
hls_signalling_data_elems = drm_system.findall("{urn:dashif:org:cpix}HLSSignalingData")
if hls_signalling_data_elems:
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='media']").text = FAIRPLAY_HLS_SIGNALING_DATA_MEDIA
drm_system.find("{urn:dashif:org:cpix}HLSSignalingData[@playlist='master']").text = FAIRPLAY_HLS_SIGNALING_DATA_MASTER
else:
raise Exception("Invalid system ID {}".format(system_id))