Issue 1373643: chunk.py can't handle >2GB chunks (original) (raw)
chunk.py unpacks the chunk size as a signed long 'l' not as unsigned long 'L' which is what it ought to do according to the WAV specs. Additionally, since field contains a byte count it makes no sense for it to be signed.
What I want to do is to read a wave file generated by madplay on the fly. Since madplay doesn't know the size of the WAVE chunk when it is written, it sets the chunk size to 0xffff which is inpreted as -1 by chunk.py . Changing chunk.py to read it as an unsigned long makes this work.
Example code:
import wave import os
f = os.popen('madplay -o wave:- foo.mp3') wf = wave.open(f, 'rb')
Without a patch, this will raise an error:
wave.Error: not a WAVE file