diff options
Diffstat (limited to 'libavcodec/012v.c')
-rw-r--r-- | libavcodec/012v.c | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/libavcodec/012v.c b/libavcodec/012v.c index 6f4533b14c..51c0d0ca0f 100644 --- a/libavcodec/012v.c +++ b/libavcodec/012v.c @@ -29,15 +29,9 @@ static av_cold int zero12v_decode_init(AVCodecContext *avctx) avctx->pix_fmt = PIX_FMT_YUV422P16; avctx->bits_per_raw_sample = 10; - avctx->coded_frame = avcodec_alloc_frame(); - if (!avctx->coded_frame) - return AVERROR(ENOMEM); - if (avctx->codec_tag == MKTAG('a', '1', '2', 'v')) av_log_ask_for_sample(avctx, "Samples with actual transparency needed\n"); - avctx->coded_frame->pict_type = AV_PICTURE_TYPE_I; - avctx->coded_frame->key_frame = 1; return 0; } @@ -46,14 +40,11 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data, { int line = 0, ret; const int width = avctx->width; - AVFrame *pic = avctx->coded_frame; + AVFrame *pic = data; uint16_t *y, *u, *v; const uint8_t *line_end, *src = avpkt->data; int stride = avctx->width * 8 / 3; - if (pic->data[0]) - avctx->release_buffer(avctx, pic); - if (width == 1) { av_log(avctx, AV_LOG_ERROR, "Width 1 not supported.\n"); return AVERROR_INVALIDDATA; @@ -64,10 +55,12 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - pic->reference = 0; - if ((ret = ff_get_buffer(avctx, pic)) < 0) + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; + pic->pict_type = AV_PICTURE_TYPE_I; + pic->key_frame = 1; + y = (uint16_t *)pic->data[0]; u = (uint16_t *)pic->data[1]; v = (uint16_t *)pic->data[2]; @@ -145,27 +138,15 @@ static int zero12v_decode_frame(AVCodecContext *avctx, void *data, } *got_frame = 1; - *(AVFrame*)data= *avctx->coded_frame; return avpkt->size; } -static av_cold int zero12v_decode_close(AVCodecContext *avctx) -{ - AVFrame *pic = avctx->coded_frame; - if (pic->data[0]) - avctx->release_buffer(avctx, pic); - av_freep(&avctx->coded_frame); - - return 0; -} - AVCodec ff_zero12v_decoder = { .name = "012v", .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_012V, .init = zero12v_decode_init, - .close = zero12v_decode_close, .decode = zero12v_decode_frame, .capabilities = CODEC_CAP_DR1, .long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"), |