summaryrefslogtreecommitdiffstats
path: root/mpcommon.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-08 13:05:49 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-08 18:05:12 +0200
commit3c2cfee488f09bd34b1edf80219d9ea66508c669 (patch)
treea8048a070e741a922a283ee8283cc2e87b6ee32e /mpcommon.c
parentfc66c94360b7326faa022d26fb7668437b4da0b1 (diff)
downloadmpv-3c2cfee488f09bd34b1edf80219d9ea66508c669.tar.bz2
mpv-3c2cfee488f09bd34b1edf80219d9ea66508c669.tar.xz
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.
Diffstat (limited to 'mpcommon.c')
-rw-r--r--mpcommon.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/mpcommon.c b/mpcommon.c
index 35f9ea015a..2fa7b6d0a8 100644
--- a/mpcommon.c
+++ b/mpcommon.c
@@ -318,10 +318,8 @@ void update_teletext(sh_video_t *sh_video, demuxer_t *demuxer, int reset)
int select_audio(demuxer_t* demuxer, int audio_id, char* audio_lang)
{
- if (audio_id == -1 && audio_lang)
- audio_id = demuxer_audio_track_by_lang(demuxer, audio_lang);
if (audio_id == -1)
- audio_id = demuxer_default_audio_track(demuxer);
+ audio_id = demuxer_audio_track_by_lang_and_default(demuxer, audio_lang);
if (audio_id != -1) // -1 (automatic) is the default behaviour of demuxers
demuxer_switch_audio(demuxer, audio_id);
if (audio_id == -2) { // some demuxers don't yet know how to switch to no sound