X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fdpx.c;h=156f1deaa49e4d33780adea6b2304c809ce98558;hb=87cf70eb237e7586cc7399627dafa1b980ec0b7d;hp=82891d6b42086bbd6b3d14244635770aeb703d05;hpb=3777ea13fbf690003f8b0d83a8bffb6e1d71c3df;p=ffmpeg diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index 82891d6b420..156f1deaa49 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -68,7 +68,7 @@ static int decode_frame(AVCodecContext *avctx, unsigned int rgbBuffer; - if (avpkt->size <= 0x324) { + if (avpkt->size <= 1634) { av_log(avctx, AV_LOG_ERROR, "Packet too small for DPX header\n"); return AVERROR_INVALIDDATA; } @@ -106,6 +106,10 @@ static int decode_frame(AVCodecContext *avctx, avctx->bits_per_raw_sample = bits_per_color = buf[0]; + buf += 825; + avctx->sample_aspect_ratio.num = read32(&buf, endian); + avctx->sample_aspect_ratio.den = read32(&buf, endian); + switch (descriptor) { case 51: // RGBA elements = 4; @@ -230,15 +234,12 @@ static av_cold int decode_end(AVCodecContext *avctx) } AVCodec ff_dpx_decoder = { - "dpx", - AVMEDIA_TYPE_VIDEO, - CODEC_ID_DPX, - sizeof(DPXContext), - decode_init, - NULL, - decode_end, - decode_frame, - 0, - NULL, + .name = "dpx", + .type = AVMEDIA_TYPE_VIDEO, + .id = CODEC_ID_DPX, + .priv_data_size = sizeof(DPXContext), + .init = decode_init, + .close = decode_end, + .decode = decode_frame, .long_name = NULL_IF_CONFIG_SMALL("DPX image"), };