]> git.sesse.net Git - ffmpeg/commitdiff
Support transparency in 32bit bmp files.
authorCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 1 Dec 2011 23:21:24 +0000 (00:21 +0100)
committerCarl Eugen Hoyos <cehoyos@ag.or.at>
Thu, 1 Dec 2011 23:21:24 +0000 (00:21 +0100)
libavcodec/bmp.c

index 22973aa52d8510fb8cccf06484ad72110f2f9f54..3418edc18157055f800eb071e5f39f78e8c0a4d8 100644 (file)
@@ -154,7 +154,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
             rgb[2] = 0;
         }
 
-        avctx->pix_fmt = PIX_FMT_BGR24;
+        avctx->pix_fmt = PIX_FMT_BGRA;
         break;
     case 24:
         avctx->pix_fmt = PIX_FMT_BGR24;
@@ -319,7 +319,13 @@ static int bmp_decode_frame(AVCodecContext *avctx,
                     dst[0] = src[rgb[2]];
                     dst[1] = src[rgb[1]];
                     dst[2] = src[rgb[0]];
-                    dst += 3;
+/* The Microsoft documentation states:
+ * "The high byte in each DWORD is not used."
+ * Both GIMP and ImageMagick store the alpha transparency value
+ * in the high byte for 32bit bmp files.
+ */
+                    dst[3] = src[3];
+                    dst += 4;
                     src += 4;
                 }