- FS_Seek(cls.capturevideo.videofile, cls.capturevideo.videofile_totalsampleframes_offset, SEEK_SET);
- SCR_CaptureVideo_RIFF_Write32(cls.capturevideo.soundsampleframe);
- SCR_CaptureVideo_RIFF_Flush();
+ // close any open chunks
+ SCR_CaptureVideo_RIFF_Finish(true);
+
+ // go back and fix the video frames and audio samples fields
+ if(cls.capturevideo.videofile_totalframes_offset1)
+ if(FS_Seek(cls.capturevideo.videofile, cls.capturevideo.videofile_totalframes_offset1, SEEK_SET) >= 0)
+ {
+ SCR_CaptureVideo_RIFF_Write32(cls.capturevideo.frame);
+ SCR_CaptureVideo_RIFF_Flush();
+ }
+ if(cls.capturevideo.videofile_totalframes_offset2)
+ if(FS_Seek(cls.capturevideo.videofile, cls.capturevideo.videofile_totalframes_offset2, SEEK_SET) >= 0)
+ {
+ SCR_CaptureVideo_RIFF_Write32(cls.capturevideo.frame);
+ SCR_CaptureVideo_RIFF_Flush();
+ }
+ if (cls.capturevideo.soundrate)
+ {
+ if(cls.capturevideo.videofile_totalsampleframes_offset)
+ if(FS_Seek(cls.capturevideo.videofile, cls.capturevideo.videofile_totalsampleframes_offset, SEEK_SET) >= 0)
+ {
+ SCR_CaptureVideo_RIFF_Write32(cls.capturevideo.soundsampleframe);
+ SCR_CaptureVideo_RIFF_Flush();
+ }
+ }