On Monday 29 September 2014 01:22:38 am Carl Eugen Hoyos wrote: > Attached patch is the first part of the fix for ticket #1304.
New, tested patch attached. Please comment, Carl Eugen
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c index 2eb2ae1..723e802 100644 --- a/libavformat/riffenc.c +++ b/libavformat/riffenc.c @@ -212,9 +212,12 @@ 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; + int palette_size = enc->pix_fmt == AV_PIX_FMT_PAL8 && extradata_size >= AVPALETTE_SIZE ? + AVPALETTE_SIZE : + 0; /* size */ - avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size)); + avio_wl32(pb, 40 + (ignore_extradata ? 0 : extradata_size - palette_size)); avio_wl32(pb, enc->width); //We always store RGB TopDown avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel