* Fix poppy captured audio when recording videos

This commit is contained in:
Tim Angus 2007-12-01 19:39:03 +00:00
parent 3cde9bf0dc
commit 5bd3ef4190

View file

@ -250,14 +250,17 @@ void CL_WriteAVIHeader( void )
WRITE_2BYTES( 1 ); //biPlanes WRITE_2BYTES( 1 ); //biPlanes
WRITE_2BYTES( 24 ); //biBitCount WRITE_2BYTES( 24 ); //biBitCount
if( afd.motionJpeg ) { //biCompression if( afd.motionJpeg ) //biCompression
{
WRITE_STRING( "MJPG" ); WRITE_STRING( "MJPG" );
WRITE_4BYTES( afd.width * WRITE_4BYTES( afd.width *
afd.height ); //biSizeImage afd.height ); //biSizeImage
} else { }
else
{
WRITE_4BYTES( 0 ); // BI_RGB WRITE_4BYTES( 0 ); // BI_RGB
WRITE_4BYTES( afd.width * WRITE_4BYTES( afd.width *
afd.height*3 ); //biSizeImage afd.height * 3 ); //biSizeImage
} }
WRITE_4BYTES( 0 ); //biXPelsPetMeter WRITE_4BYTES( 0 ); //biXPelsPetMeter
@ -391,10 +394,14 @@ qboolean CL_OpenAVIForWriting( const char *fileName )
} }
else if( Q_stricmp( Cvar_VariableString( "s_backend" ), "OpenAL" ) ) else if( Q_stricmp( Cvar_VariableString( "s_backend" ), "OpenAL" ) )
{ {
if( afd.a.bits == 16 && afd.a.channels == 2 ) if( afd.a.bits != 16 || afd.a.channels != 2 )
afd.audio = qtrue; {
Com_Printf( S_COLOR_YELLOW "WARNING: Audio format of %d bit/%d channels not supported",
afd.a.bits, afd.a.channels );
afd.audio = qfalse;
}
else else
afd.audio = qfalse; //FIXME: audio not implemented for this case afd.audio = qtrue;
} }
else else
{ {
@ -542,7 +549,7 @@ void CL_WriteAVIAudioFrame( const byte *pcmBuffer, int size )
WRITE_4BYTES( bytesInBuffer ); WRITE_4BYTES( bytesInBuffer );
SafeFS_Write( buffer, 8, afd.f ); SafeFS_Write( buffer, 8, afd.f );
SafeFS_Write( pcmBuffer, bytesInBuffer, afd.f ); SafeFS_Write( pcmCaptureBuffer, bytesInBuffer, afd.f );
SafeFS_Write( padding, paddingSize, afd.f ); SafeFS_Write( padding, paddingSize, afd.f );
afd.fileSize += ( chunkSize + paddingSize ); afd.fileSize += ( chunkSize + paddingSize );