forked from kenzuya/unshackle
fix(dash): license a track whose only key system is the W3C common PSSH as ClearKey
This commit is contained in:
@@ -7,9 +7,11 @@ from collections import Counter
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from unittest.mock import MagicMock
|
||||
from uuid import UUID
|
||||
|
||||
import pytest
|
||||
|
||||
from unshackle.core.drm import ClearKeyCENC
|
||||
from unshackle.core.manifests import DASH, HLS, ISM
|
||||
from unshackle.core.tracks import Audio, Tracks, Video
|
||||
from unshackle.core.utils.xml import load_xml
|
||||
@@ -104,3 +106,18 @@ def test_dash_segments_and_drm_resolve_offline(entry: dict[str, Any]) -> None:
|
||||
continue
|
||||
assert segments, track
|
||||
assert all(url.startswith(("http://", "https://")) for url, _ in segments), track
|
||||
|
||||
|
||||
def test_common_pssh_manifest_gives_each_track_its_clearkey() -> None:
|
||||
"""A manifest whose only key system is the W3C common PSSH gives each audio and video track its ClearKey KID."""
|
||||
entry = next(e for e in INDEX if e["file"].endswith("clearkey-server-1061a743.mpd"))
|
||||
tracks = parse(entry)
|
||||
for track in [*tracks.videos, *tracks.audio]:
|
||||
dash = track.data["dash"]
|
||||
protections = dash["representation"].findall("ContentProtection") + dash["adaptation_set"].findall(
|
||||
"ContentProtection"
|
||||
)
|
||||
assert DASH.get_drm(protections) == []
|
||||
clearkey = DASH.get_common_clearkey(protections)
|
||||
assert isinstance(clearkey, ClearKeyCENC)
|
||||
assert clearkey.kids == [UUID("feedf00d-eede-adbe-eff0-baadf00dd00d")]
|
||||
|
||||
Reference in New Issue
Block a user