X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=avi2swf%2Favi2swf.cc;h=bd7d8572a42c09e332f127ae3c38fb584fe30ede;hb=5c5bdb50a110c125e97152a78782bc268b19d8d7;hp=5c1d0d2206de7124fa784b027e0e19295367caaa;hpb=3e770482e133ffce30534c46795da19e8fec0e97;p=swftools.git diff --git a/avi2swf/avi2swf.cc b/avi2swf/avi2swf.cc index 5c1d0d2..bd7d857 100644 --- a/avi2swf/avi2swf.cc +++ b/avi2swf/avi2swf.cc @@ -13,6 +13,7 @@ extern "C" { #include "../lib/rfxswf.h" #include "../lib/args.h" } +#undef HAVE_CONFIG_H #include #if (AVIFILE_MAJOR_VERSION == 0) && (AVIFILE_MINOR_VERSION>=6) #include @@ -57,6 +58,7 @@ static int jpeg_quality = 20; static char zlib = 0; static double scale = 1.0; +static int flip = 0; #ifndef ST_DEFINEBITSJPEG #define ST_DEFINEBITSJPEG 6 @@ -69,7 +71,9 @@ struct options_t options[] = {"v","verbose"}, {"o","output"}, {"n","num"}, + {"p","flip"}, {"s","start"}, + {"d","scale"}, {"z","zlib"}, {"V","version"}, {0,0} @@ -93,6 +97,10 @@ int args_callback_option(char*name,char*val) firstframe = atoi(val); return 1; } + else if(!strcmp(name, "p")) { + flip = 1; + return 0; + } else if(!strcmp(name, "d")) { scale = atoi(val)/100.0; if(scale>1.0 || scale<=0) { @@ -120,6 +128,7 @@ void args_callback_usage(char*name) printf("\t-n , --num frames\t Number of frames to encode\n"); printf("\t-s , --start frame\t First frame to encode\n"); printf("\t-d , --scale factor\t Scale to factor percent\n"); + printf("\t-p , --flip\t\t Turn movie upside down\n"); printf("\t-V , --version\t\t Print program version and exit\n"); exit(0); } @@ -305,7 +314,7 @@ class GfxBlockCache { } best = bestsum/block->len; - if(best > 96.0) { + if(best > 64.0) { misses++; return -1; } @@ -710,9 +719,9 @@ int main (int argc,char ** argv) int c=0; if(first) { //first run tag = swf_InsertTag(NULL, ST_SOUNDSTREAMBLOCK); - swf_SetSoundStreamBlock(tag, samples, 1); + swf_SetSoundStreamBlock(tag, samples, 0, 1); } else { - swf_SetSoundStreamBlock(tag, samples, 0); + swf_SetSoundStreamBlock(tag, samples, 0, 0); } mp3_sound_pos += mp3_block_size; @@ -754,12 +763,14 @@ int main (int argc,char ** argv) { int x,y; for(y=0;y=7 don't */ -#if (AVIFILE_MAJOR_VERSION == 0) && (AVIFILE_MINOR_VERSION==6) - U8*mydata = img->At(oldheight-(int)((yy*yblocksize+y)*reziscale)); -#else - U8*mydata = img->At((int)((yy*yblocksize+y)*reziscale)); -#endif + /* some avifile versions flip the image some don't. Maybe this is + even movie dependent. We just let the user decide which side's up. */ + U8*mydata; + if(flip) + mydata = img->At(oldheight-(int)((yy*yblocksize+y)*reziscale)); + else + mydata = img->At((int)((yy*yblocksize+y)*reziscale)); + for(x=0;x