[FFmpeg-devel] [PATCH 4/4] lavu/opt: copy dict in av_opt_copy

Michael Niedermayer michaelni at gmx.at
Sat Nov 8 19:36:11 CET 2014


On Sat, Nov 08, 2014 at 06:13:53PM +0100, Lukasz Marek wrote:
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  libavutil/opt.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/libavutil/opt.c b/libavutil/opt.c
> index 0692393..86d3ddf 100644
> --- a/libavutil/opt.c
> +++ b/libavutil/opt.c
> @@ -1596,6 +1596,13 @@ 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) {
> +            if (*field_dst8 != *field_src8)
> +                av_dict_free(field_dst8);
> +            *field_dst8 = NULL;
> +            av_dict_copy(field_dst8, *field_src8, 0);
> +            if (av_dict_count(*field_src8) != av_dict_count(*field_dst8))
> +                ret = AVERROR(ENOMEM);

this results in some warnings:

libavutil/opt.c:1601:17: warning: passing argument 1 of ‘av_dict_free’ from incompatible pointer type [enabled by default]
libavutil/dict.h:172:6: note: expected ‘struct AVDictionary **’ but argument is of type ‘uint8_t **’
libavutil/opt.c:1603:13: warning: passing argument 1 of ‘av_dict_copy’ from incompatible pointer type [enabled by default]
libavutil/dict.h:166:6: note: expected ‘struct AVDictionary **’ but argument is of type ‘uint8_t **’
libavutil/opt.c:1603:13: warning: passing argument 2 of ‘av_dict_copy’ from incompatible pointer type [enabled by default]
libavutil/dict.h:166:6: note: expected ‘const struct AVDictionary *’ but argument is of type ‘uint8_t *’
libavutil/opt.c:1604:13: warning: passing argument 1 of ‘av_dict_count’ from incompatible pointer type [enabled by default]
libavutil/dict.h:113:5: note: expected ‘const struct AVDictionary *’ but argument is of type ‘uint8_t *’
libavutil/opt.c:1604:13: warning: passing argument 1 of ‘av_dict_count’ from incompatible pointer type [enabled by default]


[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I have never wished to cater to the crowd; for what I know they do not
approve, and what they approve I do not know. -- Epicurus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141108/754daec5/attachment.asc>


More information about the ffmpeg-devel mailing list