update deprecated names
file failing to open is a fatal error
This commit is contained in:
@@ -631,7 +631,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_MP3::Open( CString filename_
|
|||||||
if( !file.Open( filename ) )
|
if( !file.Open( filename ) )
|
||||||
{
|
{
|
||||||
SetError( ssprintf("Couldn't open file: %s", file.GetError().c_str()) );
|
SetError( ssprintf("Couldn't open file: %s", file.GetError().c_str()) );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
mad->filesize = file.GetFileSize();
|
mad->filesize = file.GetFileSize();
|
||||||
@@ -645,10 +645,10 @@ SoundReader_FileReader::OpenResult RageSoundReader_MP3::Open( CString filename_
|
|||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
SetError( "Failed to read any data at all" );
|
SetError( "Failed to read any data at all" );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_UNKNOWN_FILE_FORMAT;
|
||||||
case -1:
|
case -1:
|
||||||
SetError( GetError() + " (not an MP3 stream?)" );
|
SetError( GetError() + " (not an MP3 stream?)" );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_UNKNOWN_FILE_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Store the bitrate of the frame we just got. */
|
/* Store the bitrate of the frame we just got. */
|
||||||
|
|||||||
@@ -408,7 +408,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::WAV_open_internal()
|
|||||||
if( !read_le32(rw, &magic1) || magic1 != riffID )
|
if( !read_le32(rw, &magic1) || magic1 != riffID )
|
||||||
{
|
{
|
||||||
SetError( "WAV: Not a RIFF file." );
|
SetError( "WAV: Not a RIFF file." );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_UNKNOWN_FILE_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t ignore;
|
uint32_t ignore;
|
||||||
@@ -418,13 +418,13 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::WAV_open_internal()
|
|||||||
if( !read_le32( rw, &magic2 ) || magic2 != waveID )
|
if( !read_le32( rw, &magic2 ) || magic2 != waveID )
|
||||||
{
|
{
|
||||||
SetError( "Not a WAVE file." );
|
SetError( "Not a WAVE file." );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_UNKNOWN_FILE_FORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t NextChunk;
|
int32_t NextChunk;
|
||||||
BAIL_IF_MACRO(!find_chunk(fmtID, NextChunk), "No format chunk.", OPEN_MATCH_BUT_FAIL);
|
BAIL_IF_MACRO(!find_chunk(fmtID, NextChunk), "No format chunk.", OPEN_FATAL_ERROR);
|
||||||
NextChunk += this->rw.Tell();
|
NextChunk += this->rw.Tell();
|
||||||
BAIL_IF_MACRO(!read_fmt_chunk(), "Can't read format chunk.", OPEN_MATCH_BUT_FAIL);
|
BAIL_IF_MACRO(!read_fmt_chunk(), "Can't read format chunk.", OPEN_FATAL_ERROR);
|
||||||
|
|
||||||
/* I think multi-channel WAVs are possible, but I've never even seen one. */
|
/* I think multi-channel WAVs are possible, but I've never even seen one. */
|
||||||
Channels = (uint8_t) fmt.wChannels;
|
Channels = (uint8_t) fmt.wChannels;
|
||||||
@@ -450,12 +450,12 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::WAV_open_internal()
|
|||||||
SetError( ssprintf("%s not supported", format.c_str() ) );
|
SetError( ssprintf("%s not supported", format.c_str() ) );
|
||||||
|
|
||||||
/* It might be MP3 data in a WAV. (Why do people *do* that?) It's possible
|
/* It might be MP3 data in a WAV. (Why do people *do* that?) It's possible
|
||||||
* that the MAD decoder will figure that out, so let's return OPEN_NO_MATCH
|
* that the MAD decoder will figure that out, so let's return OPEN_UNKNOWN_FILE_FORMAT
|
||||||
* and keep searching for a decoder. */
|
* and keep searching for a decoder. */
|
||||||
if( fmt.wFormatTag == FMT_MPEG_L3 )
|
if( fmt.wFormatTag == FMT_MPEG_L3 )
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_UNKNOWN_FILE_FORMAT;
|
||||||
|
|
||||||
return OPEN_MATCH_BUT_FAIL;
|
return OPEN_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( fmt.wBitsPerSample == 4 && this->fmt.wFormatTag == FMT_ADPCM )
|
if ( fmt.wBitsPerSample == 4 && this->fmt.wFormatTag == FMT_ADPCM )
|
||||||
@@ -476,7 +476,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::WAV_open_internal()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
SetError( ssprintf("Unsupported sample size %i", fmt.wBitsPerSample) );
|
SetError( ssprintf("Unsupported sample size %i", fmt.wBitsPerSample) );
|
||||||
return OPEN_MATCH_BUT_FAIL;
|
return OPEN_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( Conversion == CONV_8BIT_TO_16BIT )
|
if( Conversion == CONV_8BIT_TO_16BIT )
|
||||||
@@ -487,7 +487,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::WAV_open_internal()
|
|||||||
this->rw.Seek( NextChunk );
|
this->rw.Seek( NextChunk );
|
||||||
|
|
||||||
int32_t DataSize;
|
int32_t DataSize;
|
||||||
BAIL_IF_MACRO(!find_chunk(dataID, DataSize), "No data chunk.", OPEN_MATCH_BUT_FAIL);
|
BAIL_IF_MACRO(!find_chunk(dataID, DataSize), "No data chunk.", OPEN_FATAL_ERROR);
|
||||||
|
|
||||||
fmt.data_starting_offset = this->rw.Tell();
|
fmt.data_starting_offset = this->rw.Tell();
|
||||||
fmt.adpcm_sample_frame_size = BytesPerSample * Channels;
|
fmt.adpcm_sample_frame_size = BytesPerSample * Channels;
|
||||||
@@ -504,7 +504,7 @@ SoundReader_FileReader::OpenResult RageSoundReader_WAV::Open( CString filename_
|
|||||||
if( !this->rw.Open( filename ) )
|
if( !this->rw.Open( filename ) )
|
||||||
{
|
{
|
||||||
SetError( ssprintf("Couldn't open file: %s", this->rw.GetError().c_str()) );
|
SetError( ssprintf("Couldn't open file: %s", this->rw.GetError().c_str()) );
|
||||||
return OPEN_NO_MATCH;
|
return OPEN_FATAL_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(&fmt, 0, sizeof(fmt));
|
memset(&fmt, 0, sizeof(fmt));
|
||||||
|
|||||||
Reference in New Issue
Block a user