new parameter addspacechars
[swftools.git] / avi2swf / avi2swf.cc
index a9e4619..c68fedb 100644 (file)
@@ -49,6 +49,7 @@ static float audio_adjust = 0;
 static int mp3_bitrate = 32;
 static int samplerate = 11025;
 static int numframes = 0;
+static char* skipframes = 0;
 
 static struct options_t options[] = {
 {"h", "help"},
@@ -57,10 +58,11 @@ static struct options_t options[] = {
 {"n", "num"},
 {"m", "mp3-bitrate"},
 {"r", "mp3-samplerate"},
-{"d", "scale"},
-{"k", "keyframe"},
+{"s", "scale"},
+{"S", "skipframes"},
 {"p", "flip"},
 {"q", "quality"},
+{"k", "keyframe"},
 {"x", "extragood"},
 {"T", "flashversion"},
 {"V", "version"},
@@ -119,7 +121,7 @@ int args_callback_option(char*name,char*val)
     }
     else if(!strcmp(name, "m")) {
        mp3_bitrate = atoi(val);
-       return 0;
+       return 1;
     }
     else if(!strcmp(name, "r")) {
         samplerate = atoi(val);
@@ -140,6 +142,10 @@ int args_callback_option(char*name,char*val)
        skip = atoi(val);
        return 1;
     }
+    else if(!strcmp(name, "C")) {
+       skipframes = strdup(val);
+       return 1;
+    }
     else if(!strcmp(name, "s")) {
        scale = atoi(val)/100.0;
        if(scale>1.0 || scale<=0) {
@@ -166,9 +172,11 @@ void args_callback_usage(char *name)
     printf("-n , --num frames              Number of frames to encode\n");
     printf("-m , --mp3-bitrate <kbps>      Set the mp3 bitrate to encode audio with\n");
     printf("-r , --mp3-samplerate <hz>     Set the mp3 samplerate to encode audio with (default: 11025)\n");
-    printf("-d , --scale <val>             Scale down to factor <val>. (in %, e.g. 100 = original size)\n");
+    printf("-s , --scale <val>             Scale down to factor <val>. (in %, e.g. 100 = original size)\n");
+    printf("-S , --skipframes <num>        Skip <num> frames before starting the conversion.\n");
     printf("-p , --flip                    Turn movie upside down\n");
     printf("-q , --quality <val>           Set the quality to <val>. (0-100, 0=worst, 100=best, default:80)\n");
+    printf("-k , --keyframe                Set the number of intermediate frames between keyframes.\n");
     printf("-x , --extragood               Enable some *very* expensive compression strategies.\n");
     printf("-T , --flashversion <n>        Set output flash version to <n>.\n");
     printf("-V , --version                 Print program version and exit\n");
@@ -280,6 +288,8 @@ int main (int argc,char ** argv)
     v2swf_setparameter(&v2swf, "prescale", "1");
     v2swf_setparameter(&v2swf, "flash_version", itoa(flashversion));
     v2swf_setparameter(&v2swf, "keyframe_interval", itoa(keyframe_interval));
+    if(skipframes)
+       v2swf_setparameter(&v2swf, "skipframes", skipframes);
     if(expensive)
        v2swf_setparameter(&v2swf, "motioncompensation", "1");
     if(flip)