aboutsummaryrefslogtreecommitdiffstats
path: root/libavutil
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-06-05 13:17:26 +0200
committerAnton Khirnov <anton@khirnov.net>2011-06-05 15:01:36 +0200
commitb39b06233dfd69b941a32f29171dfb63abb23c06 (patch)
tree28c0c642138802b15123b48b95ac2eea22b63831 /libavutil
parent92b4abc2ad88ac7e89a60480094b8398fe1b8dbf (diff)
downloadffmpeg-b39b06233dfd69b941a32f29171dfb63abb23c06.tar.gz
AVOptions: add av_opt_free convenience function.
Diffstat (limited to 'libavutil')
-rw-r--r--libavutil/avutil.h2
-rw-r--r--libavutil/opt.c8
-rw-r--r--libavutil/opt.h5
3 files changed, 14 insertions, 1 deletions
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 8b8ca40c94..5085a6dd0b 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 2
+#define LIBAVUTIL_VERSION_MINOR 3
#define LIBAVUTIL_VERSION_MICRO 0
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
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
diff --git a/libavutil/opt.h b/libavutil/opt.h
index 6668139fec..8c3b6c1c36 100644
--- a/libavutil/opt.h
+++ b/libavutil/opt.h
@@ -176,4 +176,9 @@ void av_opt_set_defaults2(void *s, int mask, int flags);
int av_set_options_string(void *ctx, const char *opts,
const char *key_val_sep, const char *pairs_sep);
+/**
+ * Free all string and binary options in obj.
+ */
+void av_opt_free(void *obj);
+
#endif /* AVUTIL_OPT_H */