Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 2797:f0c1c8b22c88 trunk
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
| author | nenolod |
|---|---|
| date | Thu, 24 May 2007 03:27:54 -0700 |
| parents | fa6c339cce38 |
| children | 7144a4e5e978 |
| rev | line source |
|---|---|
| 2313 | 1 /* Audacious - Cross-platform multimedia player |
| 2 * Copyright (C) 2005-2007 Audacious development team | |
| 3 * | |
| 4 * Based on BMP: | |
| 5 * Copyright (C) 2003-2004 BMP development team | |
| 6 * | |
| 7 * Based on XMMS: | |
| 8 * Copyright (C) 1998-2003 XMMS development team | |
| 9 * | |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
| 12 * the Free Software Foundation; under version 2 of the License. | |
| 13 * | |
| 14 * This program is distributed in the hope that it will be useful, | |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 * GNU General Public License for more details. | |
| 18 * | |
| 19 * You should have received a copy of the GNU General Public License | |
| 20 * along with this program; if not, write to the Free Software | |
| 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | |
| 22 */ | |
| 23 | |
| 24 #ifdef HAVE_CONFIG_H | |
| 25 # include "config.h" | |
| 26 #endif | |
| 27 | |
| 28 #ifndef SHARED_SUFFIX | |
| 29 # define SHARED_SUFFIX G_MODULE_SUFFIX | |
| 30 #endif | |
| 31 | |
| 32 #include "pluginenum.h" | |
| 33 | |
| 34 #include <glib.h> | |
| 35 #include <gmodule.h> | |
| 36 #include <glib/gprintf.h> | |
| 37 #include <string.h> | |
| 38 | |
| 39 #include "main.h" | |
| 40 #include "ui_main.h" | |
| 41 #include "playback.h" | |
| 42 #include "playlist.h" | |
|
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2313
diff
changeset
|
43 #include "strings.h" |
| 2313 | 44 #include "util.h" |
| 45 | |
| 46 #include "effect.h" | |
| 47 #include "general.h" | |
| 48 #include "input.h" | |
| 49 #include "output.h" | |
| 50 #include "visualization.h" | |
| 51 | |
| 52 const gchar *plugin_dir_list[] = { | |
| 53 PLUGINSUBS, | |
| 54 NULL | |
| 55 }; | |
| 56 | |
| 57 GHashTable *plugin_matrix = NULL; | |
| 58 GList *lowlevel_list = NULL; | |
| 59 | |
| 2623 | 60 extern GList *vfs_transports; |
| 61 | |
| 2313 | 62 static gint |
| 63 inputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 64 { | |
| 65 const InputPlugin *ap = a, *bp = b; | |
| 66 return strcasecmp(ap->description, bp->description); | |
| 67 } | |
| 68 | |
| 69 static gint | |
| 70 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 71 { | |
| 72 const OutputPlugin *ap = a, *bp = b; | |
| 73 return strcasecmp(ap->description, bp->description); | |
| 74 } | |
| 75 | |
| 76 static gint | |
| 77 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
| 78 { | |
| 79 const EffectPlugin *ap = a, *bp = b; | |
| 80 return strcasecmp(ap->description, bp->description); | |
| 81 } | |
| 82 | |
| 83 static gint | |
| 84 generallist_compare_func(gconstpointer a, gconstpointer b) | |
| 85 { | |
| 86 const GeneralPlugin *ap = a, *bp = b; | |
| 87 return strcasecmp(ap->description, bp->description); | |
| 88 } | |
| 89 | |
| 90 static gint | |
| 91 vislist_compare_func(gconstpointer a, gconstpointer b) | |
| 92 { | |
| 93 const VisPlugin *ap = a, *bp = b; | |
| 94 return strcasecmp(ap->description, bp->description); | |
| 95 } | |
| 96 | |
| 97 static gboolean | |
| 98 plugin_is_duplicate(const gchar * filename) | |
| 99 { | |
| 100 GList *l; | |
| 101 const gchar *basename = g_basename(filename); | |
| 102 | |
| 103 /* FIXME: messy stuff */ | |
| 104 | |
| 105 for (l = ip_data.input_list; l; l = g_list_next(l)) | |
| 106 if (!strcmp(basename, g_basename(INPUT_PLUGIN(l->data)->filename))) | |
| 107 return TRUE; | |
| 108 | |
| 109 for (l = op_data.output_list; l; l = g_list_next(l)) | |
| 110 if (!strcmp(basename, g_basename(OUTPUT_PLUGIN(l->data)->filename))) | |
| 111 return TRUE; | |
| 112 | |
| 113 for (l = ep_data.effect_list; l; l = g_list_next(l)) | |
| 114 if (!strcmp(basename, g_basename(EFFECT_PLUGIN(l->data)->filename))) | |
| 115 return TRUE; | |
| 116 | |
| 117 for (l = gp_data.general_list; l; l = g_list_next(l)) | |
| 118 if (!strcmp(basename, g_basename(GENERAL_PLUGIN(l->data)->filename))) | |
| 119 return TRUE; | |
| 120 | |
| 121 for (l = vp_data.vis_list; l; l = g_list_next(l)) | |
| 122 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 123 return TRUE; | |
| 124 | |
| 125 for (l = lowlevel_list; l; l = g_list_next(l)) | |
| 126 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 127 return TRUE; | |
| 128 | |
| 129 return FALSE; | |
| 130 } | |
| 131 | |
| 132 | |
| 133 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))() | |
| 134 typedef Plugin * (*PluginGetInfoFunc) (void); | |
| 135 | |
| 136 static void | |
| 137 input_plugin_init(Plugin * plugin) | |
| 138 { | |
| 139 InputPlugin *p = INPUT_PLUGIN(plugin); | |
| 140 | |
| 141 p->get_vis_type = input_get_vis_type; | |
| 142 p->add_vis_pcm = input_add_vis_pcm; | |
| 143 | |
| 144 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
| 145 else thinks we could use a CONST macro to solve the warnings? | |
| 146 - descender */ | |
| 147 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; | |
| 148 p->set_info_text = (void (*)(gchar *)) input_set_info_text; | |
| 149 p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering; | |
| 150 | |
| 151 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
| 152 | |
| 153 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename), | |
| 154 GINT_TO_POINTER(1)); | |
| 155 } | |
| 156 | |
| 157 static void | |
| 158 output_plugin_init(Plugin * plugin) | |
| 159 { | |
| 160 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
| 161 op_data.output_list = g_list_append(op_data.output_list, p); | |
| 162 } | |
| 163 | |
| 164 static void | |
| 165 effect_plugin_init(Plugin * plugin) | |
| 166 { | |
| 167 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
| 168 ep_data.effect_list = g_list_append(ep_data.effect_list, p); | |
| 169 } | |
| 170 | |
| 171 static void | |
| 172 general_plugin_init(Plugin * plugin) | |
| 173 { | |
| 174 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
| 175 gp_data.general_list = g_list_append(gp_data.general_list, p); | |
| 176 } | |
| 177 | |
| 178 static void | |
| 179 vis_plugin_init(Plugin * plugin) | |
| 180 { | |
| 181 VisPlugin *p = VIS_PLUGIN(plugin); | |
| 182 p->disable_plugin = vis_disable_plugin; | |
| 183 vp_data.vis_list = g_list_append(vp_data.vis_list, p); | |
| 184 } | |
| 185 | |
| 186 static void | |
| 187 lowlevel_plugin_init(Plugin * plugin) | |
| 188 { | |
| 189 LowlevelPlugin *p = LOWLEVEL_PLUGIN(plugin); | |
| 190 lowlevel_list = g_list_append(lowlevel_list, p); | |
| 191 } | |
| 192 | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
193 /*******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
194 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
195 static void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
196 plugin2_dispose(GModule *module, const gchar *str, ...) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
197 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
198 gchar buf[4096]; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
199 va_list va; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
200 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
201 va_start(va, str); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
202 vsnprintf(buf, 4096, str, va); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
203 va_end(va); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
204 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
205 g_print("*** %s\n", buf); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
206 g_module_close(module); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
207 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
208 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
209 void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
210 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
211 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
212 InputPlugin **ip_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
213 OutputPlugin **op_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
214 EffectPlugin **ep_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
215 GeneralPlugin **gp_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
216 VisPlugin **vp_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
217 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
218 if (header->magic != PLUGIN_MAGIC) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
219 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
220 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
221 if (header->api_version != __AUDACIOUS_PLUGIN_API__) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
222 return plugin2_dispose(module, "plugin <%s> discarded, wanting API version %d, we implement API version %d", |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
223 filename, header->api_version, __AUDACIOUS_PLUGIN_API__); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
224 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
225 if (header->init) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
226 header->init(); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
227 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
228 header->priv_assoc = g_new0(Plugin, 1); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
229 header->priv_assoc->handle = module; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
230 header->priv_assoc->filename = g_strdup(filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
231 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
232 for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
233 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
234 g_print("plugin2 '%s' provides InputPlugin <%p>", filename, *ip_iter); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
235 input_plugin_init(PLUGIN(*ip_iter)); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
236 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
237 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
238 for (op_iter = header->op_list; *op_iter != NULL; op_iter++) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
239 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
240 g_print("plugin2 '%s' provides OutputPlugin <%p>", filename, *op_iter); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
241 output_plugin_init(PLUGIN(*op_iter)); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
242 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
243 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
244 for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
245 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
246 g_print("plugin2 '%s' provides EffectPlugin <%p>", filename, *ep_iter); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
247 effect_plugin_init(PLUGIN(*ep_iter)); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
248 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
249 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
250 for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
251 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
252 g_print("plugin2 '%s' provides GeneralPlugin <%p>", filename, *gp_iter); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
253 general_plugin_init(PLUGIN(*gp_iter)); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
254 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
255 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
256 for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
257 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
258 g_print("plugin2 '%s' provides VisPlugin <%p>", filename, *vp_iter); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
259 vis_plugin_init(PLUGIN(*vp_iter)); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
260 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
261 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
262 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
263 void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
264 plugin2_unload(PluginHeader *header) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
265 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
266 GModule *module; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
267 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
268 g_return_if_fail(header->priv_assoc != NULL); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
269 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
270 module = header->priv_assoc->handle; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
271 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
272 g_free(header->priv_assoc->filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
273 g_free(header->priv_assoc); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
274 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
275 if (header->fini) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
276 header->fini(); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
277 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
278 g_module_close(module); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
279 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
280 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
281 /******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
282 |
| 2313 | 283 /* FIXME: Placed here (hopefully) temporarily - descender */ |
| 284 | |
| 285 typedef struct { | |
| 286 const gchar *name; | |
| 287 const gchar *id; | |
| 288 void (*init)(Plugin *); | |
| 289 } PluginType; | |
| 290 | |
| 291 static PluginType plugin_types[] = { | |
| 292 { "input" , "get_iplugin_info", input_plugin_init }, | |
| 293 { "output" , "get_oplugin_info", output_plugin_init }, | |
| 294 { "effect" , "get_eplugin_info", effect_plugin_init }, | |
| 295 { "general" , "get_gplugin_info", general_plugin_init }, | |
| 296 { "visualization", "get_vplugin_info", vis_plugin_init }, | |
| 297 { "lowlevel" , "get_lplugin_info", lowlevel_plugin_init }, | |
| 298 { NULL, NULL, NULL } | |
| 299 }; | |
| 300 | |
| 301 static void | |
| 302 add_plugin(const gchar * filename) | |
| 303 { | |
| 304 PluginType *type; | |
| 305 GModule *module; | |
| 306 gpointer func; | |
| 307 | |
| 308 if (plugin_is_duplicate(filename)) | |
| 309 return; | |
| 310 | |
| 2623 | 311 g_message("Loaded plugin (%s)", filename); |
| 312 | |
| 2313 | 313 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 314 printf("Failed to load plugin (%s): %s\n", | |
| 315 filename, g_module_error()); | |
| 316 return; | |
| 317 } | |
| 318 | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
319 /* v2 plugin loading */ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
320 if (g_module_symbol(module, "get_plugin_info", &func)) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
321 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
322 PluginHeader *(*header_func_p)() = func; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
323 PluginHeader *header; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
324 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
325 /* this should never happen. */ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
326 g_return_if_fail((header = header_func_p()) != NULL); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
327 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
328 plugin2_process(header, module, filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
329 return; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
330 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
331 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
332 /* v1 plugin loading */ |
| 2313 | 333 for (type = plugin_types; type->name; type++) |
| 334 { | |
| 335 if (g_module_symbol(module, type->id, &func)) { | |
| 336 Plugin *plugin = PLUGIN_GET_INFO(func); | |
| 337 | |
| 338 plugin->handle = module; | |
| 339 plugin->filename = g_strdup(filename); | |
| 340 type->init(PLUGIN_GET_INFO(func)); | |
| 341 | |
| 342 return; | |
| 343 } | |
| 344 } | |
| 345 | |
| 346 printf("Invalid plugin (%s)\n", filename); | |
| 347 g_module_close(module); | |
| 348 } | |
| 349 | |
| 350 static gboolean | |
| 351 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 352 { | |
| 353 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 354 return FALSE; | |
| 355 | |
| 356 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 357 return FALSE; | |
| 358 | |
| 359 add_plugin(path); | |
| 360 | |
| 361 return FALSE; | |
| 362 } | |
| 363 | |
| 364 static void | |
| 365 scan_plugins(const gchar * path) | |
| 366 { | |
| 367 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 368 } | |
| 369 | |
| 370 void | |
| 371 plugin_system_init(void) | |
| 372 { | |
| 373 gchar *dir, **disabled; | |
| 374 GList *node; | |
| 375 OutputPlugin *op; | |
| 376 InputPlugin *ip; | |
| 377 LowlevelPlugin *lp; | |
| 378 gint dirsel = 0, i = 0; | |
| 379 | |
| 380 if (!g_module_supported()) { | |
| 381 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 382 return; | |
| 383 } | |
| 384 | |
|
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
385 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
| 2313 | 386 NULL); |
| 387 | |
| 388 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 389 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 390 /* | |
| 391 * This is in a separate loop so if the user puts them in the | |
| 392 * wrong dir we'll still get them in the right order (home dir | |
| 393 * first) - Zinx | |
| 394 */ | |
| 395 while (plugin_dir_list[dirsel]) { | |
| 396 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 397 plugin_dir_list[dirsel++], NULL); | |
| 398 scan_plugins(dir); | |
| 399 g_free(dir); | |
| 400 } | |
| 401 dirsel = 0; | |
| 402 #endif | |
| 403 | |
| 404 while (plugin_dir_list[dirsel]) { | |
| 405 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 406 scan_plugins(dir); | |
| 407 g_free(dir); | |
| 408 } | |
| 409 | |
| 410 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 411 if (!op_data.current_output_plugin | |
| 412 && g_list_length(op_data.output_list)) { | |
| 413 op_data.current_output_plugin = op_data.output_list->data; | |
| 414 } | |
| 415 | |
| 416 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 417 | |
| 418 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 419 ep_data.enabled_list = NULL; | |
| 420 | |
| 421 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 422 gp_data.enabled_list = NULL; | |
| 423 | |
| 424 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 425 vp_data.enabled_list = NULL; | |
| 426 | |
| 427 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
| 428 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 429 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
| 430 | |
| 431 g_free(cfg.enabled_gplugins); | |
| 432 cfg.enabled_gplugins = NULL; | |
| 433 | |
| 434 g_free(cfg.enabled_vplugins); | |
| 435 cfg.enabled_vplugins = NULL; | |
| 436 | |
| 437 g_free(cfg.enabled_eplugins); | |
| 438 cfg.enabled_eplugins = NULL; | |
| 439 | |
| 440 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
| 441 op = OUTPUT_PLUGIN(node->data); | |
| 442 /* | |
| 443 * Only test basename to avoid problems when changing | |
| 444 * prefix. We will only see one plugin with the same | |
| 445 * basename, so this is usually what the user want. | |
| 446 */ | |
| 447 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
| 448 op_data.current_output_plugin = op; | |
| 449 if (op->init) | |
| 450 op->init(); | |
| 451 } | |
| 452 | |
| 453 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 454 ip = INPUT_PLUGIN(node->data); | |
| 455 if (ip->init) | |
| 456 ip->init(); | |
| 457 } | |
| 458 | |
| 459 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 460 lp = LOWLEVEL_PLUGIN(node->data); | |
| 461 if (lp->init) | |
| 462 lp->init(); | |
| 463 } | |
| 464 | |
| 465 if (cfg.disabled_iplugins) { | |
| 466 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
| 467 while (disabled[i]) { | |
| 468 g_hash_table_replace(plugin_matrix, disabled[i], | |
| 469 GINT_TO_POINTER(FALSE)); | |
| 470 i++; | |
| 471 } | |
| 472 | |
| 473 g_free(disabled); | |
| 474 | |
| 475 g_free(cfg.disabled_iplugins); | |
| 476 cfg.disabled_iplugins = NULL; | |
| 477 } | |
| 478 } | |
| 479 | |
| 480 void | |
| 481 plugin_system_cleanup(void) | |
| 482 { | |
| 483 InputPlugin *ip; | |
| 484 OutputPlugin *op; | |
| 485 EffectPlugin *ep; | |
| 486 GeneralPlugin *gp; | |
| 487 VisPlugin *vp; | |
| 488 LowlevelPlugin *lp; | |
| 489 GList *node; | |
| 490 | |
| 491 g_message("Shutting down plugin system"); | |
| 492 | |
| 493 if (playback_get_playing()) { | |
| 494 ip_data.stop = TRUE; | |
| 495 playback_stop(); | |
| 496 ip_data.stop = FALSE; | |
| 497 } | |
| 498 | |
| 2623 | 499 /* FIXME: race condition -nenolod */ |
| 500 op_data.current_output_plugin = NULL; | |
| 501 | |
| 2313 | 502 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 503 ip = INPUT_PLUGIN(node->data); | |
| 504 if (ip && ip->cleanup) { | |
| 505 ip->cleanup(); | |
| 506 GDK_THREADS_LEAVE(); | |
| 507 while (g_main_context_iteration(NULL, FALSE)); | |
| 508 GDK_THREADS_ENTER(); | |
| 509 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
510 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
511 if (ip->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
512 g_module_close(ip->handle); |
| 2313 | 513 } |
| 514 | |
| 2623 | 515 if (ip_data.input_list != NULL) |
| 516 { | |
| 2313 | 517 g_list_free(ip_data.input_list); |
| 2623 | 518 ip_data.input_list = NULL; |
| 519 } | |
| 2313 | 520 |
| 521 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 522 op = OUTPUT_PLUGIN(node->data); | |
| 523 if (op && op->cleanup) { | |
| 524 op->cleanup(); | |
| 525 GDK_THREADS_LEAVE(); | |
| 526 while (g_main_context_iteration(NULL, FALSE)); | |
| 527 GDK_THREADS_ENTER(); | |
| 528 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
529 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
530 if (op->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
531 g_module_close(op->handle); |
| 2313 | 532 } |
| 533 | |
| 2623 | 534 if (op_data.output_list != NULL) |
| 535 { | |
| 2313 | 536 g_list_free(op_data.output_list); |
| 2623 | 537 op_data.output_list = NULL; |
| 538 } | |
| 2313 | 539 |
| 540 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 541 ep = EFFECT_PLUGIN(node->data); | |
| 542 if (ep && ep->cleanup) { | |
| 543 ep->cleanup(); | |
| 544 GDK_THREADS_LEAVE(); | |
| 545 while (g_main_context_iteration(NULL, FALSE)); | |
| 546 GDK_THREADS_ENTER(); | |
| 547 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
548 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
549 if (ep->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
550 g_module_close(ep->handle); |
| 2313 | 551 } |
| 552 | |
| 2623 | 553 if (ep_data.effect_list != NULL) |
| 554 { | |
| 2313 | 555 g_list_free(ep_data.effect_list); |
| 2623 | 556 ep_data.effect_list = NULL; |
| 2313 | 557 } |
| 558 | |
| 559 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 560 gp = GENERAL_PLUGIN(node->data); | |
| 561 if (gp && gp->cleanup) { | |
| 562 gp->cleanup(); | |
| 563 GDK_THREADS_LEAVE(); | |
| 564 while (g_main_context_iteration(NULL, FALSE)); | |
| 565 GDK_THREADS_ENTER(); | |
| 566 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
567 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
568 if (gp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
569 g_module_close(gp->handle); |
| 2313 | 570 } |
| 571 | |
| 2623 | 572 if (gp_data.general_list != NULL) |
| 573 { | |
| 2313 | 574 g_list_free(gp_data.general_list); |
| 2623 | 575 gp_data.general_list = NULL; |
| 2313 | 576 } |
| 577 | |
| 578 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 579 vp = VIS_PLUGIN(node->data); | |
| 580 if (vp && vp->cleanup) { | |
| 581 vp->cleanup(); | |
| 582 GDK_THREADS_LEAVE(); | |
| 583 while (g_main_context_iteration(NULL, FALSE)); | |
| 584 GDK_THREADS_ENTER(); | |
| 585 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
586 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
587 if (vp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
588 g_module_close(vp->handle); |
| 2313 | 589 } |
| 590 | |
| 2623 | 591 if (vp_data.vis_list != NULL) |
| 592 { | |
| 2313 | 593 g_list_free(vp_data.vis_list); |
| 2623 | 594 vp_data.vis_list = NULL; |
| 595 } | |
| 2313 | 596 |
| 597 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 598 lp = LOWLEVEL_PLUGIN(node->data); | |
| 599 if (lp && lp->cleanup) { | |
| 600 lp->cleanup(); | |
| 601 GDK_THREADS_LEAVE(); | |
| 602 while (g_main_context_iteration(NULL, FALSE)); | |
| 603 GDK_THREADS_ENTER(); | |
| 604 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
605 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
606 if (lp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
607 g_module_close(lp->handle); |
| 2313 | 608 } |
| 609 | |
| 2623 | 610 if (lowlevel_list != NULL) |
| 611 { | |
| 2313 | 612 g_list_free(lowlevel_list); |
| 2623 | 613 lowlevel_list = NULL; |
| 614 } | |
| 615 | |
| 616 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 617 if (vfs_transports != NULL) | |
| 618 { | |
| 619 g_list_free(vfs_transports); | |
| 620 vfs_transports = NULL; | |
| 621 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
622 |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
623 g_hash_table_destroy( plugin_matrix ); |
| 2313 | 624 } |
