summaryrefslogtreecommitdiff
path: root/libavcodec/wnv1.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/wnv1.c
parent6e7b50b4270116ded8b874d76cb7c5b1a0341827 (diff)
downloadffmpeg-759001c534287a96dc96d1e274665feb7059145d.tar.gz
lavc decoders: work with refcounted frames.
Diffstat (limited to 'libavcodec/wnv1.c')
-rw-r--r--libavcodec/wnv1.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c
index 0e727db418..2f9fc413b0 100644
--- a/libavcodec/wnv1.c
+++ b/libavcodec/wnv1.c
@@ -32,7 +32,6 @@
typedef struct WNV1Context {
AVCodecContext *avctx;
- AVFrame pic;
int shift;
GetBitContext gb;
@@ -65,7 +64,7 @@ static int decode_frame(AVCodecContext *avctx,
WNV1Context * const l = avctx->priv_data;
const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size;
- AVFrame * const p = &l->pic;
+ AVFrame * const p = data;
unsigned char *Y,*U,*V;
int i, j, ret;
int prev_y = 0, prev_u = 0, prev_v = 0;
@@ -77,11 +76,7 @@ static int decode_frame(AVCodecContext *avctx,
return AVERROR(ENOMEM);
}
- 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");
av_free(rbuf);
return ret;
@@ -125,7 +120,6 @@ static int decode_frame(AVCodecContext *avctx,
*got_frame = 1;
- *(AVFrame*)data = l->pic;
av_free(rbuf);
return buf_size;
@@ -148,24 +142,12 @@ static av_cold int decode_init(AVCodecContext *avctx)
return 0;
}
-static av_cold int decode_end(AVCodecContext *avctx)
-{
- WNV1Context * const l = avctx->priv_data;
- AVFrame *pic = &l->pic;
-
- if (pic->data[0])
- avctx->release_buffer(avctx, pic);
-
- return 0;
-}
-
AVCodec ff_wnv1_decoder = {
.name = "wnv1",
.type = AVMEDIA_TYPE_VIDEO,
.id = AV_CODEC_ID_WNV1,
.priv_data_size = sizeof(WNV1Context),
.init = decode_init,
- .close = decode_end,
.decode = decode_frame,
.capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"),