[FFmpeg-devel] [PATCH] Implement libavcodec/opt.[ch] generic options handling

Stefano Sabatini stefano.sabatini-lala
Tue Oct 13 23:38:37 CEST 2009


On date Tuesday 2009-10-13 12:04:01 +0200, Michael Niedermayer encoded:
> On Tue, Oct 13, 2009 at 01:58:24AM +0200, Stefano Sabatini wrote:
> [...]
> > } AVOption2;
> > 
> > Would be that an acceptable move towards an acceptable solution?
> 
> honestly this all is very messy
> maybe we can just repace default_val by an union of double and char* and add
> a flag to indicate that its a char*, this with some luck should maintain
> compaibility.
> 
> and i do not see why a overrideable set_string() would make sense
> add your code to the existing set_string()
> 
> 
> > 
> > Having just a set_string handler and a string with the default value
> > (as opposed to my idea of using also a set_default_value() handler)
> > looks like a good idea.
> > 
> 
> > Still I miss how would be possible to pass some parameters (e.g. min,
> > max, offset1, offset2) to a specific option, you somehow disliked my
> > idea of using an opaque field for that.
> 
> i dont understand what you want to do with set_string() here?
[...]

Let's put it in another way: consider this example, I want to set an
option which takes in input a string representing a color, and I want
to put the corresponding color somewhere inside a context. 

Without a set_string callback, the only possible way to do it would be
to extend opt.c, which is exactly what I want to avoid. Why? Because
the function I'll use for setting that option may not be defined in
libavcodec. Also I don't want to make opt.c grow and grow every time I
need a specialized function for setting an option.

Show me how to do it without to extend opt.c and I'll be happy, just
telling that such a feature isn't worth the trouble is not an option
(pun intended).

Regards.
-- 
FFmpeg = Free and Fantastic Multimedia Pitiless Ephemeral Gem



More information about the ffmpeg-devel mailing list