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

Brian Olson icic
Sun Jan 2 18:59:34 CET 2011


On Jan 1, 2011, at 6:42 PM, Aurelien Jacobs wrote:

> This function can be reduced to:
> 
> static int is_wordexp(const char* path) {
>    return strcspn(path,"*?[]{}\\") != strlen(path);
> }

Good tip. I hadn't run into that part of strings.h before. Thanks. I've attached an updated diff to use that (and clean up another couple things I noticed on my Nth pass over the code).

>> +static int use_wordexp(VideoData *s) {
>> +    return s->use_wordexp;
>> +}
> 
> This function is just a useless and ugly indirection.
> Drop it and access s->use_wordexp directly instead (get it out of
> the ifdef).

It's either that or the altenately ugly
#if HAVE_WORDEXP
if (s->use_wordexp) {
  // foo
} else
#endif
{
  // bar
}

By defining a function that can be redefined #if ! HAVE_WORDEXP, the layout of "if(){...}else{...}" stays cleaner.
If there's a strong opinion to go with plan B like my psuedocode above, I'll do that, just wanted to explain why I did it.


Brian Olson
http://bolson.org/

-------------- next part --------------
A non-text attachment was scrubbed...
Name: img2_wordexp_20110102.diff
Type: application/octet-stream
Size: 5526 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20110102/ada3643c/attachment.obj>



More information about the ffmpeg-devel mailing list