Fixed bug 1673 - BEXT wave files only have extra metadata that you can easily skip through
authorSam Lantinga <slouken@libsdl.org>
Sun, 22 Jun 2014 10:05:59 -0700
changeset 8909a894224dc538
parent 8908 8333acde0b91
child 8910 c23ffe72934c
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.
src/audio/SDL_wave.c
src/audio/SDL_wave.h
     1.1 --- a/src/audio/SDL_wave.c	Sun Jun 22 09:48:46 2014 -0700
     1.2 +++ b/src/audio/SDL_wave.c	Sun Jun 22 10:05:59 2014 -0700
     1.3 @@ -460,7 +460,7 @@
     1.4          }
     1.5          /* 2 Uint32's for chunk header+len, plus the lenread */
     1.6          headerDiff += lenread + 2 * sizeof(Uint32);
     1.7 -    } while ((chunk.magic == FACT) || (chunk.magic == LIST));
     1.8 +    } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT));
     1.9  
    1.10      /* Decode the audio data format */
    1.11      format = (WaveFMT *) chunk.data;
     2.1 --- a/src/audio/SDL_wave.h	Sun Jun 22 09:48:46 2014 -0700
     2.2 +++ b/src/audio/SDL_wave.h	Sun Jun 22 10:05:59 2014 -0700
     2.3 @@ -29,6 +29,7 @@
     2.4  #define WAVE            0x45564157      /* "WAVE" */
     2.5  #define FACT            0x74636166      /* "fact" */
     2.6  #define LIST            0x5453494c      /* "LIST" */
     2.7 +#define BEXT            0x74786562      /* "bext" */
     2.8  #define FMT             0x20746D66      /* "fmt " */
     2.9  #define DATA            0x61746164      /* "data" */
    2.10  #define PCM_CODE        0x0001