diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-09-07 22:32:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-07 22:58:39 +0200 |
commit | f1b5693027d48a9e448f21595fb9247893c225cf (patch) | |
tree | d01e1b5a8a3abe464cd5be4d86122f0818b60132 /libavutil | |
parent | a2b66a366d7d9d7dacc217601b5e4406624f91ea (diff) | |
parent | 0ca36b4de76e10578e23199c2932682c0f510e31 (diff) | |
download | ffmpeg-f1b5693027d48a9e448f21595fb9247893c225cf.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
Add LATM muxer
v210enc: clip values according to specifications
v210enc: switch to PIX_FMT_422P10
v210dec: switch to PIX_FMT_422P10
AVOptions: remove AVOption.offset <= 0 checks
AVOptions: deprecate av_opt_set_defaults2
AVOptions: move doxy for av_opt_set_defaults() from opt.c to opt.h
libx264: fix setting some more parameters
libx264: fix setting the H.264 level
libx264: add 'direct-pred' private option
libx264: add 'partitions' private option
Conflicts:
Changelog
libavcodec/Makefile
libavcodec/libx264.c
libavcodec/v210enc.c
libavfilter/src_movie.c
libavformat/version.h
libavutil/opt.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavutil')
-rw-r--r-- | libavutil/avutil.h | 3 | ||||
-rw-r--r-- | libavutil/opt.c | 28 | ||||
-rw-r--r-- | libavutil/opt.h | 9 |
3 files changed, 25 insertions, 15 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 06c0470ce7..ef7a1459dc 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -69,6 +69,9 @@ #ifndef FF_API_AV_FIFO_PEEK #define FF_API_AV_FIFO_PEEK (LIBAVUTIL_VERSION_MAJOR < 52) #endif +#ifndef FF_API_OLD_AVOPTIONS +#define FF_API_OLD_AVOPTIONS (LIBAVUTIL_VERSION_MAJOR < 52) +#endif /** * Return the LIBAVUTIL_VERSION_INT constant. diff --git a/libavutil/opt.c b/libavutil/opt.c index 43823690aa..2d4f873847 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -59,7 +59,7 @@ static int av_set_number2(void *obj, const char *name, double num, int den, int6 void *dst; if (o_out) *o_out= o; - if (!o || o->offset<=0) + if (!o) return AVERROR_OPTION_NOT_FOUND; if (o->max*den < num*intnum || o->min*den > num*intnum) { @@ -123,7 +123,7 @@ int av_set_string3(void *obj, const char *name, const char *val, int alloc, cons *o_out = o; if (!o) return AVERROR_OPTION_NOT_FOUND; - if ((!val && o->type != FF_OPT_TYPE_STRING) || o->offset<=0) + if (!val && o->type != FF_OPT_TYPE_STRING) return AVERROR(EINVAL); if (o->type == FF_OPT_TYPE_BINARY) { @@ -233,7 +233,7 @@ const char *av_get_string(void *obj, const char *name, const AVOption **o_out, c void *dst; uint8_t *bin; int len, i; - if (!o || o->offset<=0) + if (!o) return NULL; if (o->type != FF_OPT_TYPE_STRING && (!buf || !buf_len)) return NULL; @@ -414,18 +414,21 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags) return 0; } -/** Set the values of the AVCodecContext or AVFormatContext structure. - * They are set to the defaults specified in the according AVOption options - * array default_val field. - * - * @param s AVCodecContext or AVFormatContext for which the defaults will be set - */ +void av_opt_set_defaults(void *s) +{ +#if FF_API_OLD_AVOPTIONS + av_opt_set_defaults2(s, 0, 0); +} + void av_opt_set_defaults2(void *s, int mask, int flags) { +#endif const AVOption *opt = NULL; while ((opt = av_next_option(s, opt)) != NULL) { +#if FF_API_OLD_AVOPTIONS if ((opt->flags & mask) != flags) continue; +#endif switch (opt->type) { case FF_OPT_TYPE_CONST: /* Nothing to be done here */ @@ -467,11 +470,6 @@ void av_opt_set_defaults2(void *s, int mask, int flags) } } -void av_opt_set_defaults(void *s) -{ - av_opt_set_defaults2(s, 0, 0); -} - /** * Store the value in the field in ctx that is named like key. * ctx must be an AVClass context, storing is done using AVOptions. @@ -656,7 +654,7 @@ int main(void) }; test_ctx.class = &test_class; - av_opt_set_defaults2(&test_ctx, 0, 0); + av_opt_set_defaults(&test_ctx); test_ctx.string = av_strdup("default"); av_log_set_level(AV_LOG_DEBUG); diff --git a/libavutil/opt.h b/libavutil/opt.h index efb4408f0d..95ce12c6a7 100644 --- a/libavutil/opt.h +++ b/libavutil/opt.h @@ -160,8 +160,17 @@ const AVOption *av_next_option(void *obj, const AVOption *last); */ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ void av_opt_set_defaults(void *s); + +#if FF_API_OLD_AVOPTIONS +attribute_deprecated void av_opt_set_defaults2(void *s, int mask, int flags); +#endif /** * Parse the key/value pairs list in opts. For each key/value pair |