Issue5024
Created on 2009-01-21 17:19 by rpyle, last changed 2010-07-09 15:27 by rpyle.
| Messages (3) | |||
|---|---|---|---|
| msg80333 - (view) | Author: Robert Pyle (rpyle) | Date: 2009-01-21 17:19 | |
Seems like test_wav() could easily return the actual frame count by calling wave.py just as test_aifc() uses aifc.py. |
|||
| msg109638 - (view) | Author: Mark Lawrence (BreamoreBoy) | Date: 2010-07-08 22:52 | |
Robert, could you provide a patch for this? |
|||
| msg109752 - (view) | Author: Robert Pyle (rpyle) | Date: 2010-07-09 15:27 | |
On Jul 8, 2010, at 6:52 PM, Mark Lawrence wrote: > > Mark Lawrence <breamoreboy@yahoo.co.uk> added the comment: > > Robert, could you provide a patch for this? > > ---------- > nosy: +BreamoreBoy > stage: -> needs patch > versions: +Python 3.2 > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue5024> > _______________________________________ Okay, I'm not sure exactly how I'm supposed to go about this. Here's the output from diff <new file> <original file> for sndhdr.py 131d130 < import wave 135,141c134,138 < f.seek(0) < try: < w = wave.openfp(f, 'r') < except (EOFError, wave.Error): < return None < return ('wav', w.getframerate(), w.getnchannels(), \ < w.getnframes(), 8*w.getsampwidth()) --- > style = get_short_le(h[20:22]) > nchannels = get_short_le(h[22:24]) > rate = get_long_le(h[24:28]) > sample_bits = get_short_le(h[34:36]) > return 'wav', rate, nchannels, -1, sample_bits $ All I did was use test_aifc() as inspiration, so the patched sndhdr.py calls wave.py to get the file parameters. Here's the new test_wav() in its entirety: -------------------------------- def test_wav(h, f): import wave # 'RIFF' <len> 'WAVE' 'fmt ' <len> if h[:4] != 'RIFF' or h[8:12] != 'WAVE' or h[12:16] != 'fmt ': return None f.seek(0) try: w = wave.openfp(f, 'r') except (EOFError, wave.Error): return None return ('wav', w.getframerate(), w.getnchannels(), \ w.getnframes(), 8*w.getsampwidth()) -------------------------------- If you want anything else, please ask. Bob Pyle |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2010-07-09 15:27:42 | rpyle | set | messages: + msg109752 |
| 2010-07-08 22:52:02 | BreamoreBoy | set | versions:
+ Python 3.2 nosy: + BreamoreBoy messages: + msg109638 stage: needs patch |
| 2009-01-21 17:19:42 | rpyle | create | |