[Mplayer-cvslog] CVS: main/libmpdemux demux_mkv.cpp,1.15,1.16

Moritz Bunkus CVS mosu at mplayerhq.hu
Fri May 23 17:01:29 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv17515/libmpdemux

Modified Files:
	demux_mkv.cpp 
Log Message:
Support for selecting the audio track in Matroska files via -alang.

Index: demux_mkv.cpp
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.cpp,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- demux_mkv.cpp	22 May 2003 07:49:48 -0000	1.15
+++ demux_mkv.cpp	23 May 2003 15:01:25 -0000	1.16
@@ -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



More information about the MPlayer-cvslog mailing list