mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
AUDIO: Skip JUNK padding in WAV files
Some wave files may contain a JUNK chunk before the 'fmt ' chunk, used for padding. This should be skipped when reading the header.
This commit is contained in:
parent
70b1a4432a
commit
9f802a181e
@ -62,6 +62,13 @@ bool loadWAVFromStream(Common::SeekableReadStream &stream, int &size, int &rate,
|
||||
stream.read(buf, 4);
|
||||
}
|
||||
|
||||
if (memcmp(buf, "JUNK", 4) == 0) {
|
||||
uint32 junksize = stream.readUint32LE();
|
||||
// skip junk padding (add 1 byte if odd)
|
||||
stream.skip(junksize + (junksize % 2));
|
||||
stream.read(buf, 4);
|
||||
}
|
||||
|
||||
if (memcmp(buf, "fmt ", 4) != 0) {
|
||||
warning("getWavInfo: No 'fmt' header");
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user