[FFmpeg-devel] [PATCH 1/3] lavu: add a template for refcounted objects.

Nicolas George george at nsup.org
Wed Jul 1 21:36:07 EEST 2020


Anton Khirnov (12020-07-01):
> You do not dereference buf->opaque. You pass it to the free callback
> when the refcount reaches zero, that is the only way it should ever be
> used.

You are talking about the implementation of the refcounted structure. I
was talking about when we use the refcounted structure. Your version
makes every single use more complex, because of the indirection.

This is something to know about code I write with new APIs: I always
make efforts to make the API as simple to use as possible, even if it
means making the implementation more complex. Because the implementation
is done only once, but using the API will happen many times.

And this is exactly what happens with your proposal: a refcounted
structure defined with it would be more annoying to use because of the
indirection, and I will not have it.

If you have a proposal that makes using the refcounted structure as
simple and clean as:

	av_foobar_ref(AVFoobar *f);
	av_foobar_unrefp(AVFoobar **f);

then I will listen. But if you have type pruning or indirection, then my
proposal is superior.

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/20200701/62fb6818/attachment.sig>


More information about the ffmpeg-devel mailing list