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/cllc.c | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) (limited to 'libavcodec/cllc.c') diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index 30dc53c..a6b51b3 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -271,18 +271,13 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, int *got_picture_ptr, AVPacket *avpkt) { CLLCContext *ctx = avctx->priv_data; - AVFrame *pic = avctx->coded_frame; + AVFrame *pic = data; uint8_t *src = avpkt->data; uint32_t info_tag, info_offset; int data_size; GetBitContext gb; int coding_type, ret; - if (pic->data[0]) - avctx->release_buffer(avctx, pic); - - pic->reference = 0; - /* Skip the INFO header if present */ info_offset = 0; info_tag = AV_RL32(src); @@ -334,7 +329,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_RGB24; avctx->bits_per_raw_sample = 8; - ret = ff_get_buffer(avctx, pic); + ret = ff_get_buffer(avctx, pic, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); return ret; @@ -349,7 +344,7 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_ARGB; avctx->bits_per_raw_sample = 8; - ret = ff_get_buffer(avctx, pic); + ret = ff_get_buffer(avctx, pic, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); return ret; @@ -369,7 +364,6 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, pic->pict_type = AV_PICTURE_TYPE_I; *got_picture_ptr = 1; - *(AVFrame *)data = *pic; return avpkt->size; } @@ -378,10 +372,6 @@ static av_cold int cllc_decode_close(AVCodecContext *avctx) { CLLCContext *ctx = avctx->priv_data; - if (avctx->coded_frame->data[0]) - avctx->release_buffer(avctx, avctx->coded_frame); - - av_freep(&avctx->coded_frame); av_freep(&ctx->swapped_buf); return 0; @@ -398,12 +388,6 @@ static av_cold int cllc_decode_init(AVCodecContext *avctx) ff_dsputil_init(&ctx->dsp, avctx); - avctx->coded_frame = avcodec_alloc_frame(); - if (!avctx->coded_frame) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n"); - return AVERROR(ENOMEM); - } - return 0; } -- cgit v1.1