summaryrefslogtreecommitdiff
path: root/libavcodec/truemotion2.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/truemotion2.c')
-rw-r--r--libavcodec/truemotion2.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index eacd728ca4..8c28a816f6 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -28,6 +28,7 @@
#include "bytestream.h"
#include "get_bits.h"
#include "dsputil.h"
+#include "internal.h"
#define TM2_ESCAPE 0x80000000
#define TM2_DELTAS 64
@@ -866,9 +867,8 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n");
return AVERROR(ENOMEM);
}
- p->reference = 3;
- p->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
- if ((ret = avctx->reget_buffer(avctx, p)) < 0) {
+
+ if ((ret = ff_reget_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -902,9 +902,9 @@ static int decode_frame(AVCodecContext *avctx,
l->cur = !l->cur;
*got_frame = 1;
- *(AVFrame*)data = l->pic;
+ ret = av_frame_ref(data, &l->pic);
- return buf_size;
+ return (ret < 0) ? ret : buf_size;
}
static av_cold int decode_init(AVCodecContext *avctx)
@@ -989,8 +989,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
av_freep(&l->buffer);
l->buffer_size = 0;
- if (pic->data[0])
- avctx->release_buffer(avctx, pic);
+ av_frame_unref(pic);
return 0;
}