aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/riffenc.c
diff options
context:
space:
mode:
authorMats Peterson <matsp888@yahoo.com>2016-02-23 17:17:12 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2016-02-23 17:58:52 +0100
commit3ba57bfe8ddcf151d0dcfc6bdfe76b2bb57ba018 (patch)
tree7916149ca2a74487710773aa12be3d331636eade /libavformat/riffenc.c
parent6eb4021d47ccf65916b6fcd20d5a7462504c4dd4 (diff)
downloadffmpeg-3ba57bfe8ddcf151d0dcfc6bdfe76b2bb57ba018.tar.gz
lavf/riffenc: Handle AV_PIX_FMT_MONOBLACK
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/riffenc.c')
-rw-r--r--libavformat/riffenc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 0d958e312f..1dd7971b4c 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -241,9 +241,14 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
avio_w8(pb, 0);
} else if (raw_pal_avi) {
int i;
+ enum AVPixelFormat pix_fmt = enc->pix_fmt;
+ if (pix_fmt == AV_PIX_FMT_NONE && enc->bits_per_coded_sample == 1)
+ pix_fmt = AV_PIX_FMT_MONOWHITE;
for (i = 0; i < 1 << enc->bits_per_coded_sample; i++) {
/* Initialize 1 bpp palette to black & white */
- if (!i && enc->bits_per_coded_sample == 1)
+ if (i == 0 && pix_fmt == AV_PIX_FMT_MONOWHITE)
+ avio_wl32(pb, 0xffffff);
+ else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK)
avio_wl32(pb, 0xffffff);
else
avio_wl32(pb, 0);