[FFmpeg-devel] [PATCH 1/2] avutil/buffer: add av_buffer_pool_buffer_get_opaque

Nicolas George george at nsup.org
Sun Dec 15 16:24:00 EET 2019


James Almer (12019-12-14):
> I'm not sure if this is a good idea. It takes any AVBufferRef as input,
> so it will crash on pretty much every one not created by an AVBufferPool
> (unless it checks that buf is not NULL before dereferencing it), or
> return something unrelated otherwise.

This is true, but I do not consider it that big of a problem. It makes
no sense to access the opaque pointer unless you know precisely where
the buffer comes from and what the opaque pointer contains. This is only
expanding on this a bit.

There are already several places in FFmpeg's API where parameters have a
constraint that cannot be expressed with the imperfect type system of
the C language. There are in the standard C library too: realloc() vs.
free(), pclose() vs. fclose(), etc.

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/20191215/381b8c5d/attachment.sig>


More information about the ffmpeg-devel mailing list