]> sigrok.org Git - libsigrok.git/blobdiff - src/input/wav.c
Random whitespace and other minor fixes.
[libsigrok.git] / src / input / wav.c
index 647b537cd4883e4ec5e8c748dd708b87b55e15b2..611878e850495f79342cb0b4091c61d2dc9b50d4 100644 (file)
@@ -73,7 +73,6 @@ static int parse_wav_header(GString *buf, struct context *inc)
                return SR_ERR_DATA;
        }
 
-
        if (fmt_code == WAVE_FORMAT_PCM) {
        } else if (fmt_code == WAVE_FORMAT_IEEE_FLOAT) {
                if (unitsize != 4) {
@@ -161,7 +160,7 @@ static int find_data_chunk(GString *buf, int initial_offset)
        unsigned int offset, i;
 
        offset = initial_offset;
-       while(offset < MIN(MAX_DATA_CHUNK_OFFSET, buf->len)) {
+       while (offset < MIN(MAX_DATA_CHUNK_OFFSET, buf->len)) {
                if (!memcmp(buf->str + offset, "data", 4))
                        /* Skip into the samples. */
                        return offset + 8;
@@ -240,7 +239,6 @@ static int process_buffer(struct sr_input *in)
        struct context *inc;
        struct sr_datafeed_packet packet;
        struct sr_datafeed_meta meta;
-       struct sr_channel *ch;
        struct sr_config *src;
        int offset, chunk_samples, total_samples, processed, max_chunk_samples;
        int num_samples, i;
@@ -250,8 +248,7 @@ static int process_buffer(struct sr_input *in)
        if (!inc->started) {
                for (i = 0; i < inc->num_channels; i++) {
                        snprintf(channelname, 8, "CH%d", i + 1);
-                       ch = sr_channel_new(i, SR_CHANNEL_ANALOG, TRUE, channelname);
-                       in->sdi->channels = g_slist_append(in->sdi->channels, ch);
+                       sr_channel_new(in->sdi, i, SR_CHANNEL_ANALOG, TRUE, channelname);
                }
 
                std_session_send_df_header(in->sdi, LOG_PREFIX);
@@ -365,10 +362,10 @@ SR_PRIV struct sr_input_module input_wav = {
        .id = "wav",
        .name = "WAV",
        .desc = "WAV file",
+       .exts = (const char*[]){"wav", NULL},
        .metadata = { SR_INPUT_META_HEADER | SR_INPUT_META_REQUIRED },
        .format_match = format_match,
        .init = init,
        .receive = receive,
        .end = end,
 };
-