From 3c2cfee488f09bd34b1edf80219d9ea66508c669 Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Mon, 8 Nov 2010 13:05:49 +0200 Subject: demux: improve -alang / -slang track choosing logic When -alang / -slang was specified the numerically first matching track (if any) was always chosen. This meant that specifying "-alang eng" could change the track choice even if all tracks were in English, because now the default flag of tracks was ignored. Change the logic to take the default flag into account as a secondary sorting key. The code also accepted prefix matches, so that "-slang g" would match track language "ger". I think that was not intentional. Change it to require exact matches. --- mplayer.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'mplayer.c') diff --git a/mplayer.c b/mplayer.c index 3423813deb..b061680012 100644 --- a/mplayer.c +++ b/mplayer.c @@ -1957,11 +1957,10 @@ static int select_subtitle(MPContext *mpctx) if (!found && opts->sub_id == -1) { // finally select subs by language and container hints - if (opts->sub_id == -1 && opts->sub_lang) - opts->sub_id = demuxer_sub_track_by_lang(mpctx->d_sub->demuxer, - opts->sub_lang); if (opts->sub_id == -1) - opts->sub_id = demuxer_default_sub_track(mpctx->d_sub->demuxer); + opts->sub_id = + demuxer_sub_track_by_lang_and_default(mpctx->d_sub->demuxer, + opts->sub_lang); if (opts->sub_id >= 0) { id = opts->sub_id; found = mp_property_do("sub_demux", M_PROPERTY_SET, &id, mpctx) == M_PROPERTY_OK; -- cgit v1.2.3