[FFmpeg-devel] [PATCH 1/4] lavu: add simple array implementation

Lukasz M lukasz.m.luki at gmail.com
Wed Feb 26 19:22:26 CET 2014


First, there are already several parts of array implementations in the code,
> each with various pros and cons. Adding a new one will only make matter
> worse. See av_dynarray_add() and av_dynarray2_add(): they both are
> interesting, but IIRC they have flaw that prevent them to be used in a
> generic case. Fixing them seems like a better idea.

Second, I do not like the insert/append/prepend stuff, and the av_array_at()
> function even worse. To set the value of an array cell, you write tab[42] =
> 1729. The insert/append/prepend/at stuff is the kind of thing you find in
> the ultra-generic abstract java classes. So really, you would just need a
> single function that ensures a cell is free.
>
> So really, for now my advice would be to imitate the av_dynarray[2] API but
> making sure it is usable in more cases.
>

Adding possibility to store data pointer and size outside the array struct,
changing insert functions to similar like you mention + helper function to
simplify pointers inserting.
Seems like it doesn't require much changes to fulfill your requirements.
For my needs i can just use mentioned av_dynarray_add(), but in general I
don't like situation when implementing functionality X I have to bother to
handle simple things like array myself.


More information about the ffmpeg-devel mailing list