File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,11 @@ struct wave_format_chunk {
21
21
uint32_t byte_rate ;
22
22
uint16_t block_align ;
23
23
uint16_t bits_per_sample ;
24
- uint16_t extra_params ; // Assumed to be zero below.
24
+ uint16_t extra_params ;
25
+ uint16_t valid_bits_per_sample ;
26
+ uint32_t channel_mask ;
27
+ uint16_t extended_audio_format ;
28
+ uint8_t extended_guid [14 ];
25
29
};
26
30
27
31
void common_hal_audioio_wavefile_construct (audioio_wavefile_obj_t * self ,
@@ -56,11 +60,14 @@ void common_hal_audioio_wavefile_construct(audioio_wavefile_obj_t *self,
56
60
if (bytes_read != format_size ) {
57
61
}
58
62
59
- if (format .audio_format != 1 ||
63
+ if (( format_size != 40 && format .audio_format != 1 ) ||
60
64
format .num_channels > 2 ||
61
65
format .bits_per_sample > 16 ||
62
- (format_size == 18 &&
63
- format .extra_params != 0 )) {
66
+ (format_size == 18 && format .extra_params != 0 ) ||
67
+ (format_size == 40 &&
68
+ (format .audio_format != 0xfffe ||
69
+ format .extended_audio_format != 1 ||
70
+ format .valid_bits_per_sample != format .bits_per_sample ))) {
64
71
mp_raise_ValueError (MP_ERROR_TEXT ("Unsupported format" ));
65
72
}
66
73
// Get the sample_rate
You can’t perform that action at this time.
0 commit comments