[FFmpeg-cvslog] lavf/riffenc: Handle AV_PIX_FMT_MONOBLACK

Mats Peterson git at videolan.org
Tue Feb 23 18:00:30 CET 2016


ffmpeg | branch: master | Mats Peterson <matsp888 at yahoo.com> | Tue Feb 23 17:17:12 2016 +0100| [3ba57bfe8ddcf151d0dcfc6bdfe76b2bb57ba018] | committer: Michael Niedermayer

lavf/riffenc: Handle AV_PIX_FMT_MONOBLACK

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3ba57bfe8ddcf151d0dcfc6bdfe76b2bb57ba018
---

 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);



More information about the ffmpeg-cvslog mailing list