mirror of https://github.com/mpv-player/mpv
player: add forced choice to subs-with-matching-audio
fe875083b3
confused things a bit and made
--no-subs-with-matching-audio actually mean what it says: no subtitles
if the languages match. However, the option actually meant no non-forced
subtitles not no subtitles at all. This isn't really intuitive so
instead of changing the behavior back to the old way (we already have a
release since then), add a third option "forced" which is equivalent to
the old meaning of --no-subs-with-matching audio. Fixes #13151.
This commit is contained in:
parent
871f7a152a
commit
2ad96079e9
|
@ -37,6 +37,7 @@ Interface changes
|
|||
- rename key `MP_KEY_BACK` to `MP_KEY_GO_BACK`
|
||||
- add `--sub-filter-sdh-enclosures` option
|
||||
- added the `mp.input` scripting API to query the user for textual input
|
||||
- add `forced` choice to `subs-with-matching-audio`
|
||||
--- mpv 0.37.0 ---
|
||||
- `--save-position-on-quit` and its associated commands now store state files
|
||||
in %LOCALAPPDATA% instead of %APPDATA% directory by default on Windows.
|
||||
|
|
|
@ -135,11 +135,13 @@ Track Selection
|
|||
Note that if ``--lavfi-complex`` is set before playback is started, the
|
||||
referenced tracks are always selected.
|
||||
|
||||
``--subs-with-matching-audio=<yes|no>``
|
||||
When autoselecting a subtitle track, select a full/non-forced one even if the selected
|
||||
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-with-matching-audio=<yes|forced|no>``
|
||||
When autoselecting a subtitle track, select it even if the selected audio
|
||||
stream matches you preferred subtitle language (default: yes). If this
|
||||
option is set to ``no``, then no subtitle track that matches the audio
|
||||
language will ever be autoselected by mpv regardless of ``--slang`` or
|
||||
``subs-fallback``. If set to ``forced``, then only forced subtitles
|
||||
will be selected.
|
||||
|
||||
``--subs-match-os-language=<yes|no>``
|
||||
When autoselecting a subtitle track, select the track that matches the language of your OS
|
||||
|
|
|
@ -585,7 +585,8 @@ static const m_option_t mp_opts[] = {
|
|||
{"slang", OPT_STRINGLIST(stream_lang[STREAM_SUB])},
|
||||
{"vlang", OPT_STRINGLIST(stream_lang[STREAM_VIDEO])},
|
||||
{"track-auto-selection", OPT_BOOL(stream_auto_sel)},
|
||||
{"subs-with-matching-audio", OPT_BOOL(subs_with_matching_audio)},
|
||||
{"subs-with-matching-audio", OPT_CHOICE(subs_with_matching_audio, {"no", 0},
|
||||
{"forced", 1}, {"yes", 2})},
|
||||
{"subs-match-os-language", OPT_BOOL(subs_match_os_language)},
|
||||
{"subs-fallback", OPT_CHOICE(subs_fallback, {"no", 0}, {"default", 1}, {"yes", 2})},
|
||||
{"subs-fallback-forced", OPT_CHOICE(subs_fallback_forced, {"no", 0},
|
||||
|
@ -984,7 +985,7 @@ static const struct MPOpts mp_default_opts = {
|
|||
[STREAM_VIDEO] = -2,
|
||||
[STREAM_SUB] = -2, }, },
|
||||
.stream_auto_sel = true,
|
||||
.subs_with_matching_audio = true,
|
||||
.subs_with_matching_audio = 2,
|
||||
.subs_match_os_language = true,
|
||||
.subs_fallback = 1,
|
||||
.subs_fallback_forced = 1,
|
||||
|
|
|
@ -279,7 +279,7 @@ typedef struct MPOpts {
|
|||
int stream_id[2][STREAM_TYPE_COUNT];
|
||||
char **stream_lang[STREAM_TYPE_COUNT];
|
||||
bool stream_auto_sel;
|
||||
bool subs_with_matching_audio;
|
||||
int subs_with_matching_audio;
|
||||
bool subs_match_os_language;
|
||||
int subs_fallback;
|
||||
int subs_fallback_forced;
|
||||
|
|
|
@ -673,9 +673,12 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
|
|||
if (pick && !forced_pick && sub && (!match_lang(langs, pick->lang) || os_langs) && !sub_fallback)
|
||||
pick = NULL;
|
||||
// Handle this after matching langs and selecting a fallback.
|
||||
if (pick && sub && (!opts->subs_with_matching_audio && audio_matches))
|
||||
if (pick && sub && ((!opts->subs_with_matching_audio && audio_matches) ||
|
||||
(opts->subs_with_matching_audio == 1 && audio_matches && !forced_pick)))
|
||||
{
|
||||
pick = NULL;
|
||||
// Handle edge cases if we picked a track that doesn't match the --subs-fallback-force value
|
||||
}
|
||||
// Handle edge cases if we picked a track that doesn't match the --subs-fallback-forced value
|
||||
if (pick && sub && ((!pick->forced_track && opts->subs_fallback_forced == 2) ||
|
||||
(pick->forced_track && !opts->subs_fallback_forced)))
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue