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

Michael Niedermayer michaelni
Sun May 10 01:11:33 CEST 2009


On Fri, May 08, 2009 at 09:07:03AM +0200, Stefano Sabatini wrote:
> On date Friday 2009-05-08 03:11:07 +0200, Michael Niedermayer encoded:
> > On Thu, May 07, 2009 at 09:22:01AM +0200, Stefano Sabatini wrote:
> > > On date Thursday 2009-05-07 02:02:58 +0200, Michael Niedermayer encoded:
> > [...]
> > > +int av_set_options_string(void *ctx, const char *opts,
> > > +                          const char *key_val_sep, const char *pairs_sep)
> > > +{
> > > +    int count = 0;
> > > +
> > > +    while (*opts) {
> > 
> > > +        if (parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep) < 0)
> > > +            return -1;
> > 
> > passing the error code through seems like a good idea ...
> 
> Indeed it is... patch updated.
> 
> Regards.
> -- 
> FFmpeg = Faboulous and Faithless Merciless Puristic Extreme Generator

>  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



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

Many that live deserve death. And some that die deserve life. Can you give
it to them? Then do not be too eager to deal out death in judgement. For
even the very wise cannot see all ends. -- Gandalf
-------------- 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/20090510/10bfe1c5/attachment.pgp>



More information about the ffmpeg-devel mailing list