[FFmpeg-cvslog] r16659 - trunk/libavformat/utils.c

bcoudurier subversion
Sat Jan 17 22:40:27 CET 2009


Author: bcoudurier
Date: Sat Jan 17 22:40:27 2009
New Revision: 16659

Log:
match format in names list separated by commas

Modified:
   trunk/libavformat/utils.c

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Sat Jan 17 21:08:43 2009	(r16658)
+++ trunk/libavformat/utils.c	Sat Jan 17 22:40:27 2009	(r16659)
@@ -153,6 +153,24 @@ int match_ext(const char *filename, cons
     return 0;
 }
 
+static int match_format(const char *name, const char *names)
+{
+    const char *p;
+    int len, namelen;
+
+    if (!name || !names)
+        return 0;
+
+    namelen = strlen(name);
+    while ((p = strchr(names, ','))) {
+        len = FFMAX(p - names, namelen);
+        if (!strncasecmp(name, names, len))
+            return 1;
+        names = p+1;
+    }
+    return !strcasecmp(name, names);
+}
+
 AVOutputFormat *guess_format(const char *short_name, const char *filename,
                              const char *mime_type)
 {
@@ -232,7 +250,7 @@ AVInputFormat *av_find_input_format(cons
 {
     AVInputFormat *fmt;
     for(fmt = first_iformat; fmt != NULL; fmt = fmt->next) {
-        if (!strcmp(fmt->name, short_name))
+        if (match_format(short_name, fmt->name))
             return fmt;
     }
     return NULL;




More information about the ffmpeg-cvslog mailing list