Another patch to make uncompressed AVI write in RGB24 format by anonymous virtualdub sympathiser.

This commit is contained in:
Thilo Schulz 2006-07-31 15:32:59 +00:00
parent 3a1c4aa457
commit 5efd7c8c36
2 changed files with 9 additions and 10 deletions

View file

@ -248,7 +248,7 @@ void CL_WriteAVIHeader( void )
WRITE_4BYTES( afd.width ); //biWidth WRITE_4BYTES( afd.width ); //biWidth
WRITE_4BYTES( afd.height ); //biHeight WRITE_4BYTES( afd.height ); //biHeight
WRITE_2BYTES( 1 ); //biPlanes WRITE_2BYTES( 1 ); //biPlanes
WRITE_2BYTES( 32 ); //biBitCount WRITE_2BYTES( 24 ); //biBitCount
if( afd.motionJpeg ) { //biCompression if( afd.motionJpeg ) { //biCompression
WRITE_STRING( "MJPG" ); WRITE_STRING( "MJPG" );
@ -257,7 +257,7 @@ void CL_WriteAVIHeader( void )
} else { } else {
WRITE_4BYTES( 0 ); // BI_RGB WRITE_4BYTES( 0 ); // BI_RGB
WRITE_4BYTES( afd.width * WRITE_4BYTES( afd.width *
afd.height*4 ); //biSizeImage afd.height*3 ); //biSizeImage
} }
WRITE_4BYTES( 0 ); //biXPelsPetMeter WRITE_4BYTES( 0 ); //biXPelsPetMeter

View file

@ -715,7 +715,6 @@ const void *RB_TakeVideoFrameCmd( const void *data )
const videoFrameCommand_t *cmd; const videoFrameCommand_t *cmd;
int frameSize; int frameSize;
int i; int i;
char swapper;
cmd = (const videoFrameCommand_t *)data; cmd = (const videoFrameCommand_t *)data;
@ -734,16 +733,16 @@ const void *RB_TakeVideoFrameCmd( const void *data )
} }
else else
{ {
frameSize = cmd->width * cmd->height * 4; frameSize = cmd->width * cmd->height;
for( i = 0; i < frameSize; i = i + 4) // Swap R and B for( i = 0; i < frameSize; i++) // Pack to 24bpp and swap R and B
{ {
swapper = cmd->captureBuffer[ i ]; cmd->encodeBuffer[ i*3 ] = cmd->captureBuffer[ i*4 + 2 ];
cmd->captureBuffer[ i ] = cmd->captureBuffer[ i + 2 ]; cmd->encodeBuffer[ i*3 + 1 ] = cmd->captureBuffer[ i*4 + 1 ];
cmd->captureBuffer[ i + 2 ] = swapper; cmd->encodeBuffer[ i*3 + 2 ] = cmd->captureBuffer[ i*4 ];
} }
ri.CL_WriteAVIVideoFrame( cmd->captureBuffer, frameSize );
ri.CL_WriteAVIVideoFrame( cmd->encodeBuffer, frameSize * 3 );
} }
return (const void *)(cmd + 1); return (const void *)(cmd + 1);