summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Lantinga <slouken@libsdl.org>2014-06-22 10:05:59 -0700
committerSam Lantinga <slouken@libsdl.org>2014-06-22 10:05:59 -0700
commit94ac62c7d7eddc71185ce90b9b1588660d12c246 (patch)
tree7fd1762f176805f443350d615c4c11ee72571846
parent8cb187f4fa1a706d97003215bb9c049c67007907 (diff)
Fixed bug 1673 - BEXT wave files only have extra metadata that you can easily skip through
bill In SDL_wave.c, BEXT wave files with "bext" instead of "fmt " are choked on if (chunk.magic != FMT) { SDL_SetError("Complex WAVE files not supported"); was_error = 1; goto done; } BEXT files http://en.wikipedia.org/wiki/Broadcast_Wave_Format actually playback the same as regular waves. All they have is (A LOT OF) extra header info. To open them, just SKIP the "bext" chunk, and the "fmt " chunk will be a couple of hundred bytes later. The "fmt " chunk is also bloated, but if you skip past the extra information to the "data" chunk, there is nothing different about a BEXT wave file than a "normal" one. You can then load the data and proceed as normal.
-rw-r--r--src/audio/SDL_wave.c2
-rw-r--r--src/audio/SDL_wave.h1
2 files changed, 2 insertions, 1 deletions
diff --git a/src/audio/SDL_wave.c b/src/audio/SDL_wave.c
index afa1df13a4..8316c6ff2b 100644
--- a/src/audio/SDL_wave.c
+++ b/src/audio/SDL_wave.c
@@ -460,7 +460,7 @@ SDL_LoadWAV_RW(SDL_RWops * src, int freesrc,
}
/* 2 Uint32's for chunk header+len, plus the lenread */
headerDiff += lenread + 2 * sizeof(Uint32);
- } while ((chunk.magic == FACT) || (chunk.magic == LIST));
+ } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT));
/* Decode the audio data format */
format = (WaveFMT *) chunk.data;
diff --git a/src/audio/SDL_wave.h b/src/audio/SDL_wave.h
index c53ad590ab..d136995f6e 100644
--- a/src/audio/SDL_wave.h
+++ b/src/audio/SDL_wave.h
@@ -29,6 +29,7 @@
#define WAVE 0x45564157 /* "WAVE" */
#define FACT 0x74636166 /* "fact" */
#define LIST 0x5453494c /* "LIST" */
+#define BEXT 0x74786562 /* "bext" */
#define FMT 0x20746D66 /* "fmt " */
#define DATA 0x61746164 /* "data" */
#define PCM_CODE 0x0001