Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 2798:7144a4e5e978 trunk
[svn] - temporarily work around plugin API v1 retardation
| author | nenolod |
|---|---|
| date | Thu, 24 May 2007 03:37:54 -0700 |
| parents | f0c1c8b22c88 |
| children | febdfe7a482b |
| 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 { |
|
2798
7144a4e5e978
[svn] - temporarily work around plugin API v1 retardation
nenolod
parents:
2797
diff
changeset
|
234 PLUGIN(*ip_iter)->filename = g_strdup(filename); |
|
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
|
235 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
|
236 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
|
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 |
|
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 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
|
240 { |
|
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 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
|
242 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
|
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 |
|
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 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
|
246 { |
|
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 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
|
248 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
|
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 |
|
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 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
|
252 { |
|
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 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
|
254 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
|
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 |
|
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 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
|
258 { |
|
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 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
|
260 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
|
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 |
|
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 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
|
265 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
|
266 { |
|
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 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
|
268 |
|
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 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
|
270 |
|
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 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
|
272 |
|
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->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
|
274 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
|
275 |
|
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 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
|
277 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
|
278 |
|
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 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
|
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 /******************************************************************/ |
|
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
|
283 |
| 2313 | 284 /* FIXME: Placed here (hopefully) temporarily - descender */ |
| 285 | |
| 286 typedef struct { | |
| 287 const gchar *name; | |
| 288 const gchar *id; | |
| 289 void (*init)(Plugin *); | |
| 290 } PluginType; | |
| 291 | |
| 292 static PluginType plugin_types[] = { | |
| 293 { "input" , "get_iplugin_info", input_plugin_init }, | |
| 294 { "output" , "get_oplugin_info", output_plugin_init }, | |
| 295 { "effect" , "get_eplugin_info", effect_plugin_init }, | |
| 296 { "general" , "get_gplugin_info", general_plugin_init }, | |
| 297 { "visualization", "get_vplugin_info", vis_plugin_init }, | |
| 298 { "lowlevel" , "get_lplugin_info", lowlevel_plugin_init }, | |
| 299 { NULL, NULL, NULL } | |
| 300 }; | |
| 301 | |
| 302 static void | |
| 303 add_plugin(const gchar * filename) | |
| 304 { | |
| 305 PluginType *type; | |
| 306 GModule *module; | |
| 307 gpointer func; | |
| 308 | |
| 309 if (plugin_is_duplicate(filename)) | |
| 310 return; | |
| 311 | |
| 2623 | 312 g_message("Loaded plugin (%s)", filename); |
| 313 | |
| 2313 | 314 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 315 printf("Failed to load plugin (%s): %s\n", | |
| 316 filename, g_module_error()); | |
| 317 return; | |
| 318 } | |
| 319 | |
|
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
|
320 /* 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
|
321 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
|
322 { |
|
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_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
|
324 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
|
325 |
|
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 /* 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
|
327 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
|
328 |
|
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 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
|
330 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
|
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 |
|
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
|
333 /* v1 plugin loading */ |
| 2313 | 334 for (type = plugin_types; type->name; type++) |
| 335 { | |
| 336 if (g_module_symbol(module, type->id, &func)) { | |
| 337 Plugin *plugin = PLUGIN_GET_INFO(func); | |
| 338 | |
| 339 plugin->handle = module; | |
| 340 plugin->filename = g_strdup(filename); | |
| 341 type->init(PLUGIN_GET_INFO(func)); | |
| 342 | |
| 343 return; | |
| 344 } | |
| 345 } | |
| 346 | |
| 347 printf("Invalid plugin (%s)\n", filename); | |
| 348 g_module_close(module); | |
| 349 } | |
| 350 | |
| 351 static gboolean | |
| 352 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 353 { | |
| 354 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 355 return FALSE; | |
| 356 | |
| 357 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 358 return FALSE; | |
| 359 | |
| 360 add_plugin(path); | |
| 361 | |
| 362 return FALSE; | |
| 363 } | |
| 364 | |
| 365 static void | |
| 366 scan_plugins(const gchar * path) | |
| 367 { | |
| 368 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 369 } | |
| 370 | |
| 371 void | |
| 372 plugin_system_init(void) | |
| 373 { | |
| 374 gchar *dir, **disabled; | |
| 375 GList *node; | |
| 376 OutputPlugin *op; | |
| 377 InputPlugin *ip; | |
| 378 LowlevelPlugin *lp; | |
| 379 gint dirsel = 0, i = 0; | |
| 380 | |
| 381 if (!g_module_supported()) { | |
| 382 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 383 return; | |
| 384 } | |
| 385 | |
|
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
386 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
| 2313 | 387 NULL); |
| 388 | |
| 389 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 390 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 391 /* | |
| 392 * This is in a separate loop so if the user puts them in the | |
| 393 * wrong dir we'll still get them in the right order (home dir | |
| 394 * first) - Zinx | |
| 395 */ | |
| 396 while (plugin_dir_list[dirsel]) { | |
| 397 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 398 plugin_dir_list[dirsel++], NULL); | |
| 399 scan_plugins(dir); | |
| 400 g_free(dir); | |
| 401 } | |
| 402 dirsel = 0; | |
| 403 #endif | |
| 404 | |
| 405 while (plugin_dir_list[dirsel]) { | |
| 406 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 407 scan_plugins(dir); | |
| 408 g_free(dir); | |
| 409 } | |
| 410 | |
| 411 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 412 if (!op_data.current_output_plugin | |
| 413 && g_list_length(op_data.output_list)) { | |
| 414 op_data.current_output_plugin = op_data.output_list->data; | |
| 415 } | |
| 416 | |
| 417 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 418 | |
| 419 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 420 ep_data.enabled_list = NULL; | |
| 421 | |
| 422 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 423 gp_data.enabled_list = NULL; | |
| 424 | |
| 425 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 426 vp_data.enabled_list = NULL; | |
| 427 | |
| 428 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
| 429 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 430 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
| 431 | |
| 432 g_free(cfg.enabled_gplugins); | |
| 433 cfg.enabled_gplugins = NULL; | |
| 434 | |
| 435 g_free(cfg.enabled_vplugins); | |
| 436 cfg.enabled_vplugins = NULL; | |
| 437 | |
| 438 g_free(cfg.enabled_eplugins); | |
| 439 cfg.enabled_eplugins = NULL; | |
| 440 | |
| 441 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
| 442 op = OUTPUT_PLUGIN(node->data); | |
| 443 /* | |
| 444 * Only test basename to avoid problems when changing | |
| 445 * prefix. We will only see one plugin with the same | |
| 446 * basename, so this is usually what the user want. | |
| 447 */ | |
| 448 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
| 449 op_data.current_output_plugin = op; | |
| 450 if (op->init) | |
| 451 op->init(); | |
| 452 } | |
| 453 | |
| 454 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 455 ip = INPUT_PLUGIN(node->data); | |
| 456 if (ip->init) | |
| 457 ip->init(); | |
| 458 } | |
| 459 | |
| 460 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 461 lp = LOWLEVEL_PLUGIN(node->data); | |
| 462 if (lp->init) | |
| 463 lp->init(); | |
| 464 } | |
| 465 | |
| 466 if (cfg.disabled_iplugins) { | |
| 467 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
| 468 while (disabled[i]) { | |
| 469 g_hash_table_replace(plugin_matrix, disabled[i], | |
| 470 GINT_TO_POINTER(FALSE)); | |
| 471 i++; | |
| 472 } | |
| 473 | |
| 474 g_free(disabled); | |
| 475 | |
| 476 g_free(cfg.disabled_iplugins); | |
| 477 cfg.disabled_iplugins = NULL; | |
| 478 } | |
| 479 } | |
| 480 | |
| 481 void | |
| 482 plugin_system_cleanup(void) | |
| 483 { | |
| 484 InputPlugin *ip; | |
| 485 OutputPlugin *op; | |
| 486 EffectPlugin *ep; | |
| 487 GeneralPlugin *gp; | |
| 488 VisPlugin *vp; | |
| 489 LowlevelPlugin *lp; | |
| 490 GList *node; | |
| 491 | |
| 492 g_message("Shutting down plugin system"); | |
| 493 | |
| 494 if (playback_get_playing()) { | |
| 495 ip_data.stop = TRUE; | |
| 496 playback_stop(); | |
| 497 ip_data.stop = FALSE; | |
| 498 } | |
| 499 | |
| 2623 | 500 /* FIXME: race condition -nenolod */ |
| 501 op_data.current_output_plugin = NULL; | |
| 502 | |
| 2313 | 503 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 504 ip = INPUT_PLUGIN(node->data); | |
| 505 if (ip && ip->cleanup) { | |
| 506 ip->cleanup(); | |
| 507 GDK_THREADS_LEAVE(); | |
| 508 while (g_main_context_iteration(NULL, FALSE)); | |
| 509 GDK_THREADS_ENTER(); | |
| 510 } | |
|
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
|
511 |
|
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 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
|
513 g_module_close(ip->handle); |
| 2313 | 514 } |
| 515 | |
| 2623 | 516 if (ip_data.input_list != NULL) |
| 517 { | |
| 2313 | 518 g_list_free(ip_data.input_list); |
| 2623 | 519 ip_data.input_list = NULL; |
| 520 } | |
| 2313 | 521 |
| 522 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 523 op = OUTPUT_PLUGIN(node->data); | |
| 524 if (op && op->cleanup) { | |
| 525 op->cleanup(); | |
| 526 GDK_THREADS_LEAVE(); | |
| 527 while (g_main_context_iteration(NULL, FALSE)); | |
| 528 GDK_THREADS_ENTER(); | |
| 529 } | |
|
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
|
530 |
|
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 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
|
532 g_module_close(op->handle); |
| 2313 | 533 } |
| 534 | |
| 2623 | 535 if (op_data.output_list != NULL) |
| 536 { | |
| 2313 | 537 g_list_free(op_data.output_list); |
| 2623 | 538 op_data.output_list = NULL; |
| 539 } | |
| 2313 | 540 |
| 541 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 542 ep = EFFECT_PLUGIN(node->data); | |
| 543 if (ep && ep->cleanup) { | |
| 544 ep->cleanup(); | |
| 545 GDK_THREADS_LEAVE(); | |
| 546 while (g_main_context_iteration(NULL, FALSE)); | |
| 547 GDK_THREADS_ENTER(); | |
| 548 } | |
|
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
|
549 |
|
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 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
|
551 g_module_close(ep->handle); |
| 2313 | 552 } |
| 553 | |
| 2623 | 554 if (ep_data.effect_list != NULL) |
| 555 { | |
| 2313 | 556 g_list_free(ep_data.effect_list); |
| 2623 | 557 ep_data.effect_list = NULL; |
| 2313 | 558 } |
| 559 | |
| 560 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 561 gp = GENERAL_PLUGIN(node->data); | |
| 562 if (gp && gp->cleanup) { | |
| 563 gp->cleanup(); | |
| 564 GDK_THREADS_LEAVE(); | |
| 565 while (g_main_context_iteration(NULL, FALSE)); | |
| 566 GDK_THREADS_ENTER(); | |
| 567 } | |
|
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
|
568 |
|
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 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
|
570 g_module_close(gp->handle); |
| 2313 | 571 } |
| 572 | |
| 2623 | 573 if (gp_data.general_list != NULL) |
| 574 { | |
| 2313 | 575 g_list_free(gp_data.general_list); |
| 2623 | 576 gp_data.general_list = NULL; |
| 2313 | 577 } |
| 578 | |
| 579 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 580 vp = VIS_PLUGIN(node->data); | |
| 581 if (vp && vp->cleanup) { | |
| 582 vp->cleanup(); | |
| 583 GDK_THREADS_LEAVE(); | |
| 584 while (g_main_context_iteration(NULL, FALSE)); | |
| 585 GDK_THREADS_ENTER(); | |
| 586 } | |
|
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
|
587 |
|
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 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
|
589 g_module_close(vp->handle); |
| 2313 | 590 } |
| 591 | |
| 2623 | 592 if (vp_data.vis_list != NULL) |
| 593 { | |
| 2313 | 594 g_list_free(vp_data.vis_list); |
| 2623 | 595 vp_data.vis_list = NULL; |
| 596 } | |
| 2313 | 597 |
| 598 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 599 lp = LOWLEVEL_PLUGIN(node->data); | |
| 600 if (lp && lp->cleanup) { | |
| 601 lp->cleanup(); | |
| 602 GDK_THREADS_LEAVE(); | |
| 603 while (g_main_context_iteration(NULL, FALSE)); | |
| 604 GDK_THREADS_ENTER(); | |
| 605 } | |
|
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
|
606 |
|
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 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
|
608 g_module_close(lp->handle); |
| 2313 | 609 } |
| 610 | |
| 2623 | 611 if (lowlevel_list != NULL) |
| 612 { | |
| 2313 | 613 g_list_free(lowlevel_list); |
| 2623 | 614 lowlevel_list = NULL; |
| 615 } | |
| 616 | |
| 617 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 618 if (vfs_transports != NULL) | |
| 619 { | |
| 620 g_list_free(vfs_transports); | |
| 621 vfs_transports = NULL; | |
| 622 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
623 |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
624 g_hash_table_destroy( plugin_matrix ); |
| 2313 | 625 } |
