]> git.rm.cloudns.org Git - xonotic/darkplaces.git/commitdiff
Add missing video capture ifdefs
authorcloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Jun 2020 15:36:52 +0000 (15:36 +0000)
committercloudwalk <cloudwalk@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 19 Jun 2020 15:36:52 +0000 (15:36 +0000)
Fix from nico: https://gitlab.com/xonotic/darkplaces/-/merge_requests/93
Fixed up indentation in a few of the #ifdefs

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12700 d7cf8633-e32d-0410-b094-e92efae38249

cl_screen.c
client.h
host.c
snd_main.c

index 1c66465866178cd538298e50af531a65f91184a9..2b0dfe469962e16f0fd95a8a4421df18f41fec2e 100644 (file)
@@ -2721,7 +2721,11 @@ void CL_UpdateScreen(void)
        if(drawscreenstart)
        {
                drawscreendelta = Sys_DirtyTime() - drawscreenstart;
+#ifdef CONFIG_VIDEO_CAPTURE
                if (cl_minfps.value > 0 && (cl_minfps_force.integer || !(cls.timedemo || (cls.capturevideo.active && !cls.capturevideo.realtime))) && drawscreendelta >= 0 && drawscreendelta < 60)
+#else
+               if (cl_minfps.value > 0 && (cl_minfps_force.integer || !cls.timedemo) && drawscreendelta >= 0 && drawscreendelta < 60)
+#endif
                {
                        // quality adjustment according to render time
                        double actualframetime;
index cec5b8e05e7495e0f705b163ff038a4bb924396e..ff96e4fe672d8f3308e7a17ad05af53c00c5137b 100644 (file)
--- a/client.h
+++ b/client.h
@@ -737,6 +737,7 @@ typedef enum qw_downloadtype_e
 }
 qw_downloadtype_t;
 
+#ifdef CONFIG_VIDEO_CAPTURE
 typedef enum capturevideoformat_e
 {
        CAPTUREVIDEOFORMAT_AVI_I420,
@@ -788,6 +789,7 @@ typedef struct capturevideostate_s
        void *formatspecific;
 }
 capturevideostate_t;
+#endif
 
 #define CL_MAX_DOWNLOADACKS 4
 
@@ -917,8 +919,10 @@ typedef struct client_static_s
        // extra user info for the "connect" command
        char connect_userinfo[MAX_USERINFO_STRING];
 
+#ifdef CONFIG_VIDEO_CAPTURE
        // video capture stuff
        capturevideostate_t capturevideo;
+#endif
 
        // crypto channel
        crypto_t crypto;
diff --git a/host.c b/host.c
index 7959dd570c762feb193d399ad7cedf37e0a2a387..a6387bffee57f89a752dd3452370eeec8698b2ab 100644 (file)
--- a/host.c
+++ b/host.c
@@ -925,6 +925,7 @@ void Host_Main(void)
                        R_TimeReport("---");
                        Collision_Cache_NewFrame();
                        R_TimeReport("photoncache");
+#ifdef CONFIG_VIDEO_CAPTURE
                        // decide the simulation time
                        if (cls.capturevideo.active)
                        {
@@ -938,6 +939,10 @@ void Host_Main(void)
                                }
                        }
                        else if (vid_activewindow && cl_maxfps.value >= 1 && !cls.timedemo)
+
+#else
+                       if (vid_activewindow && cl_maxfps.value >= 1 && !cls.timedemo)
+#endif
                        {
                                clframetime = cl.realframetime = max(cl_timer, 1.0 / cl_maxfps.value);
                                // when running slow, we need to sleep to keep input responsive
@@ -1327,6 +1332,7 @@ static void Host_Init (void)
                Cbuf_Execute(&cmd_client);
        }
 
+#ifdef CONFIG_VIDEO_CAPTURE
 // COMMANDLINEOPTION: Client: -capturedemo <demoname> captures a playdemo and quits
        i = COM_CheckParm("-capturedemo");
        if (i && i + 1 < sys.argc)
@@ -1335,6 +1341,7 @@ static void Host_Init (void)
                Cbuf_AddText(&cmd_client, va(vabuf, sizeof(vabuf), "playdemo %s\ncl_capturevideo 1\n", sys.argv[i + 1]));
                Cbuf_Execute(&cmd_client);
        }
+#endif
 
        if (cls.state == ca_dedicated || COM_CheckParm("-listen"))
        if (!sv.active && !cls.demoplayback && !cls.connect_trying)
index c90ed0323316d7e7969580738c37ae74c7e78e94..1509d97b3369439fbd454b6fd4aef380d7219562 100644 (file)
@@ -150,7 +150,9 @@ static qboolean sound_spatialized = false;
 
 qboolean simsound = false;
 
+#ifdef CONFIG_VIDEO_CAPTURE
 static qboolean recording_sound = false;
+#endif
 
 int snd_blocked = 0;
 static int current_swapstereo = false;
@@ -643,7 +645,9 @@ void S_Startup (void)
                extrasoundtime = 0;
        snd_renderbuffer->startframe = soundtime;
        snd_renderbuffer->endframe = soundtime;
+#ifdef CONFIG_VIDEO_CAPTURE
        recording_sound = false;
+#endif
 }
 
 void S_Shutdown(void)
@@ -1906,11 +1910,13 @@ static void S_PaintAndSubmit (void)
                usesoundtimehack = 1;
                newsoundtime = (unsigned int)((double)cl.mtime[0] * (double)snd_renderbuffer->format.speed);
        }
+#ifdef CONFIG_VIDEO_CAPTURE
        else if (cls.capturevideo.soundrate && !cls.capturevideo.realtime) // SUPER NASTY HACK to record non-realtime sound
        {
                usesoundtimehack = 2;
                newsoundtime = (unsigned int)((double)cls.capturevideo.frame * (double)snd_renderbuffer->format.speed / (double)cls.capturevideo.framerate);
        }
+#endif
        else if (simsound)
        {
                usesoundtimehack = 3;
@@ -1918,7 +1924,11 @@ static void S_PaintAndSubmit (void)
        }
        else
        {
+#ifdef CONFIG_VIDEO_CAPTURE
                snd_usethreadedmixing = snd_threaded && !cls.capturevideo.soundrate;
+#else
+               snd_usethreadedmixing = snd_threaded;
+#endif
                usesoundtimehack = 0;
                newsoundtime = SndSys_GetSoundTime();
        }
@@ -1952,6 +1962,7 @@ static void S_PaintAndSubmit (void)
        newsoundtime += extrasoundtime;
        if (newsoundtime < soundtime)
        {
+#ifdef CONFIG_VIDEO_CAPTURE
                if ((cls.capturevideo.soundrate != 0) != recording_sound)
                {
                        unsigned int additionaltime;
@@ -1970,11 +1981,16 @@ static void S_PaintAndSubmit (void)
                                                extrasoundtime);
                }
                else if (!soundtimehack)
+#else
+               if (!soundtimehack)
+#endif
                        Con_Printf("S_PaintAndSubmit: WARNING: newsoundtime < soundtime (%u < %u)\n",
                                           newsoundtime, soundtime);
        }
        soundtime = newsoundtime;
+#ifdef CONFIG_VIDEO_CAPTURE
        recording_sound = (cls.capturevideo.soundrate != 0);
+#endif
 
        // Lock submitbuffer
        if (!simsound && !SndSys_LockRenderBuffer())