[Mplayer-cvslog] CVS: main/libmpdemux demux_mkv.c,1.9,1.10

Moritz Bunkus CVS syncmail at mplayerhq.hu
Thu Mar 18 09:37:24 CET 2004


CVS change done by Moritz Bunkus CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv3236

Modified Files:
	demux_mkv.c 
Log Message:
Parse comma separated language lists instead of comparing the complete language string. Patch by Loren Merritt <lorenm at u dot washington dot edu>

Index: demux_mkv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/demux_mkv.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- demux_mkv.c	9 Feb 2004 19:21:08 -0000	1.9
+++ demux_mkv.c	18 Mar 2004 08:37:21 -0000	1.10
@@ -236,12 +236,19 @@
 static mkv_track_t *
 demux_mkv_find_track_by_language (mkv_demuxer_t *d, char *language, int type)
 {
-  int i;
+  int i, len;
   
-  for (i=0; i < d->num_tracks; i++)
-    if (d->tracks[i] != NULL && d->tracks[i]->language != NULL &&
-        d->tracks[i]->type == type && !strcmp(d->tracks[i]->language,language))
-      return d->tracks[i];
+  language += strspn(language,",");
+  while((len = strcspn(language,",")) > 0)
+    {
+      for (i=0; i < d->num_tracks; i++)
+        if (d->tracks[i] != NULL && d->tracks[i]->language != NULL &&
+            d->tracks[i]->type == type &&
+            !strncmp(d->tracks[i]->language, language, len))
+          return d->tracks[i];
+      language += len;
+      language += strspn(language,",");
+    }
   
   return NULL;
 }




More information about the MPlayer-cvslog mailing list