summaryrefslogtreecommitdiff
path: root/libavcodec/mss3.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-11-21 21:34:46 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-08 07:38:30 +0100
commit759001c534287a96dc96d1e274665feb7059145d (patch)
tree6ace9560c20aa30db92067c5b45d7bd86e458d10 /libavcodec/mss3.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/mss3.c')
-rw-r--r--libavcodec/mss3.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c
index 689daeee5d..fa5b99c454 100644
--- a/libavcodec/mss3.c
+++ b/libavcodec/mss3.c
@@ -27,6 +27,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "dsputil.h"
+#include "internal.h"
#include "mss34dsp.h"
#define HEADER_SIZE 27
@@ -730,18 +731,16 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
return buf_size;
c->got_error = 0;
- 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;
}
c->pic.key_frame = keyframe;
c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
if (!bytestream2_get_bytes_left(&gb)) {
+ if ((ret = av_frame_ref(data, &c->pic)) < 0)
+ return ret;
*got_frame = 1;
- *(AVFrame*)data = c->pic;
return buf_size;
}
@@ -798,8 +797,10 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
dst[2] += c->pic.linesize[2] * 8;
}
+ if ((ret = av_frame_ref(data, &c->pic)) < 0)
+ return ret;
+
*got_frame = 1;
- *(AVFrame*)data = c->pic;
return buf_size;
}
@@ -836,7 +837,6 @@ static av_cold int mss3_decode_init(AVCodecContext *avctx)
}
avctx->pix_fmt = AV_PIX_FMT_YUV420P;
- avctx->coded_frame = &c->pic;
init_coders(c);
@@ -848,8 +848,7 @@ static av_cold int mss3_decode_end(AVCodecContext *avctx)
MSS3Context * 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->dct_coder[i].prev_dc);