summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjo <martin@martin.st>2014-02-07 14:51:06 +0200
committerMartin Storsjo <martin@martin.st>2014-06-23 10:45:50 +0300
commitcb19aa7c129d3635b5a918e5744c283eb5fb17f7 (patch)
tree70731e2635297dcc935b12980e814b84c6120781
parent3951d0a4e5ae26d9f72a5a64d09cb7b9214b2222 (diff)
downloadfdk-aac-dabplus-cb19aa7c129d3635b5a918e5744c283eb5fb17f7.tar.gz
fdk-aac-dabplus-cb19aa7c129d3635b5a918e5744c283eb5fb17f7.tar.bz2
fdk-aac-dabplus-cb19aa7c129d3635b5a918e5744c283eb5fb17f7.zip
Allow reading wav files with a 0 bytes RIFF chunk
This is required in order to read streamed wav files produced by the libavformat wav muxer.
-rw-r--r--wavreader.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/wavreader.c b/wavreader.c
index 69b3b57..194046b 100644
--- a/wavreader.c
+++ b/wavreader.c
@@ -83,6 +83,10 @@ void* wav_read_open(const char *filename) {
if (feof(wr->wav))
break;
length = read_int32(wr);
+ if (!length) {
+ wr->streamed = 1;
+ length = ~0;
+ }
if (tag != TAG('R', 'I', 'F', 'F') || length < 4) {
fseek(wr->wav, length, SEEK_CUR);
continue;
@@ -118,7 +122,7 @@ void* wav_read_open(const char *filename) {
} else if (subtag == TAG('d', 'a', 't', 'a')) {
data_pos = ftell(wr->wav);
wr->data_length = sublength;
- if (!wr->data_length) {
+ if (!wr->data_length || wr->streamed) {
wr->streamed = 1;
return wr;
}