]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/bmp.c
Replace PIX_FMT_* -> AV_PIX_FMT_*, PixelFormat -> AVPixelFormat
[ffmpeg] / libavcodec / bmp.c
index 210d012aaaca3e551e6953d7768b90e18a5b6e19..b38e056315ea27687f174cf53df152493acc8e70 100644 (file)
@@ -136,7 +136,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
     avctx->width = width;
     avctx->height = height > 0? height: -height;
 
-    avctx->pix_fmt = PIX_FMT_NONE;
+    avctx->pix_fmt = AV_PIX_FMT_NONE;
 
     switch(depth){
     case 32:
@@ -155,21 +155,21 @@ static int bmp_decode_frame(AVCodecContext *avctx,
             rgb[2] = 0;
         }
 
-        avctx->pix_fmt = PIX_FMT_BGR24;
+        avctx->pix_fmt = AV_PIX_FMT_BGR24;
         break;
     case 24:
-        avctx->pix_fmt = PIX_FMT_BGR24;
+        avctx->pix_fmt = AV_PIX_FMT_BGR24;
         break;
     case 16:
         if(comp == BMP_RGB)
-            avctx->pix_fmt = PIX_FMT_RGB555;
+            avctx->pix_fmt = AV_PIX_FMT_RGB555;
         else if (comp == BMP_BITFIELDS) {
             if (rgb[0] == 0xF800 && rgb[1] == 0x07E0 && rgb[2] == 0x001F)
-               avctx->pix_fmt = PIX_FMT_RGB565;
+               avctx->pix_fmt = AV_PIX_FMT_RGB565;
             else if (rgb[0] == 0x7C00 && rgb[1] == 0x03E0 && rgb[2] == 0x001F)
-               avctx->pix_fmt = PIX_FMT_RGB555;
+               avctx->pix_fmt = AV_PIX_FMT_RGB555;
             else if (rgb[0] == 0x0F00 && rgb[1] == 0x00F0 && rgb[2] == 0x000F)
-               avctx->pix_fmt = PIX_FMT_RGB444;
+               avctx->pix_fmt = AV_PIX_FMT_RGB444;
             else {
                av_log(avctx, AV_LOG_ERROR, "Unknown bitfields %0X %0X %0X\n", rgb[0], rgb[1], rgb[2]);
                return AVERROR(EINVAL);
@@ -178,14 +178,14 @@ static int bmp_decode_frame(AVCodecContext *avctx,
         break;
     case 8:
         if(hsize - ihsize - 14 > 0)
-            avctx->pix_fmt = PIX_FMT_PAL8;
+            avctx->pix_fmt = AV_PIX_FMT_PAL8;
         else
-            avctx->pix_fmt = PIX_FMT_GRAY8;
+            avctx->pix_fmt = AV_PIX_FMT_GRAY8;
         break;
     case 1:
     case 4:
         if(hsize - ihsize - 14 > 0){
-            avctx->pix_fmt = PIX_FMT_PAL8;
+            avctx->pix_fmt = AV_PIX_FMT_PAL8;
         }else{
             av_log(avctx, AV_LOG_ERROR, "Unknown palette for %d-colour BMP\n", 1<<depth);
             return -1;
@@ -196,7 +196,7 @@ static int bmp_decode_frame(AVCodecContext *avctx,
         return -1;
     }
 
-    if(avctx->pix_fmt == PIX_FMT_NONE){
+    if(avctx->pix_fmt == AV_PIX_FMT_NONE){
         av_log(avctx, AV_LOG_ERROR, "unsupported pixel format\n");
         return -1;
     }
@@ -228,9 +228,6 @@ static int bmp_decode_frame(AVCodecContext *avctx,
     if(comp == BMP_RLE4 || comp == BMP_RLE8)
         memset(p->data[0], 0, avctx->height * p->linesize[0]);
 
-    if(depth == 4 || depth == 8)
-        memset(p->data[1], 0, 1024);
-
     if(height > 0){
         ptr = p->data[0] + (avctx->height - 1) * p->linesize[0];
         linesize = -p->linesize[0];
@@ -239,8 +236,11 @@ static int bmp_decode_frame(AVCodecContext *avctx,
         linesize = p->linesize[0];
     }
 
-    if(avctx->pix_fmt == PIX_FMT_PAL8){
+    if(avctx->pix_fmt == AV_PIX_FMT_PAL8){
         int colors = 1 << depth;
+
+        memset(p->data[1], 0, 1024);
+
         if(ihsize >= 36){
             int t;
             buf = buf0 + 46;
@@ -364,7 +364,7 @@ static av_cold int bmp_decode_end(AVCodecContext *avctx)
 AVCodec ff_bmp_decoder = {
     .name           = "bmp",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_BMP,
+    .id             = AV_CODEC_ID_BMP,
     .priv_data_size = sizeof(BMPContext),
     .init           = bmp_decode_init,
     .close          = bmp_decode_end,