summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2014-03-12 15:23:13 +0200
committerMartin Storsjo <martin@martin.st>2014-06-23 10:45:50 +0300
commitf82510410d6025a0577a593de6feeaf1c256c81c (patch)
tree7b171dc0c69ba6d8e8908313a53f2486b6385c11
parent16f75a570ee5efdd0ad7f3edf54eeedcacca3131 (diff)
downloadfdk-aac-f82510410d6025a0577a593de6feeaf1c256c81c.tar.gz
fdk-aac-f82510410d6025a0577a593de6feeaf1c256c81c.tar.bz2
fdk-aac-f82510410d6025a0577a593de6feeaf1c256c81c.zip
Add support for waveformatex files
This is used for multichannel wave files.
-rw-r--r--wavreader.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/wavreader.c b/wavreader.c
index 182b3eb..898eb9c 100644
--- a/wavreader.c
+++ b/wavreader.c
@@ -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);
- skip(wr->wav, sublength - 16);
+ 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;