Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 2812:5bd949bbd1c7 trunk
[svn] - remove xmms-like plugin loader
| author | nenolod |
|---|---|
| date | Mon, 28 May 2007 03:16:56 -0700 |
| parents | d5c77e670be0 |
| children | 8c518e7b2fff |
| 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; | |
| 2804 | 66 if(ap->description && bp->description) |
| 67 return strcasecmp(ap->description, bp->description); | |
| 68 else | |
| 69 return 0; | |
| 2313 | 70 } |
| 71 | |
| 72 static gint | |
| 73 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 74 { | |
| 75 const OutputPlugin *ap = a, *bp = b; | |
| 2804 | 76 if(ap->description && bp->description) |
| 77 return strcasecmp(ap->description, bp->description); | |
| 78 else | |
| 79 return 0; | |
| 2313 | 80 } |
| 81 | |
| 82 static gint | |
| 83 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
| 84 { | |
| 85 const EffectPlugin *ap = a, *bp = b; | |
| 2804 | 86 if(ap->description && bp->description) |
| 87 return strcasecmp(ap->description, bp->description); | |
| 88 else | |
| 89 return 0; | |
| 2313 | 90 } |
| 91 | |
| 92 static gint | |
| 93 generallist_compare_func(gconstpointer a, gconstpointer b) | |
| 94 { | |
| 95 const GeneralPlugin *ap = a, *bp = b; | |
| 2804 | 96 if(ap->description && bp->description) |
| 97 return strcasecmp(ap->description, bp->description); | |
| 98 else | |
| 99 return 0; | |
| 2313 | 100 } |
| 101 | |
| 102 static gint | |
| 103 vislist_compare_func(gconstpointer a, gconstpointer b) | |
| 104 { | |
| 105 const VisPlugin *ap = a, *bp = b; | |
| 2804 | 106 if(ap->description && bp->description) |
| 107 return strcasecmp(ap->description, bp->description); | |
| 108 else | |
| 109 return 0; | |
| 2313 | 110 } |
| 111 | |
| 112 static gboolean | |
| 113 plugin_is_duplicate(const gchar * filename) | |
| 114 { | |
| 115 GList *l; | |
| 116 const gchar *basename = g_basename(filename); | |
| 117 | |
| 118 /* FIXME: messy stuff */ | |
| 119 | |
| 120 for (l = ip_data.input_list; l; l = g_list_next(l)) | |
| 121 if (!strcmp(basename, g_basename(INPUT_PLUGIN(l->data)->filename))) | |
| 122 return TRUE; | |
| 123 | |
| 124 for (l = op_data.output_list; l; l = g_list_next(l)) | |
| 125 if (!strcmp(basename, g_basename(OUTPUT_PLUGIN(l->data)->filename))) | |
| 126 return TRUE; | |
| 127 | |
| 128 for (l = ep_data.effect_list; l; l = g_list_next(l)) | |
| 129 if (!strcmp(basename, g_basename(EFFECT_PLUGIN(l->data)->filename))) | |
| 130 return TRUE; | |
| 131 | |
| 132 for (l = gp_data.general_list; l; l = g_list_next(l)) | |
| 133 if (!strcmp(basename, g_basename(GENERAL_PLUGIN(l->data)->filename))) | |
| 134 return TRUE; | |
| 135 | |
| 136 for (l = vp_data.vis_list; l; l = g_list_next(l)) | |
| 137 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 138 return TRUE; | |
| 139 | |
| 140 for (l = lowlevel_list; l; l = g_list_next(l)) | |
| 141 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 142 return TRUE; | |
| 143 | |
| 144 return FALSE; | |
| 145 } | |
| 146 | |
| 147 | |
| 148 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))() | |
| 149 typedef Plugin * (*PluginGetInfoFunc) (void); | |
| 150 | |
| 151 static void | |
| 152 input_plugin_init(Plugin * plugin) | |
| 153 { | |
| 154 InputPlugin *p = INPUT_PLUGIN(plugin); | |
| 155 | |
| 156 p->get_vis_type = input_get_vis_type; | |
| 157 p->add_vis_pcm = input_add_vis_pcm; | |
| 158 | |
| 159 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
| 160 else thinks we could use a CONST macro to solve the warnings? | |
| 161 - descender */ | |
| 162 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; | |
| 163 p->set_info_text = (void (*)(gchar *)) input_set_info_text; | |
| 164 p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering; | |
| 165 | |
| 166 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
| 167 | |
| 168 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename), | |
| 169 GINT_TO_POINTER(1)); | |
| 170 } | |
| 171 | |
| 172 static void | |
| 173 output_plugin_init(Plugin * plugin) | |
| 174 { | |
| 175 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
| 176 op_data.output_list = g_list_append(op_data.output_list, p); | |
| 177 } | |
| 178 | |
| 179 static void | |
| 180 effect_plugin_init(Plugin * plugin) | |
| 181 { | |
| 182 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
| 183 ep_data.effect_list = g_list_append(ep_data.effect_list, p); | |
| 184 } | |
| 185 | |
| 186 static void | |
| 187 general_plugin_init(Plugin * plugin) | |
| 188 { | |
| 189 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
| 190 gp_data.general_list = g_list_append(gp_data.general_list, p); | |
| 191 } | |
| 192 | |
| 193 static void | |
| 194 vis_plugin_init(Plugin * plugin) | |
| 195 { | |
| 196 VisPlugin *p = VIS_PLUGIN(plugin); | |
| 197 p->disable_plugin = vis_disable_plugin; | |
| 198 vp_data.vis_list = g_list_append(vp_data.vis_list, p); | |
| 199 } | |
| 200 | |
| 201 static void | |
| 202 lowlevel_plugin_init(Plugin * plugin) | |
| 203 { | |
| 204 LowlevelPlugin *p = LOWLEVEL_PLUGIN(plugin); | |
| 205 lowlevel_list = g_list_append(lowlevel_list, p); | |
| 206 } | |
| 207 | |
|
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
|
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 |
|
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 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
|
211 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
|
212 { |
|
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 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
|
214 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
|
215 |
|
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 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
|
217 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
|
218 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
|
219 |
|
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 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
|
221 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
|
222 } |
|
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 |
|
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 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
|
225 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
|
226 { |
|
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 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
|
228 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
|
229 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
|
230 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
|
231 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
|
232 |
|
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 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
|
234 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
|
235 |
|
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 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
|
237 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
|
238 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
|
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 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
|
241 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
|
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 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
|
244 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
|
245 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
|
246 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
247 if (header->ip_list) |
|
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
|
248 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
249 for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
250 { |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
251 PLUGIN(*ip_iter)->filename = g_strdup(filename); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
252 g_print("plugin2 '%s' provides InputPlugin <%p>\n", filename, *ip_iter); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
253 input_plugin_init(PLUGIN(*ip_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
254 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
257 if (header->op_list) |
|
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
|
258 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
259 for (op_iter = header->op_list; *op_iter != NULL; op_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
260 { |
| 2801 | 261 PLUGIN(*op_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
262 g_print("plugin2 '%s' provides OutputPlugin <%p>\n", filename, *op_iter); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
263 output_plugin_init(PLUGIN(*op_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
264 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
267 if (header->ep_list) |
|
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
|
268 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
269 for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
270 { |
| 2801 | 271 PLUGIN(*ep_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
272 g_print("plugin2 '%s' provides EffectPlugin <%p>\n", filename, *ep_iter); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
273 effect_plugin_init(PLUGIN(*ep_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
274 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
277 if (header->gp_list) |
|
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
|
278 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
279 for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
280 { |
| 2801 | 281 PLUGIN(*gp_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
282 g_print("plugin2 '%s' provides GeneralPlugin <%p>\n", filename, *gp_iter); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
283 general_plugin_init(PLUGIN(*gp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
284 } |
|
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
|
285 } |
|
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
|
286 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
287 if (header->vp_list) |
|
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
|
288 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
289 for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
290 { |
| 2801 | 291 PLUGIN(*vp_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
292 g_print("plugin2 '%s' provides VisPlugin <%p>\n", filename, *vp_iter); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
293 vis_plugin_init(PLUGIN(*vp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
294 } |
|
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
|
295 } |
|
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
|
296 } |
|
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
|
297 |
|
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
|
298 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
|
299 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
|
300 { |
|
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
|
301 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
|
302 |
|
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
|
303 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
|
304 |
|
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
|
305 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
|
306 |
|
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
|
307 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
|
308 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
|
309 |
|
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
|
310 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
|
311 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
|
312 |
|
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
|
313 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
|
314 } |
|
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
|
315 |
|
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
|
316 /******************************************************************/ |
|
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
|
317 |
| 2313 | 318 /* FIXME: Placed here (hopefully) temporarily - descender */ |
| 319 | |
| 320 typedef struct { | |
| 321 const gchar *name; | |
| 322 const gchar *id; | |
| 323 void (*init)(Plugin *); | |
| 324 } PluginType; | |
| 325 | |
| 326 static PluginType plugin_types[] = { | |
| 327 { "input" , "get_iplugin_info", input_plugin_init }, | |
| 328 { "output" , "get_oplugin_info", output_plugin_init }, | |
| 329 { "effect" , "get_eplugin_info", effect_plugin_init }, | |
| 330 { "general" , "get_gplugin_info", general_plugin_init }, | |
| 331 { "visualization", "get_vplugin_info", vis_plugin_init }, | |
| 332 { "lowlevel" , "get_lplugin_info", lowlevel_plugin_init }, | |
| 333 { NULL, NULL, NULL } | |
| 334 }; | |
| 335 | |
| 336 static void | |
| 337 add_plugin(const gchar * filename) | |
| 338 { | |
| 339 PluginType *type; | |
| 340 GModule *module; | |
| 341 gpointer func; | |
| 342 | |
| 343 if (plugin_is_duplicate(filename)) | |
| 344 return; | |
| 345 | |
| 2623 | 346 g_message("Loaded plugin (%s)", filename); |
| 347 | |
| 2313 | 348 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 349 printf("Failed to load plugin (%s): %s\n", | |
| 350 filename, g_module_error()); | |
| 351 return; | |
| 352 } | |
| 353 | |
|
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
|
354 /* 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
|
355 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
|
356 { |
|
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
|
357 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
|
358 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
|
359 |
|
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
|
360 /* 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
|
361 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
|
362 |
|
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
|
363 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
|
364 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
|
365 } |
|
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
|
366 |
| 2313 | 367 printf("Invalid plugin (%s)\n", filename); |
| 368 g_module_close(module); | |
| 369 } | |
| 370 | |
| 371 static gboolean | |
| 372 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 373 { | |
| 374 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 375 return FALSE; | |
| 376 | |
| 377 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 378 return FALSE; | |
| 379 | |
| 380 add_plugin(path); | |
| 381 | |
| 382 return FALSE; | |
| 383 } | |
| 384 | |
| 385 static void | |
| 386 scan_plugins(const gchar * path) | |
| 387 { | |
| 388 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 389 } | |
| 390 | |
| 391 void | |
| 392 plugin_system_init(void) | |
| 393 { | |
| 394 gchar *dir, **disabled; | |
| 395 GList *node; | |
| 396 OutputPlugin *op; | |
| 397 InputPlugin *ip; | |
| 398 LowlevelPlugin *lp; | |
| 399 gint dirsel = 0, i = 0; | |
| 400 | |
| 401 if (!g_module_supported()) { | |
| 402 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 403 return; | |
| 404 } | |
| 405 | |
|
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
406 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
| 2313 | 407 NULL); |
| 408 | |
| 409 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 410 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 411 /* | |
| 412 * This is in a separate loop so if the user puts them in the | |
| 413 * wrong dir we'll still get them in the right order (home dir | |
| 414 * first) - Zinx | |
| 415 */ | |
| 416 while (plugin_dir_list[dirsel]) { | |
| 417 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 418 plugin_dir_list[dirsel++], NULL); | |
| 419 scan_plugins(dir); | |
| 420 g_free(dir); | |
| 421 } | |
| 422 dirsel = 0; | |
| 423 #endif | |
| 424 | |
| 425 while (plugin_dir_list[dirsel]) { | |
| 426 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 427 scan_plugins(dir); | |
| 428 g_free(dir); | |
| 429 } | |
| 430 | |
| 431 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 432 if (!op_data.current_output_plugin | |
| 433 && g_list_length(op_data.output_list)) { | |
| 434 op_data.current_output_plugin = op_data.output_list->data; | |
| 435 } | |
| 436 | |
| 437 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 438 | |
| 439 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 440 ep_data.enabled_list = NULL; | |
| 441 | |
| 442 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 443 gp_data.enabled_list = NULL; | |
| 444 | |
| 445 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 446 vp_data.enabled_list = NULL; | |
| 447 | |
| 448 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
| 449 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 450 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
| 451 | |
| 452 g_free(cfg.enabled_gplugins); | |
| 453 cfg.enabled_gplugins = NULL; | |
| 454 | |
| 455 g_free(cfg.enabled_vplugins); | |
| 456 cfg.enabled_vplugins = NULL; | |
| 457 | |
| 458 g_free(cfg.enabled_eplugins); | |
| 459 cfg.enabled_eplugins = NULL; | |
| 460 | |
| 461 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
| 462 op = OUTPUT_PLUGIN(node->data); | |
| 463 /* | |
| 464 * Only test basename to avoid problems when changing | |
| 465 * prefix. We will only see one plugin with the same | |
| 466 * basename, so this is usually what the user want. | |
| 467 */ | |
| 468 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
| 469 op_data.current_output_plugin = op; | |
| 470 if (op->init) | |
| 471 op->init(); | |
| 472 } | |
| 473 | |
| 474 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 475 ip = INPUT_PLUGIN(node->data); | |
| 476 if (ip->init) | |
| 477 ip->init(); | |
| 478 } | |
| 479 | |
| 480 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 481 lp = LOWLEVEL_PLUGIN(node->data); | |
| 482 if (lp->init) | |
| 483 lp->init(); | |
| 484 } | |
| 485 | |
| 486 if (cfg.disabled_iplugins) { | |
| 487 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
| 488 while (disabled[i]) { | |
| 489 g_hash_table_replace(plugin_matrix, disabled[i], | |
| 490 GINT_TO_POINTER(FALSE)); | |
| 491 i++; | |
| 492 } | |
| 493 | |
| 494 g_free(disabled); | |
| 495 | |
| 496 g_free(cfg.disabled_iplugins); | |
| 497 cfg.disabled_iplugins = NULL; | |
| 498 } | |
| 499 } | |
| 500 | |
| 501 void | |
| 502 plugin_system_cleanup(void) | |
| 503 { | |
| 504 InputPlugin *ip; | |
| 505 OutputPlugin *op; | |
| 506 EffectPlugin *ep; | |
| 507 GeneralPlugin *gp; | |
| 508 VisPlugin *vp; | |
| 509 LowlevelPlugin *lp; | |
| 510 GList *node; | |
| 511 | |
| 512 g_message("Shutting down plugin system"); | |
| 513 | |
| 514 if (playback_get_playing()) { | |
| 515 ip_data.stop = TRUE; | |
| 516 playback_stop(); | |
| 517 ip_data.stop = FALSE; | |
| 518 } | |
| 519 | |
| 2623 | 520 /* FIXME: race condition -nenolod */ |
| 521 op_data.current_output_plugin = NULL; | |
| 522 | |
| 2313 | 523 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 524 ip = INPUT_PLUGIN(node->data); | |
| 525 if (ip && ip->cleanup) { | |
| 526 ip->cleanup(); | |
| 527 GDK_THREADS_LEAVE(); | |
| 528 while (g_main_context_iteration(NULL, FALSE)); | |
| 529 GDK_THREADS_ENTER(); | |
| 530 } | |
|
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
|
531 |
|
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 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
|
533 g_module_close(ip->handle); |
| 2313 | 534 } |
| 535 | |
| 2623 | 536 if (ip_data.input_list != NULL) |
| 537 { | |
| 2313 | 538 g_list_free(ip_data.input_list); |
| 2623 | 539 ip_data.input_list = NULL; |
| 540 } | |
| 2313 | 541 |
| 542 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 543 op = OUTPUT_PLUGIN(node->data); | |
| 544 if (op && op->cleanup) { | |
| 545 op->cleanup(); | |
| 546 GDK_THREADS_LEAVE(); | |
| 547 while (g_main_context_iteration(NULL, FALSE)); | |
| 548 GDK_THREADS_ENTER(); | |
| 549 } | |
|
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
|
550 |
|
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 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
|
552 g_module_close(op->handle); |
| 2313 | 553 } |
| 554 | |
| 2623 | 555 if (op_data.output_list != NULL) |
| 556 { | |
| 2313 | 557 g_list_free(op_data.output_list); |
| 2623 | 558 op_data.output_list = NULL; |
| 559 } | |
| 2313 | 560 |
| 561 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 562 ep = EFFECT_PLUGIN(node->data); | |
| 563 if (ep && ep->cleanup) { | |
| 564 ep->cleanup(); | |
| 565 GDK_THREADS_LEAVE(); | |
| 566 while (g_main_context_iteration(NULL, FALSE)); | |
| 567 GDK_THREADS_ENTER(); | |
| 568 } | |
|
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
|
569 |
|
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 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
|
571 g_module_close(ep->handle); |
| 2313 | 572 } |
| 573 | |
| 2623 | 574 if (ep_data.effect_list != NULL) |
| 575 { | |
| 2313 | 576 g_list_free(ep_data.effect_list); |
| 2623 | 577 ep_data.effect_list = NULL; |
| 2313 | 578 } |
| 579 | |
| 580 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 581 gp = GENERAL_PLUGIN(node->data); | |
| 582 if (gp && gp->cleanup) { | |
| 583 gp->cleanup(); | |
| 584 GDK_THREADS_LEAVE(); | |
| 585 while (g_main_context_iteration(NULL, FALSE)); | |
| 586 GDK_THREADS_ENTER(); | |
| 587 } | |
|
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
|
588 |
|
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 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
|
590 g_module_close(gp->handle); |
| 2313 | 591 } |
| 592 | |
| 2623 | 593 if (gp_data.general_list != NULL) |
| 594 { | |
| 2313 | 595 g_list_free(gp_data.general_list); |
| 2623 | 596 gp_data.general_list = NULL; |
| 2313 | 597 } |
| 598 | |
| 599 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 600 vp = VIS_PLUGIN(node->data); | |
| 601 if (vp && vp->cleanup) { | |
| 602 vp->cleanup(); | |
| 603 GDK_THREADS_LEAVE(); | |
| 604 while (g_main_context_iteration(NULL, FALSE)); | |
| 605 GDK_THREADS_ENTER(); | |
| 606 } | |
|
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
|
607 |
|
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 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
|
609 g_module_close(vp->handle); |
| 2313 | 610 } |
| 611 | |
| 2623 | 612 if (vp_data.vis_list != NULL) |
| 613 { | |
| 2313 | 614 g_list_free(vp_data.vis_list); |
| 2623 | 615 vp_data.vis_list = NULL; |
| 616 } | |
| 2313 | 617 |
| 618 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 619 lp = LOWLEVEL_PLUGIN(node->data); | |
| 620 if (lp && lp->cleanup) { | |
| 621 lp->cleanup(); | |
| 622 GDK_THREADS_LEAVE(); | |
| 623 while (g_main_context_iteration(NULL, FALSE)); | |
| 624 GDK_THREADS_ENTER(); | |
| 625 } | |
|
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
|
626 |
|
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
|
627 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
|
628 g_module_close(lp->handle); |
| 2313 | 629 } |
| 630 | |
| 2623 | 631 if (lowlevel_list != NULL) |
| 632 { | |
| 2313 | 633 g_list_free(lowlevel_list); |
| 2623 | 634 lowlevel_list = NULL; |
| 635 } | |
| 636 | |
| 637 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 638 if (vfs_transports != NULL) | |
| 639 { | |
| 640 g_list_free(vfs_transports); | |
| 641 vfs_transports = NULL; | |
| 642 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
643 |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
644 g_hash_table_destroy( plugin_matrix ); |
| 2313 | 645 } |
