diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-21 21:34:46 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-03-08 07:38:30 +0100 |
commit | 759001c534287a96dc96d1e274665feb7059145d (patch) | |
tree | 6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/fraps.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/fraps.c')
-rw-r--r-- | libavcodec/fraps.c | 34 |
1 files changed, 9 insertions, 25 deletions
diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index 237cb743f9..2a5a5a8b38 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -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,7 +61,6 @@ 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; @@ -161,7 +161,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 +184,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 +221,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 +244,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 +288,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 +334,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 +351,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; |