From 5938e02185430ca711106aaec9b5622dbf588af3 Mon Sep 17 00:00:00 2001 From: Sean McGovern Date: Mon, 25 Jul 2011 18:51:02 -0400 Subject: cpu detection: avoid a signed overflow 1<<31 overflows because 1 is signed, so force it to unsigned. Signed-off-by: Ronald S. Bultje --- libavutil/x86/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavutil') diff --git a/libavutil/x86/cpu.c b/libavutil/x86/cpu.c index 78aeadf0a1..f747e4dba8 100644 --- a/libavutil/x86/cpu.c +++ b/libavutil/x86/cpu.c @@ -113,7 +113,7 @@ int ff_get_cpu_flags_x86(void) if(max_ext_level >= 0x80000001){ cpuid(0x80000001, eax, ebx, ecx, ext_caps); - if (ext_caps & (1<<31)) + if (ext_caps & (1U<<31)) rval |= AV_CPU_FLAG_3DNOW; if (ext_caps & (1<<30)) rval |= AV_CPU_FLAG_3DNOWEXT; -- cgit v1.2.3 From c11fb8288d282da430f598bb029deccbacb31591 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Aug 2011 07:11:26 +0200 Subject: AVOptions: add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find(). It allows to search for options only with AVClass, without allocating the corresponding context. --- doc/APIchanges | 3 +++ libavcodec/options.c | 2 +- libavformat/options.c | 2 +- libavutil/avutil.h | 2 +- libavutil/opt.h | 9 +++++++++ 5 files changed, 15 insertions(+), 3 deletions(-) (limited to 'libavutil') diff --git a/doc/APIchanges b/doc/APIchanges index a31268195f..240e613dda 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -13,6 +13,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2011-08-xx - xxxxxxx - lavu 51.10.0 + Add AV_OPT_SEARCH_FAKE_OBJ flag for av_opt_find() function. + 2011-08-xx - xxxxxx - lavu 51.9.0 Add av_fifo_peek2(), deprecate av_fifo_peek(). diff --git a/libavcodec/options.c b/libavcodec/options.c index a715dfafcb..97525634d8 100644 --- a/libavcodec/options.c +++ b/libavcodec/options.c @@ -44,7 +44,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i AVCodecContext *s = obj; AVCodec *c = NULL; - if (s->priv_data) { + if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { if (s->codec->priv_class) return av_opt_find(s->priv_data, name, unit, opt_flags, search_flags); return NULL; diff --git a/libavformat/options.c b/libavformat/options.c index 3ca8c83480..5ea0b181cb 100644 --- a/libavformat/options.c +++ b/libavformat/options.c @@ -38,7 +38,7 @@ static const AVOption *opt_find(void *obj, const char *name, const char *unit, i AVFormatContext *s = obj; AVInputFormat *ifmt = NULL; AVOutputFormat *ofmt = NULL; - if (s->priv_data) { + if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ) && s->priv_data) { if ((s->iformat && !s->iformat->priv_class) || (s->oformat && !s->oformat->priv_class)) return NULL; diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 484659a58b..24594107bc 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -40,7 +40,7 @@ #define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 9 +#define LIBAVUTIL_VERSION_MINOR 10 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libavutil/opt.h b/libavutil/opt.h index 30aa54f5b6..21dac7c569 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -215,6 +215,13 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); #define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 /** * Look for an option in an object. Consider only options which @@ -222,6 +229,8 @@ int av_opt_set_dict(void *obj, struct AVDictionary **options); * * @param[in] obj A pointer to a struct whose first element is a * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. * @param[in] name The name of the option to look for. * @param[in] unit When searching for named constants, name of the unit * it belongs to. -- cgit v1.2.3 From e955a682e125d44143415ff2b96a99a4dac78da2 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Tue, 23 Aug 2011 07:46:51 +0200 Subject: AVOptions: fix av_set_string3() doxy to match reality. Fixes bug 28. --- libavutil/opt.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libavutil') diff --git a/libavutil/opt.h b/libavutil/opt.h index 21dac7c569..68d2c798e2 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -134,7 +134,7 @@ const AVOption *av_find_opt(void *obj, const char *name, const char *unit, int m * when 0 then no av_free() nor av_strdup() will be used * @return 0 if the value has been set, or an AVERROR code in case of * error: - * AVERROR(ENOENT) if no matching option exists + * AVERROR_OPTION_NOT_FOUND if no matching option exists * AVERROR(ERANGE) if the value is out of range * AVERROR(EINVAL) if the value is not valid */ -- cgit v1.2.3