]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/v210dec.c
x86: h264qpel: Move stray comment to the right spot and clarify it
[ffmpeg] / libavcodec / v210dec.c
index d464572f781337b4590ed59cf3bcb2415ae82f5e..2a6aa613763ead7ee9126b5e6df76954c31645a5 100644 (file)
  */
 
 #include "avcodec.h"
+#include "internal.h"
 #include "libavutil/bswap.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
 
 static av_cold int decode_init(AVCodecContext *avctx)
 {
     if (avctx->width & 1) {
         av_log(avctx, AV_LOG_ERROR, "v210 needs even width\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
-    avctx->pix_fmt             = PIX_FMT_YUV422P10;
+    avctx->pix_fmt             = AV_PIX_FMT_YUV422P10;
     avctx->bits_per_raw_sample = 10;
 
     avctx->coded_frame         = avcodec_alloc_frame();
@@ -40,10 +43,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
     return 0;
 }
 
-static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
+static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
                         AVPacket *avpkt)
 {
-    int h, w;
+    int h, w, ret;
     AVFrame *pic = avctx->coded_frame;
     const uint8_t *psrc = avpkt->data;
     uint16_t *y, *u, *v;
@@ -55,12 +58,12 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
 
     if (avpkt->size < stride * avctx->height) {
         av_log(avctx, AV_LOG_ERROR, "packet too small\n");
-        return -1;
+        return AVERROR_INVALIDDATA;
     }
 
     pic->reference = 0;
-    if (avctx->get_buffer(avctx, pic) < 0)
-        return -1;
+    if ((ret = ff_get_buffer(avctx, pic)) < 0)
+        return ret;
 
     y = (uint16_t*)pic->data[0];
     u = (uint16_t*)pic->data[1];
@@ -106,7 +109,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size,
         v += pic->linesize[2] / 2 - avctx->width / 2;
     }
 
-    *data_size = sizeof(AVFrame);
+    *got_frame      = 1;
     *(AVFrame*)data = *avctx->coded_frame;
 
     return avpkt->size;
@@ -125,10 +128,10 @@ static av_cold int decode_close(AVCodecContext *avctx)
 AVCodec ff_v210_decoder = {
     .name           = "v210",
     .type           = AVMEDIA_TYPE_VIDEO,
-    .id             = CODEC_ID_V210,
+    .id             = AV_CODEC_ID_V210,
     .init           = decode_init,
     .close          = decode_close,
     .decode         = decode_frame,
     .capabilities   = CODEC_CAP_DR1,
-    .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
+    .long_name      = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
 };