Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 3123:f1c756f39e6c trunk audacious-1.4.0-DR1
Invoke "Plugins are not derived work" clause provided by GPL3.
| author | William Pitcock <nenolod@atheme-project.org> |
|---|---|
| date | Fri, 20 Jul 2007 09:09:58 -0500 |
| parents | 3b6d316f8b09 |
| children | 8775dfc57ead |
| 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 | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
| 2313 | 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 | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
|
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
| 2313 | 24 */ |
| 25 | |
| 26 #ifdef HAVE_CONFIG_H | |
| 27 # include "config.h" | |
| 28 #endif | |
| 29 | |
| 30 #ifndef SHARED_SUFFIX | |
| 31 # define SHARED_SUFFIX G_MODULE_SUFFIX | |
| 32 #endif | |
| 33 | |
| 34 #include "pluginenum.h" | |
| 35 | |
| 36 #include <glib.h> | |
| 37 #include <gmodule.h> | |
| 38 #include <glib/gprintf.h> | |
| 39 #include <string.h> | |
| 40 | |
| 41 #include "main.h" | |
| 42 #include "ui_main.h" | |
| 43 #include "playback.h" | |
| 44 #include "playlist.h" | |
|
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2313
diff
changeset
|
45 #include "strings.h" |
| 2313 | 46 #include "util.h" |
| 47 | |
| 48 #include "effect.h" | |
| 49 #include "general.h" | |
| 50 #include "input.h" | |
| 51 #include "output.h" | |
| 52 #include "visualization.h" | |
| 53 | |
| 54 const gchar *plugin_dir_list[] = { | |
| 55 PLUGINSUBS, | |
| 56 NULL | |
| 57 }; | |
| 58 | |
| 59 GHashTable *plugin_matrix = NULL; | |
| 60 GList *lowlevel_list = NULL; | |
| 61 | |
| 2623 | 62 extern GList *vfs_transports; |
| 63 | |
| 2313 | 64 static gint |
| 65 inputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 66 { | |
| 67 const InputPlugin *ap = a, *bp = b; | |
| 2804 | 68 if(ap->description && bp->description) |
| 69 return strcasecmp(ap->description, bp->description); | |
| 70 else | |
| 71 return 0; | |
| 2313 | 72 } |
| 73 | |
| 74 static gint | |
| 75 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 76 { | |
| 77 const OutputPlugin *ap = a, *bp = b; | |
| 2804 | 78 if(ap->description && bp->description) |
| 79 return strcasecmp(ap->description, bp->description); | |
| 80 else | |
| 81 return 0; | |
| 2313 | 82 } |
| 83 | |
| 84 static gint | |
| 85 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
| 86 { | |
| 87 const EffectPlugin *ap = a, *bp = b; | |
| 2804 | 88 if(ap->description && bp->description) |
| 89 return strcasecmp(ap->description, bp->description); | |
| 90 else | |
| 91 return 0; | |
| 2313 | 92 } |
| 93 | |
| 94 static gint | |
| 95 generallist_compare_func(gconstpointer a, gconstpointer b) | |
| 96 { | |
| 97 const GeneralPlugin *ap = a, *bp = b; | |
| 2804 | 98 if(ap->description && bp->description) |
| 99 return strcasecmp(ap->description, bp->description); | |
| 100 else | |
| 101 return 0; | |
| 2313 | 102 } |
| 103 | |
| 104 static gint | |
| 105 vislist_compare_func(gconstpointer a, gconstpointer b) | |
| 106 { | |
| 107 const VisPlugin *ap = a, *bp = b; | |
| 2804 | 108 if(ap->description && bp->description) |
| 109 return strcasecmp(ap->description, bp->description); | |
| 110 else | |
| 111 return 0; | |
| 2313 | 112 } |
| 113 | |
| 114 static gboolean | |
| 115 plugin_is_duplicate(const gchar * filename) | |
| 116 { | |
| 117 GList *l; | |
| 118 const gchar *basename = g_basename(filename); | |
| 119 | |
| 120 /* FIXME: messy stuff */ | |
| 121 | |
| 122 for (l = ip_data.input_list; l; l = g_list_next(l)) | |
| 123 if (!strcmp(basename, g_basename(INPUT_PLUGIN(l->data)->filename))) | |
| 124 return TRUE; | |
| 125 | |
| 126 for (l = op_data.output_list; l; l = g_list_next(l)) | |
| 127 if (!strcmp(basename, g_basename(OUTPUT_PLUGIN(l->data)->filename))) | |
| 128 return TRUE; | |
| 129 | |
| 130 for (l = ep_data.effect_list; l; l = g_list_next(l)) | |
| 131 if (!strcmp(basename, g_basename(EFFECT_PLUGIN(l->data)->filename))) | |
| 132 return TRUE; | |
| 133 | |
| 134 for (l = gp_data.general_list; l; l = g_list_next(l)) | |
| 135 if (!strcmp(basename, g_basename(GENERAL_PLUGIN(l->data)->filename))) | |
| 136 return TRUE; | |
| 137 | |
| 138 for (l = vp_data.vis_list; l; l = g_list_next(l)) | |
| 139 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 140 return TRUE; | |
| 141 | |
| 142 for (l = lowlevel_list; l; l = g_list_next(l)) | |
| 143 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename))) | |
| 144 return TRUE; | |
| 145 | |
| 146 return FALSE; | |
| 147 } | |
| 148 | |
| 149 | |
| 150 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))() | |
| 151 typedef Plugin * (*PluginGetInfoFunc) (void); | |
| 152 | |
| 153 static void | |
| 154 input_plugin_init(Plugin * plugin) | |
| 155 { | |
| 156 InputPlugin *p = INPUT_PLUGIN(plugin); | |
| 157 | |
| 158 p->get_vis_type = input_get_vis_type; | |
| 159 p->add_vis_pcm = input_add_vis_pcm; | |
| 160 | |
| 161 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
| 162 else thinks we could use a CONST macro to solve the warnings? | |
| 163 - descender */ | |
| 164 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; | |
| 165 p->set_info_text = (void (*)(gchar *)) input_set_info_text; | |
| 166 p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering; | |
| 167 | |
| 168 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
| 169 | |
| 170 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename), | |
| 171 GINT_TO_POINTER(1)); | |
| 172 } | |
| 173 | |
| 174 static void | |
| 175 output_plugin_init(Plugin * plugin) | |
| 176 { | |
| 177 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
| 178 op_data.output_list = g_list_append(op_data.output_list, p); | |
| 179 } | |
| 180 | |
| 181 static void | |
| 182 effect_plugin_init(Plugin * plugin) | |
| 183 { | |
| 184 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
| 185 ep_data.effect_list = g_list_append(ep_data.effect_list, p); | |
| 186 } | |
| 187 | |
| 188 static void | |
| 189 general_plugin_init(Plugin * plugin) | |
| 190 { | |
| 191 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
| 192 gp_data.general_list = g_list_append(gp_data.general_list, p); | |
| 193 } | |
| 194 | |
| 195 static void | |
| 196 vis_plugin_init(Plugin * plugin) | |
| 197 { | |
| 198 VisPlugin *p = VIS_PLUGIN(plugin); | |
| 199 p->disable_plugin = vis_disable_plugin; | |
| 200 vp_data.vis_list = g_list_append(vp_data.vis_list, p); | |
| 201 } | |
| 202 | |
|
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
|
203 /*******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
206 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
|
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 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
|
209 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
|
210 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
212 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
|
213 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
|
214 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
216 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
|
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 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
220 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
|
221 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
223 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
|
224 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
|
225 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
|
226 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
|
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 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
|
229 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
|
230 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
232 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
|
233 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
|
234 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
236 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
|
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 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
|
239 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
|
240 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
|
241 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
242 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
|
243 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
244 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
|
245 { |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
246 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
|
247 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
|
248 input_plugin_init(PLUGIN(*ip_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
249 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
252 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
|
253 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
254 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
|
255 { |
| 2801 | 256 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
|
257 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
|
258 output_plugin_init(PLUGIN(*op_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
259 } |
|
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
|
260 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
261 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
262 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
|
263 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
264 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
|
265 { |
| 2801 | 266 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
|
267 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
|
268 effect_plugin_init(PLUGIN(*ep_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
269 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
272 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
|
273 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
274 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
|
275 { |
| 2801 | 276 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
|
277 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
|
278 general_plugin_init(PLUGIN(*gp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
279 } |
|
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
|
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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
282 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
|
283 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
284 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
|
285 { |
| 2801 | 286 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
|
287 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
|
288 vis_plugin_init(PLUGIN(*vp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
289 } |
|
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
|
290 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
291 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
292 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
293 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
|
294 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
|
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 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
|
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 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
|
299 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
301 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
303 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
|
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 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
|
306 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
|
307 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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_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
|
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 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 /******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 |
| 2313 | 313 static void |
| 314 add_plugin(const gchar * filename) | |
| 315 { | |
| 316 GModule *module; | |
| 317 gpointer func; | |
| 318 | |
| 319 if (plugin_is_duplicate(filename)) | |
| 320 return; | |
| 321 | |
| 2623 | 322 g_message("Loaded plugin (%s)", filename); |
| 323 | |
| 2313 | 324 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 325 printf("Failed to load plugin (%s): %s\n", | |
| 326 filename, g_module_error()); | |
| 327 return; | |
| 328 } | |
| 329 | |
|
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
|
330 /* 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
|
331 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
|
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 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
|
334 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
|
335 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
336 /* 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
|
337 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
|
338 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
339 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
|
340 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
|
341 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
342 |
| 2313 | 343 printf("Invalid plugin (%s)\n", filename); |
| 344 g_module_close(module); | |
| 345 } | |
| 346 | |
| 347 static gboolean | |
| 348 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 349 { | |
| 350 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 351 return FALSE; | |
| 352 | |
| 353 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 354 return FALSE; | |
| 355 | |
| 356 add_plugin(path); | |
| 357 | |
| 358 return FALSE; | |
| 359 } | |
| 360 | |
| 361 static void | |
| 362 scan_plugins(const gchar * path) | |
| 363 { | |
| 364 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 365 } | |
| 366 | |
| 367 void | |
| 368 plugin_system_init(void) | |
| 369 { | |
| 370 gchar *dir, **disabled; | |
| 371 GList *node; | |
| 372 OutputPlugin *op; | |
| 373 InputPlugin *ip; | |
| 374 LowlevelPlugin *lp; | |
| 375 gint dirsel = 0, i = 0; | |
| 376 | |
| 377 if (!g_module_supported()) { | |
| 378 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 379 return; | |
| 380 } | |
| 381 | |
|
2624
840fb578a834
[svn] - [security, backport to 1.3] fix improper comparisons of hashtables used by the plugin loader.
nenolod
parents:
2623
diff
changeset
|
382 plugin_matrix = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, |
| 2313 | 383 NULL); |
| 384 | |
| 385 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 386 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 387 /* | |
| 388 * This is in a separate loop so if the user puts them in the | |
| 389 * wrong dir we'll still get them in the right order (home dir | |
| 390 * first) - Zinx | |
| 391 */ | |
| 392 while (plugin_dir_list[dirsel]) { | |
| 393 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 394 plugin_dir_list[dirsel++], NULL); | |
| 395 scan_plugins(dir); | |
| 396 g_free(dir); | |
| 397 } | |
| 398 dirsel = 0; | |
| 399 #endif | |
| 400 | |
| 401 while (plugin_dir_list[dirsel]) { | |
| 402 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 403 scan_plugins(dir); | |
| 404 g_free(dir); | |
| 405 } | |
| 406 | |
| 407 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 408 if (!op_data.current_output_plugin | |
| 409 && g_list_length(op_data.output_list)) { | |
| 410 op_data.current_output_plugin = op_data.output_list->data; | |
| 411 } | |
| 412 | |
| 413 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 414 | |
| 415 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 416 ep_data.enabled_list = NULL; | |
| 417 | |
| 418 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 419 gp_data.enabled_list = NULL; | |
| 420 | |
| 421 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 422 vp_data.enabled_list = NULL; | |
| 423 | |
| 424 general_enable_from_stringified_list(cfg.enabled_gplugins); | |
| 425 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 426 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
| 427 | |
| 428 g_free(cfg.enabled_gplugins); | |
| 429 cfg.enabled_gplugins = NULL; | |
| 430 | |
| 431 g_free(cfg.enabled_vplugins); | |
| 432 cfg.enabled_vplugins = NULL; | |
| 433 | |
| 434 g_free(cfg.enabled_eplugins); | |
| 435 cfg.enabled_eplugins = NULL; | |
| 436 | |
| 437 for (node = op_data.output_list; node; node = g_list_next(node)) { | |
| 438 op = OUTPUT_PLUGIN(node->data); | |
| 439 /* | |
| 440 * Only test basename to avoid problems when changing | |
| 441 * prefix. We will only see one plugin with the same | |
| 442 * basename, so this is usually what the user want. | |
| 443 */ | |
| 444 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) | |
| 445 op_data.current_output_plugin = op; | |
| 446 if (op->init) | |
| 447 op->init(); | |
| 448 } | |
| 449 | |
| 450 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 451 ip = INPUT_PLUGIN(node->data); | |
| 452 if (ip->init) | |
| 453 ip->init(); | |
| 454 } | |
| 455 | |
| 456 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 457 lp = LOWLEVEL_PLUGIN(node->data); | |
| 458 if (lp->init) | |
| 459 lp->init(); | |
| 460 } | |
| 461 | |
| 462 if (cfg.disabled_iplugins) { | |
| 463 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
| 464 while (disabled[i]) { | |
| 465 g_hash_table_replace(plugin_matrix, disabled[i], | |
| 466 GINT_TO_POINTER(FALSE)); | |
| 467 i++; | |
| 468 } | |
| 469 | |
| 470 g_free(disabled); | |
| 471 | |
| 472 g_free(cfg.disabled_iplugins); | |
| 473 cfg.disabled_iplugins = NULL; | |
| 474 } | |
| 475 } | |
| 476 | |
| 477 void | |
| 478 plugin_system_cleanup(void) | |
| 479 { | |
| 480 InputPlugin *ip; | |
| 481 OutputPlugin *op; | |
| 482 EffectPlugin *ep; | |
| 483 GeneralPlugin *gp; | |
| 484 VisPlugin *vp; | |
| 485 LowlevelPlugin *lp; | |
| 486 GList *node; | |
| 487 | |
| 488 g_message("Shutting down plugin system"); | |
| 489 | |
| 490 if (playback_get_playing()) { | |
| 491 ip_data.stop = TRUE; | |
| 492 playback_stop(); | |
| 493 ip_data.stop = FALSE; | |
| 494 } | |
| 495 | |
| 2623 | 496 /* FIXME: race condition -nenolod */ |
| 497 op_data.current_output_plugin = NULL; | |
| 498 | |
| 2313 | 499 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 500 ip = INPUT_PLUGIN(node->data); | |
| 501 if (ip && ip->cleanup) { | |
| 502 ip->cleanup(); | |
| 503 GDK_THREADS_LEAVE(); | |
| 504 while (g_main_context_iteration(NULL, FALSE)); | |
| 505 GDK_THREADS_ENTER(); | |
| 506 } | |
|
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
|
507 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
508 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
|
509 g_module_close(ip->handle); |
| 2313 | 510 } |
| 511 | |
| 2623 | 512 if (ip_data.input_list != NULL) |
| 513 { | |
| 2313 | 514 g_list_free(ip_data.input_list); |
| 2623 | 515 ip_data.input_list = NULL; |
| 516 } | |
| 2313 | 517 |
| 518 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 519 op = OUTPUT_PLUGIN(node->data); | |
| 520 if (op && op->cleanup) { | |
| 521 op->cleanup(); | |
| 522 GDK_THREADS_LEAVE(); | |
| 523 while (g_main_context_iteration(NULL, FALSE)); | |
| 524 GDK_THREADS_ENTER(); | |
| 525 } | |
|
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
|
526 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
527 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
|
528 g_module_close(op->handle); |
| 2313 | 529 } |
| 530 | |
| 2623 | 531 if (op_data.output_list != NULL) |
| 532 { | |
| 2313 | 533 g_list_free(op_data.output_list); |
| 2623 | 534 op_data.output_list = NULL; |
| 535 } | |
| 2313 | 536 |
| 537 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 538 ep = EFFECT_PLUGIN(node->data); | |
| 539 if (ep && ep->cleanup) { | |
| 540 ep->cleanup(); | |
| 541 GDK_THREADS_LEAVE(); | |
| 542 while (g_main_context_iteration(NULL, FALSE)); | |
| 543 GDK_THREADS_ENTER(); | |
| 544 } | |
|
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
|
545 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
546 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
|
547 g_module_close(ep->handle); |
| 2313 | 548 } |
| 549 | |
| 2623 | 550 if (ep_data.effect_list != NULL) |
| 551 { | |
| 2313 | 552 g_list_free(ep_data.effect_list); |
| 2623 | 553 ep_data.effect_list = NULL; |
| 2313 | 554 } |
| 555 | |
| 556 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 557 gp = GENERAL_PLUGIN(node->data); | |
| 558 if (gp && gp->cleanup) { | |
| 559 gp->cleanup(); | |
| 560 GDK_THREADS_LEAVE(); | |
| 561 while (g_main_context_iteration(NULL, FALSE)); | |
| 562 GDK_THREADS_ENTER(); | |
| 563 } | |
|
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
|
564 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
565 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
|
566 g_module_close(gp->handle); |
| 2313 | 567 } |
| 568 | |
| 2623 | 569 if (gp_data.general_list != NULL) |
| 570 { | |
| 2313 | 571 g_list_free(gp_data.general_list); |
| 2623 | 572 gp_data.general_list = NULL; |
| 2313 | 573 } |
| 574 | |
| 575 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 576 vp = VIS_PLUGIN(node->data); | |
| 577 if (vp && vp->cleanup) { | |
| 578 vp->cleanup(); | |
| 579 GDK_THREADS_LEAVE(); | |
| 580 while (g_main_context_iteration(NULL, FALSE)); | |
| 581 GDK_THREADS_ENTER(); | |
| 582 } | |
|
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
|
583 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
584 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
|
585 g_module_close(vp->handle); |
| 2313 | 586 } |
| 587 | |
| 2623 | 588 if (vp_data.vis_list != NULL) |
| 589 { | |
| 2313 | 590 g_list_free(vp_data.vis_list); |
| 2623 | 591 vp_data.vis_list = NULL; |
| 592 } | |
| 2313 | 593 |
| 594 for (node = lowlevel_list; node; node = g_list_next(node)) { | |
| 595 lp = LOWLEVEL_PLUGIN(node->data); | |
| 596 if (lp && lp->cleanup) { | |
| 597 lp->cleanup(); | |
| 598 GDK_THREADS_LEAVE(); | |
| 599 while (g_main_context_iteration(NULL, FALSE)); | |
| 600 GDK_THREADS_ENTER(); | |
| 601 } | |
|
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
|
602 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
603 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
|
604 g_module_close(lp->handle); |
| 2313 | 605 } |
| 606 | |
| 2623 | 607 if (lowlevel_list != NULL) |
| 608 { | |
| 2313 | 609 g_list_free(lowlevel_list); |
| 2623 | 610 lowlevel_list = NULL; |
| 611 } | |
| 612 | |
| 613 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 614 if (vfs_transports != NULL) | |
| 615 { | |
| 616 g_list_free(vfs_transports); | |
| 617 vfs_transports = NULL; | |
| 618 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
619 |
|
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
620 g_hash_table_destroy( plugin_matrix ); |
| 2313 | 621 } |
