summaryrefslogtreecommitdiff
path: root/libavcodec/jvdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/jvdec.c')
-rw-r--r--libavcodec/jvdec.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c
index 53d8285788..067845eeba 100644
--- a/libavcodec/jvdec.c
+++ b/libavcodec/jvdec.c
@@ -28,6 +28,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "get_bits.h"
+#include "internal.h"
#include "libavutil/intreadwrite.h"
typedef struct JvContext {
@@ -135,7 +136,7 @@ static int decode_frame(AVCodecContext *avctx,
JvContext *s = avctx->priv_data;
const uint8_t *buf = avpkt->data;
const uint8_t *buf_end = buf + avpkt->size;
- int video_size, video_type, ret, i, j;
+ int video_size, video_type, i, j, ret;
if (avpkt->size < 6)
return AVERROR_INVALIDDATA;
@@ -149,7 +150,7 @@ static int decode_frame(AVCodecContext *avctx,
av_log(avctx, AV_LOG_ERROR, "video size %d invalid\n", video_size);
return AVERROR_INVALIDDATA;
}
- if ((ret = avctx->reget_buffer(avctx, &s->frame)) < 0) {
+ if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -190,8 +191,9 @@ static int decode_frame(AVCodecContext *avctx,
s->palette_has_changed = 0;
memcpy(s->frame.data[1], s->palette, AVPALETTE_SIZE);
+ if ((ret = av_frame_ref(data, &s->frame)) < 0)
+ return ret;
*got_frame = 1;
- *(AVFrame*)data = s->frame;
}
return avpkt->size;
@@ -201,8 +203,7 @@ static av_cold int decode_close(AVCodecContext *avctx)
{
JvContext *s = avctx->priv_data;
- if(s->frame.data[0])
- avctx->release_buffer(avctx, &s->frame);
+ av_frame_unref(&s->frame);
return 0;
}