[FFmpeg-cvslog] avstring: Expose the simple name match function

Luca Barbato git at videolan.org
Tue Jul 29 20:31:29 CEST 2014


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Tue Jul 29 14:29:13 2014 +0100| [69e7336b8e16ee65226fc20381baf537f4b125e6] | committer: Luca Barbato

avstring: Expose the simple name match function

Signed-off-by: Vittorio Giovara <vittorio.giovara at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69e7336b8e16ee65226fc20381baf537f4b125e6
---

 doc/APIchanges       |    3 +++
 libavformat/format.c |   20 +-------------------
 libavutil/avstring.c |   20 ++++++++++++++++++++
 libavutil/avstring.h |    9 +++++++++
 libavutil/version.h  |    2 +-
 5 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/doc/APIchanges b/doc/APIchanges
index 8fb0c23..261993b 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil:     2013-12-xx
 
 API changes, most recent first:
 
+2014-07-xx - xxxxxxx - lavu 53.19.0 - avstring.h
+  Make name matching function from lavf public as av_match_name().
+
 2014-xx-xx - xxxxxxx - lavc 55.57.0 - avcodec.h
   Add AV_CODEC_PROP_REORDER to mark codecs supporting frame reordering.
 
diff --git a/libavformat/format.c b/libavformat/format.c
index 073f770..1dd83f5 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -100,24 +100,6 @@ int av_match_ext(const char *filename, const char *extensions)
     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 (!av_strncasecmp(name, names, len))
-            return 1;
-        names = p + 1;
-    }
-    return !av_strcasecmp(name, names);
-}
-
 AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
                                 const char *mime_type)
 {
@@ -180,7 +162,7 @@ AVInputFormat *av_find_input_format(const char *short_name)
 {
     AVInputFormat *fmt = NULL;
     while ((fmt = av_iformat_next(fmt)))
-        if (match_format(short_name, fmt->name))
+        if (av_match_name(short_name, fmt->name))
             return fmt;
     return NULL;
 }
diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 3ea7be0..eb5c95a 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -234,6 +234,26 @@ int av_isxdigit(int c)
     return av_isdigit(c) || (c >= 'a' && c <= 'f');
 }
 
+int av_match_name(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 (!av_strncasecmp(name, names, len))
+            return 1;
+        names = p + 1;
+    }
+    return !av_strcasecmp(name, names);
+}
+
+
+
 #ifdef TEST
 
 int main(void)
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index b7d1098..9a18ddd 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -219,6 +219,15 @@ const char *av_basename(const char *path);
  */
 const char *av_dirname(char *path);
 
+
+/**
+ * Match instances of a name in a comma-separated list of names.
+ * @param name  Name to look for.
+ * @param names List of names.
+ * @return 1 on match, 0 otherwise.
+ */
+int av_match_name(const char *name, const char *names);
+
 /**
  * @}
  */
diff --git a/libavutil/version.h b/libavutil/version.h
index a2625b5..e981948 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -54,7 +54,7 @@
  */
 
 #define LIBAVUTIL_VERSION_MAJOR 53
-#define LIBAVUTIL_VERSION_MINOR 18
+#define LIBAVUTIL_VERSION_MINOR 19
 #define LIBAVUTIL_VERSION_MICRO  0
 
 #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \



More information about the ffmpeg-cvslog mailing list