From 53d032374d9f8fdfca260ed9a67190c37159f7c2 Mon Sep 17 00:00:00 2001 From: Dudemanguy Date: Sun, 6 Aug 2023 21:39:17 -0500 Subject: [PATCH] player: remove special auto option from alang/slang/vlang This proved to be too problematic. Depending on the value of --subs-with-matching-audio, you could either end up with cases where --slang wasn't respected and users didn't get subtitles or alternatively cases where subtitles were given and the user didn't ask for them. Fundamentally, the OS language functionality doesn't really map well to slang (and for alang/vlang it makes zero sense; not that anyone actually used it). Instead of trying to shove it in an option where it doesn't belong, we should split this off into something else. So for now, just remove the special handling of "auto" and flip slang back to NULL. --- DOCS/interface-changes.rst | 2 ++ DOCS/man/options.rst | 5 +---- options/options.c | 3 --- player/loadfile.c | 9 ++------- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 538439ec28..8d34fcf99e 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -43,6 +43,8 @@ Interface changes - add `--libplacebo-opts` option - change `--video-pan-x/y` to be relative to the destination rectangle - add `--audio-file-exts`, `--cover-art-auto-exts`, and `--sub-auto-exts` + - change `slang` default back to NULL + - remove special handling of the `auto` value from `--alang/slang/vlang` options --- mpv 0.36.0 --- - add `--target-contrast` - Target luminance value is now also applied when ICC profile is used. diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index 23692a672f..94d7bce6e8 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -11,9 +11,6 @@ Track Selection A track that matches more subtags will be preferred over one that matches fewer, with preference given to earlier subtags over later ones. See also ``--aid``. - The special value "auto" can be included anywhere in the list, - and is equivalent to the user's OS-level list of preferred languages. - This is a string list option. See `List Options`_ for details. .. admonition:: Examples @@ -24,7 +21,7 @@ Track Selection audio. ``--slang=`` - Equivalent to ``--alang``, for subtitle tracks (default: auto). + Equivalent to ``--alang``, for subtitle tracks. This is a string list option. See `List Options`_ for details. diff --git a/options/options.c b/options/options.c index 7b9156a823..13fefd5f0d 100644 --- a/options/options.c +++ b/options/options.c @@ -1042,9 +1042,6 @@ static const struct MPOpts mp_default_opts = { { [STREAM_AUDIO] = -2, [STREAM_VIDEO] = -2, [STREAM_SUB] = -2, }, }, - .stream_lang = { - [STREAM_SUB] = (char *[]){ "auto", NULL }, - }, .stream_auto_sel = true, .subs_with_matching_audio = true, .subs_fallback = 1, diff --git a/player/loadfile.c b/player/loadfile.c index 84cef94639..a64a0733df 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -568,13 +568,8 @@ static char **process_langs(char **in) size_t nb = 0; char **out = NULL; for (int i = 0; in && in[i]; i++) { - if (!strcmp(in[i], "auto")) { - if (!add_auto_langs(&nb, &out)) - break; - } else { - if (!append_lang(&nb, &out, talloc_strdup(NULL, in[i]))) - break; - } + if (!append_lang(&nb, &out, talloc_strdup(NULL, in[i]))) + break; } return out; }