summaryrefslogtreecommitdiffstats
path: root/player/loadfile.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-09-01 11:21:37 -0500
committerDudemanguy <random342@airmail.cc>2023-09-01 13:22:03 -0500
commiteca51d8e4593685638cd3384452cedfd1c1448c2 (patch)
treeed7961cf1445603ee0ff7a00774cb8e78f4356ea /player/loadfile.c
parentc9c917c5c3fa763e65683e686f7834a35cd25241 (diff)
downloadmpv-eca51d8e4593685638cd3384452cedfd1c1448c2.tar.bz2
mpv-eca51d8e4593685638cd3384452cedfd1c1448c2.tar.xz
loadfile: fix forced subtitles not respecting slang
fbe8f9919428a7ed24a61899bfd85bbb7680e389 made it possible for mpv to autoselect forced subtitles again (it was bugged and would ignore without slang being specified). Unfortunately, I forgot to take slang into account here, so it would always autoselect the subtitles if they are available. Fix this by checking both that it matches the lang and that the previous track pick wasn't already matched (os_langs being true is essentially equivalent to there not being any specified slang). This way, it still respects the order of languages in your slang list. Probably someone out there will be upset that forced subtitles aren't always preferred regardless of the order, but that can be another option for later I guess.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r--player/loadfile.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index b9c6786cdc..630ddfbf84 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -645,12 +645,17 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
if (!pick || compare_track(track, pick, langs, os_langs, mpctx->opts, preferred_program))
pick = track;
- // We only try to autoselect forced tracks if they match the audio language and are subs or
- // if the user always wants forced sub tracks
+ // Autoselecting forced sub tracks requires the following:
+ // 1. Matches the audio language or --subs-fallback-forced=always.
+ // 2. Matches the users list of preferred languages or none were specified (i.e. slang was not set).
+ // 3. A track *wasn't* already selected by slang previously.
if (fallback_forced && track->forced_track &&
+ (os_langs || (match_lang(langs, track->lang) && !match_lang(langs, pick->lang))) &&
(mp_match_lang_single(audio_lang, track->lang) || opts->subs_fallback_forced == 2) &&
(!forced_pick || compare_track(track, forced_pick, langs, os_langs, mpctx->opts, preferred_program)))
+ {
forced_pick = track;
+ }
}
// If we found a forced track, use that.