X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=avi2swf%2Fv2swf.c;h=a8244b4ba42eb321e20a30240392309cae0a9aa8;hb=c93d52568f86b5639d40e34e384e8115e0037b75;hp=616fa219bc7dd8a60514da831428ab65ad185061;hpb=ea85265659cd4886ba848218870b0d5516d47ba8;p=swftools.git diff --git a/avi2swf/v2swf.c b/avi2swf/v2swf.c index 616fa21..a8244b4 100644 --- a/avi2swf/v2swf.c +++ b/avi2swf/v2swf.c @@ -39,6 +39,7 @@ typedef struct _v2swf_internal_t ringbuffer_t r; videoreader_t* video; + double video_fps; int width; int height; @@ -81,6 +82,8 @@ typedef struct _v2swf_internal_t int prescale; int scale; + + int add_cut; int domotion; @@ -413,8 +416,22 @@ static void finish(v2swf_internal_t*i) if(!i->finished) { msg("write endtag\n", i->finished); + if(i->add_cut) { + swf_ResetTag(i->tag, ST_SHOWFRAME); + i->filesize += swf_WriteTag2(&i->out, i->tag); + + swf_ResetTag(i->tag, ST_REMOVEOBJECT2); + swf_SetU16(i->tag, 1); //depth + i->filesize += swf_WriteTag2(&i->out, i->tag); + + swf_ResetTag(i->tag, ST_DOACTION); + swf_SetU16(i->tag, 0x0007); + i->filesize += swf_WriteTag2(&i->out, i->tag); + } + swf_ResetTag(i->tag, ST_END); i->filesize += swf_WriteTag2(&i->out, i->tag); + i->out.finish(&i->out); if(i->version>=6) { @@ -829,17 +846,19 @@ int v2swf_init(v2swf_t*v2swf, videoreader_t * video) msg("video: %dx%d, fps %f\n", video->width, video->height, video->fps); i->video = video; + i->video_fps = ((int)(video->fps*256))/256.0; i->blockdiff = 64; i->keyframe_interval = 8; i->quality = 20; i->scale = 65536; + i->add_cut = 1; i->samplerate = 11025; i->prescale = 0; i->head_done = 0; i->diffmode = DIFFMODE_QMEAN; i->audio_fix = 1.0; i->fixheader = 0; - i->framerate = video->fps; + i->framerate = i->video_fps; i->fpsratio = 1.00000000000; i->fpspos = 0.0; i->bitrate = 32; @@ -914,6 +933,8 @@ void v2swf_setparameter(v2swf_t*v2swf, char*name, char*value) i->version = atoi(value); } else if(!strcmp(name, "audiosync")) { i->audio_fix = (int)(atof(value)); + } else if(!strcmp(name, "addcut")) { + i->add_cut = atoi(value); } else if(!strcmp(name, "scale")) { i->scale = (int)(atof(value)*65536); } else if(!strcmp(name, "scale65536")) { @@ -932,7 +953,7 @@ void v2swf_setparameter(v2swf_t*v2swf, char*name, char*value) i->samplerate = atoi(value); } else if(!strcmp(name, "framerate")) { i->framerate = atof(value); - i->fpsratio = i->framerate / i->video->fps; + i->fpsratio = i->framerate / i->video_fps; } else if(!strcmp(name, "mp3_bitrate")) { int t=0,o;