From b39b06233dfd69b941a32f29171dfb63abb23c06 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sun, 5 Jun 2011 13:17:26 +0200 Subject: AVOptions: add av_opt_free convenience function. --- libavutil/opt.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libavutil/opt.c') diff --git a/libavutil/opt.c b/libavutil/opt.c index 4e25918ed1..172fcec456 100644 --- a/libavutil/opt.c +++ b/libavutil/opt.c @@ -520,6 +520,14 @@ int av_set_options_string(void *ctx, const char *opts, return count; } +void av_opt_free(void *obj) +{ + const AVOption *o = NULL; + while ((o = av_next_option(obj, o))) + if (o->type == FF_OPT_TYPE_STRING || o->type == FF_OPT_TYPE_BINARY) + av_freep((uint8_t *)obj + o->offset); +} + #ifdef TEST #undef printf -- cgit v1.2.3