Browse Source

lavu/opt: copy dict in av_opt_copy

Signed-off-by: Lukasz Marek <lukasz.m.luki2@gmail.com>
tags/n2.5
Lukasz Marek 10 years ago
parent
commit
4e179436b6
1 changed files with 9 additions and 0 deletions
  1. +9
    -0
      libavutil/opt.c

+ 9
- 0
libavutil/opt.c View File

@@ -1595,6 +1595,15 @@ int av_opt_copy(void *dst, void *src)
*(int*)(field_dst8 + 1) = len; *(int*)(field_dst8 + 1) = len;
} else if (o->type == AV_OPT_TYPE_CONST) { } else if (o->type == AV_OPT_TYPE_CONST) {
// do nothing // 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 { } else {
memcpy(field_dst, field_src, opt_size(o->type)); memcpy(field_dst, field_src, opt_size(o->type));
} }


Loading…
Cancel
Save