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/vmnc.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/vmnc.c')
-rw-r--r-- | libavcodec/vmnc.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 4071cdf51a..41e4730b44 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -31,6 +31,7 @@ #include "libavutil/common.h" #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "internal.h" enum EncTypes { MAGIC_WMVd = 0x574D5664, @@ -293,13 +294,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, VmncContext * const c = avctx->priv_data; uint8_t *outptr; const uint8_t *src = buf; - int dx, dy, w, h, depth, enc, chunks, res, size_left; + int dx, dy, w, h, depth, enc, chunks, res, size_left, ret; - c->pic.reference = 1; - c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; - if(avctx->reget_buffer(avctx, &c->pic) < 0){ + if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return -1; + return ret; } c->pic.key_frame = 0; @@ -448,7 +447,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } } *got_frame = 1; - *(AVFrame*)data = c->pic; + if ((ret = av_frame_ref(data, &c->pic)) < 0) + return ret; /* always report that the buffer was completely consumed */ return buf_size; @@ -502,8 +502,7 @@ static av_cold int decode_end(AVCodecContext *avctx) { VmncContext * const c = avctx->priv_data; - if (c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); + av_frame_unref(&c->pic); av_free(c->curbits); av_free(c->curmask); |