forked from FFmpeg/FFmpeg
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>
This commit is contained in:
commit
31e0b5d3cb
5 changed files with 33 additions and 22 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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, \
|
||||
|
|
Loading…
Add table
Reference in a new issue