[FFmpeg-devel] [PATCH 14/42] avcodec/hevcdec: Use RefStruct API for RefPicListTap buffer

Anton Khirnov anton at khirnov.net
Wed Oct 4 11:10:40 EEST 2023


Quoting Andreas Rheinhardt (2023-10-02 13:07:14)
> Anton Khirnov:
> > Quoting Andreas Rheinhardt (2023-09-19 21:57:06)
> >> avcodec/hevcdec: Use RefStruct API for RefPicListTap buffer
> >                                                     ^
> >                                                     b
> > 
> >> Given that the RefStruct API relies on the user to know
> >> the size of the objects and does not provide a way to get it,
> > 
> > Is there a reason you decided not to provide it, or there just wasn't
> > any code that would be improved by it?
> > 
> 
> In this example, there would be no improvement if RefStruct recorded the
> size (in bytes) and provided a getter for it.
> 
> In general, the philosophy of the RefStruct API is that the user and not
> the API knows what is in the user data. So the user has to keep track of
> stuff like this in cases where the user doesn't know it.
> 
> The only scenario where keeping track of the size would be advantageous
> would be for using arrays-of-whatever if the callbacks provided the size
> as a parameter (to be ignored by most users), because one could then
> derive the number of elements from it. I pondered this, but given that
> the AVBuffer API doesn't do so either, I didn't do it. Shall I change this?

I'm leaning towards no, it's overly specific and the advantage probably
small.

-- 
Anton Khirnov


More information about the ffmpeg-devel mailing list