player: always try to detect subtitle language from file name

Previously, we'd only attempt to call guess_lang_from_filename if the
external file name matched the video name ignoring the extensions. So if
they didn't match, we'd just report the language as "unknown". And since
the name will never match for urls, the language would always be treated
as unknown.

Now we'll always try to guess the language from the filename regardless
of its similarity to the video file name.

Closes #10348
This commit is contained in:
Arthur Williams 2023-05-21 01:56:18 -07:00 committed by Leo Izen
parent ec58670a0d
commit 519e56f80f
1 changed files with 2 additions and 3 deletions

View File

@ -248,10 +248,9 @@ static void append_dir_subtitles(struct mpv_global *global, struct MPOpts *opts,
prio |= 32; // exact movie name match
bstr lang = {0};
int start = 0;
lang = guess_lang_from_filename(tmp_fname_trim, &start);
if (bstr_startswith(tmp_fname_trim, f_fname_trim)) {
int start = 0;
lang = guess_lang_from_filename(tmp_fname_trim, &start);
if (lang.len && start == f_fname_trim.len)
prio |= 16; // exact movie name + followed by lang
}