From 6bc6f6368354fb8d16e9a8fb005135a7ac5d16e8 Mon Sep 17 00:00:00 2001 From: kramm Date: Sat, 30 Oct 2004 15:18:14 +0000 Subject: [PATCH] added -z option. --- src/jpeg2swf.c | 6 ++++++ src/jpeg2swf.doc | 4 ++++ src/png2swf.c | 19 +++++++++++++++++-- src/png2swf.doc | 4 ++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/jpeg2swf.c b/src/jpeg2swf.c index f20b53f..16efc3c 100644 --- a/src/jpeg2swf.c +++ b/src/jpeg2swf.c @@ -378,6 +378,10 @@ int args_callback_option(char *arg, char *val) global.version = 6; return 0; + case 'z': + global.version = 6; + return 0; + case 'Y': if (val) global.force_height = atoi(val); @@ -407,6 +411,7 @@ static struct options_t options[] = { {"m", "mx"}, {"q", "quality"}, {"r", "rate"}, +{"z", "zlib"}, {"X", "width"}, {"Y", "height"}, {"v", "verbose"}, @@ -449,6 +454,7 @@ void args_callback_usage(char *name) 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("-z , --zlib Enable Flash 6 (MX) Zlib Compression\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"); diff --git a/src/jpeg2swf.doc b/src/jpeg2swf.doc index a2ecb82..7275b09 100644 --- a/src/jpeg2swf.doc +++ b/src/jpeg2swf.doc @@ -17,6 +17,10 @@ converted picture is a seperate frame in the target SWF. This option can be set independently for each image. -r --rate Set movie framerate (frames per second) +-z --zlib + Enable Flash 6 (MX) Zlib Compression + Use Flash MX (SWF 6) Zlib encoding for the output. The resulting SWF will be + smaller, but not playable in Flash Plugins of Version 5 and below. -X --width Force movie width to (default: autodetect) -Y --height diff --git a/src/png2swf.c b/src/png2swf.c index 6d4fd77..e01e0b9 100644 --- a/src/png2swf.c +++ b/src/png2swf.c @@ -39,6 +39,7 @@ struct { int nfiles; int verbose; int do_cgi; + int version; char *outfile; } global; @@ -53,7 +54,7 @@ TAG *MovieStart(SWF * swf, float framerate, int dx, int dy) memset(swf, 0x00, sizeof(SWF)); - swf->fileVersion = 5; + swf->fileVersion = global.version; swf->frameRate = (int)(256.0 * framerate); swf->movieSize.xmax = dx * 20; swf->movieSize.ymax = dy * 20; @@ -83,7 +84,13 @@ int MovieFinish(SWF * swf, TAG * t, char *sname) if(global.do_cgi) { if FAILED(swf_WriteCGI(swf)) fprintf(stderr,"WriteCGI() failed.\n"); } else { - if FAILED(swf_WriteSWF(f,swf)) fprintf(stderr,"WriteSWF() failed.\n"); + 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 (f != so) close(f); } @@ -783,6 +790,11 @@ int args_callback_option(char *arg, char *val) res = 1; break; + case 'z': + global.version = 1; + res = 1; + break; + case 'C': global.do_cgi = 1; break; @@ -826,6 +838,7 @@ int args_callback_option(char *arg, char *val) static struct options_t options[] = { {"r", "rate"}, {"o", "output"}, +{"z", "zlib"}, {"X", "pixel"}, {"Y", "pixel"}, {"v", "verbose"}, @@ -865,6 +878,7 @@ void args_callback_usage(char *name) printf("\n"); printf("-r , --rate Set movie framerate (frames per second)\n"); printf("-o , --output Set name for SWF output file.\n"); + printf("-z , --zlib Enable Flash 6 (MX) Zlib Compression\n"); printf("-X , --pixel Force movie width to (default: autodetect)\n"); printf("-Y , --pixel Force movie height to (default: autodetect)\n"); printf("-v , --verbose Set verbose level (0=quiet, 1=default, 2=debug)\n"); @@ -882,6 +896,7 @@ int main(int argc, char **argv) global.framerate = 1.0; global.verbose = 1; + global.version = 4; processargs(argc, argv); diff --git a/src/png2swf.doc b/src/png2swf.doc index dc2a572..1f97d59 100644 --- a/src/png2swf.doc +++ b/src/png2swf.doc @@ -18,6 +18,10 @@ though, to preserve the alpha, which can't be encoded in any other way in the SW -o, --output Set name for SWF output file. Explicitly specify output file. (Otherwise, output will go to stdout / output.swf) +-z --zlib + Enable Flash 6 (MX) Zlib Compression + Use Flash MX (SWF 6) Zlib encoding for the output. The resulting SWF will be + smaller, but not playable in Flash Plugins of Version 5 and below. -X, --pixel Force movie width to (default: autodetect) -Y, --pixel -- 1.7.10.4