summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/APIchanges3
-rw-r--r--libavformat/format.c22
-rw-r--r--libavutil/avstring.c18
-rw-r--r--libavutil/avstring.h8
-rw-r--r--libavutil/version.h4
5 files changed, 33 insertions, 22 deletions
diff --git a/doc/APIchanges b/doc/APIchanges
index 575a11dff5..090e513cd4 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,9 @@ libavutil: 2012-10-22
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 e2eeb6ff09..4b3d55a2e3 100644
--- a/libavformat/format.c
+++ b/libavformat/format.c
@@ -104,24 +104,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)
{
@@ -141,7 +123,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
score_max = 0;
while ((fmt = av_oformat_next(fmt))) {
score = 0;
- if (fmt->name && short_name && match_format(short_name, fmt->name))
+ if (fmt->name && short_name && av_match_name(short_name, fmt->name))
score += 100;
if (fmt->mime_type && mime_type && !strcmp(fmt->mime_type, mime_type))
score += 10;
@@ -188,7 +170,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 e75cdc6312..a63fb84bcf 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -307,6 +307,24 @@ 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);
+}
+
int av_utf8_decode(int32_t *codep, const uint8_t **bufp, const uint8_t *buf_end,
unsigned int flags)
{
diff --git a/libavutil/avstring.h b/libavutil/avstring.h
index de2f71d12b..616c0662fc 100644
--- a/libavutil/avstring.h
+++ b/libavutil/avstring.h
@@ -268,6 +268,14 @@ 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);
+
enum AVEscapeMode {
AV_ESCAPE_MODE_AUTO, ///< Use auto-selected escaping mode.
AV_ESCAPE_MODE_BACKSLASH, ///< Use backslash escaping.
diff --git a/libavutil/version.h b/libavutil/version.h
index 6d8d6f0ced..0c69a7893b 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -56,8 +56,8 @@
*/
#define LIBAVUTIL_VERSION_MAJOR 52
-#define LIBAVUTIL_VERSION_MINOR 92
-#define LIBAVUTIL_VERSION_MICRO 101
+#define LIBAVUTIL_VERSION_MINOR 93
+#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
LIBAVUTIL_VERSION_MINOR, \