AUDIO: Disable MP3 decoding in Wave files if MAD dependency is disabled

This commit is contained in:
Paul Gilbert 2016-09-02 23:54:55 -04:00
parent d971dbea40
commit d7e52b4b50

View file

@ -106,11 +106,18 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
debug(" bitsPerSample: %d", bitsPerSample); debug(" bitsPerSample: %d", bitsPerSample);
#endif #endif
#ifdef USE_MAD
if (type == kWaveFormatMP3) { if (type == kWaveFormatMP3) {
bitsPerSample = 8; bitsPerSample = 8;
} else { } else {
#endif
if (type != kWaveFormatPCM && type != kWaveFormatMSADPCM && type != kWaveFormatMSIMAADPCM) { if (type != kWaveFormatPCM && type != kWaveFormatMSADPCM && type != kWaveFormatMSIMAADPCM) {
#ifdef USE_MAD
warning("getWavInfo: only PCM, MS ADPCM, MP3, or IMA ADPCM data is supported (type %d)", type); warning("getWavInfo: only PCM, MS ADPCM, MP3, or IMA ADPCM data is supported (type %d)", type);
#else
warning("getWavInfo: only PCM, MS ADPCM, or IMA ADPCM data is supported (type %d)", type);
#endif
return false; return false;
} }
@ -121,7 +128,9 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
if (avgBytesPerSec != samplesPerSec * blockAlign && type != kWaveFormatMSADPCM) { if (avgBytesPerSec != samplesPerSec * blockAlign && type != kWaveFormatMSADPCM) {
debug(0, "getWavInfo: avgBytesPerSec is invalid"); debug(0, "getWavInfo: avgBytesPerSec is invalid");
} }
#ifdef USE_MAD
} }
#endif
// Prepare the return values. // Prepare the return values.
rate = samplesPerSec; rate = samplesPerSec;
@ -187,8 +196,10 @@ SeekableAudioStream *makeWAVStream(Common::SeekableReadStream *stream, DisposeAf
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMSIma, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign); return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMSIma, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
else if (type == kWaveFormatMSADPCM) // MS ADPCM else if (type == kWaveFormatMSADPCM) // MS ADPCM
return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign); return makeADPCMStream(stream, disposeAfterUse, size, Audio::kADPCMMS, rate, (flags & Audio::FLAG_STEREO) ? 2 : 1, blockAlign);
#ifdef USE_MAD
else if (type == kWaveFormatMP3) else if (type == kWaveFormatMP3)
return makeMP3Stream(stream, disposeAfterUse); return makeMP3Stream(stream, disposeAfterUse);
#endif
// Raw PCM, make sure the last packet is complete // Raw PCM, make sure the last packet is complete
uint sampleSize = (flags & Audio::FLAG_16BITS ? 2 : 1) * (flags & Audio::FLAG_STEREO ? 2 : 1); uint sampleSize = (flags & Audio::FLAG_16BITS ? 2 : 1) * (flags & Audio::FLAG_STEREO ? 2 : 1);