diff options
Diffstat (limited to 'libavcodec/yuv4dec.c')
-rw-r--r-- | libavcodec/yuv4dec.c | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/libavcodec/yuv4dec.c b/libavcodec/yuv4dec.c index 8eb72c2..95cacbe 100644 --- a/libavcodec/yuv4dec.c +++ b/libavcodec/yuv4dec.c @@ -27,35 +27,23 @@ static av_cold int yuv4_decode_init(AVCodecContext *avctx) { avctx->pix_fmt = AV_PIX_FMT_YUV420P; - 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 yuv4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { - AVFrame *pic = avctx->coded_frame; + AVFrame *pic = data; const 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 < 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1)) { 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); } @@ -83,17 +71,12 @@ static int yuv4_decode_frame(AVCodecContext *avctx, void *data, } *got_frame = 1; - *(AVFrame *)data = *pic; return avpkt->size; } static av_cold int yuv4_decode_close(AVCodecContext *avctx) { - if (avctx->coded_frame->data[0]) - avctx->release_buffer(avctx, avctx->coded_frame); - - av_freep(&avctx->coded_frame); return 0; } |