changeset 6594:e094b1b11e1d libavcodec

Support for BMP os2v1.
author benoit
date Mon, 14 Apr 2008 13:13:08 +0000
parents e47a04d636a7
children 92eb6af449dc
files bmp.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/bmp.c	Sun Apr 13 21:06:31 2008 +0000
+++ b/bmp.c	Mon Apr 14 13:13:08 2008 +0000
@@ -84,8 +84,16 @@
         return -1;
     }
 
+    if (ihsize == 40) {
     width = bytestream_get_le32(&buf);
     height = bytestream_get_le32(&buf);
+    } else if (ihsize == 12) {
+        width  = bytestream_get_le16(&buf);
+        height = bytestream_get_le16(&buf);
+    } else {
+        av_log(avctx, AV_LOG_ERROR, "unsupported BMP file, patch welcome");
+        return -1;
+    }
 
     if(bytestream_get_le16(&buf) != 1){ /* planes */
         av_log(avctx, AV_LOG_ERROR, "invalid BMP header\n");
@@ -94,7 +102,7 @@
 
     depth = bytestream_get_le16(&buf);
 
-    if(ihsize > 16)
+    if(ihsize == 40)
         comp = bytestream_get_le32(&buf);
     else
         comp = BMP_RGB;