[Scummvm-git-logs] scummvm master -> 9f802a181eddd53ffb1f3a7149c648e73268d367

bluegr noreply at scummvm.org
Sun May 28 10:57:03 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9f802a181e AUDIO: Skip JUNK padding in WAV files


Commit: 9f802a181eddd53ffb1f3a7149c648e73268d367
    https://github.com/scummvm/scummvm/commit/9f802a181eddd53ffb1f3a7149c648e73268d367
Author: Walter Agazzi (walter.agazzi at protonmail.com)
Date: 2023-05-28T13:56:59+03:00

Commit Message:
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.

Changed paths:
    audio/decoders/wave.cpp


diff --git a/audio/decoders/wave.cpp b/audio/decoders/wave.cpp
index 1da5f9bdb57..a247ab82880 100644
--- a/audio/decoders/wave.cpp
+++ b/audio/decoders/wave.cpp
@@ -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;




More information about the Scummvm-git-logs mailing list