]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/8bps.c
libavcodec/utils: Add braces to shut up gcc warnings
[ffmpeg] / libavcodec / 8bps.c
index a686b728b993c3cb23b78debe80d3c008dc6acb9..8f0692c4ba874e20f9fb185251700cb7204eb515 100644 (file)
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 
+#include "libavutil/internal.h"
 #include "libavutil/intreadwrite.h"
 #include "avcodec.h"
+#include "internal.h"
 
 
-static const enum PixelFormat pixfmt_rgb24[] = {
-    PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE };
+static const enum AVPixelFormat pixfmt_rgb24[] = {
+    AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB32, AV_PIX_FMT_NONE };
 
-/*
- * Decoder context
- */
 typedef struct EightBpsContext {
     AVCodecContext *avctx;
     AVFrame pic;
@@ -54,14 +54,8 @@ typedef struct EightBpsContext {
     uint32_t pal[256];
 } EightBpsContext;
 
-
-/*
- *
- * Decode a frame
- *
- */
 static int decode_frame(AVCodecContext *avctx, void *data,
-                        int *data_size, AVPacket *avpkt)
+                        int *got_frame, AVPacket *avpkt)
 {
     const uint8_t *buf = avpkt->data;
     int buf_size       = avpkt->size;
@@ -81,7 +75,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
 
     c->pic.reference    = 0;
     c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
-    if (avctx->get_buffer(avctx, &c->pic) < 0){
+    if (ff_get_buffer(avctx, &c->pic) < 0){
         av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
         return -1;
     }
@@ -93,7 +87,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
     if (planes == 4)
         planes--;
 
-    px_inc = planes + (avctx->pix_fmt == PIX_FMT_RGB32);
+    px_inc = planes + (avctx->pix_fmt == AV_PIX_FMT_RGB32);
 
     for (p = 0; p < planes; p++) {
         /* Lines length pointer for this plane */
@@ -146,19 +140,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
         memcpy (c->pic.data[1], c->pal, AVPALETTE_SIZE);
     }
 
-    *data_size = sizeof(AVFrame);
+    *got_frame = 1;
     *(AVFrame*)data = c->pic;
 
     /* always report that the buffer was completely consumed */
     return buf_size;
 }
 
-
-/*
- *
- * Init 8BPS decoder
- *
- */
 static av_cold int decode_init(AVCodecContext *avctx)
 {
     EightBpsContext * const c = avctx->priv_data;
@@ -168,7 +156,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     switch (avctx->bits_per_coded_sample) {
     case 8:
-        avctx->pix_fmt = PIX_FMT_PAL8;
+        avctx->pix_fmt = AV_PIX_FMT_PAL8;
         c->planes      = 1;
         c->planemap[0] = 0; // 1st plane is palette indexes
         break;
@@ -180,7 +168,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
         c->planemap[2] = 0; // 3rd plane is blue
         break;
     case 32:
-        avctx->pix_fmt = PIX_FMT_RGB32;
+        avctx->pix_fmt = AV_PIX_FMT_RGB32;
         c->planes      = 4;
 #if HAVE_BIGENDIAN
         c->planemap[0] = 1; // 1st plane is red
@@ -203,14 +191,6 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-
-
-
-/*
- *
- * Uninit 8BPS decoder
- *
- */
 static av_cold int decode_end(AVCodecContext *avctx)
 {
     EightBpsContext * const c = avctx->priv_data;
@@ -221,8 +201,6 @@ static av_cold int decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-
-
 AVCodec ff_eightbps_decoder = {
     .name           = "8bps",
     .type           = AVMEDIA_TYPE_VIDEO,