On Tuesday 26 August 2003 10:25, Ronald Bultje wrote: > Interesting code in line 464 of jpeg2yuv.c: > > if (param->loop != 1) > loops--; > > Somehow, I believe this is a typo and should read '-1' instead of '1'. > Could you re-try with that change?
Could be. Just changing that line didn't make any difference, though. In generate_YUV4MPEG(), there is a loops = param->loop;. Param->loop seem to be zero, regardless of -n, loops-- decrements loops and the first comparison while(loops) does is to a negative loops. It all seems to boil down to a section of parse_commandline(): case 'l': param->loop = atoi(optarg); if (param->loop == 0) mjpeg_error_exit1( "-l option requires a number greater than 0"); break; Earlier, param->loop is initialized to 0, and if one doesn't supply -l (which I didn't do), the zero check isn't performed. The man page has this to say: -l num Specifies the nummber of loops (default: 0 loops ) When this option is not used the given range of images is only processed once. If you use this option and as number 1, jpeg2yv will loop forever writing the image to stdout. When you use n > 1 it will loop. n-time till it finishes. which almost is consistent with 1.6.1.90's behaviour. However, I'd like to propose a couple of changes: Line 464: 1: if (param->loop != -1) loops--; This will break the previous meaning of -l: In 1.60.1.90 "-l 1" means "loop forever". This would change "loop forever" to "-l -1". With this change, "-l 1" means "one copy", "-l 2" "two copies", and so on. 2: static void parse_commandline(int argc, char ** argv, parameters_t *param) { param->loop = 1; } Initialize loop to 1, meaning one copy, instead of the illegal and possibly-never-catched 0. 3: In the usage text: " -l num loop -1=forever, l >= 1 n-times \n" 4: In the man page: -l num Specifies the number of loops (default: 1 loop ) When this option is not used the given range of images is only processed once. If you use -l -1, jpeg2yuv will loop forever writing the image to stdout. When you use l >= 1 it will loop n-times until it finishes. (The man page mentions n in the l instructions. Correct or a typo?) With these changes, -n 1 -l 1 gives one copy of one file, -n 2 -l 1 gives one copy each of two files, and -n 1 -l 2 gives two copies of one file. Guess what -n 2 -l 2 does? Does this make sense at all? /Sam ------------------------------------------------------- This SF.net email is sponsored by: VM Ware With VMware you can run multiple operating systems on a single machine. WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0 _______________________________________________ Mjpeg-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/mjpeg-users