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/ivi_common.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/ivi_common.c')
-rw-r--r-- | libavcodec/ivi_common.c | 21 |
1 files changed, 7 insertions, 14 deletions
diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 76782e5173..3d7cd13b7f 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -811,6 +811,7 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, { IVI45DecContext *ctx = avctx->priv_data; const uint8_t *buf = avpkt->data; + AVFrame *frame = data; int buf_size = avpkt->size; int result, p, b; @@ -861,30 +862,25 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, av_log(avctx, AV_LOG_ERROR, "Buffer contains IP frames!\n"); } - if (ctx->frame.data[0]) - avctx->release_buffer(avctx, &ctx->frame); - - ctx->frame.reference = 0; avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height); - if ((result = ff_get_buffer(avctx, &ctx->frame)) < 0) { + if ((result = ff_get_buffer(avctx, frame, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return result; } if (ctx->is_scalable) { if (avctx->codec_id == AV_CODEC_ID_INDEO4) - ff_ivi_recompose_haar(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]); + ff_ivi_recompose_haar(&ctx->planes[0], frame->data[0], frame->linesize[0]); else - ff_ivi_recompose53 (&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]); + ff_ivi_recompose53 (&ctx->planes[0], frame->data[0], frame->linesize[0]); } else { - ivi_output_plane(&ctx->planes[0], ctx->frame.data[0], ctx->frame.linesize[0]); + ivi_output_plane(&ctx->planes[0], frame->data[0], frame->linesize[0]); } - ivi_output_plane(&ctx->planes[2], ctx->frame.data[1], ctx->frame.linesize[1]); - ivi_output_plane(&ctx->planes[1], ctx->frame.data[2], ctx->frame.linesize[2]); + ivi_output_plane(&ctx->planes[2], frame->data[1], frame->linesize[1]); + ivi_output_plane(&ctx->planes[1], frame->data[2], frame->linesize[2]); *got_frame = 1; - *(AVFrame*)data = ctx->frame; return buf_size; } @@ -901,9 +897,6 @@ av_cold int ff_ivi_decode_close(AVCodecContext *avctx) if (ctx->mb_vlc.cust_tab.table) ff_free_vlc(&ctx->mb_vlc.cust_tab); - if (ctx->frame.data[0]) - avctx->release_buffer(avctx, &ctx->frame); - #if IVI4_STREAM_ANALYSER if (avctx->codec_id == AV_CODEC_ID_INDEO4) { if (ctx->is_scalable) |