changeset 20173:30d56afbf584

Simplify demux_mkv_get_sub_lang
author reimar
date Thu, 12 Oct 2006 17:18:20 +0000
parents 0885acdcfae8
children 6f346bb9ede7
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 1 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Thu Oct 12 15:18:56 2006 +0000
+++ b/libmpdemux/demux_mkv.c	Thu Oct 12 17:18:20 2006 +0000
@@ -3935,23 +3935,10 @@
                        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_SUBTITLE)
-        num++;
-      if (num == (track_num + 1))
-        {
+  mkv_track_t *track = demux_mkv_find_track_by_num (mkv_d, track_num, MATROSKA_TRACK_SUBTITLE);
           if ((track->language != NULL) &&
               strcmp(track->language, "und"))
             strncpy(lang, track->language, maxlen);
-          return;
-        }
-    }
 }
 
 /** \brief Get the language code for an audio track.