annotate audacious/pluginenum.c @ 2230:561dea8d84e1 trunk

[svn] zh_TW.po updated by: Cheng-Wei Chien <e.cwchien@gmail.com>
author cwchien
date Sun, 31 Dec 2006 23:46:17 -0800
parents 894f7aa46f83
children d507d2c1f75c
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
1460
411b4aaf928b [svn] fine
nemo
parents: 1459
diff changeset
8 * it under the terms of the GNU General Public License as published by
2105
f18a5b617c34 [svn] - move to GPLv2-only. Based on my interpretation of the license, we are
nenolod
parents: 2098
diff changeset
9 * the Free Software Foundation; under version 2 of the License.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
1459
705d4c089fce [svn] Fix postal code.
chainsaw
parents: 1458
diff changeset
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #ifdef HAVE_CONFIG_H
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22 # include "config.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24
1631
20ff61083530 [svn] - make audtool build
nenolod
parents: 1566
diff changeset
25 #ifndef SHARED_SUFFIX
20ff61083530 [svn] - make audtool build
nenolod
parents: 1566
diff changeset
26 # define SHARED_SUFFIX G_MODULE_SUFFIX
20ff61083530 [svn] - make audtool build
nenolod
parents: 1566
diff changeset
27 #endif
20ff61083530 [svn] - make audtool build
nenolod
parents: 1566
diff changeset
28
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 #include "pluginenum.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 #include <glib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 #include <gmodule.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 #include <glib/gprintf.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 #include "controlsocket.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 #include "main.h"
1653
a6e6d3500c13 [svn] - revert back to r2216
nenolod
parents: 1649
diff changeset
38 #include "mainwin.h"
538
e4e897d20791 [svn] remove libaudcore, we never did anything with it
nenolod
parents: 380
diff changeset
39 #include "playback.h"
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 #include "playlist.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41 #include "util.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 #include "effect.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 #include "general.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 #include "input.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 #include "output.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 #include "visualization.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 const gchar *plugin_dir_list[] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 PLUGINSUBS,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51 NULL
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 GHashTable *plugin_matrix = NULL;
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
55 GList *lowlevel_list = NULL;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 inputlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 const InputPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 outputlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67 const OutputPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 effectlist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 const EffectPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 generallist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 const GeneralPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85 static gint
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 vislist_compare_func(gconstpointer a, gconstpointer b)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88 const VisPlugin *ap = a, *bp = b;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 return strcasecmp(ap->description, bp->description);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 plugin_is_duplicate(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 GList *l;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 const gchar *basename = g_basename(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 /* FIXME: messy stuff */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 for (l = ip_data.input_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 if (!strcmp(basename, g_basename(INPUT_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 = op_data.output_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 if (!strcmp(basename, g_basename(OUTPUT_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 = ep_data.effect_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 if (!strcmp(basename, g_basename(EFFECT_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 = gp_data.general_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 if (!strcmp(basename, g_basename(GENERAL_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 for (l = vp_data.vis_list; l; l = g_list_next(l))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
120 for (l = lowlevel_list; l; l = g_list_next(l))
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
121 if (!strcmp(basename, g_basename(VIS_PLUGIN(l->data)->filename)))
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
122 return TRUE;
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
123
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128 #define PLUGIN_GET_INFO(x) ((PluginGetInfoFunc)(x))()
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 typedef Plugin * (*PluginGetInfoFunc) (void);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 input_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 InputPlugin *p = INPUT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 p->get_vis_type = input_get_vis_type;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 p->add_vis_pcm = input_add_vis_pcm;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 else thinks we could use a CONST macro to solve the warnings?
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 - descender */
2098
425963ded156 [svn] - provide the old ABI for plugins (intermediate layer).
nenolod
parents: 2079
diff changeset
142 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 p->set_info_text = (void (*)(gchar *)) input_set_info_text;
1273
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 906
diff changeset
144 p->set_status_buffering = (void (*)(gboolean)) input_set_status_buffering;
3b990c26fc46 [svn] - Support for the buffer indicator in playpaus.png that was apparently
nhjm449
parents: 906
diff changeset
145
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 ip_data.input_list = g_list_append(ip_data.input_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 g_hash_table_replace(plugin_matrix, g_path_get_basename(p->filename),
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 GINT_TO_POINTER(1));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 output_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 OutputPlugin *p = OUTPUT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 op_data.output_list = g_list_append(op_data.output_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 effect_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 EffectPlugin *p = EFFECT_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 ep_data.effect_list = g_list_append(ep_data.effect_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167 general_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 GeneralPlugin *p = GENERAL_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 p->xmms_session = ctrlsocket_get_session_id();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 gp_data.general_list = g_list_append(gp_data.general_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 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 vis_plugin_init(Plugin * plugin)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 VisPlugin *p = VIS_PLUGIN(plugin);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178 p->xmms_session = ctrlsocket_get_session_id();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 p->disable_plugin = vis_disable_plugin;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 vp_data.vis_list = g_list_append(vp_data.vis_list, p);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
183 static void
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
184 lowlevel_plugin_init(Plugin * plugin)
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
185 {
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
186 LowlevelPlugin *p = LOWLEVEL_PLUGIN(plugin);
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
187 lowlevel_list = g_list_append(lowlevel_list, p);
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
188 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 /* FIXME: Placed here (hopefully) temporarily - descender */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192 typedef struct {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 const gchar *name;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 const gchar *id;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 void (*init)(Plugin *);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 } PluginType;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 static PluginType plugin_types[] = {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 { "input" , "get_iplugin_info", input_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 { "output" , "get_oplugin_info", output_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 { "effect" , "get_eplugin_info", effect_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 { "general" , "get_gplugin_info", general_plugin_init },
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 { "visualization", "get_vplugin_info", vis_plugin_init },
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
204 { "lowlevel" , "get_lplugin_info", lowlevel_plugin_init },
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 { NULL, NULL, NULL }
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 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 add_plugin(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 PluginType *type;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 GModule *module;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213 gpointer func;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 if (plugin_is_duplicate(filename))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217
1970
94a720c9bfef [svn] - only GModule would be so dumb to push all symbols to the global
nenolod
parents: 1653
diff changeset
218 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) {
12
b03906396b3a [svn] Debugging notices.
nenolod
parents: 0
diff changeset
219 printf("Failed to load plugin (%s): %s\n",
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 filename, g_module_error());
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 for (type = plugin_types; type->name; type++)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 if (g_module_symbol(module, type->id, &func)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 Plugin *plugin = PLUGIN_GET_INFO(func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 plugin->handle = module;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 plugin->filename = g_strdup(filename);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231 type->init(PLUGIN_GET_INFO(func));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236
12
b03906396b3a [svn] Debugging notices.
nenolod
parents: 0
diff changeset
237 printf("Invalid plugin (%s)\n", filename);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 g_module_close(module);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 static gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 {
1631
20ff61083530 [svn] - make audtool build
nenolod
parents: 1566
diff changeset
244 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX))
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 add_plugin(path);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255 static void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 scan_plugins(const gchar * path)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 dir_foreach(path, scan_plugin_func, NULL, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262 plugin_system_init(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 gchar *dir, **disabled;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 OutputPlugin *op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267 InputPlugin *ip;
1566
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
268 LowlevelPlugin *lp;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 gint dirsel = 0, i = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 if (!g_module_supported()) {
781
12c47704b4b5 [svn] Add error reporting for many places, patch by external contributor Derek
nenolod
parents: 687
diff changeset
272 report_error("Module loading not supported! Plugins will not be loaded.\n");
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 plugin_matrix = g_hash_table_new_full(g_str_hash, g_int_equal, g_free,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 #ifndef DISABLE_USER_PLUGIN_DIR
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 * This is in a separate loop so if the user puts them in the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 * wrong dir we'll still get them in the right order (home dir
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284 * first) - Zinx
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 while (plugin_dir_list[dirsel]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288 plugin_dir_list[dirsel++], NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 scan_plugins(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 g_free(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 dirsel = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293 #endif
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 while (plugin_dir_list[dirsel]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 scan_plugins(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 g_free(dir);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 if (!op_data.current_output_plugin
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 && g_list_length(op_data.output_list)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 op_data.current_output_plugin = op_data.output_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 ep_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313 gp_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 vp_data.enabled_list = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 general_enable_from_stringified_list(cfg.enabled_gplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 vis_enable_from_stringified_list(cfg.enabled_vplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 effect_enable_from_stringified_list(cfg.enabled_eplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 g_free(cfg.enabled_gplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 cfg.enabled_gplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 g_free(cfg.enabled_vplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326 cfg.enabled_vplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 g_free(cfg.enabled_eplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 cfg.enabled_eplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331 for (node = op_data.output_list; node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332 op = OUTPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 /*
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 * Only test basename to avoid problems when changing
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 * prefix. We will only see one plugin with the same
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336 * basename, so this is usually what the user want.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 if (!strcmp(g_basename(cfg.outputplugin), g_basename(op->filename)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 op_data.current_output_plugin = op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 if (op->init)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 op->init();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 for (node = ip_data.input_list; node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 if (ip->init)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 ip->init();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349
1566
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
350 for (node = lowlevel_list; node; node = g_list_next(node)) {
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
351 lp = LOWLEVEL_PLUGIN(node->data);
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
352 if (lp->init)
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
353 lp->init();
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
354 }
e513069caf71 [svn] - pls and m3u is now fully modular
nenolod
parents: 1563
diff changeset
355
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 if (cfg.disabled_iplugins) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 while (disabled[i]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 g_hash_table_replace(plugin_matrix, disabled[i],
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 GINT_TO_POINTER(FALSE));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 i++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 g_free(disabled);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 g_free(cfg.disabled_iplugins);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 cfg.disabled_iplugins = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 plugin_system_cleanup(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374 InputPlugin *ip;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 OutputPlugin *op;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 EffectPlugin *ep;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377 GeneralPlugin *gp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 VisPlugin *vp;
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
379 LowlevelPlugin *lp;
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 GList *node;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
382 g_message("Shutting down plugin system");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2159
diff changeset
384 if (playback_get_playing()) {
906
704c0b2e5f6b [svn] - this should be it for now
nhjm449
parents: 834
diff changeset
385 ip_data.stop = TRUE;
2228
894f7aa46f83 [svn] - bmp_playback_* -> playback_* -- i knew something smelled rotten here, hmm.
nenolod
parents: 2159
diff changeset
386 playback_stop();
906
704c0b2e5f6b [svn] - this should be it for now
nhjm449
parents: 834
diff changeset
387 ip_data.stop = FALSE;
704c0b2e5f6b [svn] - this should be it for now
nhjm449
parents: 834
diff changeset
388 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390 for (node = get_input_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391 ip = INPUT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 if (ip && ip->cleanup) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 ip->cleanup();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
395 while (g_main_context_iteration(NULL, FALSE));
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 g_module_close(ip->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 if (ip_data.input_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 g_list_free(ip_data.input_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 for (node = get_output_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 op = OUTPUT_PLUGIN(node->data);
309
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
406 if (op && op->cleanup) {
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
407 op->cleanup();
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
408 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
409 while (g_main_context_iteration(NULL, FALSE));
309
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
410 GDK_THREADS_ENTER();
b04ce1c98b6f [svn] Plugin cleanup functionality, via giacomo.
nenolod
parents: 284
diff changeset
411 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 g_module_close(op->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 if (op_data.output_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 g_list_free(op_data.output_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 for (node = get_effect_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 ep = EFFECT_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 if (ep && ep->cleanup) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 ep->cleanup();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
423 while (g_main_context_iteration(NULL, FALSE));
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
424 GDK_THREADS_ENTER();
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
425 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
426 g_module_close(ep->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
427 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
428
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
429 if (ep_data.effect_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
430 g_list_free(ep_data.effect_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
431
2079
78002535143b [svn] remove plugin-reactivation loops for general and visualization plugins
yaz
parents: 1970
diff changeset
432 #if 0
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
433 for (node = get_general_enabled_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
434 gp = GENERAL_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
435 enable_general_plugin(g_list_index(gp_data.general_list, gp), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
436 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
437
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
438 if (gp_data.enabled_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
439 g_list_free(gp_data.enabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
440
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
441 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
442 while (g_main_context_iteration(NULL, FALSE));
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
443 GDK_THREADS_ENTER();
2079
78002535143b [svn] remove plugin-reactivation loops for general and visualization plugins
yaz
parents: 1970
diff changeset
444 #endif
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
445
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
446 for (node = get_general_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
447 gp = GENERAL_PLUGIN(node->data);
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
448 if (gp && gp->cleanup) {
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
449 gp->cleanup();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
450 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
451 while (g_main_context_iteration(NULL, FALSE));
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
452 GDK_THREADS_ENTER();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
453 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
454 g_module_close(gp->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
455 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
456
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
457 if (gp_data.general_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
458 g_list_free(gp_data.general_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
459
2079
78002535143b [svn] remove plugin-reactivation loops for general and visualization plugins
yaz
parents: 1970
diff changeset
460 #if 0
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
461 for (node = get_vis_enabled_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
462 vp = VIS_PLUGIN(node->data);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
463 enable_vis_plugin(g_list_index(vp_data.vis_list, vp), FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
464 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
465
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
466 if (vp_data.enabled_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
467 g_list_free(vp_data.enabled_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
468
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
469 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
470 while (g_main_context_iteration(NULL, FALSE));
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
471 GDK_THREADS_ENTER();
2079
78002535143b [svn] remove plugin-reactivation loops for general and visualization plugins
yaz
parents: 1970
diff changeset
472 #endif
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
473
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
474 for (node = get_vis_list(); node; node = g_list_next(node)) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
475 vp = VIS_PLUGIN(node->data);
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
476 if (vp && vp->cleanup) {
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
477 vp->cleanup();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
478 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
479 while (g_main_context_iteration(NULL, FALSE));
650
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
480 GDK_THREADS_ENTER();
980d651da2fc [svn] Actually use the cleanup hooks on general & visualization plugins.
chainsaw
parents: 538
diff changeset
481 }
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
482 g_module_close(vp->handle);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
483 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
484
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
485 if (vp_data.vis_list)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
486 g_list_free(vp_data.vis_list);
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
487
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
488 for (node = lowlevel_list; node; node = g_list_next(node)) {
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
489 lp = LOWLEVEL_PLUGIN(node->data);
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
490 if (lp && lp->cleanup) {
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
491 lp->cleanup();
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
492 GDK_THREADS_LEAVE();
2159
35bdfcd17ba7 [svn] - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
yaz
parents: 2105
diff changeset
493 while (g_main_context_iteration(NULL, FALSE));
1563
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
494 GDK_THREADS_ENTER();
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
495 }
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
496 g_module_close(lp->handle);
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
497 }
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
498
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
499 if (lowlevel_list)
c4640c88942d [svn] - lowlevel plugin stuff
nenolod
parents: 1460
diff changeset
500 g_list_free(lowlevel_list);
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
501 }