On 12/14/2021 9:53 AM, Nicolas George wrote:
James Almer (12021-12-14):
You could attach it dynamically allocated strings too, and to prevent the
need for the module allocating them to outlive the layout, we could add an
opaque pointer to AVChannelLayout (not AVChannelCustom) and a user set
free() call back to pass that pointer to, on uninit().

So you want to shift the responsibility to worry about pointer lifetime
and ownership to the API user. Sure, we can do that. We can always shift
responsibility to API users, but that is not very nice to them.

We add a const uint8_t* field to AVChannelCustom. If the user wants to allocate the strings instead, and not worry about their lifetime, they can provide the layout with a custom free() function that will take care of cleaning anything they came up with on uninit().


I think the best solution would be to make this new structure
ref-counted.

Having something like this called on every copy sounds inefficient. And what will you refcount? The layout? Each channel's string? Can you be more specific about how do you imagine implementing this?


Remember that I proposed a template to make ref-counted structures
easily:
https://ffmpeg.org/pipermail/ffmpeg-devel/2020-June/265227.html
(Notice that it was soon after the first version of this API was posted:
I was thinking of it already then.)

Regards,


_______________________________________________
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".
_______________________________________________
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".

Reply via email to