mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
added kludge for buggy soundfiler from SGI; when reading 0 frames,
just set file pointer correctly instead of returning the complete file.
This commit is contained in:
parent
772eca639c
commit
8d733a00f0
1 changed files with 12 additions and 1 deletions
11
Lib/aifc.py
11
Lib/aifc.py
|
@ -379,7 +379,16 @@ class Aifc_read():
|
||||||
self._comm_chunk_read = 0
|
self._comm_chunk_read = 0
|
||||||
while formlength > 0:
|
while formlength > 0:
|
||||||
self._ssnd_seek_needed = 1
|
self._ssnd_seek_needed = 1
|
||||||
|
#DEBUG: SGI's soundfiler has a bug. There should
|
||||||
|
# be no need to check for EOF here.
|
||||||
|
try:
|
||||||
chunk = Chunk().init(self._file)
|
chunk = Chunk().init(self._file)
|
||||||
|
except EOFError:
|
||||||
|
if formlength == 8:
|
||||||
|
print 'Warning: FORM chunk size too large'
|
||||||
|
formlength = 0
|
||||||
|
break
|
||||||
|
raise EOFError # different error, raise exception
|
||||||
formlength = formlength - 8 - chunk.chunksize
|
formlength = formlength - 8 - chunk.chunksize
|
||||||
if chunk.chunksize & 1:
|
if chunk.chunksize & 1:
|
||||||
formlength = formlength - 1
|
formlength = formlength - 1
|
||||||
|
@ -495,6 +504,8 @@ class Aifc_read():
|
||||||
if pos:
|
if pos:
|
||||||
self._ssnd_chunk.setpos(pos + 8)
|
self._ssnd_chunk.setpos(pos + 8)
|
||||||
self._ssnd_seek_needed = 0
|
self._ssnd_seek_needed = 0
|
||||||
|
if nframes == 0:
|
||||||
|
return ''
|
||||||
size = nframes * self._nchannels * self._sampwidth
|
size = nframes * self._nchannels * self._sampwidth
|
||||||
if self._decomp:
|
if self._decomp:
|
||||||
if self._comptype in ('ULAW', 'ALAW'):
|
if self._comptype in ('ULAW', 'ALAW'):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue