diff options
author | Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com> | 2022-10-15 13:30:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-15 13:30:05 (GMT) |
commit | 05c042e70786bd2e3fcb274d185e1e0a54dab5a7 (patch) | |
tree | e5e79482539955752470af9e56c2af834f63ac6b /Lib/sndhdr.py | |
parent | 3c4cbd177f36777a04e78eb07ce20367560a66d3 (diff) | |
download | cpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.zip cpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.tar.gz cpython-05c042e70786bd2e3fcb274d185e1e0a54dab5a7.tar.bz2 |
gh-85525: Indicate supported sound header formats (#21575)
* Indicate supported sound header formats
* modify file names
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Diffstat (limited to 'Lib/sndhdr.py')
-rw-r--r-- | Lib/sndhdr.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/sndhdr.py b/Lib/sndhdr.py index 98a7834..45def9a 100644 --- a/Lib/sndhdr.py +++ b/Lib/sndhdr.py @@ -77,6 +77,7 @@ def whathdr(filename): tests = [] def test_aifc(h, f): + """AIFC and AIFF files""" with warnings.catch_warnings(): warnings.simplefilter('ignore', category=DeprecationWarning) import aifc @@ -100,6 +101,7 @@ tests.append(test_aifc) def test_au(h, f): + """AU and SND files""" if h.startswith(b'.snd'): func = get_long_be elif h[:4] in (b'\0ds.', b'dns.'): @@ -133,6 +135,7 @@ tests.append(test_au) def test_hcom(h, f): + """HCOM file""" if h[65:69] != b'FSSD' or h[128:132] != b'HCOM': return None divisor = get_long_be(h[144:148]) @@ -146,6 +149,7 @@ tests.append(test_hcom) def test_voc(h, f): + """VOC file""" if not h.startswith(b'Creative Voice File\032'): return None sbseek = get_short_le(h[20:22]) @@ -160,6 +164,7 @@ tests.append(test_voc) def test_wav(h, f): + """WAV file""" import wave # 'RIFF' <len> 'WAVE' 'fmt ' <len> if not h.startswith(b'RIFF') or h[8:12] != b'WAVE' or h[12:16] != b'fmt ': @@ -176,6 +181,7 @@ tests.append(test_wav) def test_8svx(h, f): + """8SVX file""" if not h.startswith(b'FORM') or h[8:12] != b'8SVX': return None # Should decode it to get #channels -- assume always 1 @@ -185,6 +191,7 @@ tests.append(test_8svx) def test_sndt(h, f): + """SNDT file""" if h.startswith(b'SOUND'): nsamples = get_long_le(h[8:12]) rate = get_short_le(h[20:22]) @@ -194,6 +201,7 @@ tests.append(test_sndt) def test_sndr(h, f): + """SNDR file""" if h.startswith(b'\0\0'): rate = get_short_le(h[2:4]) if 4000 <= rate <= 25000: |