[FFmpeg-devel] [PATCH 4/6] avfilter/avfilter: Allow to free non-static pads generically

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Tue Aug 17 18:31:29 EEST 2021


Nicolas George:
> Andreas Rheinhardt (12021-08-17):
>> This can be enabled/disabled on a per-filter basis by setting
>> the new internal flags FF_FILTER_FLAG_FREE_(IN|OUT)PADS and
>> on a per-pad basis by setting the AVFILTERPAD_FLAG_FREE_NAME flag.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>> I decided to combine both approaches: It has the advantage that
>> the marginal extra code for a filter all of whose inputs'/outputs'
>> names need to be freed is zero while making it easy to handle filters
>> that have some inputs/outputs whose names need to be freed.
> 
> It had the drawback that the information about the nature of the pads
> ends up at two places of the code that are not close to each other. It
> is not good for maintenance and readability.
> 
> I think a boolean flag to ff_append_...pad() would do the job much more
> elegantly. What do you think about it?
> 
Well, this has the problem that it adds code in many places, whereas
static flags for the filter just need code in two places (with zero
marginal cost for making another filter use this feature, whereas a flag
to ff_append_... has a nonzero cost even to users not making use of this
feature). I also like that it uses a static flag for what is essentially
a static property.

- Andreas


More information about the ffmpeg-devel mailing list