[FFmpeg-cvslog] lavu/opt: copy dict in av_opt_copy

Lukasz Marek git at videolan.org
Sun Nov 9 17:57:38 CET 2014


ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Sat Nov  8 18:12:56 2014 +0100| [4e179436b6c859ae2e47ab088de8fc89b379a07b] | committer: Lukasz Marek

lavu/opt: copy dict in av_opt_copy

Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4e179436b6c859ae2e47ab088de8fc89b379a07b
---

 libavutil/opt.c |    9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index 6aabfe3..fca5354 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -1595,6 +1595,15 @@ int av_opt_copy(void *dst, void *src)
             *(int*)(field_dst8 + 1) = len;
         } else if (o->type == AV_OPT_TYPE_CONST) {
             // do nothing
+        } else if (o->type == AV_OPT_TYPE_DICT) {
+            AVDictionary **sdict = (AVDictionary **) field_src;
+            AVDictionary **ddict = (AVDictionary **) field_dst;
+            if (*sdict != *ddict)
+                av_dict_free(ddict);
+            *ddict = NULL;
+            av_dict_copy(ddict, *sdict, 0);
+            if (av_dict_count(*sdict) != av_dict_count(*ddict))
+                ret = AVERROR(ENOMEM);
         } else {
             memcpy(field_dst, field_src, opt_size(o->type));
         }



More information about the ffmpeg-cvslog mailing list