- width = (int)(oldwidth*scale);
- height = (int)(oldheight*scale);
- reziscale = 1/scale;
-
- vstream -> StartStreaming();
- if(do_audio)
- {
- astream -> StartStreaming();
- printf("%f framerate\n", fps);
- printf("%f samples/frame\n", samplesperframe);
- printf("%d samplerate\n", samplerate);
- }
-
- if(zlib)
- file = open("__tmp__.swf", O_WRONLY|O_CREAT|O_TRUNC, 0644);
- else
- file = open(outputfilename, O_WRONLY|O_CREAT|O_TRUNC, 0644);
-
- memset(&swf, 0, sizeof(swf));
- swf.frameRate = (int)(fps*256);
- swf.fileVersion = 4;
- swf.fileSize = 0x0fffffff;
- swf.frameCount = lastframe - firstframe;
- r.xmin = 0;
- r.ymin = 0;
- r.xmax = width*20;
- r.ymax = height*20;
- swf.movieSize = r;
-
- filesize += swf_WriteHeader(file, &swf);
-
- tag = swf_InsertTag(NULL, ST_SETBACKGROUNDCOLOR);
- swf_SetU8(tag,0); //black
- swf_SetU8(tag,0);
- swf_SetU8(tag,0);
- filesize += swf_WriteTag(file, tag);
- swf_DeleteTag(tag);
-
- tag = swf_InsertTag(NULL, ST_SOUNDSTREAMHEAD2);
- swf_SetSoundStreamHead(tag, (int)samplesperframe/4);
- filesize += swf_WriteTag(file, tag);
- swf_DeleteTag(tag);
-
- int frame = 0;
- initdisplay(file);
-
- double movie_sound_pos = 0;
- int mp3_sound_pos = 0;
-
- if(do_audio)
- {
- WAVEFORMATEX wave;
- astream->GetAudioFormatInfo(&wave,0);
-
- printf("nChannels:%d\n", wave.nChannels);
- printf("nSamplesPerSec:%d\n", wave.nSamplesPerSec);
- printf("nAvgBytesPerSec:%d\n", wave.nAvgBytesPerSec);
- printf("nBlockAlign:%d\n", wave.nBlockAlign);
- printf("wBitsPerSample:%d\n", wave.wBitsPerSample);
- printf("cbSize:%d\n", wave.cbSize);
- }
-
- SoundReader* sound = new SoundReader(astream);
-
- while(1) {
- if(vstream->ReadFrame()<0) {
- printf("\n");
- break;
- }