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/mss1.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/mss1.c')
-rw-r--r-- | libavcodec/mss1.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c index c9edb2e2d7..dffdde5a15 100644 --- a/libavcodec/mss1.c +++ b/libavcodec/mss1.c @@ -25,6 +25,7 @@ */ #include "avcodec.h" +#include "internal.h" #include "mss12.h" typedef struct MSS1Context { @@ -150,10 +151,7 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, init_get_bits(&gb, buf, buf_size * 8); arith_init(&acoder, &gb); - ctx->pic.reference = 3; - ctx->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_READABLE | - FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; - if ((ret = avctx->reget_buffer(avctx, &ctx->pic)) < 0) { + if ((ret = ff_reget_buffer(avctx, &ctx->pic)) < 0) { av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); return ret; } @@ -180,8 +178,10 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, memcpy(ctx->pic.data[1], c->pal, AVPALETTE_SIZE); ctx->pic.palette_has_changed = pal_changed; + if ((ret = av_frame_ref(data, &ctx->pic)) < 0) + return ret; + *got_frame = 1; - *(AVFrame*)data = ctx->pic; /* always report that the buffer was completely consumed */ return buf_size; @@ -206,8 +206,7 @@ static av_cold int mss1_decode_end(AVCodecContext *avctx) { MSS1Context * const ctx = avctx->priv_data; - if (ctx->pic.data[0]) - avctx->release_buffer(avctx, &ctx->pic); + av_frame_unref(&ctx->pic); ff_mss12_decode_end(&ctx->ctx); return 0; |