[FFmpeg-devel] [PATCH] Enhance libavcodec/opt.c API

Stefano Sabatini stefano.sabatini-lala
Mon May 12 09:23:10 CEST 2008


On date Monday 2008-05-12 00:01:05 +0200, Michael Niedermayer encoded:
> On Sun, May 11, 2008 at 10:49:37PM +0200, Stefano Sabatini wrote:
> > On date Sunday 2008-05-11 19:09:02 +0200, Michael Niedermayer encoded:
> > > On Sun, May 11, 2008 at 06:08:06PM +0200, Stefano Sabatini wrote:
> > > > Hi all,
> > > > 
> > > > one of the main problems with the AVOption API is that it is
> > > > impossible to distinguish when setting an option value if an option is
> > > > simply not present in a context, or the provided value is wrong.
> > > > 
> > > > This proposal adds a function named av_set_opt_string() which takes as
> > > > parameter the pointer to the option to be set, this solution could
> > > > eventually be extended to the other av_set_* and av_get_* functions
> > > > (also improving efficiency in many cases).
> > > > 
> > > > In this way you can check for the presence of an option with
> > > > av_opt_find(), then use the av_set_opt_string() function on the found
> > > > option to set its value, if the value provided is wrong then it will
> > > > return NULL.
> > > 
> > > patch rejected
> > 
> > Please could you elaborate more on this (I'm just wondering which
> > obvious thing I missed this time).
> 
> I see no limitation even less so see i any removed limitation in your patch.

Mhh... av_opt_find() followed by an av_set_string() does the trick,
although not very efficiently since in this way the program has to
find two times the option in the array, anyway if you're against this
API change I'll leave it as it is.
 
> > Anyway current behavior of ffmpeg:opt_default() (which depends on the current
> > limitation of opt.c API) sucks, for example:
> > 
> > $ ffmpeg -b foo
> > [...]
> > Must supply at least one output file
> > 
> > $ ffmpeg -flags bar
> > [...]
> > ffmpeg: unrecognized option '-flags'
> 
> I dont think your patch would change these in any way.

Patch incoming for this.

Regards.
-- 
FFmpeg = Funny and Frenzy Monstrous Portable EnGraver




More information about the ffmpeg-devel mailing list