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

Michael Niedermayer michael at niedermayer.cc
Wed Dec 15 00:12:54 EET 2021


On Tue, Dec 14, 2021 at 04:30:04PM -0300, James Almer wrote:
> On 12/14/2021 3:54 PM, Nicolas George wrote:
> > 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.
> 
> There's "char name[16]". Bigger than a pointer (Could be 8 bytes instead,
> but then it's kinda small). The user will not have to worry about the
> lifetime of anything then.

the advantages of a fixed length array are
* no dynamic allocation (overhead, complexity, error handling)
* no refcounting
* easier to cleanly display in user interfaces than arbitrary length strings
* no question about what to do with overly long strings (mb, gb?)

thx

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Its not that you shouldnt use gotos but rather that you should write
readable code and code with gotos often but not always is less readable
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20211214/d3315031/attachment.sig>


More information about the ffmpeg-devel mailing list