[FFmpeg-devel] [PATCH]Write (tiff) palette in mov

Michael Niedermayer michaelni at gmx.at
Thu Jun 7 21:26:34 CEST 2012


On Thu, Jun 07, 2012 at 02:38:26PM +0200, Carl Eugen Hoyos wrote:
> Hi!
> 
> Attached patch allows to write a static palette to mov, fixes for example:
> $ ./ffmpeg -i tests/data/fate/vsynth2-dv.dv -pix_fmt pal8 -vcodec tiff -s 257x257 tiff257pal.mov
> Related to ticket #1286.
> 
> Similar patches fix targa, png and rawvideo.
> 
> Please review, Carl Eugen

>  libavcodec/tiffenc.c |    5 +++++
>  libavformat/movenc.c |   12 ++++++++++++
>  2 files changed, 17 insertions(+)
> 9ec66c80b0b929f5f49e9202d1afba01f49cd849  patchmovpal.diff
> diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
> index 9f90c61..5cfeffe 100644
> --- a/libavcodec/tiffenc.c
> +++ b/libavcodec/tiffenc.c
> @@ -452,6 +452,11 @@ static int encode_frame(AVCodecContext * avctx, AVPacket *pkt,
>              pal[i + 512] = ( rgb        & 0xff) * 257;
>          }
>          add_entry(s, TIFF_PAL, TIFF_SHORT, 256 * 3, pal);
> +        avctx->extradata = av_realloc(avctx->extradata, AVPALETTE_SIZE + FF_INPUT_BUFFER_PADDING_SIZE);
> +        if (!avctx->extradata)
> +            return AVERROR(ENOMEM);
> +        avctx->extradata_size = AVPALETTE_SIZE;
> +        memcpy(avctx->extradata, p->data[1], AVPALETTE_SIZE);
>      }

extradata isnt variable while this looks like it could be reallocated
per frame

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Those who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120607/d775e1e7/attachment.asc>


More information about the ffmpeg-devel mailing list