[FFmpeg-devel] [PATCH] lavu: header and documentation for AVWriter

Nicolas George george at nsup.org
Tue Aug 30 22:37:36 EEST 2022


Leo Izen (12022-08-30):
> Is there a reason this is AVWriter wr = foo() and not AVWriter *wr = foo()?
> Most other APIs return pointers to structs, rather than structs themselves
> (see: av_packet_alloc). Using a pointer would prevent us from having
> sizeof(AVWriter) as part of the ABI, as was done with AVPacket.

Yes: to return a pointer, you need somewhere to store the structure. One
of the point of AVWriter is that you can store it on the stack to avoid
dynamic allocations when the string is short enough.

Note that AVWriter is exactly two pointers. It will always be two
pointers, and all the objects that I intend to introduce later will
always be two pointers: one const pointer for the methods, one pointer
for the object itself.

This design is essential to the features I promised for AVWriter and for
later.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220830/9db2dc47/attachment.sig>


More information about the ffmpeg-devel mailing list