summaryrefslogtreecommitdiff
path: root/libavutil
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-09-04 11:42:41 +0200
committerAnton Khirnov <anton@khirnov.net>2011-09-07 11:19:43 +0200
commit79eff9132581af69fbbd2674337b75fad29aa306 (patch)
tree598c62f3e4bbbb3714aaaed3ac7bc47cc91e8610 /libavutil
parenta7e2b2ccc9e184820f13894de6cb7e49abcb6130 (diff)
AVOptions: deprecate av_opt_set_defaults2
It's a hack which was created to allow for multiple options with different defaults to refer to same field (e.g. 'b' vs 'ab'). There is no need for it anymore.
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/avutil.h3
-rw-r--r--libavutil/opt.c16
-rw-r--r--libavutil/opt.h4
3 files changed, 17 insertions, 6 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 24594107bc..3f9267908a 100644
--- a/libavutil/avutil.h
+++ b/libavutil/avutil.h
@@ -66,6 +66,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 0dd58a7f14..160da8d756 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -414,12 +414,21 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
return 0;
}
+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 */
@@ -461,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.
@@ -648,7 +652,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 f8eea6bc2a..c6a59196be 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -166,7 +166,11 @@ int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags);
* @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