[FFmpeg-devel] [PATCH 16/16] avfilter/vsrc_testsrc: Deduplicate options

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Mon Jan 4 21:46:48 EET 2021


Nicolas George:
> Andreas Rheinhardt (12021-01-04):
>> What enumerating code? It is actually commonplace that options are
>> shared (you can find examples in libavfilter by using 'git grep -e
>> define --and -e options'); pointing into other options and thereby
>> reusing only a part of other options is not common, but I don't really
>> see why it shouldn't work.
> 
> Using #define to de-duplicate the source is fine, of course.
> 
The examples that this command shows you do not only de-duplicate in the
source (like it is done here in vsrc_testsrc.c), but really in the
binary. And it works (for it not to work the AVOpt API would need to be
modified to e.g. store the addresses of all the AVOption arrays that it
has received so far and compare whether a AVOption * actually points
into an array already known; and of course it would have to error
out/abort for it to matter).

> But IIRC pointing to the same array, i.e. de-duplicating in the binary,
> will lead to the code that enumerate options to loop in some way. I do
> not remember the details, and I cannot find a commit that talks about
> it, sorry. Maybe somebody here remembers better?

- Andreas


More information about the ffmpeg-devel mailing list