feat(tracks): add Audio bit_depth and sample_rate from manifests and carry them over remote

This commit is contained in:
imSp4rky
2026-12-02 15:24:01 -07:00
parent 2c305c475f
commit 3b6bd02e46
14 changed files with 268 additions and 35 deletions
+5
View File
@@ -335,6 +335,10 @@ class HLS:
track_type: type[Audio] | type[Subtitle]
if media.type == "AUDIO":
track_type = Audio
# BIT-DEPTH and SAMPLE-RATE (RFC 8216bis), which the m3u8 library keeps in extras
resolution = {
k: int(v) for k in ("bit_depth", "sample_rate") if str(v := media.extras.get(k, "")).isdecimal()
}
codec: Any = HLS.select_audio_codec(audio_codecs_by_group_id.get(media.group_id), media.uri)
if media.channels:
# the channel count, then /-separated coding (JOC) and usage identifiers (RFC 8216bis)
@@ -376,6 +380,7 @@ class HLS:
channels=media.channels,
joc=joc,
descriptive="public.accessibility.describes-video" in (media.characteristics or ""),
**resolution,
)
if track_type is Audio
else dict(