summaryrefslogtreecommitdiff
path: root/libavcodec/y41pdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/y41pdec.c')
-rw-r--r--libavcodec/y41pdec.c20
1 files changed, 2 insertions, 18 deletions
diff --git a/libavcodec/y41pdec.c b/libavcodec/y41pdec.c
index 655a426143..e53fe16966 100644
--- a/libavcodec/y41pdec.c
+++ b/libavcodec/y41pdec.c
@@ -32,34 +32,23 @@ static av_cold int y41p_decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_WARNING, "y41p requires width to be divisible by 8.\n");
}
- avctx->coded_frame = avcodec_alloc_frame();
- if (!avctx->coded_frame) {
- av_log(avctx, AV_LOG_ERROR, "Could not allocate frame.\n");
- return AVERROR(ENOMEM);
- }
-
return 0;
}
static int y41p_decode_frame(AVCodecContext *avctx, void *data,
int *got_frame, AVPacket *avpkt)
{
- AVFrame *pic = avctx->coded_frame;
+ AVFrame *pic = data;
uint8_t *src = avpkt->data;
uint8_t *y, *u, *v;
int i, j;
- if (pic->data[0])
- avctx->release_buffer(avctx, pic);
-
if (avpkt->size < 1.5 * avctx->height * avctx->width) {
av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n");
return AVERROR(EINVAL);
}
- pic->reference = 0;
-
- if (ff_get_buffer(avctx, pic) < 0) {
+ if (ff_get_buffer(avctx, pic, 0) < 0) {
av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n");
return AVERROR(ENOMEM);
}
@@ -90,17 +79,12 @@ static int y41p_decode_frame(AVCodecContext *avctx, void *data,
}
*got_frame = 1;
- *(AVFrame *)data = *pic;
return avpkt->size;
}
static av_cold int y41p_decode_close(AVCodecContext *avctx)
{
- if (avctx->coded_frame->data[0])
- avctx->release_buffer(avctx, avctx->coded_frame);
-
- av_freep(&avctx->coded_frame);
return 0;
}