@@ -228,7 +228,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
pal_avi = !for_asf &&
(pix_fmt == AV_PIX_FMT_PAL8 ||
pix_fmt == AV_PIX_FMT_MONOWHITE ||
- pix_fmt == AV_PIX_FMT_MONOBLACK);
+ pix_fmt == AV_PIX_FMT_MONOBLACK ||
+ pix_fmt == AV_PIX_FMT_GRAY8);
/* Size (not including the size of the color table or color masks) */
avio_wl32(pb, 40 + (ignore_extradata || pal_avi ? 0 : extradata_size));
@@ -263,6 +264,13 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecParameters *par,
avio_wl32(pb, 0xffffff);
else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK)
avio_wl32(pb, 0xffffff);
+ else if (pix_fmt == AV_PIX_FMT_PAL8 || pix_fmt == AV_PIX_FMT_GRAY8) {
+ /* Initialize palette */
+ avio_w8(pb,i);
+ avio_w8(pb,i);
+ avio_w8(pb,i);
+ avio_w8(pb,0);
+ }
else
avio_wl32(pb, 0);
}