[FFmpeg-devel] [PATCH 16/16] avfilter/vsrc_testsrc: Deduplicate options
Andreas Rheinhardt
andreas.rheinhardt at gmail.com
Mon Jan 4 21:39:24 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.
>
> 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?
>
> Regards,
>
The AVOpt API simply deals with arrays of AVOptions that are terminated
by a { NULL } entry. A pointer that points into such an array still
points into a { NULL } terminated list of options. It is really the same
as with ordinary strings*. Using ffmpeg -h filter=allyuv still shows the
same options.
(Is it possible that you are confusing this with AVFilterPads? Several
of the AVFilterPad arrays are also the same and I have not yet checked
whether they can be safely deduplicated or not.)
- Andreas
*: With the difference that the compiler is not allowed to deduplicate
on its own whereas this is legal for string literals.
More information about the ffmpeg-devel
mailing list