changeset 76:d03c70b7b50d libavformat

huffyuv encoding fixed
author michaelni
date Sat, 08 Mar 2003 11:21:33 +0000
parents 78bec272ce3a
children f416fa1f5f1c
files avidec.c avienc.c
diffstat 2 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/avidec.c	Sat Mar 08 10:57:44 2003 +0000
+++ b/avidec.c	Sat Mar 08 11:21:33 2003 +0000
@@ -174,6 +174,9 @@
                     st->codec.extradata_size= size - 10*4;
                     st->codec.extradata= av_malloc(st->codec.extradata_size); //FIXME where should we free this?
                     get_buffer(pb, st->codec.extradata, st->codec.extradata_size);
+                    
+                    if(st->codec.extradata_size & 1) //FIXME check if the encoder really did this correctly
+                        get_byte(pb);
 
 #ifdef DEBUG
                     print_tag("video", tag1, 0);
--- a/avienc.c	Sat Mar 08 10:57:44 2003 +0000
+++ b/avienc.c	Sat Mar 08 11:21:33 2003 +0000
@@ -129,11 +129,12 @@
 /* BITMAPINFOHEADER header */
 void put_bmp_header(ByteIOContext *pb, AVCodecContext *enc, const CodecTag *tags, int for_asf)
 {
-    put_le32(pb, 40); /* size */
+    put_le32(pb, 40 + enc->extradata_size); /* size */
     put_le32(pb, enc->width);
     put_le32(pb, enc->height);
     put_le16(pb, 1); /* planes */
-    put_le16(pb, 24); /* depth */
+    
+    put_le16(pb, enc->bits_per_sample ? enc->bits_per_sample : 24); /* depth */
     /* compression type */
     put_le32(pb, for_asf ? codec_get_asf_tag(tags, enc->codec_id) : codec_get_tag(tags, enc->codec_id));
     put_le32(pb, enc->width * enc->height * 3);
@@ -141,6 +142,11 @@
     put_le32(pb, 0);
     put_le32(pb, 0);
     put_le32(pb, 0);
+    
+    put_buffer(pb, enc->extradata, enc->extradata_size);
+
+    if (enc->extradata_size & 1)
+        put_byte(pb, 0);
 }
 
 static void parse_specific_params(AVCodecContext *stream, int *au_byterate, int *au_ssize, int *au_scale)