]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
handle failure of video capture startup
authorRudolf Polzer <divverent@alientrap.org>
Tue, 4 Jan 2011 13:20:38 +0000 (14:20 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Tue, 4 Jan 2011 13:20:38 +0000 (14:20 +0100)
cap_lavc.c
cl_screen.c

index f48765d77d7c19c83157692a61e1f49a9032cf1c..b5e4a30672d0901a9b54b413a968f1f27db3c854 100644 (file)
@@ -886,6 +886,7 @@ void SCR_CaptureVideo_Lavc_BeginVideo(void)
                {
                        Con_Printf("Failed to write header\n");
                        SCR_CaptureVideo_EndVideo();
+                       return;
                }
 
                format->buffer = Z_Malloc(format->bufsize);
index 75f217278a0830941b906187b05876e91d3bdb65..a155c867dc5682108197ce31ea408ae793d25337 100644 (file)
@@ -1194,6 +1194,7 @@ void SCR_CaptureVideo_EndVideo(void)
        if (!cls.capturevideo.active)
                return;
        cls.capturevideo.active = false;
+       Cvar_SetValueQuick(&cl_capturevideo, 0);
 
        Con_Printf("Finishing capture of %s.%s (%d frames, %d audio frames)\n", cls.capturevideo.basename, cls.capturevideo.formatextension, cls.capturevideo.frame, cls.capturevideo.soundsampleframe);
 
@@ -1312,6 +1313,8 @@ void SCR_CaptureVideo(void)
        {
                if (!cls.capturevideo.active)
                        SCR_CaptureVideo_BeginVideo();
+               if(!cls.capturevideo.active)
+                       return;
                if (cls.capturevideo.framerate != cl_capturevideo_fps.value * cl_capturevideo_framestep.integer)
                {
                        Con_Printf("You can not change the video framerate while recording a video.\n");
@@ -1330,7 +1333,6 @@ void SCR_CaptureVideo(void)
                // if falling behind more than one second, stop
                if (newframenum - cls.capturevideo.frame > 60 * (int)ceil(cls.capturevideo.framerate))
                {
-                       Cvar_SetValueQuick(&cl_capturevideo, 0);
                        Con_Printf("video saving failed on frame %i, your machine is too slow for this capture speed.\n", cls.capturevideo.frame);
                        SCR_CaptureVideo_EndVideo();
                        return;
@@ -1340,7 +1342,6 @@ void SCR_CaptureVideo(void)
                cls.capturevideo.frame = newframenum;
                if (cls.capturevideo.error)
                {
-                       Cvar_SetValueQuick(&cl_capturevideo, 0);
                        Con_Printf("video saving failed on frame %i, out of disk space? stopping video capture.\n", cls.capturevideo.frame);
                        SCR_CaptureVideo_EndVideo();
                }