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/loco.c | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'libavcodec/loco.c') diff --git a/libavcodec/loco.c b/libavcodec/loco.c index b1ad41ae46..427a56f0fa 100644 --- a/libavcodec/loco.c +++ b/libavcodec/loco.c @@ -45,7 +45,6 @@ enum LOCO_MODE { typedef struct LOCOContext { AVCodecContext *avctx; - AVFrame pic; int lossy; int mode; } LOCOContext; @@ -173,14 +172,10 @@ static int decode_frame(AVCodecContext *avctx, LOCOContext * const l = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; - AVFrame * const p = &l->pic; + AVFrame * const p = data; int decoded, ret; - if (p->data[0]) - avctx->release_buffer(avctx, p); - - p->reference = 0; - if ((ret = ff_get_buffer(avctx, p)) < 0) { + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return ret; } @@ -260,7 +255,6 @@ static int decode_frame(AVCodecContext *avctx, } *got_frame = 1; - *(AVFrame*)data = l->pic; return buf_size; buf_too_small: @@ -321,24 +315,12 @@ static av_cold int decode_init(AVCodecContext *avctx) return 0; } -static av_cold int decode_end(AVCodecContext *avctx) -{ - LOCOContext * const l = avctx->priv_data; - AVFrame *pic = &l->pic; - - if (pic->data[0]) - avctx->release_buffer(avctx, pic); - - return 0; -} - AVCodec ff_loco_decoder = { .name = "loco", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_LOCO, .priv_data_size = sizeof(LOCOContext), .init = decode_init, - .close = decode_end, .decode = decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("LOCO"), -- cgit v1.2.3