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/mss4.c | |
parent | 6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff) | |
download | ffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz |
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/mss4.c')
-rw-r--r-- | libavcodec/mss4.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index f4e4d8ddb4..a74c363dda 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -29,6 +29,7 @@ #include "bytestream.h" #include "dsputil.h" #include "get_bits.h" +#include "internal.h" #include "mss34dsp.h" #include "unary.h" @@ -553,11 +554,7 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - c->pic.reference = 3; - c->pic.buffer_hints = FF_BUFFER_HINTS_VALID | - FF_BUFFER_HINTS_PRESERVE | - FF_BUFFER_HINTS_REUSABLE; - if ((ret = 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 ret; } @@ -566,7 +563,8 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, : AV_PICTURE_TYPE_P; if (frame_type == SKIP_FRAME) { *got_frame = 1; - *(AVFrame*)data = c->pic; + if ((ret = av_frame_ref(data, &c->pic)) < 0) + return ret; return buf_size; } @@ -622,8 +620,10 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, dst[2] += c->pic.linesize[2] * 16; } + if ((ret = av_frame_ref(data, &c->pic)) < 0) + return ret; + *got_frame = 1; - *(AVFrame*)data = c->pic; return buf_size; } @@ -649,7 +649,6 @@ static av_cold int mss4_decode_init(AVCodecContext *avctx) } avctx->pix_fmt = AV_PIX_FMT_YUV444P; - avctx->coded_frame = &c->pic; return 0; } @@ -659,8 +658,7 @@ static av_cold int mss4_decode_end(AVCodecContext *avctx) MSS4Context * const c = avctx->priv_data; int i; - if (c->pic.data[0]) - avctx->release_buffer(avctx, &c->pic); + av_frame_unref(&c->pic); for (i = 0; i < 3; i++) av_freep(&c->prev_dc[i]); mss4_free_vlcs(c); |