refactor(drm): build PlayReady from base64 with PlayReady.from_pssh_b64 in server keys and the wire rebuild

This commit is contained in:
imSp4rky
2026-11-29 11:35:37 -07:00
parent 1cbaa2d307
commit 0ba9e6dfed
12 changed files with 182 additions and 55 deletions
@@ -9,7 +9,6 @@ import base64
from types import SimpleNamespace
from uuid import UUID
import pyplayready.system.pssh as pr_pssh_mod
import pytest
import unshackle.core.cdm as cdm_mod
@@ -24,11 +23,6 @@ KID_A = UUID("161219ec3df64e0eadbb3827c0ccc46d")
KID_B = UUID("43de497c6d1945f49acc2951696ec628")
class _FakePRPSSH:
def __init__(self, data):
self.data = data
class _FakePlayReady:
"""Only the headers this object knows about yield keys."""
@@ -38,6 +32,10 @@ class _FakePlayReady:
self.pssh_b64 = pssh_b64
self.absorbed: list = []
@classmethod
def from_pssh_b64(cls, pssh_b64, kid=None):
return cls(pssh_b64=pssh_b64, kid=kid)
def absorb(self, *others):
for other in others:
if other is self:
@@ -53,7 +51,6 @@ class _FakePlayReady:
@pytest.fixture
def playready_env(monkeypatch):
monkeypatch.setattr(pr_pssh_mod, "PSSH", _FakePRPSSH)
monkeypatch.setattr(drm_mod, "PlayReady", _FakePlayReady)
monkeypatch.setitem(cdm_mod.__dict__, "load_cdm", lambda *a, **k: object())
monkeypatch.setattr(detect_mod, "is_playready_cdm", lambda cdm: True)