changeset 1563:c4640c88942d trunk

[svn] - lowlevel plugin stuff
author nenolod
date Thu, 10 Aug 2006 20:35:10 -0700
parents 71c91ebdb55c
children 3a60eafe91c7
files ChangeLog audacious/plugin.h audacious/pluginenum.c
diffstat 3 files changed, 56 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Aug 10 20:20:39 2006 -0700
+++ b/ChangeLog	Thu Aug 10 20:35:10 2006 -0700
@@ -1,3 +1,12 @@
+2006-08-11 03:20:39 +0000  William Pitcock <nenolod@nenolod.net>
+  revision [2038]
+  - further progress
+  
+
+  Changes:        Modified:
+  +8 -0           trunk/configure.ac  
+
+
 2006-08-11 03:13:57 +0000  William Pitcock <nenolod@nenolod.net>
   revision [2036]
   - bootstrap for ContainerPlugin dir stuff
--- a/audacious/plugin.h	Thu Aug 10 20:20:39 2006 -0700
+++ b/audacious/plugin.h	Thu Aug 10 20:35:10 2006 -0700
@@ -40,6 +40,8 @@
 #define GENERAL_PLUGIN(x) ((GeneralPlugin *)(x))
 #define VIS_PLUGIN(x)     ((VisPlugin *)(x))
 
+#define LOWLEVEL_PLUGIN(x) ((LowlevelPlugin *)(x))
+
 
 typedef enum {
     FMT_U8,
@@ -67,6 +69,8 @@
 typedef struct _GeneralPlugin GeneralPlugin;
 typedef struct _VisPlugin     VisPlugin;
 
+typedef struct _LowlevelPlugin LowlevelPlugin;
+
 /* Sadly, this is the most we can generalize out of the disparate
    plugin structs usable with typecasts - descender */
 struct _Plugin {
@@ -74,6 +78,22 @@
     gchar *filename;
 };
 
+/*
+ * LowlevelPlugin is used for lowlevel system services, such as PlaylistContainers,
+ * VFSContainers and the like.
+ *
+ * They are not GUI visible at this time.
+ */
+struct _LowlevelPlugin {
+    gpointer handle;
+    gchar *filename;
+
+    gchar *description;
+
+    void (*init) (void);
+    void (*cleanup) (void);
+};
+
 struct _OutputPlugin {
     gpointer handle;
     gchar *filename;
--- a/audacious/pluginenum.c	Thu Aug 10 20:20:39 2006 -0700
+++ b/audacious/pluginenum.c	Thu Aug 10 20:35:10 2006 -0700
@@ -49,6 +49,7 @@
 };
 
 GHashTable *plugin_matrix = NULL;
+GList *lowlevel_list = NULL;
 
 static gint
 inputlist_compare_func(gconstpointer a, gconstpointer b)
@@ -113,6 +114,10 @@
         if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename)))
             return TRUE;
 
+    for (l = lowlevel_list; l; l = g_list_next(l))
+        if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename)))
+            return TRUE;
+
     return FALSE;
 }
 
@@ -172,6 +177,12 @@
     vp_data.vis_list = g_list_append(vp_data.vis_list, p);
 }
 
+static void
+lowlevel_plugin_init(Plugin * plugin)
+{
+    LowlevelPlugin *p = LOWLEVEL_PLUGIN(plugin);
+    lowlevel_list = g_list_append(lowlevel_list, p);    
+}
 
 /* FIXME: Placed here (hopefully) temporarily - descender */
 
@@ -187,6 +198,7 @@
     { "effect"       , "get_eplugin_info", effect_plugin_init },
     { "general"      , "get_gplugin_info", general_plugin_init },
     { "visualization", "get_vplugin_info", vis_plugin_init },
+    { "lowlevel"     , "get_lplugin_info", lowlevel_plugin_init },
     { NULL, NULL, NULL }
 };
 
@@ -354,6 +366,7 @@
     EffectPlugin *ep;
     GeneralPlugin *gp;
     VisPlugin *vp;
+    LowlevelPlugin *lp;
     GList *node;
 
     g_message("Shutting down plugin system");
@@ -457,4 +470,18 @@
 
     if (vp_data.vis_list)
         g_list_free(vp_data.vis_list);
+
+    for (node = lowlevel_list; node; node = g_list_next(node)) {
+        lp = LOWLEVEL_PLUGIN(node->data);
+        if (lp && lp->cleanup) {
+            lp->cleanup();
+            GDK_THREADS_LEAVE();
+            while (g_main_iteration(FALSE));
+            GDK_THREADS_ENTER();
+        }
+        g_module_close(lp->handle);
+    }
+
+    if (lowlevel_list)
+        g_list_free(lowlevel_list);
 }