Store DRM in the track.drm property in HLS and DASH

This commit is contained in:
rlaphoenix 2023-03-04 11:49:53 +00:00
parent f8166f098c
commit 318832e6b2
2 changed files with 3 additions and 1 deletions

View File

@ -302,6 +302,7 @@ class DASH:
adaptation_set.findall("ContentProtection")
)
if drm:
track.drm = drm
drm = drm[0] # just use the first supported DRM system for now
if isinstance(drm, Widevine):
# license and grab content keys
@ -336,7 +337,6 @@ class DASH:
# Players would normally calculate segments via Byte-Ranges, but we don't care
track.url = urljoin(period_base_url, base_url)
track.descriptor = track.Descriptor.URL
track.drm = [drm] if drm else []
else:
segments: list[tuple[str, Optional[str]]] = []
@ -442,6 +442,7 @@ class DASH:
# it might not have Widevine DRM, or might not have found the PSSH
log.warning("No Widevine PSSH was found for this track, is it DRM free?")
else:
track.drm = [drm]
# license and grab content keys
if not license_widevine:
raise ValueError("license_widevine func must be supplied to use Widevine DRM")

View File

@ -242,6 +242,7 @@ class HLS:
sys.exit(1)
else:
if drm:
track.drm = drm
drm = drm[0] # just use the first supported DRM system for now
log.debug("Got segment key, %s", drm)
if isinstance(drm, Widevine):