- return 1;
- }
- outputs = sr_output_list();
- for (i = 0; outputs[i]; i++) {
- if (strcmp(outputs[i]->id, fmtspec))
- continue;
- g_hash_table_remove(fmtargs, "sigrok_key");
- output_format = outputs[i];
- g_hash_table_iter_init(&iter, fmtargs);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- /* only supporting one parameter per output module
- * for now, and only its value */
- output_format_param = g_strdup(value);
- break;
- }
- break;
- }
- if (!output_format) {
- g_critical("Invalid output format %s.", opt_output_format);
- return 1;
- }
+ if (!(omod = sr_output_find(fmtspec)))
+ g_critical("Unknown output module '%s'.", fmtspec);
+ g_hash_table_remove(fmtargs, "sigrok_key");
+ if ((options = sr_output_options_get(omod))) {
+ fmtopts = generic_arg_to_opt(options, fmtargs);
+ sr_output_options_free(options);
+ } else
+ fmtopts = NULL;
+ o = sr_output_new(omod, fmtopts, sdi);
+ if (fmtopts)
+ g_hash_table_destroy(fmtopts);