changeset 10167:531b00ad6f2d

Support for selecting the audio track in Matroska files via -alang.
author mosu
date Fri, 23 May 2003 15:01:25 +0000
parents e860465ef46e
children 22572f1dafa3
files libmpdemux/demux_mkv.cpp mencoder.c mplayer.c
diffstat 3 files changed, 16 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.cpp	Fri May 23 14:38:59 2003 +0000
+++ b/libmpdemux/demux_mkv.cpp	Fri May 23 15:01:25 2003 +0000
@@ -55,6 +55,7 @@
 
 // for e.g. "-slang ger"
 extern char *dvdsub_lang;
+extern char *audio_lang;
 
 // default values for Matroska elements
 #define MKVD_TIMECODESCALE 1000000 // 1000000 = 1ms
@@ -1503,13 +1504,19 @@
 
   track = NULL;
   if (demuxer->audio->id == -1) { // Automatically select an audio track.
-    // Search for an audio track that has the 'default' flag set.
-    for (i = 0; i < mkv_d->num_tracks; i++)
-      if ((mkv_d->tracks[i]->type == 'a') && mkv_d->tracks[i]->ok &&
-          mkv_d->tracks[i]->default_track) {
-        track = mkv_d->tracks[i];
-        break;
-      }
+    // check if the user specified an audio language
+    if (audio_lang != NULL) {
+      track = find_track_by_language(mkv_d, audio_lang, NULL, 'a');
+    }
+    if (track == NULL)
+      // no audio language specified, or language not found
+      // Search for an audio track that has the 'default' flag set.
+      for (i = 0; i < mkv_d->num_tracks; i++)
+        if ((mkv_d->tracks[i]->type == 'a') && mkv_d->tracks[i]->ok &&
+            mkv_d->tracks[i]->default_track) {
+          track = mkv_d->tracks[i];
+          break;
+        }
 
     if (track == NULL)
       // No track has the 'default' flag set - let's take the first audio
--- a/mencoder.c	Fri May 23 14:38:59 2003 +0000
+++ b/mencoder.c	Fri May 23 15:01:25 2003 +0000
@@ -99,7 +99,7 @@
 int video_id=-1;
 int dvdsub_id=-1;
 int vobsub_id=-1;
-static char* audio_lang=NULL;
+char* audio_lang=NULL;
 char* dvdsub_lang=NULL;
 static char* spudec_ifo=NULL;
 
--- a/mplayer.c	Fri May 23 14:38:59 2003 +0000
+++ b/mplayer.c	Fri May 23 15:01:25 2003 +0000
@@ -230,7 +230,7 @@
 int video_id=-1;
 int dvdsub_id=-1;
 int vobsub_id=-1;
-static char* audio_lang=NULL;
+char* audio_lang=NULL;
 char* dvdsub_lang=NULL;
 static char* spudec_ifo=NULL;
 char* filename=NULL; //"MI2-Trailer.avi";