qboolean Movie_GetSoundtime (void) { if (!Movie_IsActive()) return false; soundtime += Q_rint (host_frametime * shm->speed * (Movie_FrameTime() / host_frametime)); return true; }
void S_ExtraUpdate (void) { #ifdef _WIN32 if (Movie_IsActive()) return; //qb: jqavi IN_Accumulate (); #endif if (snd_noextraupdate.value) return; // don't pollute timings }
void Movie_Stop_f (void) { if (!Movie_IsActive()) { Con_Printf ("Not capturing\n"); return; } if (cls.capturedemo) cls.capturedemo = false; Movie_Stop (); }
void Movie_TransferStereo16 (void) { if (!Movie_IsActive()) return; // Copy last audio chunk written into our temporary buffer memcpy (capture_audio_samples + (captured_audio_samples << 1), snd_out, snd_linear_count * shm->channels); captured_audio_samples += (snd_linear_count >> 1); if (captured_audio_samples >= Q_rint (host_frametime * shm->speed)) { // We have enough audio samples to match one frame of video Capture_WriteAudio (captured_audio_samples, (byte *)capture_audio_samples); captured_audio_samples = 0; } }
/* =================== Host_FilterTime Returns false if the time is too short to run a frame =================== */ qboolean Host_FilterTime (double time) { double fps; realtime += time; fps = QMAX(10, pq_maxfps.value); #ifdef SUPPORTS_AVI_CAPTURE if (!cls.capturedemo && !cls.timedemo && realtime - oldrealtime < 1.0 / fps) #else if (!cls.timedemo && realtime - oldrealtime < 1.0 / fps) #endif { #ifdef SUPPORTS_SYSSLEEP if (host_sleep.value) Sys_Sleep (); // Lower cpu #endif return false; // framerate is too high } #ifdef SUPPORTS_AVI_CAPTURE if (Movie_IsActive()) host_frametime = Movie_FrameTime (); else #endif host_frametime = realtime - oldrealtime; #ifdef SUPPORTS_DEMO_CONTROLS if (cls.demoplayback) host_frametime *= bound(0, cl_demospeed.value, 20); #endif oldrealtime = realtime; //johnfitz -- host_timescale is more intuitive than host_framerate if (host_timescale.value > 0) host_frametime *= host_timescale.value; //johnfitz else if (host_framerate.value > 0) host_frametime = host_framerate.value; else // don't allow really long or short frames host_frametime = bound(0.001, host_frametime, 0.1); return true; }
void Movie_UpdateScreen (void) //qb: add stretch and gamma to capture { //int k; int i, j; static int r,g,b,v, rowp; //qb: speedup byte *buffer, *p, *hwpal; if (!Movie_IsActive()) return; if (capture_hack.value) { if (hack_ctr != capture_hack.value) { if (!hack_ctr) hack_ctr = capture_hack.value; else hack_ctr--; return; } hack_ctr--; } if (vid_ddraw.value) //qb: make GDI vid work. hwpal = (byte *) &ddpal; else hwpal = (byte *) &colors; if (modelist[vid_modenum].stretched) //qb: capture stretched modes properly { buffer = Q_malloc (4 * vid.width * vid.height * 3, "movie buffer"); p = buffer; for (i = vid.height - 1 ; i >= 0 ; i--) { rowp = i * vid.rowbytes; for (j = 0 ; j < vid.width ; j++) { v = vid.buffer[rowp]*4; //qb: *4 because ddpal is 32bit (alpha) r = hwpal[v]; g = hwpal[v+1]; b = hwpal[v+2]; *p++ = r; *p++ = g; *p++ = b; *p++ = r; *p++ = g; *p++ = b; rowp++; } rowp = i * vid.rowbytes; for (j = 0 ; j < vid.width ; j++) { v = vid.buffer[rowp]*4; //qb: *4 because ddpal is 32bit (alpha) r = hwpal[v]; g = hwpal[v+1]; b = hwpal[v+2]; *p++ = r; *p++ = g; *p++ = b; *p++ = r; *p++ = g; *p++ = b; rowp++; } } } else { buffer = Q_malloc (vid.width * vid.height * 3, "movie buffer"); p = buffer; for (i = vid.height - 1 ; i >= 0 ; i--) { rowp = i * vid.rowbytes; for (j = 0 ; j < vid.width ; j++) { v = vid.buffer[rowp]*4; //qb: *4 because ddpal is 32bit (alpha) r = hwpal[v]; g = hwpal[v+1]; b = hwpal[v+2]; *p++ = r; *p++ = g; *p++ = b; rowp++; } } } Capture_WriteVideo (buffer); Q_free (buffer); }