[FFmpeg-cvslog] AVOptions: add av_opt_free convenience function.
Anton Khirnov
git at videolan.org
Mon Jun 6 03:51:49 CEST 2011
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun 5 13:17:26 2011 +0200| [b39b06233dfd69b941a32f29171dfb63abb23c06] | committer: Anton Khirnov
AVOptions: add av_opt_free convenience function.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b39b06233dfd69b941a32f29171dfb63abb23c06
---
doc/APIchanges | 3 +++
libavutil/avutil.h | 2 +-
libavutil/opt.c | 8 ++++++++
libavutil/opt.h | 5 +++++
4 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/doc/APIchanges b/doc/APIchanges
index a55b152..77eb6d2 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -13,6 +13,9 @@ libavutil: 2011-04-18
API changes, most recent first:
+2011-06-xx - xxxxxxx - lavu 51.3.0 - opt.h
+ Add av_opt_free convenience function.
+
2011-05-28 - 0420bd7 - lavu 51.2.0 - pixdesc.h
Add av_get_pix_fmt_name() in libavutil/pixdesc.h, and deprecate
avcodec_get_pix_fmt_name() in libavcodec/avcodec.h in its favor.
diff --git a/libavutil/avutil.h b/libavutil/avutil.h
index 8b8ca40..5085a6d 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 4e25918..172fcec 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 6668139..8c3b6c1 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 */
More information about the ffmpeg-cvslog
mailing list