Bug fix for audio stream header still being written to AVI file even though audio capture has been disabled (for Qt GUI using old libgwavi).
This commit is contained in:
parent
672dcac6b2
commit
2b9b2386d3
|
@ -2153,7 +2153,7 @@ int aviRecordOpenFile( const char *filepath )
|
|||
{
|
||||
gwavi = new gwavi_t();
|
||||
|
||||
if ( gwavi->open( fileName, nes_shm->video.ncol, nes_shm->video.nrow, fourcc, fps, &audioConfig ) )
|
||||
if ( gwavi->open( fileName, nes_shm->video.ncol, nes_shm->video.nrow, fourcc, fps, recordAudio ? &audioConfig : NULL ) )
|
||||
{
|
||||
char msg[512];
|
||||
fprintf( avLogFp, "Error: Failed to open AVI file.\n");
|
||||
|
|
|
@ -82,6 +82,7 @@ gwavi_t::gwavi_t(void)
|
|||
movi_fpos = 0;
|
||||
bits_per_pixel = 24;
|
||||
avi_std = 2;
|
||||
audioEnabled = false;
|
||||
}
|
||||
|
||||
gwavi_t::~gwavi_t(void)
|
||||
|
@ -212,6 +213,8 @@ gwavi_t::open(const char *filename, unsigned int width, unsigned int height,
|
|||
strcpy( stream_index_v.chunkId, "00dc");
|
||||
stream_index_v.streamId = 0;
|
||||
|
||||
audioEnabled = false;
|
||||
|
||||
if (audio)
|
||||
{
|
||||
/* set stream header */
|
||||
|
@ -242,6 +245,7 @@ gwavi_t::open(const char *filename, unsigned int width, unsigned int height,
|
|||
|
||||
strcpy( stream_index_a.chunkId, "01wb");
|
||||
stream_index_a.streamId = 1;
|
||||
audioEnabled = true;
|
||||
}
|
||||
std_index_base_ofs_v = 0;
|
||||
std_index_base_ofs_a = 0;
|
||||
|
@ -326,9 +330,13 @@ gwavi_t::add_frame( unsigned char *buffer, size_t len, unsigned int flags)
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
if ( write_stream_std_indx( out, &stream_index_a ) == -1 )
|
||||
|
||||
if ( audioEnabled )
|
||||
{
|
||||
return -1;
|
||||
if ( write_stream_std_indx( out, &stream_index_a ) == -1 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
offsets.clear();
|
||||
|
||||
|
@ -496,9 +504,12 @@ gwavi_t::close(void)
|
|||
{
|
||||
return -1;
|
||||
}
|
||||
if ( write_stream_std_indx( out, &stream_index_a ) == -1 )
|
||||
if ( audioEnabled )
|
||||
{
|
||||
return -1;
|
||||
if ( write_stream_std_indx( out, &stream_index_a ) == -1 )
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,6 +216,7 @@ class gwavi_t
|
|||
int bits_per_pixel;
|
||||
int avi_std;
|
||||
char fourcc[8];
|
||||
char audioEnabled;
|
||||
|
||||
// helper functions
|
||||
long long ftell(FILE *fp);
|
||||
|
|
Loading…
Reference in New Issue