We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 1673 - BEXT wave files only have extra metadata that you can easily skip through
Summary: BEXT wave files only have extra metadata that you can easily skip through
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: audio (show other bugs)
Version: 1.2.6
Hardware: x86 Windows 7
: P2 trivial
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-12-26 10:07 UTC by bill
Modified: 2018-07-30 12:23 UTC (History)
2 users (show)

See Also:


Attachments
SDL_wave.c with BEXT chunk (19.67 KB, patch)
2014-05-30 15:38 UTC, Carlos
Details | Diff
A patch version of the fix. (978 bytes, patch)
2018-07-30 12:23 UTC, Rene Dudfield
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description bill 2012-12-26 10:07:37 UTC
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.
Comment 1 Sam Lantinga 2012-12-31 14:02:30 UTC
Do you have a sample save file, and a patch to fix this?

Thanks!
Comment 2 Carlos 2014-05-30 15:38:04 UTC
Created attachment 1664 [details]
SDL_wave.c with BEXT chunk

#define BEXT            0x74786562      /* "bext" */
Comment 3 Carlos 2014-05-30 15:40:43 UTC
Hi,
I got a workaround for this issue (see attachment).  
The format is called BWF (which are the same as BEXT)
(http://en.wikipedia.org/wiki/Broadcast_Wave_Format)

I was getting the error:
"Error in music Complex WAVE files not supported"

It can be solved by just skipping these chunks.

In SDL_wave.c, replace


    } while ((chunk.magic == FACT) || (chunk.magic == LIST));

with

    } while ((chunk.magic == FACT) || (chunk.magic == LIST) || (chunk.magic == BEXT));

In SDL_wave.h define BEXT as:
#define BEXT            0x74786562      /* "bext" */


Other chunks are indicated in the Wikipedia page, but this was enough for me.
I kindly request you to add this change. Thank you very much.
Comment 4 Sam Lantinga 2014-06-22 17:09:11 UTC
Fixed, thanks!
https://hg.libsdl.org/SDL/rev/a894224dc538
Comment 5 Rene Dudfield 2018-07-30 12:23:07 UTC
Created attachment 3273 [details]
A patch version of the fix.

Attaching a patch here just to make it slightly easier for others to read and download (Some people from: homebrew, archlinux, and pygame).