# HG changeset patch # User William Pitcock # Date 1235784096 21600 # Node ID aa98096c7f6886329b9cbee47c6bfa5674fa1190 # Parent 68f905a12c772aa264375c05a03341ce683caf94 Implement core changes for output plugin probing. I never thought I would actually use a goto. diff -r 68f905a12c77 -r aa98096c7f68 src/audlegacy/pluginenum.c --- a/src/audlegacy/pluginenum.c Fri Feb 27 19:16:28 2009 -0600 +++ b/src/audlegacy/pluginenum.c Fri Feb 27 19:21:36 2009 -0600 @@ -826,6 +826,7 @@ DiscoveryPlugin *dp; GtkWidget *dialog; gint dirsel = 0, i = 0; + gint prio; if (!g_module_supported()) { dialog = @@ -909,22 +910,34 @@ cfg.enabled_dplugins = NULL; - for (node = op_data.output_list; node; node = g_list_next(node)) { - op = OUTPUT_PLUGIN(node->data); - /* - * Only test basename to avoid problems when changing - * prefix. We will only see one plugin with the same - * basename, so this is usually what the user want. - */ - if (cfg.outputplugin && !strcmp(g_path_get_basename(cfg.outputplugin), g_path_get_basename(op->filename))) - op_data.current_output_plugin = op; - if (op->init) - { - plugin_set_current((Plugin *)op); - op->init(); - } + for (prio = 10; prio >= 0; prio--) { + for (node = op_data.output_list; node; node = g_list_next(node)) { + op = OUTPUT_PLUGIN(node->data); + + /* + * Only test basename to avoid problems when changing + * prefix. We will only see one plugin with the same + * basename, so this is usually what the user want. + */ + if (cfg.outputplugin && !strcmp(g_path_get_basename(cfg.outputplugin), g_path_get_basename(op->filename))) + { + op_data.current_output_plugin = op; + goto found_output; + } + + if (op->init && op->probe_priority == prio) + { + plugin_set_current((Plugin *)op); + if (op->init() == OUTPUT_PLUGIN_INIT_FOUND_DEVICES && op_data.current_output_plugin == NULL) + { + op_data.current_output_plugin = op; + goto found_output; + } + } + } } +found_output: for (node = ip_data.input_list; node; node = g_list_next(node)) { ip = INPUT_PLUGIN(node->data); if (ip->init)