Skip JUNK chunks in wave files
authorSam Lantinga <slouken@libsdl.org>
Tue, 08 Jul 2014 00:42:14 -0700
changeset 8998 995f6cd966a7
parent 8997 9e23a50a63f7
child 8999 c6398920a9ca
Skip JUNK chunks in wave files
src/audio/SDL_wave.c
src/audio/SDL_wave.h
--- a/src/audio/SDL_wave.c	Tue Jul 08 00:23:36 2014 -0700
+++ b/src/audio/SDL_wave.c	Tue Jul 08 00:42:14 2014 -0700
@@ -460,7 +460,7 @@
         }
         /* 2 Uint32's for chunk header+len, plus the lenread */
         headerDiff += lenread + 2 * sizeof(Uint32);
-    } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT));
+    } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT) || (chunk.magic == JUNK));
 
     /* Decode the audio data format */
     format = (WaveFMT *) chunk.data;
--- a/src/audio/SDL_wave.h	Tue Jul 08 00:23:36 2014 -0700
+++ b/src/audio/SDL_wave.h	Tue Jul 08 00:42:14 2014 -0700
@@ -30,6 +30,7 @@
 #define FACT            0x74636166      /* "fact" */
 #define LIST            0x5453494c      /* "LIST" */
 #define BEXT            0x74786562      /* "bext" */
+#define JUNK            0x4B4E554A      /* "JUNK" */
 #define FMT             0x20746D66      /* "fmt " */
 #define DATA            0x61746164      /* "data" */
 #define PCM_CODE        0x0001