Hi Benoit, thank you for investigating this issue and sending a patch.
On 2014-09-22 12:30 +0200, Benoit Fouet wrote: > The is_glob() function was not working with unescaped glob patterns, > which is the way only glob_sequence (which is deprecated) works. > Fixes ticket #3948 > --- > libavformat/img2dec.c | 14 +------------- > 1 file changed, 1 insertion(+), 13 deletions(-) > > diff --git a/libavformat/img2dec.c b/libavformat/img2dec.c > index a21429f..64ebc31 100644 > --- a/libavformat/img2dec.c > +++ b/libavformat/img2dec.c > @@ -75,19 +75,7 @@ static int infer_size(int *width_ptr, int *height_ptr, int > size) > static int is_glob(const char *path) The way you want to change this function makes its semantics unsuitable for the other place it is called. Actually it is not the is_glob that is wrong here but the problem is the way the demuxer selection changed since commit b3fd2b17 which fixed ticket #3901. Though I agree it would be desirable to have the command line pointed out in ticket #3948 still working. One way to do achieve it is to be more heuristic like you did below. > { > #if HAVE_GLOB > - size_t span = 0; > - const char *p = path; > - > - while (p = strchr(p, '%')) { > - if (*(++p) == '%') { > - ++p; > - continue; > - } > - if (span = strspn(p, "*?[]{}")) > - break; > - } > - /* Did we hit a glob char or get to the end? */ > - return span != 0; > + return strspn(path, "%*?[]{}") != 0; This seems wrong; it would only work for '*.png' but not for './*.png' or 'dir/*.png'. or 'foo-*.png' etc. 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? return AVPROBE_SCORE_MAX; else if (p->buf_size == 0) return 0; [...] Alexander
pgpwJheujtWq8.pgp
Description: PGP signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel