[FFmpeg-devel] [PATCH] stricter dnxhd test

Baptiste Coudurier baptiste.coudurier
Mon Sep 14 23:00:10 CEST 2009


On 09/14/2009 01:54 PM, Reimar D?ffinger wrote:
> I believe this to be correct in so far as our decoder should fail for
> any formats this rejects.
> Unfortunately I was not able to find any samples for raw DNxHD (I thought
> there were some in the samples archive, but I didn't find any), so it is
> untested...

We have a dnxhd encoder :)

> Index: libavformat/raw.c
> ===================================================================
> --- libavformat/raw.c   (revision 19844)
> +++ libavformat/raw.c   (working copy)
> @@ -558,10 +558,17 @@
>   static int dnxhd_probe(AVProbeData *p)
>   {
>       static const uint8_t header[] = {0x00,0x00,0x02,0x80,0x01};
> -    if (!memcmp(p->buf, header, 5))
> -        return AVPROBE_SCORE_MAX;
> -    else
> +    int w, h, compression_id;
> +    if (memcmp(p->buf, header, 5))
>           return 0;
> +    h = AV_RB16(p->buf + 0x18);
> +    w = AV_RB16(p->buf + 0x1a);
> +    if (!w || !h)
> +        return 0;
> +    compression_id = AV_RB32(p->buf + 0x28);
> +    if (compression_id<  1237 || compression_id>  1253)
> +        return 0;
> +    return AVPROBE_SCORE_MAX;

Missing p->buf_size check ? AVPROBE_PADDING_SIZE is 32.

-- 
Baptiste COUDURIER
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
FFmpeg maintainer                                  http://www.ffmpeg.org



More information about the ffmpeg-devel mailing list