Skip to content

Commit 96d6853

Browse files
author
dedobbin
committed
wav: support more sample sizes
1 parent ebb5ea4 commit 96d6853

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

symphonia-format-riff/src/wave/chunks.rs

+5-9
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,11 @@ impl WaveFormatChunk {
7878
// Select the appropriate codec using bits per sample. Samples are always interleaved and
7979
// little-endian encoded for the PCM format.
8080
let codec = match bits_per_sample {
81-
8 => CODEC_TYPE_PCM_U8,
82-
16 => CODEC_TYPE_PCM_S16LE,
83-
24 => CODEC_TYPE_PCM_S24LE,
84-
32 => CODEC_TYPE_PCM_S32LE,
85-
_ => {
86-
return decode_error(
87-
"wav: bits per sample for fmt_pcm must be 8, 16, 24 or 32 bits",
88-
)
89-
}
81+
1..=8 => CODEC_TYPE_PCM_U8,
82+
9..=16 => CODEC_TYPE_PCM_S16LE,
83+
17..=24 => CODEC_TYPE_PCM_S24LE,
84+
25..=32 => CODEC_TYPE_PCM_S32LE,
85+
_ => return decode_error("wav: bits per sample unsupported for pcm"),
9086
};
9187

9288
let channels = try_channel_count_to_mask(n_channels)?;

0 commit comments

Comments
 (0)