git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
small fix for previous commit
[swftools.git]
/
src
/
jpeg2swf.c
diff --git
a/src/jpeg2swf.c
b/src/jpeg2swf.c
index
39dd7ef
..
da3c318
100644
(file)
--- a/
src/jpeg2swf.c
+++ b/
src/jpeg2swf.c
@@
-45,8
+45,6
@@
struct {
int next_id;
char *asset_name;
int version;
int next_id;
char *asset_name;
int version;
- int xoffset;
- int yoffset;
int fit_to_movie;
float scale;
} global;
int fit_to_movie;
float scale;
} global;
@@
-83,8
+81,8
@@
TAG *MovieStart(SWF * swf, float framerate, int dx, int dy)
swf->movieSize.xmax = clip_x2 * 20;
swf->movieSize.ymax = clip_y2 * 20;
} else {
swf->movieSize.xmax = clip_x2 * 20;
swf->movieSize.ymax = clip_y2 * 20;
} else {
- swf->movieSize.xmin = global.xoffset * 20;
- swf->movieSize.ymin = global.yoffset * 20;
+ swf->movieSize.xmin = 0;
+ swf->movieSize.ymin = 0;
swf->movieSize.xmax = swf->movieSize.xmin + dx * 20;
swf->movieSize.ymax = swf->movieSize.ymin + dy * 20;
}
swf->movieSize.xmax = swf->movieSize.xmin + dx * 20;
swf->movieSize.ymax = swf->movieSize.ymin + dy * 20;
}
@@
-138,13
+136,11
@@
int MovieFinish(SWF * swf, TAG * t, char *sname)
sname = "output.swf";
handle = open(sname, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
}
sname = "output.swf";
handle = open(sname, O_BINARY | O_RDWR | O_CREAT | O_TRUNC, 0666);
}
- 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<0 && sname) {
+ perror(sname);
}
}
+ if (swf_WriteSWF(handle, swf)<0)
+ fprintf(stderr, "Unable to write output file: %s\n", sname);
if (handle != so)
close(handle);
if (handle != so)
close(handle);
@@
-290,16
+286,16
@@
TAG *MovieAddFrame(SWF * swf, TAG * t, char *sname, int quality,
width = movie_width / 20;
height = movie_height / 20;
} else {
width = movie_width / 20;
height = movie_height / 20;
} else {
- m.sx = 20 * 0x10000;
- m.sy = 20 * 0x10000;
+ m.sx = 20 * 0x10000;
+ m.sy = 20 * 0x10000;
}
}
- m.tx = global.xoffset * 20;
- m.ty = global.yoffset * 20;
+ m.tx = 0;
+ m.ty = 0;
fs = swf_ShapeAddBitmapFillStyle(s, &m, global.next_id, 1);
global.next_id++;
swf_SetU16(t, global.next_id); // id
fs = swf_ShapeAddBitmapFillStyle(s, &m, global.next_id, 1);
global.next_id++;
swf_SetU16(t, global.next_id); // id
- r.xmin = global.xoffset * 20;
- r.ymin = global.yoffset * 20;
+ r.xmin = 0;
+ r.ymin = 0;
r.xmax = r.xmin + width * 20;
r.ymax = r.ymin + height * 20;
swf_SetRect(t, &r);
r.xmax = r.xmin + width * 20;
r.ymax = r.ymin + height * 20;
swf_SetRect(t, &r);
@@
-465,18
+461,9
@@
int args_callback_option(char *arg, char *val)
global.asset_name = val;
res = 1;
break;
global.asset_name = val;
res = 1;
break;
-
- case 'x':
- if (val) {
- global.xoffset = atoi(val);
- }
- res = 1;
- break;
-
- case 'y':
- if (val) {
- global.yoffset = atoi(val);
- }
+
+ case 'T':
+ global.version = atoi(val);
res = 1;
break;
res = 1;
break;
@@
-506,6
+493,12
@@
int args_callback_option(char *arg, char *val)
break;
}
break;
}
+ case 'M': {
+ global.mx = 1;
+ res = 1;
+ break;
+ }
+
case 'm': {
char*s = strdup(val);
char*c = strchr(s, ':');
case 'm': {
char*s = strdup(val);
char*c = strchr(s, ':');
@@
-548,10
+541,12
@@
static struct options_t options[] = {
{"q", "quality"},
{"r", "rate"},
{"z", "zlib"},
{"q", "quality"},
{"r", "rate"},
{"z", "zlib"},
+{"M", "mx"},
{"x", "xoffset"},
{"y", "yoffset"},
{"X", "width"},
{"Y", "height"},
{"x", "xoffset"},
{"y", "yoffset"},
{"X", "width"},
{"Y", "height"},
+{"T", "flashversion"},
{"v", "verbose"},
{"V", "version"},
{"f", "fit-to-movie"},
{"v", "verbose"},
{"V", "version"},
{"f", "fit-to-movie"},
@@
-592,12
+587,14
@@
void args_callback_usage(char *name)
printf("\n");
printf("-o , --output <outputfile> Explicitly specify output file. (otherwise, output.swf will be used)\n");
printf("-q , --quality <quality> Set compression quality (1-100, 1=worst, 100=best)\n");
printf("\n");
printf("-o , --output <outputfile> Explicitly specify output file. (otherwise, output.swf will be used)\n");
printf("-q , --quality <quality> Set compression quality (1-100, 1=worst, 100=best)\n");
- printf("-r , --rate <framerate> Set movie framerate (frames per second)\n");
+ printf("-r , --rate <framerate> Set movie framerate (frames per second)\n");
printf("-z , --zlib <zlib> Enable Flash 6 (MX) Zlib Compression\n");
printf("-z , --zlib <zlib> Enable Flash 6 (MX) Zlib Compression\n");
+ printf("-M , --mx Use Flash MX H.263 compression (use for correlated images)\n");
printf("-x , --xoffset <offset> horizontally offset images by <offset>\n");
printf("-y , --yoffset <offset> vertically offset images by <offset>\n");
printf("-X , --width <width> Force movie width to <width> (default: autodetect)\n");
printf("-Y , --height <height> Force movie height to <height> (default: autodetect)\n");
printf("-x , --xoffset <offset> horizontally offset images by <offset>\n");
printf("-y , --yoffset <offset> vertically offset images by <offset>\n");
printf("-X , --width <width> Force movie width to <width> (default: autodetect)\n");
printf("-Y , --height <height> Force movie height to <height> (default: autodetect)\n");
+ printf("-T , --flashversion <version> Set flash file version to <version>\n");
printf("-v , --verbose <level> Set verbose level to <level> (0=quiet, 1=default, 2=debug)\n");
printf("-V , --version Print version information and exit\n");
printf("-f , --fit-to-movie Fit images to movie size\n");
printf("-v , --verbose <level> Set verbose level to <level> (0=quiet, 1=default, 2=debug)\n");
printf("-V , --version Print version information and exit\n");
printf("-f , --fit-to-movie Fit images to movie size\n");
@@
-619,8
+616,6
@@
int main(int argc, char **argv)
global.version = 4;
global.asset_name = NULL;
global.next_id = 1;
global.version = 4;
global.asset_name = NULL;
global.next_id = 1;
- global.xoffset = 0;
- global.yoffset = 0;
global.fit_to_movie = 0;
global.scale = 1.0;
global.fit_to_movie = 0;
global.scale = 1.0;