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? >> we need to store the number of elements allocated ourselves; >> but this is actually better than deriving it from the size >> in bytes. >> >> Signed-off-by: Andreas Rheinhardt <andreas.rheinha...@outlook.com> >> --- >> libavcodec/hevc_refs.c | 14 ++++++++------ >> libavcodec/hevcdec.c | 5 ++--- >> libavcodec/hevcdec.h | 3 ++- >> 3 files changed, 12 insertions(+), 10 deletions(-) > > The actual code looks good. > _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".