X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjpeg2swf.c;h=f20b53f8f1e5fe8d6c3a75f46bab167ce844ef3d;hb=4869bc5b2b604ddc9ac43f954f1448f6c868e571;hp=fad11522bd90b646909b79153713fb576677e9ca;hpb=5480f1eae83c641a75b225db52bbfc1fcb62e6b6;p=swftools.git diff --git a/src/jpeg2swf.c b/src/jpeg2swf.c index fad1152..f20b53f 100644 --- a/src/jpeg2swf.c +++ b/src/jpeg2swf.c @@ -42,6 +42,7 @@ struct { int verbose; char *outfile; int mx; + int version; } global; typedef struct _image { @@ -61,7 +62,7 @@ TAG *MovieStart(SWF * swf, float framerate, int dx, int dy) memset(swf, 0x00, sizeof(SWF)); - swf->fileVersion = 4; + swf->fileVersion = global.version; swf->frameRate = (int)(256.0 * framerate); swf->movieSize.xmax = dx * 20; swf->movieSize.ymax = dy * 20; @@ -92,8 +93,14 @@ int MovieFinish(SWF * swf, TAG * t, char *sname) sname = "output.swf"; handle = open(sname, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666); } - if (swf_WriteSWF(handle, swf)<0) - fprintf(stderr, "Unable to write output file: %s\n", sname); + if(global.version >= 6) { + if (swf_WriteSWC(handle, swf)<0) + fprintf(stderr, "Unable to write output file: %s\n", sname); + } else { + if (swf_WriteSWF(handle, swf)<0) + fprintf(stderr, "Unable to write output file: %s\n", sname); + } + if (handle != so) close(handle); @@ -368,6 +375,7 @@ int args_callback_option(char *arg, char *val) case 'm': global.mx = 1; + global.version = 6; return 0; case 'Y': @@ -394,15 +402,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}, +{0,0} }; int args_callback_longoption(char *name, char *val) @@ -433,29 +442,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 (frames per second)\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\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"); } @@ -469,6 +467,7 @@ int main(int argc, char **argv) global.quality = 60; global.framerate = 1.0; global.verbose = 1; + global.version = 4; processargs(argc, argv);