[FFmpeg-devel] [PATCH] reduce score returned by FLIC format

Reimar Döffinger Reimar.Doeffinger
Wed Mar 26 15:34:53 CET 2008


Hello,
On Wed, Mar 26, 2008 at 07:14:52AM -0700, Mike Melanson wrote:
> Index: libavformat/flic.c
> ===================================================================
> --- libavformat/flic.c	(revision 12594)
> +++ libavformat/flic.c	(working copy)
> @@ -53,14 +53,26 @@
>  static int flic_probe(AVProbeData *p)
>  {
>      int magic_number;
> +    int width;
> +    int height;
>  
>      magic_number = AV_RL16(&p->buf[4]);
> +    width = AV_RL16(&p->buf[8]);
> +    height = AV_RL16(&p->buf[10]);
> +
> +    /* sanity-check the dimensions */
> +    if ((width < 4) && (width > 2048))
> +        return 0;
> +    if ((height < 4) && (height > 2048))
> +        return 0;
> +
>      if ((magic_number != FLIC_FILE_MAGIC_1) &&
>          (magic_number != FLIC_FILE_MAGIC_2) &&
>          (magic_number != FLIC_FILE_MAGIC_3))
>          return 0;

IMO check width/height last and e.g. return AVPROBE_SCORE_MAX/4 if the
check fails.

> -    return AVPROBE_SCORE_MAX;
> +    /* never completely sure */
> +    return 9*AVPROBE_SCORE_MAX/10;

AVPROBE_SCORE_MAX*9/10

looks much nicer to my eyes...




More information about the ffmpeg-devel mailing list