[FFmpeg-devel] [PATCH] lavu: Add av_dict_from_string()

Stefano Sabatini stefasab at gmail.com
Fri Feb 24 17:34:40 CET 2012

On date Thursday 2012-02-16 21:46:53 +0100, Alexander Strasser encoded:
> Andrey Utkin wrote:
> > 2012/2/16 Alexander Strasser <eclipse7 at gmx.net>:
> > >  Would it seem OK for you to use an array of character pointers or similar?
> > > I guess your current interface would not allow passing through arbitrary
> > > character strings.
> > >
> > >  Another advantage would be that a more generic interface would serve a wider
> > > audience of applications in a better way (though some would need a little more
> > > code, but maybe we could also provide that in a separate API if you think it
> > > would be useful to have in lavu).
> > 
> > Thanks for pointing out the limitation of my procedure. Yep, option
> > value can't contain comma and '='.
> > But, if caller have an array of string pointers, then IMO he is at a
> > single step from having it split by option name and value, so passing
> > it to some librarian helper function seems having little sense.
> > The only idea i have on extending capability of this function is
> > support of escaping comma and = with backslash.
>   Yes, it lowers the value of the utility function. I think I misread part of your
> code/intention earlier, please pardon my oversight.
>   Maybe it would be fine if we have backslash escaping supported. It needs a bit
> of thought work and writing down the exact specs of what the function supports.

Note that escaping is already implemented in
libavutil/opt.h:av_set_options_string(), which makes use of
av_get_token() and the internal parse_key_value_pair().

The last one may be made internal in a shared header and used for
implementing escaping in av_dict_from_string().

FFmpeg = Free and Forgiving Mega Pitiless Enlightening Glue

More information about the ffmpeg-devel mailing list