[FFmpeg-devel] [PATCH]Do not add extradata size to bitmapinfoheader size

Carl Eugen Hoyos cehoyos at ag.or.at
Sat Sep 27 10:51:25 CEST 2014


Attached patch is one of two patches necessary to fix ticket #1304.
The MSDN documentation indicates that the palette is not part of the 
bitmapinfoheader but the bitmapinfoheader is part of the bitmapinfo 
structure that also contains the palette.

An alternative is to add the extradata_size except if it is a palette 
but imo, attached is more correct.

The second issue to fix ticket #1304 is that a too small frame size 
is written to the bitmapinfoheader, it is 192x127 for a 189x127 pal8 
frame. 0 is allowed if the pix_fmt is rawvideo.

Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 2eb2ae1..db35af4 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -214,7 +214,7 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
     int extradata_size = enc->extradata_size - 9*keep_height;
     /* size */
-    avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
+    avio_wl32(pb, 40);
     avio_wl32(pb, enc->width);
     //We always store RGB TopDown
     avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);

More information about the ffmpeg-devel mailing list