[FFmpeg-devel] [PATCH] avformat/img2dec: fix glob pattern detection.

Alexander Strasser eclipse7 at gmx.net
Fri Oct 3 01:20:31 CEST 2014


On 2014-10-02 22:51 +0200, Alexander Strasser wrote:
[...]
>   Maybe something like this patch would be acceptable
> (WARNING: only lightly tested):
> 
> diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c
> index 16bd699..aa7c2f6 100644
> --- a/libavformat/img2dec.c
> +++ b/libavformat/img2dec.c
> @@ -160,7 +160,7 @@ static int img_read_probe(AVProbeData *p)
>      if (p->filename && ff_guess_image2_codec(p->filename)) {
>          if (av_filename_number_test(p->filename))
>              return AVPROBE_SCORE_MAX;
> -        else if (is_glob(p->filename))
> +        else if (p->filename[strcspn(p->filename, "*?{\0")]) // glob pattern?

  I am sorry that superflous NUL slipped in there :(  Please ignore it.

  For as to why I did not include "[" in the list of glob chars, is
because I think it is too common in file and directory names to use
as a heuristic to favour image2 demuxer.

>              return AVPROBE_SCORE_MAX;
>          else if (p->buf_size == 0)
>              return 0;

[...]


  Alexander
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20141003/1ae179d4/attachment.asc>


More information about the ffmpeg-devel mailing list