[FFmpeg-devel] Extending AVOption system

Stefano Sabatini stefano.sabatini-lala
Thu Jun 12 13:09:45 CEST 2008


On date Thursday 2008-06-12 12:17:03 +0200, Michael Niedermayer encoded:
> On Thu, Jun 12, 2008 at 12:12:10AM +0200, Stefano Sabatini wrote:
[...]
> > Sorry to bother again, I'm not really happy with this solution too...
> > 
> > This still breaks compatibility in a very subtle way, suppose that a
> > funky user from Mars already uses AVOption and has an AVClass with the
> > first item set to
> > 
> > { " len", 42, ...}
> 
> This is ridiculous, command line options dont start with spaces
> even less so ones using AVOption.

OK (this wasn't my main objection anyway).
 
> > when 42 is not equal to sizeof(options)/sizeof(AVOptions) -1 and
> > furthermore the array isn't sorted, yes you may wonder why someone
> > should do such thing but you know people from mars do very weird
> > things...
> > 
> > Even if possibly there aren't users affected by this problem, we're
> > still complicating the API, what's even worst we can't define the size of
> > the array in the options array itself like this:
> > 
> > static AVOption options[]={
> >  {" len", NULL, sizeof(options)/sizoef(AVOption),
> >  ...
> > }
> > 
> > since it issues an incomplete type error.
> 
> {" len", NULL, 123,
> 
> will not

But is brittle, in this way we're requesting developers to update the
options lenght every time a new option is added, also the size depends
on the active ifdeffery so this doesn't look like a viable solution.

> > My solution is to set in the item the offset to -1 meaning
> > "unspecified", then perform a sort of lazy initialization when
> > performing the first av_opt_find():
> [...]
> > which requires also to eliminate the constness of both:
> 
> rejected
> 
> 
> > 
> >     const struct AVOption *option;
> > 
> > in log.h:AVClass and of:
> > 
> > static const AVOption options[]={
> > 
> > in the various utils.c.
> > 
> 
> > For this I continue to prefer the solution contemplating a major bump.
> 
> We will not bump the major version so people can set
> bt=b in the preset files
> 
> we could put the whole new code under #if version >= X though

For me this solution is OK (I'll send an updated plan later).

Regards.
-- 
FFmpeg = Foolish Foolish MultiPurpose EnGine




More information about the ffmpeg-devel mailing list