X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fjpeg2swf.c;h=7c23147d377ea0d5d7589b3d7d6a684e6666f090;hb=48d48fa9f1a7173381258b6e0f1765bc84c0a7a1;hp=8de7c1ad4d6e846bb77e049cc7025cf745668bdf;hpb=27dde1bf85a1656f41f10ecb7f68af555bfa7dd3;p=swftools.git diff --git a/src/jpeg2swf.c b/src/jpeg2swf.c index 8de7c1a..7c23147 100644 --- a/src/jpeg2swf.c +++ b/src/jpeg2swf.c @@ -93,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); @@ -205,7 +211,7 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int quality, t = swf_InsertTag(t, ST_VIDEOFRAME); swf_SetU16(t, 0xf00d); quant = 1+(30-(30*quality)/100); - if(!(frame&127)) { + if(!(frame%20)) { swf_SetVideoStreamIFrame(t, &stream, pic2, quant); } else { swf_SetVideoStreamPFrame(t, &stream, pic2, quant); @@ -234,6 +240,8 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int quality, swf_GetMatrix(NULL, &m); m.sx = 20 * 0x10000; m.sy = 20 * 0x10000; + m.tx = -10; + m.ty = -10; fs = swf_ShapeAddBitmapFillStyle(s, &m, id, 0); swf_SetU16(t, id + 1); // id r.xmin = r.ymin = 0; @@ -248,8 +256,10 @@ TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int quality, swf_ShapeSetLine(t, s, 0, -r.ymax); swf_ShapeSetEnd(t); - t = swf_InsertTag(t, ST_REMOVEOBJECT2); - swf_SetU16(t, 1); // depth + if(frame) { + t = swf_InsertTag(t, ST_REMOVEOBJECT2); + swf_SetU16(t, 1); // depth + } t = swf_InsertTag(t, ST_PLACEOBJECT2); swf_GetMatrix(NULL, &m); @@ -372,6 +382,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); @@ -401,6 +415,7 @@ static struct options_t options[] = { {"m", "mx"}, {"q", "quality"}, {"r", "rate"}, +{"z", "zlib"}, {"X", "width"}, {"Y", "height"}, {"v", "verbose"}, @@ -443,6 +458,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");