gboolean zip_created;
uint64_t samplerate;
char *filename;
- gint min_analog_index;
+ gint analog_offset;
};
static int init(struct sr_output *o, GHashTable *options)
char *s, *metabuf;
gsize metalen;
guint logic_channels = 0, analog_channels = 0;
+ gint min_analog_index;
outc = o->priv;
g_key_file_set_string(meta, devgroup, "samplerate", s);
g_free(s);
- outc->min_analog_index = -1;
+ min_analog_index = -1;
for (l = o->sdi->channels; l; l = l->next) {
ch = l->data;
logic_channels++;
break;
case SR_CHANNEL_ANALOG:
- if (outc->min_analog_index == -1 ||
- ch->index < outc->min_analog_index)
- outc->min_analog_index = ch->index;
+ if (min_analog_index == -1 ||
+ ch->index < min_analog_index)
+ min_analog_index = ch->index;
analog_channels++;
break;
}
}
+ outc->analog_offset = logic_channels - min_analog_index + 1;
+
g_key_file_set_integer(meta, devgroup, "total probes", logic_channels);
g_key_file_set_integer(meta, devgroup, "total analog", analog_channels);
s = g_strdup_printf("probe%d", ch->index + 1);
break;
case SR_CHANNEL_ANALOG:
- s = g_strdup_printf("analog%d",
- ch->index - outc->min_analog_index + 1);
+ s = g_strdup_printf("analog%d", ch->index + outc->analog_offset);
break;
}
if (ch->enabled)
channel = analog->meaning->channels->data;
basename = g_strdup_printf("analog-1-%u",
- channel->index - outc->min_analog_index + 1);
+ channel->index + outc->analog_offset);
baselen = strlen(basename);
next_chunk_num = 1;
num_files = zip_get_num_entries(archive, 0);
sr_dbg("Opened %s.", capturefile);
} else if (vdev->cur_analog_channel < vdev->num_analog_channels) {
vdev->capturefile = g_strdup_printf("analog-1-%d",
- vdev->cur_analog_channel + 1);
+ vdev->num_channels + vdev->cur_analog_channel + 1);
vdev->cur_analog_channel++;
vdev->cur_chunk = 0;
return TRUE;
}
sr_config_set(sdi, NULL, SR_CONF_NUM_ANALOG_CHANNELS,
g_variant_new_int32(total_analog));
- for (k = 0; k < total_analog; k++) {
+ for (k = total_channels; k < (total_channels + total_analog); k++) {
g_snprintf(channelname, sizeof(channelname),
"%d", k);
sr_channel_new(sdi, k, SR_CHANNEL_ANALOG,