srzip: Renumber analog channels from zero in output file.
This commit is contained in:
parent
7163dcbe18
commit
26918dced0
|
@ -33,6 +33,7 @@ struct out_context {
|
||||||
gboolean zip_created;
|
gboolean zip_created;
|
||||||
uint64_t samplerate;
|
uint64_t samplerate;
|
||||||
char *filename;
|
char *filename;
|
||||||
|
gint min_analog_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int init(struct sr_output *o, GHashTable *options)
|
static int init(struct sr_output *o, GHashTable *options)
|
||||||
|
@ -104,6 +105,8 @@ static int zip_create(const struct sr_output *o)
|
||||||
g_key_file_set_string(meta, devgroup, "samplerate", s);
|
g_key_file_set_string(meta, devgroup, "samplerate", s);
|
||||||
g_free(s);
|
g_free(s);
|
||||||
|
|
||||||
|
outc->min_analog_index = -1;
|
||||||
|
|
||||||
for (l = o->sdi->channels; l; l = l->next) {
|
for (l = o->sdi->channels; l; l = l->next) {
|
||||||
ch = l->data;
|
ch = l->data;
|
||||||
switch (ch->type) {
|
switch (ch->type) {
|
||||||
|
@ -111,6 +114,9 @@ static int zip_create(const struct sr_output *o)
|
||||||
logic_channels++;
|
logic_channels++;
|
||||||
break;
|
break;
|
||||||
case SR_CHANNEL_ANALOG:
|
case SR_CHANNEL_ANALOG:
|
||||||
|
if (outc->min_analog_index == -1 ||
|
||||||
|
ch->index < outc->min_analog_index)
|
||||||
|
outc->min_analog_index = ch->index;
|
||||||
analog_channels++;
|
analog_channels++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +132,8 @@ static int zip_create(const struct sr_output *o)
|
||||||
s = g_strdup_printf("probe%d", ch->index + 1);
|
s = g_strdup_printf("probe%d", ch->index + 1);
|
||||||
break;
|
break;
|
||||||
case SR_CHANNEL_ANALOG:
|
case SR_CHANNEL_ANALOG:
|
||||||
s = g_strdup_printf("analog%d", ch->index + 1);
|
s = g_strdup_printf("analog%d",
|
||||||
|
ch->index - outc->min_analog_index + 1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (ch->enabled)
|
if (ch->enabled)
|
||||||
|
@ -310,7 +317,8 @@ static int zip_append_analog(const struct sr_output *o,
|
||||||
}
|
}
|
||||||
channel = analog->meaning->channels->data;
|
channel = analog->meaning->channels->data;
|
||||||
|
|
||||||
basename = g_strdup_printf("analog-1-%u", channel->index + 1);
|
basename = g_strdup_printf("analog-1-%u",
|
||||||
|
channel->index - outc->min_analog_index + 1);
|
||||||
baselen = strlen(basename);
|
baselen = strlen(basename);
|
||||||
next_chunk_num = 1;
|
next_chunk_num = 1;
|
||||||
num_files = zip_get_num_entries(archive, 0);
|
num_files = zip_get_num_entries(archive, 0);
|
||||||
|
|
Loading…
Reference in New Issue