|
From: Thor A. <th...@bi...> - 2010-05-30 23:10:57
|
On Fri, May 28, 2010 at 07:54:58PM +0200, Chris Bagwell wrote: > > On Sun, May 23, 2010 at 07:08:05PM +0000, Michael Chapman wrote: > > > > [...] > > > > > perpetuates the error. > > > Not SoX's fault (I suspect the flavour of WAV it writes is limited > > > to 4GB). > > > > > > IT WOULD BE NICE if SoX did 'WARN' when doing this though, > > > i.e. "I cannot write a proper header to the output file because > > > it is >4GB". > > > > Maybe something like the attached should be applied? Not sure if > > this covers all eventualities, still getting acquainted with the > > source code. > > [...] > > I was about to submit this patch but think I may have detect a logic > error in existing code. Thor (or anyone), do you think you could help > me debug? I'll try my best. > Bottom line is if a WAV length of a single chunk is beyond the size > that can be represented in the 32-bit length field of WAV files then > issues will occur with certain applications that depend on valid > lengths. As far as I can tell, and I am no expert, the problem is that the RIFF format header should contain the total file size [1] in bytes in the first chunk header. This will of course be wrong when chunk sizes of greater than 2**32 are created. > Some applications understand the basic issue and will go into special > modes if it see maximum chunk length value of 0xffffffff and thats > what SoX is attempting to do in these cases. This is not my experience when creating large wav files with sox, but I may be doing something wrong. I'll do some further checking. [...] > Thor, was there a special reason you used lsx_filelength() instead of > looking at numSamples with your warning patch? I ask because file > length != wav chunk length. Based on what I read about the header format [2, 3 and others], the "master" chunk length parameter == file length - first header size - padding. > I suspect SoX has some logic error here and is not writing special > length value of 0xffffffff into header. Code reviews of this area > appreciated and patches especially welcomed. This is my experience as well, I'll take a look during the next week. [...] [1] Minus header and padding [2] http://en.wikipedia.org/wiki/WAV [3] http://www.dragonwins.com/wav/ -- best regards Thor Andreassen |