[FFmpeg-devel] [PATCH] avformat/riffenc: fix handling monowhite when pix_fmt is not set
Michael Niedermayer
michael at niedermayer.cc
Tue Feb 23 13:11:55 CET 2016
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
libavformat/riffenc.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index b6f4b67..1dd7971 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -241,11 +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 == 0 && enc->pix_fmt == AV_PIX_FMT_MONOWHITE)
+ if (i == 0 && pix_fmt == AV_PIX_FMT_MONOWHITE)
avio_wl32(pb, 0xffffff);
- else if (i == 1 && enc->pix_fmt == AV_PIX_FMT_MONOBLACK)
+ else if (i == 1 && pix_fmt == AV_PIX_FMT_MONOBLACK)
avio_wl32(pb, 0xffffff);
else
avio_wl32(pb, 0);
--
1.7.9.5
More information about the ffmpeg-devel
mailing list