cls.capturevideo.format = CAPTUREVIDEOFORMAT_AVI_I420;
cls.capturevideo.formatextension = "avi";
cls.capturevideo.videofile = FS_OpenRealFile(va(vabuf, sizeof(vabuf), "%s.%s", cls.capturevideo.basename, cls.capturevideo.formatextension), "wb", false);
+ if (!cls.capturevideo.videofile)
+ {
+ Con_Printf(CON_ERROR "Failed to open video file \"%s\", cancelling video capture.\n", vabuf);
+ cls.capturevideo.error = true;
+ return;
+ }
cls.capturevideo.writeEndVideo = SCR_CaptureVideo_Avi_EndVideo;
cls.capturevideo.writeVideoFrame = SCR_CaptureVideo_Avi_VideoFrames;
cls.capturevideo.writeSoundFrame = SCR_CaptureVideo_Avi_SoundFrame;
cls.capturevideo.format = CAPTUREVIDEOFORMAT_OGG_VORBIS_THEORA;
cls.capturevideo.formatextension = "ogv";
cls.capturevideo.videofile = FS_OpenRealFile(va(vabuf, sizeof(vabuf), "%s.%s", cls.capturevideo.basename, cls.capturevideo.formatextension), "wb", false);
+ if (!cls.capturevideo.videofile)
+ {
+ Con_Printf(CON_ERROR "Failed to open video file \"%s\", cancelling video capture.\n", vabuf);
+ cls.capturevideo.error = true;
+ return;
+ }
cls.capturevideo.writeEndVideo = SCR_CaptureVideo_Ogg_EndVideo;
cls.capturevideo.writeVideoFrame = SCR_CaptureVideo_Ogg_VideoFrames;
cls.capturevideo.writeSoundFrame = SCR_CaptureVideo_Ogg_SoundFrame;
cls.capturevideo.outbuffer = NULL;
}
+ // If demo capture failed don't leave the demo playing.
+ // CL_StopPlayback shuts down when demo capture finishes successfully.
+ if (cls.capturevideo.error && Sys_CheckParm("-capturedemo"))
+ host.state = host_shutdown;
+
memset(&cls.capturevideo, 0, sizeof(cls.capturevideo));
}
{
if (!cls.capturevideo.active)
SCR_CaptureVideo_BeginVideo();
+ if (cls.capturevideo.error)
+ {
+ // specific error message was printed already
+ Cvar_SetValueQuick(&cl_capturevideo, 0);
+ SCR_CaptureVideo_EndVideo();
+ return;
+ }
+
if (cls.capturevideo.framerate != cl_capturevideo_fps.value * cl_capturevideo_framestep.integer)
{
Con_Printf(CON_WARN "You can not change the video framerate while recording a video.\n");