[FFmpeg-devel] [PATCH 07/11] lavu/dict: add av_dict_serialize

Lukasz Marek lukasz.m.luki2 at gmail.com
Tue Nov 18 20:00:51 CET 2014

On 18 November 2014 03:31, Michael Niedermayer <michaelni at gmx.at> wrote:
> > >It should be also possible to serialize an empty dictionary
> > >
> > >the serialization string should also contain a serialization format
> > >identifer/version otherwise future maintaince could become hard
> > >this identifer should specify the used separator chars
> >
> > Escaping OK, added. But what is the point of this? It will just
> > require additional function to remove these and pass it to
> > av_dict_parse_string.
> > Of course user will not have to remember separators.
> what will the function be used for ?
> will it be used to store dictionaries in files?, communicate them
> across the network? communicate between libs ?
> most likely the format will change over the years in some way,
> maybe dictionaries will get additional fields for type or maybe
> length for non-null terminated data, or ...

OK, with this assumption you are totally right. I'm just not sure it is so

> how will that work without any way to identify the version or format?
> also a serialization stream thats self containd seems much nicer to
> handle as theres no need to keep track of the exact version (if we
> end up having more than 1) the used seperators, ...
> also consider 2 libs or apps to interface with each other using this
> serialization format, if one requires a change to the format how can
> the other know without a version in it, it would need to know it by
> external means. it can surely be done but it doesnt feel like
> something desirable

I can do one of followings:
- I can move this function to ffserver_config.c, where it is needed as
presented here (to create simple pairs separated with comas)
- Rename function to av_dict_get_string or something so it wont get
confused with your idea of serialize function. I still think both version
has own usecases

> [...]
> > +    if (!buffer || pairs_sep == '\0' || key_val_sep == '\0' ||
> pairs_sep == key_val_sep)
> > +        return AVERROR(EINVAL);
> does it work if the escaping chars " ' \ are used as seperators ?

It may be surprising, but all crazy combinations are working ok.

> > also please make sure the version you add to doc/APIchanges matches
> > > what you set in version.h
> > Did I add wrong before?
> I fixed it in 4eae568a0712b8b59cb74b3882963f938c26eab4

OK, sorry for that. Most entries below had 0 and I copy pasted. I didn't
really noticed there is 0, not 100, but I will be more careful next time.

More information about the ffmpeg-devel mailing list