]> sigrok.org Git - libsigrok.git/blobdiff - src/input/wav.c
Removal of sdi->index, step 3: sr_dev_inst_new() calls for input mods
[libsigrok.git] / src / input / wav.c
index fe12a2f812647d4bc0d4b173ee65232d7d266983..528209569a71824de3245ecea2abe1c891b3659f 100644 (file)
@@ -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) {
@@ -149,7 +149,7 @@ static int init(struct sr_input *in, GHashTable *options)
 {
        (void)options;
 
-       in->sdi = sr_dev_inst_new(0, SR_ST_ACTIVE, NULL, NULL, NULL);
+       in->sdi = sr_dev_inst_new(SR_ST_ACTIVE, NULL, NULL, NULL);
 
        return SR_OK;
 }