From 759001c534287a96dc96d1e274665feb7059145d Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Wed, 21 Nov 2012 21:34:46 +0100 Subject: lavc decoders: work with refcounted frames. --- libavcodec/indeo2.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'libavcodec/indeo2.c') diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index 1b4d51b6b1..37b3ea19cd 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -29,6 +29,7 @@ #include "avcodec.h" #include "get_bits.h" #include "indeo2data.h" +#include "internal.h" #include "mathops.h" typedef struct Ir2Context{ @@ -148,12 +149,7 @@ static int ir2_decode_frame(AVCodecContext *avctx, AVFrame * const p = &s->picture; int start, ret; - if (p->data[0]) - avctx->release_buffer(avctx, p); - - p->reference = 1; - p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; - if ((ret = avctx->reget_buffer(avctx, p)) < 0) { + if ((ret = ff_reget_buffer(avctx, p)) < 0) { av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } @@ -206,7 +202,9 @@ static int ir2_decode_frame(AVCodecContext *avctx, return ret; } - *picture = s->picture; + if ((ret = av_frame_ref(picture, &s->picture)) < 0) + return ret; + *got_frame = 1; return buf_size; @@ -241,8 +239,7 @@ static av_cold int ir2_decode_end(AVCodecContext *avctx) Ir2Context * const ic = avctx->priv_data; AVFrame *pic = &ic->picture; - if (pic->data[0]) - avctx->release_buffer(avctx, pic); + av_frame_unref(pic); return 0; } -- cgit v1.2.3