I don't know what I was thinking. Dazed and confused. Here's a new version that includes your changes.

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 949721054447d59957f6567bea032384f9362a3d Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Tue, 23 Feb 2016 17:17:12 +0100
Subject: [PATCH v2] lavf/riffenc: Handle AV_PIX_FMT_MONOBLACK

---
 libavformat/riffenc.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 0d958e3..1dd7971 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);
-- 
1.7.10.4

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel

Reply via email to