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