[Python-checkins] cpython (merge 3.3 -> default): Issue #19131: The aifc module now correctly reads and writes sampwidth of
serhiy.storchaka
python-checkins at python.org
Sat Oct 12 17:25:39 CEST 2013
http://hg.python.org/cpython/rev/cff4dd674efe
changeset: 86228:cff4dd674efe
parent: 86225:cc1e2f9a569a
parent: 86227:863a92cc9e03
user: Serhiy Storchaka <storchaka at gmail.com>
date: Sat Oct 12 18:23:21 2013 +0300
summary:
Issue #19131: The aifc module now correctly reads and writes sampwidth of
compressed streams.
files:
Lib/aifc.py | 9 +++++----
Misc/NEWS | 3 +++
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/Lib/aifc.py b/Lib/aifc.py
--- a/Lib/aifc.py
+++ b/Lib/aifc.py
@@ -468,15 +468,13 @@
if self._comptype != b'NONE':
if self._comptype == b'G722':
self._convert = self._adpcm2lin
- self._framesize = self._framesize // 4
elif self._comptype in (b'ulaw', b'ULAW'):
self._convert = self._ulaw2lin
- self._framesize = self._framesize // 2
elif self._comptype in (b'alaw', b'ALAW'):
self._convert = self._alaw2lin
- self._framesize = self._framesize // 2
else:
raise Error('unsupported compression type')
+ self._sampwidth = 2
else:
self._comptype = b'NONE'
self._compname = b'not compressed'
@@ -804,7 +802,10 @@
_write_short(self._file, self._nchannels)
self._nframes_pos = self._file.tell()
_write_ulong(self._file, self._nframes)
- _write_short(self._file, self._sampwidth * 8)
+ if self._comptype in (b'ULAW', b'ulaw', b'ALAW', b'alaw', b'G722'):
+ _write_short(self._file, 8)
+ else:
+ _write_short(self._file, self._sampwidth * 8)
_write_float(self._file, self._framerate)
if self._aifc:
self._file.write(self._comptype)
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -36,6 +36,9 @@
Library
-------
+- Issue #19131: The aifc module now correctly reads and writes sampwidth of
+ compressed streams.
+
- Issue #19209: Remove import of copyreg from the os module to speed up
interpreter startup. stat_result and statvfs_result are now hard-coded to
reside in the os module.
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list