[FFmpeg-devel] [PATCH 1/6] lavfi/buffersink: add accessors for the stream properties.

Andreas Cadhalpun andreas.cadhalpun at googlemail.com
Wed Dec 21 02:56:59 EET 2016


On 20.12.2016 15:46, wm4 wrote:
> In general, replacing public fields with macro-generated accessors is
> really just a rename. Admittedly, it removes a confusing indirection
> (though ->inputs[0]) in this case, but in general the improvements are
> very minor. What does it matter if whether there are 100 fields or 100
> set/get functions?

There are several benefits of using accessors:
 * It is much easier to keep the ABI stable for accessor functions than
   for public structs, because the order of members doesn't affect them.
 * It is much easier to check which binary uses which ABI, because the
   functions are listed in the symbols table, while checking which
   struct member is accessed requires disassembling.
 * Having the struct private means it can't be allocated on the stack
   by API users, preventing problems when the struct size changes.

Best regards,
Andreas


More information about the ffmpeg-devel mailing list