[FFmpeg-devel] [PATCH 2/7] lavfi/buffersink: add a flag for retrieving stream parameters

James Almer jamrial at gmail.com
Wed Sep 25 22:39:46 EEST 2024


On 9/25/2024 4:27 PM, Marton Balint wrote:
> 
> 
> On Wed, 25 Sep 2024, Nicolas George wrote:
> 
>> Anton Khirnov (12024-09-25):
>>> Because AVFilterLink is internal state of the filtergraph and should not
>>> be exposed at all.
>>
>> Anyway, if you cannot come up with an API that does not require dynamic
>> allocations and all the boilerplate code it requires just to retrieve a
>> few integers, then drop the series altogether.
> 
> I kind of agree. It is suboptimal that the buffersink stores all its 
> parameters already in a public struct, but you can only access them if 
> you get yourself an owned copy with all the overhead of copying / 
> referencing, plus now you have to do extra allocation for the results 
> and error checking as well.
> 
> Also I don't like that you are misusing an AVFrame struct to pass 
> parameters. How the user should know which parameters are set in AVFrame 
> and which are not? A dedicated struct would be better, or just use 
> AVFilterLink.

There is AVBufferSrcParameters, which could be renamed and reused here. 
Exact same fields, but for the opposite purpose.
It still requires allocating it before using it, but since a normal 
filterchain will have buffersrc -> [...] -> buffersink, the same 
allocated struct can be used for both.

The main benefit i see from doing this is that, much like you don't 
create references/copies for the fields you put in AVBufferSrcParameters 
because av_buffersrc_parameters_set() is what internally will do that, 
buffersink wouldn't need to create references/copies to store anything 
there either, leaving that to the caller (who will be informed the 
fields in the output struct are still owned by the library).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature.asc
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20240925/37ee3f1c/attachment.sig>


More information about the ffmpeg-devel mailing list