[FFmpeg-devel] [PATCH] Move av_open_input_file probe loop to its own method

Stefano Sabatini stefano.sabatini-lala
Tue Mar 23 09:17:06 CET 2010


On date Monday 2010-03-22 20:41:44 -0400, Micah F. Galizia encoded:
> Index: libavformat/utils.c
> ===================================================================
> --- libavformat/utils.c	(revision 22639)
> +++ libavformat/utils.c	(working copy)
> @@ -478,7 +478,8 @@
>          return AVERROR(EINVAL);
>      }
>  
> -    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0; probe_size<<=1){
> +    for(probe_size= PROBE_BUF_MIN; probe_size<=max_probe_size && !*fmt && ret >= 0;
> +        probe_size = FFMIN(probe_size<<1, FFMAX(max_probe_size, probe_size+1))) {
>          int ret, score = probe_size < max_probe_size ? AVPROBE_SCORE_MAX/4 : 0;
>          int buf_offset = (probe_size == PROBE_BUF_MIN) ? 0 : probe_size>>1;
>  
> @@ -513,6 +514,11 @@
>      }
>  
>      av_free(buf);
> +
> +    if (!*fmt) {
> +        return AVERROR(EINVAL);
> +    }

AVERROR_INVALIDDATA, like in av_open_input_file().

Regards.
-- 
FFmpeg = Fiendish and Free Mastering Pitiful Erroneous Gem



More information about the ffmpeg-devel mailing list