aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mmvideo.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/mmvideo.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/mmvideo.c')
-rw-r--r--libavcodec/mmvideo.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c
index 784b939734..7101f8033f 100644
--- a/libavcodec/mmvideo.c
+++ b/libavcodec/mmvideo.c
@@ -34,6 +34,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#define MM_PREAMBLE_SIZE 6
@@ -60,8 +61,6 @@ static av_cold int mm_decode_init(AVCodecContext *avctx)
avctx->pix_fmt = AV_PIX_FMT_PAL8;
- s->frame.reference = 1;
-
return 0;
}
@@ -187,9 +186,9 @@ static int mm_decode_frame(AVCodecContext *avctx,
buf_size -= MM_PREAMBLE_SIZE;
bytestream2_init(&s->gb, buf, buf_size);
- if (avctx->reget_buffer(avctx, &s->frame) < 0) {
+ if ((res = ff_reget_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
- return -1;
+ return res;
}
switch(type) {
@@ -209,8 +208,10 @@ static int mm_decode_frame(AVCodecContext *avctx,
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
+ if ((res = av_frame_ref(data, &s->frame)) < 0)
+ return res;
+
*got_frame = 1;
- *(AVFrame*)data = s->frame;
return buf_size;
}
@@ -219,8 +220,7 @@ static av_cold int mm_decode_end(AVCodecContext *avctx)
{
MmContext *s = avctx->priv_data;
- if(s->frame.data[0])
- avctx->release_buffer(avctx, &s->frame);
+ av_frame_unref(&s->frame);
return 0;
}