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/dvdec.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/dvdec.c')
-rw-r--r-- | libavcodec/dvdec.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 441deadaab..cc9c232c60 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -326,16 +326,12 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, return -1; /* NOTE: we only accept several full frames */ } - if (s->picture.data[0]) - avctx->release_buffer(avctx, &s->picture); - - s->picture.reference = 0; s->picture.key_frame = 1; s->picture.pict_type = AV_PICTURE_TYPE_I; avctx->pix_fmt = s->sys->pix_fmt; avctx->time_base = s->sys->time_base; avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); - if (ff_get_buffer(avctx, &s->picture) < 0) { + if (ff_get_buffer(avctx, &s->picture, 0) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); return -1; } @@ -350,7 +346,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, /* return image */ *got_frame = 1; - *(AVFrame*)data = s->picture; + av_frame_move_ref(data, &s->picture); /* Determine the codec's sample_aspect ratio from the packet */ vsc_pack = buf + 80*5 + 48 + 5; @@ -367,8 +363,7 @@ static int dvvideo_close(AVCodecContext *c) { DVVideoContext *s = c->priv_data; - if (s->picture.data[0]) - c->release_buffer(c, &s->picture); + av_frame_unref(&s->picture); return 0; } |