diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-29 20:09:15 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-29 20:24:42 +0200 |
commit | 31e0b5d3cb40acd960b6f6c711557a82dc2d6c5f (patch) | |
tree | c2854dbdc4da5a38bf9b791e7288ae9b3d7688c9 /libavutil | |
parent | e066f01539fd2ed19bda2031c43ddf266f0a000a (diff) | |
parent | 69e7336b8e16ee65226fc20381baf537f4b125e6 (diff) | |
download | ffmpeg-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>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avstring.c | 18 | ||||
-rw-r--r-- | libavutil/avstring.h | 8 | ||||
-rw-r--r-- | libavutil/version.h | 4 |
3 files changed, 28 insertions, 2 deletions
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, \ |