From 6792559f8aa8fb0775b259fa35c9a5dc2dd24796 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 9 Nov 2013 10:14:46 +0100 Subject: vc1: use the AVFrame API properly. --- libavcodec/vc1dec.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'libavcodec/vc1dec.c') diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 0f22ebe081..5c9eb8be98 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5364,8 +5364,8 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) int width = v->output_width>>!!plane; for (row = 0; row < v->output_height>>!!plane; row++) { - uint8_t *dst = v->sprite_output_frame.data[plane] + - v->sprite_output_frame.linesize[plane] * row; + uint8_t *dst = v->sprite_output_frame->data[plane] + + v->sprite_output_frame->linesize[plane] * row; for (sprite = 0; sprite <= v->two_sprites; sprite++) { uint8_t *iplane = s->current_picture.f.data[plane]; @@ -5455,8 +5455,8 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) v->two_sprites = 0; } - av_frame_unref(&v->sprite_output_frame); - if (ff_get_buffer(avctx, &v->sprite_output_frame, 0) < 0) { + av_frame_unref(v->sprite_output_frame); + if (ff_get_buffer(avctx, v->sprite_output_frame, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -5673,6 +5673,10 @@ static av_cold int vc1_decode_init(AVCodecContext *avctx) v->res_sprite = (avctx->codec_id == AV_CODEC_ID_VC1IMAGE); } + v->sprite_output_frame = av_frame_alloc(); + if (!v->sprite_output_frame) + return AVERROR(ENOMEM); + avctx->profile = v->profile; if (v->profile == PROFILE_ADVANCED) avctx->level = v->level; @@ -5714,7 +5718,7 @@ av_cold int ff_vc1_decode_end(AVCodecContext *avctx) VC1Context *v = avctx->priv_data; int i; - av_frame_unref(&v->sprite_output_frame); + av_frame_free(&v->sprite_output_frame); for (i = 0; i < 4; i++) av_freep(&v->sr_rows[i >> 1][i & 1]); @@ -6085,7 +6089,7 @@ image: if (vc1_decode_sprites(v, &s->gb)) goto err; #endif - if ((ret = av_frame_ref(pict, &v->sprite_output_frame)) < 0) + if ((ret = av_frame_ref(pict, v->sprite_output_frame)) < 0) goto err; *got_frame = 1; } else { -- cgit v1.2.3