Skip to content

Commit

Permalink
player: make track language matching case insensitive
Browse files Browse the repository at this point in the history
There is no reason not to do this, and probably saves the user some
trouble.

Mostly untested.

Closes mpv-player#5272.
  • Loading branch information
wm4 authored and kevmitch committed Dec 23, 2017
1 parent 30686dc commit a721dac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion player/external_files.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static void append_dir_subtitles(struct mpv_global *global,
if (bstr_startswith(tmp_fname_trim, f_fname_trim))
lang = guess_lang_from_filename(tmp_fname_trim);
for (int n = 0; langs && langs[n]; n++) {
if (lang.len && bstr_startswith0(lang, langs[n])) {
if (lang.len && bstr_case_startswith(lang, bstr0(langs[n]))) {
prio = 4; // matches the movie name + lang extension
break;
}
Expand Down
2 changes: 1 addition & 1 deletion player/loadfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ void add_demuxer_tracks(struct MPContext *mpctx, struct demuxer *demuxer)
static int match_lang(char **langs, char *lang)
{
for (int idx = 0; langs && langs[idx]; idx++) {
if (lang && strcmp(langs[idx], lang) == 0)
if (lang && strcasecmp(langs[idx], lang) == 0)
return INT_MAX - idx;
}
return 0;
Expand Down

0 comments on commit a721dac

Please sign in to comment.