[FFmpeg-devel] [PATCH] Implement av_set_options_string()

Michael Niedermayer michaelni
Tue May 12 01:11:58 CEST 2009


On Mon, May 11, 2009 at 11:23:01PM +0200, Stefano Sabatini wrote:
> On date Sunday 2009-05-10 02:00:52 +0200, Stefano Sabatini encoded:
> > On date Sunday 2009-05-10 01:11:33 +0200, Michael Niedermayer encoded:
> [...]
> > > >  parseutils.c |  139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> > > >  parseutils.h |   19 ++++++++
> > > >  2 files changed, 158 insertions(+)
> > > > b112e8cb0e69efd7091663c8077d454ecb736ecc  parseutils-implement-set-options.patch
> > > > Index: libavfilter-soc/ffmpeg/libavfilter/parseutils.c
> > > > ===================================================================
> > > > --- libavfilter-soc.orig/ffmpeg/libavfilter/parseutils.c	2009-05-06 20:58:43.000000000 +0200
> > > > +++ libavfilter-soc/ffmpeg/libavfilter/parseutils.c	2009-05-08 09:03:35.000000000 +0200
> > > > @@ -248,10 +248,110 @@
> > > >      return 0;
> > > >  }
> > > >  
> > > > +/**
> > > > + * Stores the value in the field in ctx that is named like key.
> > > > + * ctx must be an AVClass context, storing is done using AVOptions.
> > > > + *
> > > > + * @param buf the string to parse, buf will be updated to point at the
> > > > + * separator just after the parsed key/value pair
> > > > + * @param key_val_sep a 0-terminated list of the characters used to
> > > > + * separate key from value
> > > > + * @param pairs_sep a 0-terminated list of the characters used to
> > > > + * separate two pairs from each other
> > > 
> > > > + * @return 0 if no key/value pair has been found, 1 if a key/value
> > > > + * pair has been successfully parsed and set, a negative value
> > > > + * otherwise
> > > 
> > > thats too vague
> > > there are many failure modes
> > > from parsing failures, over the key being not in the AVOptions list to
> > > value not being valid
> > 
> > Yes, patch updated.
> 
> Ping + patch updated with minor fixes in the docs (
> a 0-terminated list of *the* characters -> a 0-terminated list of
> characters;
> 0 if key/value pair -> 0 if *the* key/value pair).
> 
> Now I wonder if this description:
>  * a negative value corresponding to an AVERROR* error code if
>  * the key/value pair cannot be parsed, if no matching option exists,
>  * or if the value is not valid
> 
> is too specific, or if a simple:
> 
>  * a negative value corresponding to an AVERROR* error code if
>  * the key/value pair is not valid
> 
> would be preferable.
> 
> Regards.
> -- 
> FFmpeg = Freak & Funny Mortal Pitiless Ecumenical Governor

>  parseutils.c |  136 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  parseutils.h |   20 ++++++++
>  2 files changed, 156 insertions(+)
> 28e3c86e97fbce88dff6ccbbf64b401bf9f37fc9  parseutils-implement-set-options.patch
[...]
> @@ -50,4 +52,22 @@
>   */
>  int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx);
>  
> +/**
> + * Parses the key/value pairs list in opts. For each key/value pair
> + * found, stores the value in the field in ctx that is named like the
> + * key. ctx must be an AVClass context, storing is done using
> + * AVOptions.
> + *
> + * @param key_val_sep a 0-terminated list of characters used to
> + * separate key from value
> + * @param pairs_sep a 0-terminated list of characters used to separate
> + * two pairs from each other
> + * @return the number of successfully set key/value pairs, a negative
> + * value corresponding to an AVERROR* error code if opts cannot be
> + * parsed, if no matching option exists for a key, or if a value is
> + * not valid

please document which codes are used for which case

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

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090512/baf9637a/attachment.pgp>



More information about the ffmpeg-devel mailing list