+void show_input(void)
+{
+ const struct sr_input_module *imod;
+ const struct sr_option **opts;
+ GSList *l;
+ int i;
+ char *s, **tok;
+
+ tok = g_strsplit(opt_input_format, ":", 0);
+ if (!tok[0] || !(imod = sr_input_find(tok[0])))
+ g_critical("Input module '%s' not found.", opt_input_format);
+
+ printf("ID: %s\nName: %s\n", sr_input_id_get(imod),
+ sr_input_name_get(imod));
+ printf("Description: %s\n", sr_input_description_get(imod));
+ if ((opts = sr_input_options_get(imod))) {
+ printf("Options:\n");
+ for (i = 0; opts[i]; i++) {
+ printf(" %s: %s", opts[i]->id, opts[i]->desc);
+ if (opts[i]->def) {
+ s = g_variant_print(opts[i]->def, FALSE);
+ printf(" (default %s", s);
+ g_free(s);
+ if (opts[i]->values) {
+ printf(", possible values ");
+ for (l = opts[i]->values; l; l = l->next) {
+ s = g_variant_print((GVariant *)l->data, FALSE);
+ printf("%s%s", s, l->next ? ", " : "");
+ g_free(s);
+ }
+ }
+ printf(")");
+ }
+ printf("\n");
+ }
+ sr_input_options_free(opts);
+ }
+ g_strfreev(tok);
+}
+
+void show_output(void)
+{
+ const struct sr_output_module *omod;
+ const struct sr_option **opts;
+ GSList *l;
+ int i;
+ char *s, **tok;
+
+ tok = g_strsplit(opt_output_format, ":", 0);
+ if (!tok[0] || !(omod = sr_output_find(tok[0])))
+ g_critical("Output module '%s' not found.", opt_output_format);
+
+ printf("ID: %s\nName: %s\n", sr_output_id_get(omod),
+ sr_output_name_get(omod));
+ printf("Description: %s\n", sr_output_description_get(omod));
+ if ((opts = sr_output_options_get(omod))) {
+ printf("Options:\n");
+ for (i = 0; opts[i]; i++) {
+ printf(" %s: %s", opts[i]->id, opts[i]->desc);
+ if (opts[i]->def) {
+ s = g_variant_print(opts[i]->def, FALSE);
+ printf(" (default %s", s);
+ g_free(s);
+ if (opts[i]->values) {
+ printf(", possible values ");
+ for (l = opts[i]->values; l; l = l->next) {
+ s = g_variant_print((GVariant *)l->data, FALSE);
+ printf("%s%s", s, l->next ? ", " : "");
+ g_free(s);
+ }
+ }
+ printf(")");
+ }
+ printf("\n");
+ }
+ sr_output_options_free(opts);
+ }
+ g_strfreev(tok);
+}
+
+void show_transform(void)
+{
+ const struct sr_transform_module *tmod;
+ const struct sr_option **opts;
+ GSList *l;
+ int i;
+ char *s, **tok;
+
+ tok = g_strsplit(opt_transform_module, ":", 0);
+ if (!tok[0] || !(tmod = sr_transform_find(tok[0])))
+ g_critical("Transform module '%s' not found.", opt_transform_module);
+
+ printf("ID: %s\nName: %s\n", sr_transform_id_get(tmod),
+ sr_transform_name_get(tmod));
+ printf("Description: %s\n", sr_transform_description_get(tmod));
+ if ((opts = sr_transform_options_get(tmod))) {
+ printf("Options:\n");
+ for (i = 0; opts[i]; i++) {
+ printf(" %s: %s", opts[i]->id, opts[i]->desc);
+ if (opts[i]->def) {
+ s = g_variant_print(opts[i]->def, FALSE);
+ printf(" (default %s", s);
+ g_free(s);
+ if (opts[i]->values) {
+ printf(", possible values ");
+ for (l = opts[i]->values; l; l = l->next) {
+ s = g_variant_print((GVariant *)l->data, FALSE);
+ printf("%s%s", s, l->next ? ", " : "");
+ g_free(s);
+ }
+ }
+ printf(")");
+ }
+ printf("\n");
+ }
+ sr_transform_options_free(opts);
+ }
+ g_strfreev(tok);
+}