annotate audacious/pluginenum.c @ 785:20a62ae86b6e trunk

[svn] - some compilers couldn't figure the original call out, so put a struct infront of it
author nenolod
date Thu, 02 Mar 2006 16:07:31 -0800
parents 12c47704b4b5
children d17d96d91e7d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* BMP - Cross-platform multimedia player
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * Copyright (C) 2003-2004 BMP development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * Based on XMMS:
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 * Copyright (C) 1998-2003 XMMS development team.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * it under the terms of the GNU General Public Licensse as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26 #include "pluginenum.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include <gmodule.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 #include <glib/gprintf.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #include "controlsocket.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include "main.h"
781
12c47704b4b5 [svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents: 687
diff changeset
35 #include "mainwin.h"
538
e4e897d20791 [svn] remove libaudcore, we never did anything with it
nenolod
parents: 380
diff changeset
36 #include "playback.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "playlist.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 #include "effect.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 #include "general.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 #include "input.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 #include "output.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 #include "visualization.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 const gchar *plugin_dir_list[] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 PLUGINSUBS,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48 NULL
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 GHashTable *plugin_matrix = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 inputlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56 const InputPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 outputlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 const OutputPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 effectlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 const EffectPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 generallist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 const GeneralPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 vislist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 const VisPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 plugin_is_duplicate(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 GList *l;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 const gchar *basename = g_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 /* FIXME: messy stuff */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 for (l = ip_data.input_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 if (!strcmp(basename, g_basename(INPUT_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 for (l = op_data.output_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 if (!strcmp(basename, g_basename(OUTPUT_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 for (l = ep_data.effect_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 if (!strcmp(basename, g_basename(EFFECT_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 for (l = gp_data.general_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 if (!strcmp(basename, g_basename(GENERAL_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 for (l = vp_data.vis_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 typedef Plugin * (*PluginGetInfoFunc) (void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 input_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 InputPlugin *p = INPUT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 p->get_vis_type = input_get_vis_type;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 p->add_vis_pcm = input_add_vis_pcm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 else thinks we could use a CONST macro to solve the warnings?
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 - descender */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 p->set_info_text = (void (*)(gchar *)) input_set_info_text;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 ip_data.input_list = g_list_append(ip_data.input_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 GINT_TO_POINTER(1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 output_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 OutputPlugin *p = OUTPUT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147 op_data.output_list = g_list_append(op_data.output_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 effect_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 EffectPlugin *p = EFFECT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 ep_data.effect_list = g_list_append(ep_data.effect_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 general_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 GeneralPlugin *p = GENERAL_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 p->xmms_session = ctrlsocket_get_session_id();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 gp_data.general_list = g_list_append(gp_data.general_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 vis_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 VisPlugin *p = VIS_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 p->xmms_session = ctrlsocket_get_session_id();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 p->disable_plugin = vis_disable_plugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 vp_data.vis_list = g_list_append(vp_data.vis_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 /* FIXME: Placed here (hopefully) temporarily - descender */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 const gchar *name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 const gchar *id;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 void (*init)(Plugin *);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 } PluginType;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183 static PluginType plugin_types[] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 { "input" , "get_iplugin_info", input_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 { "output" , "get_oplugin_info", output_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186 { "effect" , "get_eplugin_info", effect_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 { "general" , "get_gplugin_info", general_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 { "visualization", "get_vplugin_info", vis_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 { NULL, NULL, NULL }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 add_plugin(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 PluginType *type;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 GModule *module;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197 gpointer func;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 if (plugin_is_duplicate(filename))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 if (!(module = g_module_open(filename, 0))) {
12
b03906396b3a [svn] Debugging notices.
nenolod
parents: 0
diff changeset
203 printf("Failed to load plugin (%s): %s\n",
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 filename, g_module_error());
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 for (type = plugin_types; type->name; type++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 if (g_module_symbol(module, type->id, &func)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 Plugin *plugin = PLUGIN_GET_INFO(func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 plugin->handle = module;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 plugin->filename = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 type->init(PLUGIN_GET_INFO(func));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220
12
b03906396b3a [svn] Debugging notices.
nenolod
parents: 0
diff changeset
221 printf("Invalid plugin (%s)\n", filename);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 g_module_close(module);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228 if (!str_has_suffix_nocase(basename, G_MODULE_SUFFIX))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 add_plugin(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 scan_plugins(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 dir_foreach(path, scan_plugin_func, NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 plugin_system_init(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 gchar *dir, **disabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 OutputPlugin *op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 gint dirsel = 0, i = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 if (!g_module_supported()) {
781
12c47704b4b5 [svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents: 687
diff changeset
255 report_error("Module loading not supported! Plugins will not be loaded.\n");
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 plugin_matrix = g_hash_table_new_full(g_str_hash, g_int_equal, g_free,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 #ifndef DISABLE_USER_PLUGIN_DIR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 * This is in a separate loop so if the user puts them in the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 * wrong dir we'll still get them in the right order (home dir
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 * first) - Zinx
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 while (plugin_dir_list[dirsel]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 plugin_dir_list[dirsel++], NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 scan_plugins(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 g_free(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 dirsel = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278 while (plugin_dir_list[dirsel]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 scan_plugins(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 g_free(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 if (!op_data.current_output_plugin
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 && g_list_length(op_data.output_list)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 op_data.current_output_plugin = op_data.output_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 ep_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 gp_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 vp_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 general_enable_from_stringified_list(cfg.enabled_gplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 vis_enable_from_stringified_list(cfg.enabled_vplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 effect_enable_from_stringified_list(cfg.enabled_eplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 g_free(cfg.enabled_gplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 cfg.enabled_gplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 g_free(cfg.enabled_vplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 cfg.enabled_vplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 g_free(cfg.enabled_eplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 cfg.enabled_eplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 for (node = op_data.output_list; node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 op = OUTPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317 * Only test basename to avoid problems when changing
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 * prefix. We will only see one plugin with the same
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 * basename, so this is usually what the user want.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 op_data.current_output_plugin = op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 if (op->init)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324 op->init();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 for (node = ip_data.input_list; node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 if (ip->init)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 ip->init();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 if (cfg.disabled_iplugins) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 while (disabled[i]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336 g_hash_table_replace(plugin_matrix, disabled[i],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 GINT_TO_POINTER(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 i++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 g_free(disabled);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 g_free(cfg.disabled_iplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 cfg.disabled_iplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349 plugin_system_cleanup(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 OutputPlugin *op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 EffectPlugin *ep;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 GeneralPlugin *gp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355 VisPlugin *vp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 g_message("Shutting down plugin system");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 if (bmp_playback_get_playing())
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 bmp_playback_stop();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 for (node = get_input_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365 if (ip && ip->cleanup) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 ip->cleanup();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 GDK_THREADS_LEAVE();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 while (g_main_iteration(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 g_module_close(ip->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 if (ip_data.input_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 g_list_free(ip_data.input_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 for (node = get_output_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 op = OUTPUT_PLUGIN(node->data);
309
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
379 if (op && op->cleanup) {
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
380 op->cleanup();
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
381 GDK_THREADS_LEAVE();
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
382 while (g_main_iteration(FALSE));
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
383 GDK_THREADS_ENTER();
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
384 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 g_module_close(op->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388 if (op_data.output_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 g_list_free(op_data.output_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391 for (node = get_effect_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 ep = EFFECT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 if (ep && ep->cleanup) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 ep->cleanup();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395 GDK_THREADS_LEAVE();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 while (g_main_iteration(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 g_module_close(ep->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 if (ep_data.effect_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 g_list_free(ep_data.effect_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 for (node = get_general_enabled_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 gp = GENERAL_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407 enable_general_plugin(g_list_index(gp_data.general_list, gp), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410 if (gp_data.enabled_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 g_list_free(gp_data.enabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413 GDK_THREADS_LEAVE();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 while (g_main_iteration(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417 for (node = get_general_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 gp = GENERAL_PLUGIN(node->data);
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
419 if (gp && gp->cleanup) {
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
420 gp->cleanup();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
421 GDK_THREADS_LEAVE();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
422 while (g_main_iteration(FALSE));
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
423 GDK_THREADS_ENTER();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
424 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425 g_module_close(gp->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428 if (gp_data.general_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429 g_list_free(gp_data.general_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431 for (node = get_vis_enabled_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
432 vp = VIS_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 enable_vis_plugin(g_list_index(vp_data.vis_list, vp), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 if (vp_data.enabled_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437 g_list_free(vp_data.enabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439 GDK_THREADS_LEAVE();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440 while (g_main_iteration(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
442
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443 for (node = get_vis_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
444 vp = VIS_PLUGIN(node->data);
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
445 if (vp && vp->cleanup) {
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
446 vp->cleanup();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
447 GDK_THREADS_LEAVE();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
448 while (g_main_iteration(FALSE));
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
449 GDK_THREADS_ENTER();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
450 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
451 g_module_close(vp->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
452 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
453
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454 if (vp_data.vis_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455 g_list_free(vp_data.vis_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456 }