Respect "ignore_extradata", for what it's worth.

Mats

--
Mats Peterson
http://matsp888.no-ip.org/~mats/
>From 8bdcc615499872b034c9b17a38d296aa74e31d09 Mon Sep 17 00:00:00 2001
From: Mats Peterson <matsp...@yahoo.com>
Date: Thu, 10 Mar 2016 08:31:24 +0100
Subject: [PATCH 2/3 v3] lavf/riffenc: Improve spec compliance

---
 libavformat/riffenc.c |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/libavformat/riffenc.c b/libavformat/riffenc.c
index 195a58e..518b292 100644
--- a/libavformat/riffenc.c
+++ b/libavformat/riffenc.c
@@ -222,8 +222,14 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
     if (!enc->extradata_size && pal_avi)
         extradata_size = 4 * (1 << enc->bits_per_coded_sample);
 
-    /* size */
-    avio_wl32(pb, 40 + (ignore_extradata ? 0 :extradata_size));
+    /*
+     * Size (not including the size of extra data like the color table or
+     * color masks).
+     * An exception is made for HuffYUV, which includes the size of the
+     * Huffman tables here.
+     */
+    avio_wl32(pb, 40 + (ignore_extradata ||
+              enc->codec_id != AV_CODEC_ID_HUFFYUV ? 0 : extradata_size));
     avio_wl32(pb, enc->width);
     //We always store RGB TopDown
     avio_wl32(pb, enc->codec_tag || keep_height ? enc->height : -enc->height);
@@ -236,7 +242,8 @@ void ff_put_bmp_header(AVIOContext *pb, AVCodecContext *enc,
     avio_wl32(pb, (enc->width * enc->height * (enc->bits_per_coded_sample ? enc->bits_per_coded_sample : 24)+7) / 8);
     avio_wl32(pb, 0);
     avio_wl32(pb, 0);
-    avio_wl32(pb, 0);
+    /* number of color indices in the color table that are used */
+    avio_wl32(pb, pal_avi ? 1 << enc->bits_per_coded_sample : 0);
     avio_wl32(pb, 0);
 
     if (!ignore_extradata) {
-- 
1.7.10.4

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

Reply via email to