[FFmpeg-devel] [RFC] WC3 decoder without AVPaletteControl

Reimar Döffinger Reimar.Doeffinger
Wed Apr 15 14:40:43 CEST 2009

On Wed, Apr 15, 2009 at 02:06:55PM +0200, Michael Niedermayer wrote:
> i never felt the need for a grow or append packet function when thinking
> about palettes

Well, the problem is that at least for some formats the palettes are
stored apart from the frame data, so at least you have to store them
until you have the video data.
Now add to that that some formats allow an "arbitrary" number of
palettes or other "opcodes" that operate on the palette that you all
need to merge into one AVPacket, and you must set the position to that
of the first part so you can merge them all together, if possible
handling read/malloc errors at least somewhat sensibly and consistently
it seemed like the best approach to do it.
If you had a look at the CDXL demuxer I think the issue is similar:
you have a header which contains the size of video and palette packets
and some other information the decoder needs anyway. You can either
manually write the information the decoder needs into a manually
allocated AVPacket, hoping someone will notice the missing integer
overflow check, or you just read the header via av_get_packet,
extract the sizes, and use av_append_packet to have a full video
packet with all the info necessary.
AVI doesn't really have _that_ issue, it always has exactly one fully
coded palette AFAICT.

More information about the ffmpeg-devel mailing list