[FFmpeg-devel] [patch] allow wordexp globs in image2 file sequence import

Aurelien Jacobs aurel
Tue Jan 4 00:22:49 CET 2011


On Sun, Jan 02, 2011 at 09:26:08PM -0500, Brian Olson wrote:
> On Jan 2, 2011, at 5:47 PM, Aurelien Jacobs wrote:
> 
> > No. None of those !
> > s->use_wordexp should be used unconditionally. Not under any kind of
> > #if. And thus use_wordexp should always be part of the structure
> > definition so its definition shouldn't be under #if either.
> > 
> > Aurel
> 
> 
> Oh, yes. That is eminently reasonable and makes good code. Updated
> patch attached.

Yes, that's what I meant.

> I think I saw that memory is being allocated and zeroed, so
> s->use_wordexp will default to off, as it should.

Yes indeed.

> Index: libavformat/img2.c
> ===================================================================
> --- libavformat/img2.c	(revision 26178)
> +++ libavformat/img2.c	(working copy)
> [...]
> @@ -117,6 +124,14 @@
>      return CODEC_ID_NONE;
>  }
>  
> +static int is_wordexp(const char* path) {
> +#if HAVE_WORDEXP
> +    return 0 != strspn(path, "*?[](){}\\");
> +#else
> +    return 0;
> +#endif
> +}

This looks wrong. This won't detect expressions such as "pict*.jpeg".
And it would look cleaner without #if:

static int is_wordexp(const char* path) {
    return HAVE_WORDEXP && strcspn(path, "*?[](){}\\") != strlen(path);
}

Aurel



More information about the ffmpeg-devel mailing list