player/loadfile: match audio and subtitle language with mp_match_lang

For matching the audio language with the track subtitle language,
strcasecmp is insufficient since it only allows exact matches and misses
the language regional variant. Fix this by simply using mp_match_lang
instead.

Fixes #16461.
This commit is contained in:
Dudemanguy committed 2025-06-19 20:18:02 +00:00
1 parent e8ade130fa
commit 580f2ecbd5
1 file changed
+1 -1
+1 -1
View File
@@ -595,7 +595,7 @@ struct track *select_default_track(struct MPContext *mpctx, int order,
continue;
if (sub) {
// Subtitle specific auto-selecting crap.
bool audio_matches = audio_lang && track->lang && !strcasecmp(audio_lang, track->lang);
bool audio_matches = mp_match_lang((char *[]){ (char *)audio_lang, NULL }, track->lang) > 0;
bool forced = track->forced_track && (opts->subs_fallback_forced == 2 ||
(audio_matches && opts->subs_fallback_forced == 1));
bool lang_match = !os_langs && mp_match_lang(langs, track->lang) > 0;