]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/roqvideodec.c
cabac: split cabac.h into declarations and function definitions
[ffmpeg] / libavcodec / roqvideodec.c
index 3391ec4042fc3171f35b8a38c96c512a5703dca2..527ba51c99fc55d88ec2db10cf0277c88bcf16af 100644 (file)
@@ -1,34 +1,33 @@
 /*
  * Copyright (C) 2003 the ffmpeg project
  *
- * This file is part of FFmpeg.
+ * This file is part of Libav.
  *
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
  * License as published by the Free Software Foundation; either
  * version 2.1 of the License, or (at your option) any later version.
  *
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /**
- * @file roqvideodec.c
- * Id RoQ Video Decoder by Dr. Tim Ferguson
- * For more information about the Id RoQ format, visit:
+ * @file
+ * id RoQ Video Decoder by Dr. Tim Ferguson
+ * For more information about the id RoQ format, visit:
  *   http://www.csse.monash.edu.au/~timf/
  */
 
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
 
 #include "avcodec.h"
 #include "bytestream.h"
@@ -153,7 +152,7 @@ static void roqvideo_decode_frame(RoqContext *ri)
 }
 
 
-static int roq_decode_init(AVCodecContext *avctx)
+static av_cold int roq_decode_init(AVCodecContext *avctx)
 {
     RoqContext *s = avctx->priv_data;
 
@@ -169,11 +168,14 @@ static int roq_decode_init(AVCodecContext *avctx)
 
 static int roq_decode_frame(AVCodecContext *avctx,
                             void *data, int *data_size,
-                            const uint8_t *buf, int buf_size)
+                            AVPacket *avpkt)
 {
+    const uint8_t *buf = avpkt->data;
+    int buf_size = avpkt->size;
     RoqContext *s = avctx->priv_data;
     int copy= !s->current_frame->data[0];
 
+    s->current_frame->reference = 3;
     if (avctx->reget_buffer(avctx, s->current_frame)) {
         av_log(avctx, AV_LOG_ERROR, "  RoQ: get_buffer() failed\n");
         return -1;
@@ -196,7 +198,7 @@ static int roq_decode_frame(AVCodecContext *avctx,
     return buf_size;
 }
 
-static int roq_decode_end(AVCodecContext *avctx)
+static av_cold int roq_decode_end(AVCodecContext *avctx)
 {
     RoqContext *s = avctx->priv_data;
 
@@ -209,14 +211,14 @@ static int roq_decode_end(AVCodecContext *avctx)
     return 0;
 }
 
-AVCodec roq_decoder = {
-    "roqvideo",
-    CODEC_TYPE_VIDEO,
-    CODEC_ID_ROQ,
-    sizeof(RoqContext),
-    roq_decode_init,
-    NULL,
-    roq_decode_end,
-    roq_decode_frame,
-    CODEC_CAP_DR1,
+AVCodec ff_roq_decoder = {
+    .name           = "roqvideo",
+    .type           = AVMEDIA_TYPE_VIDEO,
+    .id             = CODEC_ID_ROQ,
+    .priv_data_size = sizeof(RoqContext),
+    .init           = roq_decode_init,
+    .close          = roq_decode_end,
+    .decode         = roq_decode_frame,
+    .capabilities   = CODEC_CAP_DR1,
+    .long_name = NULL_IF_CONFIG_SMALL("id RoQ video"),
 };