changeset 4884:f1fc1d973f27

imported new plugin enumeration loop.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Mon, 22 Jun 2009 14:53:31 +0900
parents f8e00917d6cc
children c058fc4d6968
files src/audlegacy/pluginenum.c
diffstat 1 files changed, 46 insertions(+), 39 deletions(-) [+]
line wrap: on
line diff
--- a/src/audlegacy/pluginenum.c	Sat May 23 00:00:14 2009 +0900
+++ b/src/audlegacy/pluginenum.c	Mon Jun 22 14:53:31 2009 +0900
@@ -401,6 +401,8 @@
     .load_preset_file = load_preset_file,
     .output_plugin_cleanup = output_plugin_cleanup,
     .output_plugin_reinit = output_plugin_reinit,
+
+//    .get_plugin_menu = get_plugin_menu
 };
 
 /*****************************************************************/
@@ -644,7 +646,7 @@
 
     g_message("*** %s\n", buf);
     g_free(buf);
-    
+
     g_module_close(module);
 }
 
@@ -672,7 +674,7 @@
     header->priv_assoc->filename = g_strdup(filename);
 
     n = 0;
-    
+
     if (header->ip_list)
     {
         for (i = 0; (header->ip_list)[i] != NULL; i++, n++)
@@ -699,7 +701,7 @@
             effect_plugin_init(PLUGIN((header->ep_list)[i]));
         }
     }
-    
+
 
     if (header->gp_list)
     {
@@ -906,54 +908,59 @@
     g_free(cfg.enabled_dplugins);
     cfg.enabled_dplugins = NULL;
 
-
-    for (prio = 10; prio >= 0; prio--) {
-        for (node = op_data.output_list; node; node = g_list_next(node)) {
-            op = OUTPUT_PLUGIN(node->data);
+    if (!cfg.outputplugin) {
+        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;
+                if (op->probe_priority != prio)
+                    continue;
+
 		if (op->init)
 		{
 		    OutputPluginInitStatus ret = op->init();
 		    if (ret == OUTPUT_PLUGIN_INIT_NO_DEVICES)
 		    {
-		        printf("Plugin %s reports no devices. Attempting to avert disaster, trying others.\n", 
-		          g_path_get_basename(op->filename));
-                    } else if (ret == OUTPUT_PLUGIN_INIT_FAIL) {
-		        printf("Plugin %s was unable to initialise. Attemping to avert disaster, trying others.\n", 
-		          g_path_get_basename(op->filename));
-                    } else if (ret == OUTPUT_PLUGIN_INIT_FOUND_DEVICES) {
-		        goto found_output;
-                    } else {
-		        printf("Plugin %s did not report status. Do you still need to convert it? Will proceed for now.\n",
-		          g_path_get_basename(op->filename));
-		        goto found_output;
+		        g_message("Plugin %s reports no devices. Attempting to avert disaster, trying others.\n",
+                                  g_path_get_basename(op->filename));
+                    }
+                    else if (ret == OUTPUT_PLUGIN_INIT_FAIL)
+                    {
+		        g_message("Plugin %s was unable to initialise. Attemping to avert disaster, trying others.\n",
+		                  g_path_get_basename(op->filename));
+                    }
+                    else if (ret == OUTPUT_PLUGIN_INIT_FOUND_DEVICES)
+                    {
+                        if (!op_data.current_output_plugin)
+                            op_data.current_output_plugin = op;
                     }
-		} else {
-                   goto found_output;
-                }
+                    else if (!op_data.current_output_plugin)
+                    {
+		        g_message("Plugin %s did not report status, and no plugin has worked yet. Do you still need to convert it? Selecting for now...\n",
+		                  g_path_get_basename(op->filename));
+
+                        if (!op_data.current_output_plugin)
+                            op_data.current_output_plugin = op;
+                    }
+		}
+            }
+        }
+    }
+    else
+    {
+        for (node = op_data.output_list; node; node = g_list_next(node)) {
+            op = OUTPUT_PLUGIN(node->data);
+
+            if (op->init) {
+                plugin_set_current((Plugin *)op);
+                op->init();
             }
 
-            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;
-                }
-	    }
+            if (!g_ascii_strcasecmp(g_path_get_basename(cfg.outputplugin), g_path_get_basename(op->filename)))
+                op_data.current_output_plugin = op;
         }
     }
 
-found_output:
     for (node = ip_data.input_list; node; node = g_list_next(node)) {
         ip = INPUT_PLUGIN(node->data);
         if (ip->init)