]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/fraps.c
lavc: remove disabled FF_API_COLOR_TABLE_ID cruft
[ffmpeg] / libavcodec / fraps.c
index 237cb743f9255e56004069995eaae15a2a11f20a..66ecdef419c770405980cbc4dd0638261cdbc1b5 100644 (file)
@@ -36,6 +36,7 @@
 #include "huffman.h"
 #include "bytestream.h"
 #include "dsputil.h"
+#include "internal.h"
 
 #define FPS_TAG MKTAG('F', 'P', 'S', 'x')
 
@@ -60,12 +61,13 @@ static av_cold int decode_init(AVCodecContext *avctx)
 {
     FrapsContext * const s = avctx->priv_data;
 
-    avctx->coded_frame = &s->frame;
     avctx->pix_fmt     = AV_PIX_FMT_NONE; /* set in decode_frame */
 
     s->avctx  = avctx;
     s->tmpbuf = NULL;
 
+    avcodec_get_frame_defaults(&s->frame);
+
     ff_dsputil_init(&s->dsp, avctx);
 
     return 0;
@@ -161,7 +163,7 @@ static int decode_frame(AVCodecContext *avctx,
 
     pix_fmt = version & 1 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P;
     if (avctx->pix_fmt != pix_fmt && f->data[0]) {
-        avctx->release_buffer(avctx, f);
+        av_frame_unref(f);
     }
     avctx->pix_fmt = pix_fmt;
 
@@ -184,11 +186,7 @@ static int decode_frame(AVCodecContext *avctx,
             return AVERROR_INVALIDDATA;
         }
 
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if ((ret = avctx->reget_buffer(avctx, f)) < 0) {
+        if ((ret = ff_reget_buffer(avctx, f)) < 0) {
             av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
             return ret;
         }
@@ -225,11 +223,7 @@ static int decode_frame(AVCodecContext *avctx,
             return AVERROR_INVALIDDATA;
         }
 
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if ((ret = avctx->reget_buffer(avctx, f)) < 0) {
+        if ((ret = ff_reget_buffer(avctx, f)) < 0) {
             av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
             return ret;
         }
@@ -252,11 +246,7 @@ static int decode_frame(AVCodecContext *avctx,
          * Fraps v4 is virtually the same
          */
         planes = 3;
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if ((ret = avctx->reget_buffer(avctx, f)) < 0) {
+        if ((ret = ff_reget_buffer(avctx, f)) < 0) {
             av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
             return ret;
         }
@@ -300,11 +290,7 @@ static int decode_frame(AVCodecContext *avctx,
     case 5:
         /* Virtually the same as version 4, but is for RGB24 */
         planes = 3;
-        f->reference = 1;
-        f->buffer_hints = FF_BUFFER_HINTS_VALID |
-                          FF_BUFFER_HINTS_PRESERVE |
-                          FF_BUFFER_HINTS_REUSABLE;
-        if ((ret = avctx->reget_buffer(avctx, f)) < 0) {
+        if ((ret = ff_reget_buffer(avctx, f)) < 0) {
             av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
             return ret;
         }
@@ -350,7 +336,8 @@ static int decode_frame(AVCodecContext *avctx,
         break;
     }
 
-    *frame = *f;
+    if ((ret = av_frame_ref(frame, f)) < 0)
+        return ret;
     *got_frame = 1;
 
     return buf_size;
@@ -366,8 +353,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
 {
     FrapsContext *s = (FrapsContext*)avctx->priv_data;
 
-    if (s->frame.data[0])
-        avctx->release_buffer(avctx, &s->frame);
+    av_frame_unref(&s->frame);
 
     av_freep(&s->tmpbuf);
     return 0;