changeset 20168:0ba2a57c95a6

modifications pointed out by reimar doffinger
author ptt
date Thu, 12 Oct 2006 14:11:39 +0000
parents 31c1a556c294
children 424af0d076af
files libmpdemux/demux_mkv.c mplayer.c
diffstat 2 files changed, 6 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Thu Oct 12 13:41:57 2006 +0000
+++ b/libmpdemux/demux_mkv.c	Thu Oct 12 14:11:39 2006 +0000
@@ -3969,23 +3969,11 @@
                        int maxlen)
 {
   mkv_demuxer_t *mkv_d = (mkv_demuxer_t *) demuxer->priv;
-  mkv_track_t *track;
-  int i, num;
-
-  num = 0;
-  for (i = 0; i < mkv_d->num_tracks; i++)
-    {
-      track = mkv_d->tracks[i];
-      if (track->type == MATROSKA_TRACK_AUDIO)
-        num++;
-      if (num == (track_num + 1))
-        {
-          if ((track->language != NULL) &&
-              strcmp(track->language, "und"))
-            strlcpy(lang, track->language, maxlen);
-          return;
-        }
-    }
+  mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_AUDIO);
+  if ((track->language != NULL) &&
+      strcmp(track->language, "und"))
+    strlcpy(lang, track->language, maxlen);
+  return;
 }
 
 
--- a/mplayer.c	Thu Oct 12 13:41:57 2006 +0000
+++ b/mplayer.c	Thu Oct 12 14:11:39 2006 +0000
@@ -1816,6 +1816,7 @@
             if (code) {
                 lang[0] = code >> 8;
                 lang[1] = code;
+                lang[2] = 0;
             }
             snprintf(*(char**)arg, 63, "(%d) %s", audio_id, code ? lang : MSGTR_Unknown);
             return 1;