X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=avi2swf%2Fv2swf.c;h=db32c0c762aae0962ed7acdf4336a75c30bbc9df;hb=5f258d914bd49400899ad22d4f043fb2de278b6b;hp=a536c088ff29ac54fb272850450664a390ad2acd;hpb=6e6c53e5b76e2d8e213cf84bb3acd412767cd1e2;p=swftools.git diff --git a/avi2swf/v2swf.c b/avi2swf/v2swf.c index a536c08..db32c0c 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; @@ -571,6 +572,11 @@ static void scaleimage(v2swf_internal_t*i) int xv,yv; int xm = (i->video->width*65536)/i->width; int ym = (i->video->height*65536)/i->height; + msg("scaling from %dx%d to %dx%d\n", + i->video->width, i->video->height, + i->width, i->height + ); + memset(i->buffer, 255, i->width*i->height*4); for(y=0,yv=0;yheight;y++,yv+=ym) { int*src = &((int*)i->vrbuffer)[(yv>>16)*i->video->width]; @@ -635,8 +641,6 @@ static int encodeoneframe(v2swf_internal_t*i) writeShowFrame(i); } - msg("scaling\n"); - scaleimage(i); msg("version is %d\n", i->version); @@ -826,6 +830,7 @@ 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; @@ -836,7 +841,7 @@ int v2swf_init(v2swf_t*v2swf, videoreader_t * video) 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; @@ -929,7 +934,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;