summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-07-29 20:09:15 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-07-29 20:24:42 +0200
commit31e0b5d3cb40acd960b6f6c711557a82dc2d6c5f (patch)
treec2854dbdc4da5a38bf9b791e7288ae9b3d7688c9
parente066f01539fd2ed19bda2031c43ddf266f0a000a (diff)
parent69e7336b8e16ee65226fc20381baf537f4b125e6 (diff)
downloadffmpeg-streaming-31e0b5d3cb40acd960b6f6c711557a82dc2d6c5f.zip
ffmpeg-streaming-31e0b5d3cb40acd960b6f6c711557a82dc2d6c5f.tar.gz
Merge commit '69e7336b8e16ee65226fc20381baf537f4b125e6'
* commit '69e7336b8e16ee65226fc20381baf537f4b125e6': avstring: Expose the simple name match function Conflicts: libavutil/avstring.c libavutil/avstring.h libavutil/version.h Merged-by: Michael Niedermayer <michaelni@gmx.at>
-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 575a11d..090e513 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 e2eeb6f..4b3d55a 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 e75cdc6..a63fb84 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 de2f71d..616c066 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 6d8d6f0..0c69a78 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, \
OpenPOWER on IntegriCloud