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

Michael Niedermayer michaelni at gmx.at
Thu Nov 20 02:17:38 CET 2014


On Wed, Nov 19, 2014 at 11:24:06PM +0100, Lukasz Marek wrote:
> On 19.11.2014 21:50, Lukasz Marek wrote:
> >On 19-Nov-2014 8:59 pm, "Michael Niedermayer" <michaelni at gmx.at
> ><mailto:michaelni at gmx.at>> wrote:
> > >
> > > On Wed, Nov 19, 2014 at 02:25:48AM +0100, Lukasz Marek wrote:
> > > > On 19.11.2014 01:13, Michael Niedermayer wrote:
> > > > >On Wed, Nov 19, 2014 at 12:30:53AM +0100, Lukasz Marek wrote:
> > > > >>On 18.11.2014 20:47, Michael Niedermayer wrote:
> > > > >>>>>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
> > > > >>>
> > > > >>>iam fine with either of these
> > > > >>
> > > > >>OK, renamed. I swapped separators order to be the same as
> > > > >>parse_string's ones. added tests for corner cases where potential
> > > > >>escape chars are separators.
> > > > >
> > > > >[...]
> > > > >
> > > > >>+{
> > > > >>+    AVDictionary *dict = NULL;
> > > > >>+    char *buffer = NULL;
> > > > >>+
> > > > >>+    printf("Testing av_dict_get_string() and
> >av_dict_parse_string()");
> > > > >>+    av_dict_get_string(dict, &buffer, '=', ',');
> > > > >>+    printf("%s\n", buffer);
> > > > >>+    av_freep(&buffer);
> > > > >>+    av_dict_set(&dict, "aaa", "aaa", 0);
> > > > >>+    av_dict_set(&dict, "b,b", "bbb", 0);
> > > > >>+    av_dict_set(&dict, "c=c", "ccc", 0);
> > > > >>+    av_dict_set(&dict, "ddd", "d,d", 0);
> > > > >>+    av_dict_set(&dict, "eee", "e=e", 0);
> > > > >>+    av_dict_set(&dict, "f,f", "f=f", 0);
> > > > >>+    av_dict_set(&dict, "g=g", "g,g", 0);
> > > > >>+    test_separators(dict, ',', '=');
> > > > >>+    av_dict_free(&dict);
> > > > >>+    av_dict_set(&dict, "aaa", "aaa", 0);
> > > > >
> > > > >i tried this instead
> > > > >av_dict_set(&dict, "a\\,=\'\"aa", "a\\,=\'\"aa", 0);
> > > > >
> > > > >and it doesnt seem to work
> > > >
> > > > obviously av_get_token is broken, i'm not going to fix it soon, so
> > > > consider patchset dropped unless no one does or wahtever
> > >
> > > i dont think we need \ as a seperator, supporting that case would
> > > only add work
> > > I suggest this:
> >
> >OK. I will fix it later.
> 
> Updated.
> 

>  Makefile |    1 
>  dict.c   |   90 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  dict.h   |   18 ++++++++++++
>  3 files changed, 109 insertions(+)
> 5eb2cb6e7f068d0ca4c39f674e8087ba74e2972f  0001-lavu-dict-add-av_dict_serialize.patch
> From a84dbe1ef00797d79a96664dfd701fd612f027c5 Mon Sep 17 00:00:00 2001
> From: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> Date: Sun, 16 Nov 2014 01:45:07 +0100
> Subject: [PATCH] lavu/dict: add av_dict_serialize
> 
> TODO: bump minor, update doc/APIchanges

LGTM

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- 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/20141120/520e1c77/attachment.asc>


More information about the ffmpeg-devel mailing list