0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 03:52:22 +02:00

loadfile: fix --no-subs-with-matching-audio with --slang

If --slang was set to some language and it matched the subtitle track,
then --no-subs-with-matching-audio would do nothing. Fix the logic by
doing the --no-subs-with-matching-audio step at the end to ensure that
it always "wins" over whatever --slang or --subs-fallback has set.
Clarify the docs a bit to make it clearer that this is the intended
behavior. Fixes fbe8f99194.
This commit is contained in:
Dudemanguy 2023-08-29 12:34:27 -05:00
parent 92fe8f1a4e
commit df613cef4c
2 changed files with 7 additions and 3 deletions

View File

@ -137,7 +137,9 @@ Track Selection
``--subs-with-matching-audio=<yes|no>`` ``--subs-with-matching-audio=<yes|no>``
When autoselecting a subtitle track, select a full/non-forced one even if the selected When autoselecting a subtitle track, select a full/non-forced one even if the selected
audio stream matches your preferred subtitle language (default: yes). audio stream matches your preferred subtitle language (default: yes). If this option is
set to ``no``, a non-forced subtitle track that matches the audio language will never be
autoselected by mpv regardless of the value of ``--slang`` or ``--subs-fallback``.
``--subs-match-os-language=<yes|no>`` ``--subs-match-os-language=<yes|no>``
When autoselecting a subtitle track, select the track that matches the language of your OS When autoselecting a subtitle track, select the track that matches the language of your OS

View File

@ -663,8 +663,10 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
sub_fallback = (pick->is_external && !pick->no_default) || opts->subs_fallback == 2 || sub_fallback = (pick->is_external && !pick->no_default) || opts->subs_fallback == 2 ||
(opts->subs_fallback == 1 && pick->default_track); (opts->subs_fallback == 1 && pick->default_track);
} }
if (pick && !forced_pick && sub && (!match_lang(langs, pick->lang) || os_langs) && if (pick && !forced_pick && sub && (!match_lang(langs, pick->lang) || os_langs) && !sub_fallback)
((!opts->subs_with_matching_audio && audio_matches) || !sub_fallback)) pick = NULL;
// Handle this after matching langs and selecting a fallback.
if (pick && !forced_pick && sub && (!opts->subs_with_matching_audio && audio_matches))
pick = NULL; pick = NULL;
if (pick && pick->attached_picture && !mpctx->opts->audio_display) if (pick && pick->attached_picture && !mpctx->opts->audio_display)