feat(hdr): find HDR Vivid and HDR10+ SEI in MPEG-TS and VVC tracks, read local HLS playlists and accept a 200 probe body

This commit is contained in:
imSp4rky
2026-12-02 09:43:50 -07:00
parent c7a3febf88
commit ccdd14c845
6 changed files with 307 additions and 76 deletions
+1 -11
View File
@@ -5,22 +5,12 @@ from typing import Any
from pymediainfo import MediaInfo
from tests.core.test_hdr10plus_probe import ts
from tests.core.test_hdr10plus_probe import media_packet, ts
from unshackle.commands.dl import take_unmuxable_audio
from unshackle.core.placement import no_mux_extension, track_file_suffix
from unshackle.core.tracks import Audio, Tracks, Video
def media_packet(pid: int, payload: bytes, start: bool) -> bytes:
"""One TS packet carrying ``payload``, padded with adaptation-field stuffing as packagers do."""
stuffing = 184 - len(payload)
flags = 0x40 if start else 0x00
if stuffing:
field = bytes([stuffing - 1]) + (b"\x00" + b"\xff" * (stuffing - 2) if stuffing > 1 else b"")
return bytes([0x47, flags | pid >> 8, pid & 0xFF, 0x30]) + field + payload
return bytes([0x47, flags | pid >> 8, pid & 0xFF, 0x10]) + payload
def audio_vivid_ts(frames: list[bytes]) -> bytes:
"""A PAT, a PMT with one Audio Vivid stream on PID 0x100, and one PES per frame."""
data = ts((0xD5, b""))