Mercurial > audlegacy
changeset 4827:aa98096c7f68
Implement core changes for output plugin probing.
I never thought I would actually use a goto.
author | William Pitcock <nenolod@atheme.org> |
---|---|
date | Fri, 27 Feb 2009 19:21:36 -0600 |
parents | 68f905a12c77 |
children | e413f6dffd21 |
files | src/audlegacy/pluginenum.c |
diffstat | 1 files changed, 27 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- 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)