Add support for waveformatex files

This is used for multichannel wave files.
This commit is contained in:
Martin Storsjo 2014-03-12 15:23:13 +02:00
parent 16f75a570e
commit f82510410d
1 changed files with 11 additions and 1 deletions

View File

@ -124,7 +124,17 @@ void* wav_read_open(const char *filename) {
wr->byte_rate = read_int32(wr);
wr->block_align = read_int16(wr);
wr->bits_per_sample = read_int16(wr);
if (wr->format == 0xfffe) {
if (sublength < 28) {
// Insufficient data for waveformatex
break;
}
skip(wr->wav, 8);
wr->format = read_int32(wr);
skip(wr->wav, sublength - 28);
} else {
skip(wr->wav, sublength - 16);
}
} else if (subtag == TAG('d', 'a', 't', 'a')) {
data_pos = ftell(wr->wav);
wr->data_length = sublength;