From f00e9c4b10f5ab7cd382d3019eb7bee13fcc3866 Mon Sep 17 00:00:00 2001 From: Lukasz Marek Date: Thu, 27 Nov 2014 00:11:01 +0100 Subject: lavu/opt: add consts where possible --- libavutil/opt.c | 8 ++++---- libavutil/opt.h | 7 ++++--- libavutil/version.h | 7 +++++++ 3 files changed, 15 insertions(+), 7 deletions(-) (limited to 'libavutil') diff --git a/libavutil/opt.c b/libavutil/opt.c index 5b26a00ead..64ce896833 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -42,13 +42,13 @@ #include #if FF_API_OLD_AVOPTIONS -const AVOption *av_next_option(void *obj, const AVOption *last) +const AVOption *av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last) { return av_opt_next(obj, last); } #endif -const AVOption *av_opt_next(void *obj, const AVOption *last) +const AVOption *av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *last) { const AVClass *class; if (!obj) @@ -61,7 +61,7 @@ const AVOption *av_opt_next(void *obj, const AVOption *last) return NULL; } -static int read_number(const AVOption *o, void *dst, double *num, int *den, int64_t *intnum) +static int read_number(const AVOption *o, const void *dst, double *num, int *den, int64_t *intnum) { switch (o->type) { case AV_OPT_TYPE_FLAGS: *intnum = *(unsigned int*)dst;return 0; @@ -1573,7 +1573,7 @@ static int opt_size(enum AVOptionType type) return 0; } -int av_opt_copy(void *dst, void *src) +int av_opt_copy(void *dst, FF_CONST_AVUTIL55 void *src) { const AVOption *o = NULL; const AVClass *c; diff --git a/libavutil/opt.h b/libavutil/opt.h index 7338e78368..d611c9b3ce 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -33,6 +33,7 @@ #include "log.h" #include "pixfmt.h" #include "samplefmt.h" +#include "version.h" /** * @defgroup avoptions AVOptions @@ -416,7 +417,7 @@ double av_get_double(void *obj, const char *name, const AVOption **o_out); AVRational av_get_q(void *obj, const char *name, const AVOption **o_out); int64_t av_get_int(void *obj, const char *name, const AVOption **o_out); attribute_deprecated const char *av_get_string(void *obj, const char *name, const AVOption **o_out, char *buf, int buf_len); -attribute_deprecated const AVOption *av_next_option(void *obj, const AVOption *last); +attribute_deprecated const AVOption *av_next_option(FF_CONST_AVUTIL55 void *obj, const AVOption *last); #endif /** @@ -673,7 +674,7 @@ const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, * or NULL * @return next AVOption or NULL */ -const AVOption *av_opt_next(void *obj, const AVOption *prev); +const AVOption *av_opt_next(FF_CONST_AVUTIL55 void *obj, const AVOption *prev); /** * Iterate over AVOptions-enabled children of obj. @@ -825,7 +826,7 @@ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags * @param src Object to copy into * @return 0 on success, negative on error */ -int av_opt_copy(void *dest, void *src); +int av_opt_copy(void *dest, FF_CONST_AVUTIL55 void *src); /** * Get a default list of allowed ranges for the given option. diff --git a/libavutil/version.h b/libavutil/version.h index 8b357deca6..c19e943970 100644 --- a/libavutil/version.h +++ b/libavutil/version.h @@ -120,6 +120,13 @@ #define FF_API_OPT_TYPE_METADATA (LIBAVUTIL_VERSION_MAJOR < 55) #endif +#ifndef FF_CONST_AVUTIL55 +#if LIBAVUTIL_VERSION_MAJOR >= 55 +#define FF_CONST_AVUTIL55 const +#else +#define FF_CONST_AVUTIL55 +#endif +#endif /** * @} -- cgit v1.2.1