summaryrefslogtreecommitdiff
path: root/libavcodec/smc.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/smc.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/smc.c')
-rw-r--r--libavcodec/smc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/libavcodec/smc.c b/libavcodec/smc.c
index 1834003a39..de81a43e91 100644
--- a/libavcodec/smc.c
+++ b/libavcodec/smc.c
@@ -35,6 +35,7 @@
#include "libavutil/intreadwrite.h"
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
#define CPAIR 2
#define CQUAD 4
@@ -429,15 +430,13 @@ static int smc_decode_frame(AVCodecContext *avctx,
int buf_size = avpkt->size;
SmcContext *s = avctx->priv_data;
const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL);
+ int ret;
bytestream2_init(&s->gb, buf, buf_size);
- s->frame.reference = 1;
- s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE |
- FF_BUFFER_HINTS_REUSABLE | FF_BUFFER_HINTS_READABLE;
- if (avctx->reget_buffer(avctx, &s->frame)) {
+ if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) {
av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
- return -1;
+ return ret;
}
if (pal) {
@@ -448,7 +447,8 @@ static int smc_decode_frame(AVCodecContext *avctx,
smc_decode_stream(s);
*got_frame = 1;
- *(AVFrame*)data = s->frame;
+ if ((ret = av_frame_ref(data, &s->frame)) < 0)
+ return ret;
/* always report that the buffer was completely consumed */
return buf_size;
@@ -458,8 +458,7 @@ static av_cold int smc_decode_end(AVCodecContext *avctx)
{
SmcContext *s = avctx->priv_data;
- if (s->frame.data[0])
- avctx->release_buffer(avctx, &s->frame);
+ av_frame_unref(&s->frame);
return 0;
}