[Python-Dev] Expanding max chunk size to 4GB.

2005-07-06 Thread Mark Rages
The RIFF chunk size (used by the Python wave library) is 2GB, because
the length is read as a signed 32-bit integer.

The attached patch to chunk.py raises the limit to 4GB by using a
signed integer.

Is this correct?

Is there a more general solution to 32-bit addressing limitation in
wave files?  Multiple chunks?  Set the length field to zero and let
software assume we only have one chunk?

Regards,
Mark Rages
[EMAIL PROTECTED]
-- 
You think that it is a secret, but it never has been one.
  - fortune cookie
--- chunk.py2005-07-06 11:39:07.179742573 -0500
+++ chunk.py.orig   2005-07-06 11:36:53.001585367 -0500
@@ -62,7 +62,7 @@
 if len(self.chunkname) < 4:
 raise EOFError
 try:
-self.chunksize = struct.unpack(strflag+'L', file.read(4))[0]
+self.chunksize = struct.unpack(strflag+'l', file.read(4))[0]
 except struct.error:
 raise EOFError
 if inclheader:
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com


Re: [Python-Dev] Expanding max chunk size to 4GB.

2005-07-06 Thread Mark Rages
On 7/6/05, Guido van Rossum <[EMAIL PROTECTED]> wrote:
> Looks ok to me, but have you tested this with other software that
> reads/writes wave files?

It appears to work, but I haven't done enough testing to be confident.

> You seem to be speculating about the format where you should be
> reading the reference documentation for this file format (alas, I
> can't help you find it -- you can Google for it as well as I can :).

This site says it's a "long": http://www.borg.com/~jglatt/tech/wave.htm
This site says it's a "ulong": http://www.borg.com/~jglatt/tech/aboutiff.htm

Unsigned makes more sense, considering it's a byte count and would
never be negative.

I've CC'd Erik de Castro Lopo, whose word is more definitive than
random websites.

> Also, patches, are best submitted to SourceForge. Read python.org/dev/.

Oh, sorry, the patch was only to illustrate my idea.  I'll submit a
proper patch to SF once I hear from Erik.

Regards,
Mark
[EMAIL PROTECTED]
-- 
You think that it is a secret, but it never has been one.
  - fortune cookie
___
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com