aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/qpeg.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/qpeg.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/qpeg.c')
-rw-r--r--libavcodec/qpeg.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c
index c295543c38..afcb2dfc97 100644
--- a/libavcodec/qpeg.c
+++ b/libavcodec/qpeg.c
@@ -26,6 +26,7 @@
#include "avcodec.h"
#include "bytestream.h"
+#include "internal.h"
typedef struct QpegContext{
AVCodecContext *avctx;
@@ -256,8 +257,7 @@ static int decode_frame(AVCodecContext *avctx,
}
bytestream2_init(&a->buffer, avpkt->data, avpkt->size);
- p->reference = 3;
- if ((ret = avctx->reget_buffer(avctx, p)) < 0) {
+ if ((ret = ff_reget_buffer(avctx, p)) < 0) {
av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
return ret;
}
@@ -280,8 +280,10 @@ static int decode_frame(AVCodecContext *avctx,
}
memcpy(a->pic.data[1], a->pal, AVPALETTE_SIZE);
+ if ((ret = av_frame_ref(data, &a->pic)) < 0)
+ return ret;
+
*got_frame = 1;
- *(AVFrame*)data = a->pic;
return avpkt->size;
}
@@ -300,8 +302,7 @@ static av_cold int decode_end(AVCodecContext *avctx){
QpegContext * const a = avctx->priv_data;
AVFrame * const p = &a->pic;
- if(p->data[0])
- avctx->release_buffer(avctx, p);
+ av_frame_unref(p);
av_free(a->refdata);
return 0;