X-Git-Url: https://sigrok.org/gitweb/?a=blobdiff_plain;f=src%2Finput%2Fwav.c;h=edabd47ca95324a934d81ae9d39b30ecfe65a59f;hb=9a10ce65d62526a24cbca2ee9e1cf55e132d6f7a;hp=fe12a2f812647d4bc0d4b173ee65232d7d266983;hpb=73145219c01dd8a1a00f54c7ac4c2c537ff02518;p=libsigrok.git diff --git a/src/input/wav.c b/src/input/wav.c index fe12a2f8..edabd47c 100644 --- a/src/input/wav.c +++ b/src/input/wav.c @@ -63,15 +63,15 @@ static int parse_wav_header(GString *buf, struct context *inc) samplerate = RL32(buf->str + 24); samplesize = RL16(buf->str + 32); - if (samplesize != 8 && samplesize != 16 && samplesize != 32) { - sr_err("Only 8, 16 or 32 bits per sample supported."); - return SR_ERR_DATA; - } - num_channels = RL16(buf->str + 22); if (num_channels == 0) return SR_ERR; unitsize = samplesize / num_channels; + if (unitsize != 1 && unitsize != 2 && unitsize != 4) { + sr_err("Only 8, 16 or 32 bits per sample supported."); + return SR_ERR_DATA; + } + if (fmt_code == WAVE_FORMAT_PCM) { } else if (fmt_code == WAVE_FORMAT_IEEE_FLOAT) {