changeset 12041:c5aa951feff8

Parse comma separated language lists instead of comparing the complete language string. Patch by Loren Merritt <lorenm at u dot washington dot edu>
author mosu
date Thu, 18 Mar 2004 08:37:21 +0000
parents cdc4feff6023
children ebea9d9163b0
files libmpdemux/demux_mkv.c
diffstat 1 files changed, 12 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_mkv.c	Thu Mar 18 01:19:20 2004 +0000
+++ b/libmpdemux/demux_mkv.c	Thu Mar 18 08:37:21 2004 +0000
@@ -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;
 }