+ /*
+ * Scan flexible, to get prefered format specs which describe
+ * the input file's data formats. As well as some simple specs
+ * for backwards compatibility and user convenience.
+ *
+ * This logic ends up with a copy of the format string, either
+ * user provided or internally derived. Actual creation of the
+ * column processing details gets deferred until the first line
+ * of input data was seen. To support automatic determination of
+ * e.g. channel counts from column counts.
+ */
+ s = g_variant_get_string(g_hash_table_lookup(options, "column_formats"), NULL);
+ if (s && *s) {
+ inc->column_formats = g_strdup(s);
+ sr_dbg("User specified column_formats: %s.", s);
+ } else if (single_column && logic_channels) {
+ format_char = col_format_char[format];
+ if (single_column == 1) {
+ inc->column_formats = g_strdup_printf("%c%zu",
+ format_char, logic_channels);
+ } else {
+ inc->column_formats = g_strdup_printf("%zu-,%c%zu",
+ single_column - 1,
+ format_char, logic_channels);
+ }
+ sr_dbg("Backwards compat single_column, col %zu, fmt %s, bits %zu -> %s.",
+ single_column, col_format_text[format], logic_channels,
+ inc->column_formats);
+ } else if (!single_column) {
+ if (first_column > 1) {
+ inc->column_formats = g_strdup_printf("%zu-,%zul",
+ first_column - 1, logic_channels);
+ } else {
+ inc->column_formats = g_strdup_printf("%zul",
+ logic_channels);
+ }
+ sr_dbg("Backwards compat multi-column, col %zu, chans %zu -> %s.",
+ first_column, logic_channels,
+ inc->column_formats);
+ } else {
+ sr_warn("Unknown or unsupported columns layout spec, assuming simple multi-column mode.");
+ inc->column_formats = g_strdup("*l");