aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/xwddec.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/xwddec.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/xwddec.c')
-rw-r--r--libavcodec/xwddec.c30
1 files changed, 2 insertions, 28 deletions
diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c
index 274e4fa103..23f9c01d60 100644
--- a/libavcodec/xwddec.c
+++ b/libavcodec/xwddec.c
@@ -26,19 +26,10 @@
#include "internal.h"
#include "xwd.h"
-static av_cold int xwd_decode_init(AVCodecContext *avctx)
-{
- avctx->coded_frame = avcodec_alloc_frame();
- if (!avctx->coded_frame)
- return AVERROR(ENOMEM);
-
- return 0;
-}
-
static int xwd_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
- AVFrame *p = avctx->coded_frame;
+ AVFrame *p = data;
const uint8_t *buf = avpkt->data;
int i, ret, buf_size = avpkt->size;
uint32_t version, header_size, vclass, ncolors;
@@ -205,11 +196,7 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
return AVERROR_PATCHWELCOME;
}
- if (p->data[0])
- avctx->release_buffer(avctx, p);
-
- p->reference = 0;
- if ((ret = ff_get_buffer(avctx, p)) < 0) {
+ if ((ret = ff_get_buffer(avctx, p, 0)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret;
}
@@ -243,27 +230,14 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data,
}
*got_frame = 1;
- *(AVFrame *)data = *p;
return buf_size;
}
-static av_cold int xwd_decode_close(AVCodecContext *avctx)
-{
- if (avctx->coded_frame->data[0])
- avctx->release_buffer(avctx, avctx->coded_frame);
-
- av_freep(&avctx->coded_frame);
-
- return 0;
-}
-
AVCodec ff_xwd_decoder = {
.name = "xwd",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_XWD,
- .init = xwd_decode_init,
- .close = xwd_decode_close,
.decode = xwd_decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("XWD (X Window Dump) image"),