[FFmpeg-devel] [PATCH 001/279] Add a new channel layout API

Nicolas George george at nsup.org
Tue Dec 14 20:54:23 EET 2021


James Almer (12021-12-14):
> 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 understood what you suggested, and it amounts to letting API users
fend for themselves. We can do that, but I would prefer if we only did
on last resort, if we do not find a more convenient solution.

> Having something like this called on every copy sounds inefficient. And what

What??? Ref-counting makes operations more efficient by avoiding new
dynamic allocations.

I grant you, the code currently tries to avoid dynamic allocations, but
I do not think it is actually manageable without seriously limiting the
features of the API. And you know me, I try to avoid dynamic allocations
as much as possible.

> will you refcount? The layout? Each channel's string? Can you be more
> specific about how do you imagine implementing this?

The whole layout structure, with all the possible custom layouts,
dictionaries and strings.

I do not think that sharing strings between layouts that are similar but
not equal is worth the added complexity.

(We may consider a ref-counted string type at some point, maybe, but
that is another story.)

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/20211214/1c5436bb/attachment.sig>


More information about the ffmpeg-devel mailing list