Fixed a big in INFO parsing

This commit is contained in:
Jamie Hardt
2022-11-23 18:50:46 -08:00
parent 64f3a640e3
commit d9e3e8deee
3 changed files with 3 additions and 3 deletions

View File

@@ -21,12 +21,12 @@ class TestWaveInfo(TestCase):
self.assertEqual(info.fmt.channel_count, ffprobe_info['streams'][0]['channels'])
self.assertEqual(info.fmt.sample_rate, int(ffprobe_info['streams'][0]['sample_rate']))
self.assertEqual(info.fmt.bits_per_sample, int(ffprobe_info['streams'][0]['bits_per_raw_sample']))
self.assertEqual(info.fmt.bits_per_sample, int(ffprobe_info['streams'][0]['bits_per_sample']))
if info.fmt.audio_format == 1:
self.assertTrue(ffprobe_info['streams'][0]['codec_name'].startswith('pcm'))
streams = ffprobe_info['streams'][0]
byte_rate = int(streams['sample_rate']) * streams['channels'] * int(streams['bits_per_raw_sample']) / 8
byte_rate = int(streams['sample_rate']) * streams['channels'] * int(streams['bits_per_sample']) / 8
self.assertEqual(info.fmt.byte_rate, byte_rate)
def test_data_against_ffprobe(self):

View File

@@ -91,7 +91,7 @@ class WavInfoReader:
return chunk_descriptor.read_data(from_stream) if chunk_descriptor else None
def _describe_data(self):
data_chunk = next(c for c in self.main_list if c.ident == b'data')
data_chunk = next(c for c in self.main_list if type(c) is ChunkDescriptor and c.ident == b'data')
return WavDataDescriptor(byte_count=data_chunk.length,
frame_count=int(data_chunk.length / self.fmt.block_align))