- g_string_append_printf(ctx->header, "; Channels (%d/%d): ",
- ctx->num_enabled_probes, num_probes);
- for (i = 0; i < ctx->num_enabled_probes; i++)
- g_string_append_printf(ctx->header, "%s, ", ctx->probelist[i]);
- g_string_append_printf(ctx->header, "\n");
+ num_channels = g_slist_length(o->sdi->channels);
+ g_string_append_printf(header, "; Channels (%d/%d):",
+ ctx->num_enabled_channels, num_channels);
+ for (i = 0, l = o->sdi->channels; l; l = l->next, i++) {
+ ch = l->data;
+ if (ch->type != SR_CHANNEL_LOGIC)
+ continue;
+ if (!ch->enabled)
+ continue;
+ g_string_append_printf(header, " %s,", ch->name);
+ }
+ if (o->sdi->channels)
+ /* Drop last separator. */
+ g_string_truncate(header, header->len - 1);
+ g_string_append_printf(header, "\n");
+
+ if (ctx->samplerate == 0) {
+ if (sr_config_get(o->sdi->driver, o->sdi, NULL, SR_CONF_SAMPLERATE,
+ &gvar) == SR_OK) {
+ ctx->samplerate = g_variant_get_uint64(gvar);
+ g_variant_unref(gvar);
+ }
+ }
+ if (ctx->samplerate != 0) {
+ samplerate_s = sr_samplerate_string(ctx->samplerate);
+ g_string_append_printf(header, "; Samplerate: %s\n", samplerate_s);
+ g_free(samplerate_s);
+ }