[FFmpeg-devel] [PATCH]Do not add palette size to the bitmapheader size

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Sep 29 01:22:38 CEST 2014


Hi!

Attached patch is the first part of the fix for ticket #1304.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 2eb2ae1..cf235c1 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -212,6 +212,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
     int keep_height = enc->extradata_size >= 9 &&
                       !memcmp(enc->extradata + enc->extradata_size - 9, "BottomUp", 9);
     int extradata_size = enc->extradata_size - 9*keep_height;
+    if (enc->pix_fmt == AV_PIX_FMT_PAL8 && extradata_size >= AVPALETTE_SIZE)
+        extradata_size -= AVPALETTE_SIZE;
 
     /* size */
     avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));


More information about the ffmpeg-devel mailing list