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/truemotion2.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/truemotion2.c')
-rw-r--r-- | libavcodec/truemotion2.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index d517906e43..2ecfb93161 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -28,6 +28,7 @@ #include "bytestream.h" #include "get_bits.h" #include "dsputil.h" +#include "internal.h" #define TM2_ESCAPE 0x80000000 #define TM2_DELTAS 64 @@ -847,9 +848,8 @@ static int decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); } - p->reference = 1; - p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; - if ((ret = avctx->reget_buffer(avctx, p)) < 0) { + + if ((ret = ff_reget_buffer(avctx, p)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(swbuf); return ret; @@ -883,10 +883,10 @@ static int decode_frame(AVCodecContext *avctx, l->cur = !l->cur; *got_frame = 1; - *(AVFrame*)data = l->pic; + ret = av_frame_ref(data, &l->pic); av_free(swbuf); - return buf_size; + return (ret < 0) ? ret : buf_size; } static av_cold int decode_init(AVCodecContext *avctx) @@ -968,8 +968,7 @@ static av_cold int decode_end(AVCodecContext *avctx) av_free(l->V2_base); } - if (pic->data[0]) - avctx->release_buffer(avctx, pic); + av_frame_unref(pic); return 0; } |