X-Git-Url: http://git.asbjorn.biz/?p=swftools.git;a=blobdiff_plain;f=src%2Fjpeg2swf.c;h=aa01fbc69086ecd99f74fac5c42a2cd1d2945a65;hp=4d485ef55bb138faac4dbe623bad8e5968edb0d0;hb=6f3e9add89a0157ef6552bc154475b43b371e615;hpb=aee9de2c6eb23628e54b6896f5b441d9b39317c1 diff --git a/src/jpeg2swf.c b/src/jpeg2swf.c index 4d485ef..aa01fbc 100644 --- a/src/jpeg2swf.c +++ b/src/jpeg2swf.c @@ -33,7 +33,7 @@ struct { int quality; - int framerate; + float framerate; int max_image_width; int max_image_height; int force_width; @@ -54,7 +54,7 @@ image_t image[MAX_INPUT_FILES]; VIDEOSTREAM stream; -TAG *MovieStart(SWF * swf, int framerate, int dx, int dy) +TAG *MovieStart(SWF * swf, float framerate, int dx, int dy) { TAG *t; RGBA rgb; @@ -62,7 +62,7 @@ TAG *MovieStart(SWF * swf, int framerate, int dx, int dy) memset(swf, 0x00, sizeof(SWF)); swf->fileVersion = 4; - swf->frameRate = (25600 / framerate); + swf->frameRate = (int)(256.0 * framerate); swf->movieSize.xmax = dx * 20; swf->movieSize.ymax = dy * 20; @@ -338,8 +338,8 @@ int args_callback_option(char *arg, char *val) case 'r': if (val) - global.framerate = atoi(val); - if ((global.framerate < 1) ||(global.framerate > 5000)) { + global.framerate = atof(val); + if ((global.framerate < 1.0/256) || (global.framerate >= 256.0)) { if (VERBOSE(1)) fprintf(stderr, "Error: You must specify a valid framerate between 1 and 10000.\n"); @@ -394,14 +394,16 @@ int args_callback_option(char *arg, char *val) return res; } -struct options_t options[] = { {"q", "quality"}, +static struct options_t options[] = { {"o", "output"}, {"m", "mx"}, +{"q", "quality"}, {"r", "rate"}, -{"v", "verbose"}, {"X", "width"}, {"Y", "height"}, +{"v", "verbose"}, {"V", "version"}, +{0,0} }; int args_callback_longoption(char *name, char *val) @@ -432,29 +434,18 @@ int args_callback_command(char *arg, char *next) // actually used as filename void args_callback_usage(char *name) { - printf - ("Usage: %s [-options [value]] imagefiles[.jpg]|[.jpeg] [...]\n", - name); - printf - ("-o outputfile --output explicitly specify output file. (otherwise, output.swf will be used)\n"); - printf - ("-m --mx Use Flash MX H.263 compression (use for correlated images)\n"); - printf - ("-q quality --quality Set compression quality (1-100, 1=worst, 100=best)\n"); - printf - ("-r framerate --rate Set movie framerate (100/sec)\n"); - printf - ("-o outputfile --output Set name for SWF output file\n"); - printf - ("-X pixel --width Force movie width to pixel (default: autodetect)\n"); - printf - ("-Y pixel --height Force movie height to pixel (default: autodetect)\n"); - printf - ("-v level --verbose Set verbose level (0=quiet, 1=default, 2=debug)\n"); - printf - ("-V --version Print version information and exit\n"); - printf - ("The following options can be set independently for each image: -q -s\n"); + printf("\n"); + printf("Usage: %s [-options [value]] imagefiles[.jpg]|[.jpeg] [...]\n", name); + printf("\n"); + printf("-o , --output Explicitly specify output file. (otherwise, output.swf will be used)\n"); + printf("-m , --mx Use Flash MX H.263 compression (use for correlated images)\n"); + printf("-q , --quality Set compression quality (1-100, 1=worst, 100=best)\n"); + printf("-r , --rate Set movie framerate (frames per second)\n"); + printf("-X , --width Force movie width to (default: autodetect)\n"); + printf("-Y , --height Force movie height to (default: autodetect)\n"); + printf("-v , --verbose Set verbose level to (0=quiet, 1=default, 2=debug)\n"); + printf("-V , --version Print version information and exit\n"); + printf("\n"); } @@ -466,7 +457,7 @@ int main(int argc, char **argv) memset(&global, 0x00, sizeof(global)); global.quality = 60; - global.framerate = 100; + global.framerate = 1.0; global.verbose = 1; processargs(argc, argv);