aboutsummaryrefslogtreecommitdiff
path: root/libavcodec/smacker.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/smacker.c')
-rw-r--r--libavcodec/smacker.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c
index bc75a17e63..c37fb14a4d 100644
--- a/libavcodec/smacker.c
+++ b/libavcodec/smacker.c
@@ -358,18 +358,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
GetByteContext gb2;
GetBitContext gb;
int blocks, blk, bw, bh;
- int i;
+ int i, ret;
int stride;
int flags;
if (avpkt->size <= 769)
return 0;
- smk->pic.reference = 1;
- smk->pic.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
- if(avctx->reget_buffer(avctx, &smk->pic) < 0){
+ if ((ret = ff_reget_buffer(avctx, &smk->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
/* make the palette available on the way out */
@@ -497,8 +495,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
}
+ if ((ret = av_frame_ref(data, &smk->pic)) < 0)
+ return ret;
+
*got_frame = 1;
- *(AVFrame*)data = smk->pic;
/* always report that the buffer was completely consumed */
return avpkt->size;
@@ -548,8 +548,7 @@ static av_cold int decode_end(AVCodecContext *avctx)
av_freep(&smk->full_tbl);
av_freep(&smk->type_tbl);
- if (smk->pic.data[0])
- avctx->release_buffer(avctx, &smk->pic);
+ av_frame_unref(&smk->pic);
return 0;
}
@@ -614,7 +613,7 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */
frame->nb_samples = unp_size / (avctx->channels * (bits + 1));
- if ((ret = ff_get_buffer(avctx, frame)) < 0) {
+ if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}