feat(tracks): add Video.hdr10_base and forward s_lang over remote and REST

A DV track with an HDR10 base (profile 8.1) lists as DV+HDR10; dl_params now carry s_lang.
This commit is contained in:
imSp4rky
2026-10-27 13:06:48 -06:00
parent 0440f2ba54
commit 9017ab95b7
12 changed files with 54 additions and 13 deletions
+1
View File
@@ -511,6 +511,7 @@ def perform_download(
"lang": params.get("lang", ["orig"]),
"v_lang": params.get("v_lang", []),
"a_lang": params.get("a_lang", []),
"s_lang": params.get("s_lang", ["all"]),
"forced_subs": params.get("forced_subs", False),
"exact_lang": params.get("exact_lang", False),
# dl skips the local service config and guards the proxy for a remote_services server
+2 -1
View File
@@ -1752,6 +1752,7 @@ def serialize_video_track(track: Video, include_url: bool = False) -> Dict[str,
"closed_captions": list(getattr(track, "closed_captions", None) or []),
"dv_compatible_bitstream": bool(getattr(track, "dv_compatible_bitstream", False)),
"hdr10plus": bool(getattr(track, "hdr10plus", False)),
"hdr10_base": bool(getattr(track, "hdr10_base", False)),
}
result.update(serialize_track_common(track))
if include_url and hasattr(track, "url") and track.url:
@@ -3653,7 +3654,7 @@ def forwarded_dl_params(data: Dict[str, Any]) -> Dict[str, Any]:
return None
params: Dict[str, Any] = {}
for key in ("lang", "v_lang", "a_lang"):
for key in ("lang", "v_lang", "a_lang", "s_lang"):
langs = str_list(key)
params[key] = langs if langs is not None else list(cast(List[str], DEFAULT_DOWNLOAD_PARAMS[key]))
# the dl CLI default is [], and some services test membership in it
+6 -1
View File
@@ -795,7 +795,7 @@ async def list_tracks(request: web.Request) -> web.Response:
dl_params:
type: object
description: |
The dl track selection (lang, v_lang, a_lang, acodec, forced_subs, exact_lang), in the same
The dl track selection (lang, v_lang, a_lang, s_lang, acodec, forced_subs, exact_lang), in the same
form as on `/api/session/create`. The service reads it from `ctx.parent.params`.
credentials:
type: object
@@ -1916,6 +1916,11 @@ async def session_create(request: web.Request) -> web.Response:
items:
type: string
default: []
s_lang:
type: array
items:
type: string
default: ["all"]
forced_subs:
type: boolean
default: false
+2 -1
View File
@@ -287,6 +287,7 @@ def deserialize_video(data: Dict[str, Any]) -> Video:
closed_captions=data.get("closed_captions") or None,
dv_compatible_bitstream=bool(data.get("dv_compatible_bitstream", False)),
hdr10plus=bool(data.get("hdr10plus", False)),
hdr10_base=bool(data.get("hdr10_base", False)),
)
@@ -1329,7 +1330,7 @@ class RemoteService:
params = self.ctx.parent.params
dl_params: dict[str, Any] = {
key: [str(x) for x in params[key]]
for key in ("lang", "v_lang", "a_lang")
for key in ("lang", "v_lang", "a_lang", "s_lang")
if params.get(key) is not None
}
if params.get("acodec") is not None:
+7 -2
View File
@@ -237,6 +237,7 @@ class Video(Track):
closed_captions: Optional[list[dict[str, Any]]] = None,
dv_compatible_bitstream: bool = False,
hdr10plus: bool = False,
hdr10_base: bool = False,
**kwargs: Any,
) -> None:
"""
@@ -256,6 +257,7 @@ class Video(Track):
Strings may represent numbers, floats, or a fraction (num/den).
All strings will be cast to either a number or float.
hdr10plus: The DV track also carries HDR10+ metadata. The HDR10+ probe sets it.
hdr10_base: The DV track has an HDR10 base layer, as DV profile 8.1 does.
Note: If codec, bitrate, width, height, or fps is not specified, unshackle can
skip some checks or assume a value. Give as much information as possible.
@@ -305,6 +307,7 @@ class Video(Track):
self.needs_duration_fix = False
self.dv_compatible_bitstream = dv_compatible_bitstream
self.hdr10plus = hdr10plus
self.hdr10_base = hdr10_base
self.hybrid_base_only = False
self.native_hybrid = False
@@ -321,6 +324,7 @@ class Video(Track):
"scan_type": self.scan_type.name if self.scan_type else None,
"dv_compatible_bitstream": self.dv_compatible_bitstream,
"hdr10plus": self.hdr10plus,
"hdr10_base": self.hdr10_base,
}
)
return data
@@ -339,6 +343,7 @@ class Video(Track):
scan_type=Video.ScanType[data["scan_type"]] if data.get("scan_type") else None,
dv_compatible_bitstream=data.get("dv_compatible_bitstream", False),
hdr10plus=data.get("hdr10plus", False),
hdr10_base=data.get("hdr10_base", False),
)
@staticmethod
@@ -377,8 +382,8 @@ class Video(Track):
@property
def range_label(self) -> str:
"""The range that ``-r`` selects the track by, then any second format it carries: HDR10+DV, DV+HDR10P."""
label = self.range.name + ("+HDR10P" if self.hdr10plus else "")
"""The range that ``-r`` selects the track by, then any second format it carries: HDR10+DV, DV+HDR10, DV+HDR10P."""
label = self.range.name + ("+HDR10P" if self.hdr10plus else "+HDR10" if self.hdr10_base else "")
return f"{label}+DV" if self.dv_compatible_bitstream and self.range != Video.Range.DV else label
def __str__(self) -> str: