[FFmpeg-devel] [PATCH 03/23] avfilter/avfilter: Allow to free pads generically

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Aug 16 16:57:56 EEST 2021


Nicolas George:
> Andreas Rheinhardt (12021-08-12):
>> This can be enabled/disabled on a per-filter basis by setting
>> the new internal flags FF_FILTER_FLAG_FREE_(IN|OUT)PADS.
>>
>> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
>> ---
>> It would be possible to only free the names of non-static pads;
>> it could then be used with the headphone and afir filters.
>> But I don't think the additional complexity is worth it.
> 
> I agree on principle. But I think it would be cleaner to implement it
> with a per-pad flag.
> 
> We could replace the needs_writable field by a flags field, with
> NEEDS_WRITABLE as the first flag and FREE_NAME as a new flag.
> 
> That way, you do not need to distinguish input and output pads in the
> surrounding code.
> 
> But since you already wrote the code, I will not insist if you prefer to
> keep it as it is.
> 
As it so happens, I am working on a different patchset [1] that does add
a flags field to AVFilterPads [2], [3] right now. So I am certainly not
against this part of your proposal. But it felt more natural to do it
this way given that these are freed in avfilter_free(), but making it a
per-pad property would allow to easily cover the two remaining cases,
namely the headphone and afir filters, so I'll try it and see whether it
simplifies things.

- Andreas

[1]: https://github.com/mkver/FFmpeg/tree/pad_count
[2]:
https://github.com/mkver/FFmpeg/commit/a492a9db5ab22a8ed03e90de4381d4d1050841e7
[3]:
https://github.com/mkver/FFmpeg/commit/8fec2d737e55038754a47b3f5d25ca7ce1105175


More information about the ffmpeg-devel mailing list