sub/sd_sbr: pass track language to sbr_load_text#17273
Merged
kasper93 merged 1 commit intompv-player:masterfrom Jan 15, 2026
Merged
sub/sd_sbr: pass track language to sbr_load_text#17273kasper93 merged 1 commit intompv-player:masterfrom
sbr_load_text#17273kasper93 merged 1 commit intompv-player:masterfrom
Conversation
The language hint is required for *correct* handling of RTL in srv3 so provide the best-effort guess from the subtitle track. Without this hint some RTL paragraphs are going to be wrongly assumed LTR and reorder incorrectly. Additionally, subrandr may soon start treating srv3 segments as `inline-block`s which means guessing is not going to be possible anymore (at least as part of unicode bidi algorithm).
afishhh
commented
Jan 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The language hint is required for correct handling of RTL in srv3 so
provide the best-effort guess from the subtitle track.
Without this hint some RTL paragraphs are going to be wrongly assumed
LTR and reorder incorrectly. Additionally, subrandr may soon start
treating srv3 segments as
inline-blocks which means guessing is notgoing to be possible anymore (at least as part of unicode bidi algorithm).
This will alleviate the issue from #12978 when using srv3 subtitles (careful wording to not close that issue in case we still want to track it for other formats). I tested it with the example subtitle line provided in that issue (manually transplanted to srv3) and it seemed to work.
Currently does nothing. With afishhh/subrandr#139 it gets parsed as a
LanguageIdentifier(Unicode BCP47), canonicalized, and its directionality used for base paragraph direction (directionCSS property on root inline box of srv3 lines).Also: sometimes
yt-dlpattaches weird stuff likeen-sAO4vbAqVZooren-sAO4vbAqVZowhich will fail to even be detected as a language tag by mpv, not sure what to do about that (even if it did it would fail in subrandr, could probably special case in both but let's not complicate for now?).