* AVI video output

- Uses motion jpeg codec by default
  - Use cl_avidemo to set a framerate
  - \video [filename] to start capture
  - \stopvideo to stop capture
  - Audio capture is a bit ropey
This commit is contained in:
Tim Angus 2006-01-04 03:12:12 +00:00
parent 92ad3e99dc
commit a21eb2bbcb
15 changed files with 910 additions and 11 deletions

View file

@ -699,6 +699,51 @@ void R_ScreenShotJPEG_f (void) {
//============================================================================
/*
==================
RB_TakeVideoFrameCmd
==================
*/
const void *RB_TakeVideoFrameCmd( const void *data )
{
const videoFrameCommand_t *cmd;
int frameSize;
int i;
cmd = (const videoFrameCommand_t *)data;
qglReadPixels( 0, 0, cmd->width, cmd->height, GL_RGBA,
GL_UNSIGNED_BYTE, cmd->captureBuffer );
// gamma correct
if( ( tr.overbrightBits > 0 ) && glConfig.deviceSupportsGamma )
R_GammaCorrect( cmd->captureBuffer, cmd->width * cmd->height * 4 );
if( cmd->motionJpeg )
{
frameSize = SaveJPGToBuffer( cmd->encodeBuffer, 95,
cmd->width, cmd->height, cmd->captureBuffer );
}
else
{
frameSize = cmd->width * cmd->height * 4;
// Vertically flip the image
for( i = 0; i < cmd->height; i++ )
{
Com_Memcpy( &cmd->encodeBuffer[ i * ( cmd->width * 4 ) ],
&cmd->captureBuffer[ ( cmd->height - i - 1 ) * ( cmd->width * 4 ) ],
cmd->width * 4 );
}
}
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize );
return (const void *)(cmd + 1);
}
//============================================================================
/*
** GL_SetDefaultState
*/
@ -1201,5 +1246,7 @@ refexport_t *GetRefAPI ( int apiVersion, refimport_t *rimp ) {
re.GetEntityToken = R_GetEntityToken;
re.inPVS = R_inPVS;
re.TakeVideoFrame = RE_TakeVideoFrame;
return &re;
}