Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 3684:2f9d8b987e40
Export VfsBuffer functions.
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Mon, 01 Oct 2007 23:32:57 -0500 |
| parents | 4284187479d7 |
| children | 0ba593887cae |
| rev | line source |
|---|---|
| 2313 | 1 /* Audacious - Cross-platform multimedia player |
| 2 * Copyright (C) 2005-2007 Audacious development team | |
| 3 * | |
| 4 * Based on BMP: | |
| 5 * Copyright (C) 2003-2004 BMP development team | |
| 6 * | |
| 7 * Based on XMMS: | |
| 8 * Copyright (C) 1998-2003 XMMS development team | |
| 9 * | |
| 10 * This program is free software; you can redistribute it and/or modify | |
| 11 * it under the terms of the GNU General Public License as published by | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
12 * the Free Software Foundation; under version 3 of the License. |
| 2313 | 13 * |
| 14 * This program is distributed in the hope that it will be useful, | |
| 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 17 * GNU General Public License for more details. | |
| 18 * | |
| 19 * You should have received a copy of the GNU General Public License | |
|
3121
3b6d316f8b09
GPL3 relicensing.
William Pitcock <nenolod@atheme-project.org>
parents:
2825
diff
changeset
|
20 * along with this program. If not, see <http://www.gnu.org/licenses>. |
|
3123
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
21 * |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
22 * The Audacious team does not consider modular code linking to |
|
f1c756f39e6c
Invoke "Plugins are not derived work" clause provided by GPL3.
William Pitcock <nenolod@atheme-project.org>
parents:
3121
diff
changeset
|
23 * Audacious or using our public API to be a derived work. |
| 2313 | 24 */ |
| 25 | |
| 26 #ifdef HAVE_CONFIG_H | |
| 27 # include "config.h" | |
| 28 #endif | |
| 29 | |
| 30 #ifndef SHARED_SUFFIX | |
| 31 # define SHARED_SUFFIX G_MODULE_SUFFIX | |
| 32 #endif | |
| 33 | |
| 34 #include <glib.h> | |
| 35 #include <gmodule.h> | |
| 36 #include <glib/gprintf.h> | |
| 37 #include <string.h> | |
| 38 | |
| 39 #include "main.h" | |
| 40 #include "ui_main.h" | |
| 41 #include "playback.h" | |
| 42 #include "playlist.h" | |
|
2373
ad1d7687814c
[svn] made strings.h for existing strings.c, cleanups
mf0102
parents:
2313
diff
changeset
|
43 #include "strings.h" |
| 2313 | 44 #include "util.h" |
| 45 | |
| 46 #include "effect.h" | |
| 47 #include "general.h" | |
| 48 #include "input.h" | |
| 49 #include "output.h" | |
| 50 #include "visualization.h" | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
51 #include "discovery.h" |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
52 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
53 #include "pluginenum.h" |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
54 |
|
3684
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
55 #include "vfs_buffer.h" |
|
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
56 |
| 2313 | 57 const gchar *plugin_dir_list[] = { |
| 58 PLUGINSUBS, | |
| 59 NULL | |
| 60 }; | |
| 61 | |
|
3682
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
62 /*****************************************************************/ |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
63 |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
64 static struct _AudaciousFuncTableV1 _aud_papi_v1 = { |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
65 .vfs_fopen = vfs_fopen, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
66 .vfs_fclose = vfs_fclose, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
67 .vfs_dup = vfs_dup, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
68 .vfs_fread = vfs_fread, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
69 .vfs_fwrite = vfs_fwrite, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
70 .vfs_getc = vfs_getc, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
71 .vfs_ungetc = vfs_ungetc, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
72 .vfs_fgets = vfs_fgets, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
73 .vfs_fseek = vfs_fseek, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
74 .vfs_rewind = vfs_rewind, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
75 .vfs_ftell = vfs_ftell, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
76 .vfs_feof = vfs_feof, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
77 .vfs_file_test = vfs_file_test, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
78 .vfs_is_writeable = vfs_is_writeable, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
79 .vfs_truncate = vfs_truncate, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
80 .vfs_fsize = vfs_fsize, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
81 .vfs_get_metadata = vfs_get_metadata, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
82 .vfs_fprintf = vfs_fprintf, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
83 .vfs_register_transport = vfs_register_transport, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
84 .vfs_file_get_contents = vfs_file_get_contents, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
85 .vfs_is_remote = vfs_is_remote, |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
86 .vfs_is_streaming = vfs_is_streaming, |
|
3684
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
87 |
|
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
88 .vfs_buffer_new = vfs_buffer_new, |
|
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
89 .vfs_buffer_new_from_string = vfs_buffer_new_from_string, |
| 3683 | 90 }; |
|
3682
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
91 |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
92 /*****************************************************************/ |
|
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
93 |
| 2313 | 94 GList *lowlevel_list = NULL; |
| 2623 | 95 extern GList *vfs_transports; |
| 96 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
97 mowgli_dictionary_t *plugin_dict = NULL; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
98 |
| 2313 | 99 static gint |
| 100 inputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 101 { | |
| 102 const InputPlugin *ap = a, *bp = b; | |
| 2804 | 103 if(ap->description && bp->description) |
| 104 return strcasecmp(ap->description, bp->description); | |
| 105 else | |
| 106 return 0; | |
| 2313 | 107 } |
| 108 | |
| 109 static gint | |
| 110 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 111 { | |
| 112 const OutputPlugin *ap = a, *bp = b; | |
| 2804 | 113 if(ap->description && bp->description) |
| 114 return strcasecmp(ap->description, bp->description); | |
| 115 else | |
| 116 return 0; | |
| 2313 | 117 } |
| 118 | |
| 119 static gint | |
| 120 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
| 121 { | |
| 122 const EffectPlugin *ap = a, *bp = b; | |
| 2804 | 123 if(ap->description && bp->description) |
| 124 return strcasecmp(ap->description, bp->description); | |
| 125 else | |
| 126 return 0; | |
| 2313 | 127 } |
| 128 | |
| 129 static gint | |
| 130 generallist_compare_func(gconstpointer a, gconstpointer b) | |
| 131 { | |
| 132 const GeneralPlugin *ap = a, *bp = b; | |
| 2804 | 133 if(ap->description && bp->description) |
| 134 return strcasecmp(ap->description, bp->description); | |
| 135 else | |
| 136 return 0; | |
| 2313 | 137 } |
| 138 | |
| 139 static gint | |
| 140 vislist_compare_func(gconstpointer a, gconstpointer b) | |
| 141 { | |
| 142 const VisPlugin *ap = a, *bp = b; | |
| 2804 | 143 if(ap->description && bp->description) |
| 144 return strcasecmp(ap->description, bp->description); | |
| 145 else | |
| 146 return 0; | |
| 2313 | 147 } |
| 148 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
149 static gint |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
150 discoverylist_compare_func(gconstpointer a, gconstpointer b) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
151 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
152 const DiscoveryPlugin *ap = a, *bp = b; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
153 if(ap->description && bp->description) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
154 return strcasecmp(ap->description, bp->description); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
155 else |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
156 return 0; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
157 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
158 |
| 2313 | 159 static gboolean |
| 160 plugin_is_duplicate(const gchar * filename) | |
| 161 { | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
162 gchar *base_filename = g_path_get_basename(filename); |
| 2313 | 163 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
164 if (mowgli_dictionary_retrieve(plugin_dict, base_filename) != NULL) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
165 { |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
166 g_free(base_filename); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
167 return TRUE; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
168 } |
| 2313 | 169 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
170 g_free(base_filename); |
| 2313 | 171 |
| 172 return FALSE; | |
| 173 } | |
| 174 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
175 gboolean |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
176 plugin_is_enabled(const gchar *filename) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
177 { |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
178 Plugin *plugin = mowgli_dictionary_retrieve(plugin_dict, filename); |
| 2313 | 179 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
180 if (!plugin) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
181 return FALSE; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
182 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
183 return plugin->enabled; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
184 } |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
185 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
186 void |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
187 plugin_set_enabled(const gchar *filename, gboolean enabled) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
188 { |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
189 Plugin *plugin = mowgli_dictionary_retrieve(plugin_dict, filename); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
190 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
191 if (!plugin) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
192 return; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
193 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
194 plugin->enabled = enabled; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
195 } |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
196 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
197 Plugin * |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
198 plugin_get_plugin(const gchar *filename) |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
199 { |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
200 return mowgli_dictionary_retrieve(plugin_dict, filename); |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
201 } |
| 2313 | 202 |
| 203 static void | |
| 204 input_plugin_init(Plugin * plugin) | |
| 205 { | |
| 206 InputPlugin *p = INPUT_PLUGIN(plugin); | |
| 207 | |
| 208 p->get_vis_type = input_get_vis_type; | |
| 209 p->add_vis_pcm = input_add_vis_pcm; | |
| 210 | |
| 211 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
| 212 else thinks we could use a CONST macro to solve the warnings? | |
| 213 - descender */ | |
| 214 p->set_info = (void (*)(gchar *, gint, gint, gint, gint)) playlist_set_info_old_abi; | |
|
3165
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
215 p->set_info_text = input_set_info_text; |
|
8775dfc57ead
Remove mainwin_set_info_text() craq. Still some work to do.
William Pitcock <nenolod@atheme-project.org>
parents:
3123
diff
changeset
|
216 p->set_status_buffering = input_set_status_buffering; |
| 2313 | 217 |
| 218 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
| 219 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
220 p->enabled = TRUE; |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
221 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
222 /* XXX: we need something better than p->filename if plugins |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
223 will eventually provide multiple plugins --nenolod */ |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
224 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 225 } |
| 226 | |
| 227 static void | |
| 228 output_plugin_init(Plugin * plugin) | |
| 229 { | |
| 230 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
| 231 op_data.output_list = g_list_append(op_data.output_list, p); | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
232 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
233 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 234 } |
| 235 | |
| 236 static void | |
| 237 effect_plugin_init(Plugin * plugin) | |
| 238 { | |
| 239 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
| 240 ep_data.effect_list = g_list_append(ep_data.effect_list, p); | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
241 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
242 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 243 } |
| 244 | |
| 245 static void | |
| 246 general_plugin_init(Plugin * plugin) | |
| 247 { | |
| 248 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
| 249 gp_data.general_list = g_list_append(gp_data.general_list, p); | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
250 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
251 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 252 } |
| 253 | |
| 254 static void | |
| 255 vis_plugin_init(Plugin * plugin) | |
| 256 { | |
| 257 VisPlugin *p = VIS_PLUGIN(plugin); | |
| 258 p->disable_plugin = vis_disable_plugin; | |
| 259 vp_data.vis_list = g_list_append(vp_data.vis_list, p); | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
260 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
261 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 262 } |
| 263 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
264 static void |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
265 discovery_plugin_init(Plugin * plugin) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
266 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
267 DiscoveryPlugin *p = DISCOVERY_PLUGIN(plugin); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
268 dp_data.discovery_list = g_list_append(dp_data.discovery_list, p); |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
269 |
|
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
270 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
271 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
272 |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
273 /*******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
274 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
275 static void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
276 plugin2_dispose(GModule *module, const gchar *str, ...) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
277 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
278 gchar buf[4096]; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
279 va_list va; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
280 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
281 va_start(va, str); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
282 vsnprintf(buf, 4096, str, va); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
283 va_end(va); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
284 |
|
3247
e21930ccd5a8
remove old debugging notices that aren't very relevant anymore.
William Pitcock <nenolod@atheme-project.org>
parents:
3232
diff
changeset
|
285 g_message("*** %s\n", buf); |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
286 g_module_close(module); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
287 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
288 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
289 void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
290 plugin2_process(PluginHeader *header, GModule *module, const gchar *filename) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
291 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
292 InputPlugin **ip_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
293 OutputPlugin **op_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
294 EffectPlugin **ep_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
295 GeneralPlugin **gp_iter; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
296 VisPlugin **vp_iter; |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
297 DiscoveryPlugin **dp_iter; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
298 |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
299 if (header->magic != PLUGIN_MAGIC) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
300 return plugin2_dispose(module, "plugin <%s> discarded, invalid module magic", filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
301 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
302 if (header->api_version != __AUDACIOUS_PLUGIN_API__) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
303 return plugin2_dispose(module, "plugin <%s> discarded, wanting API version %d, we implement API version %d", |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
304 filename, header->api_version, __AUDACIOUS_PLUGIN_API__); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
305 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
306 if (header->init) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
307 header->init(); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
308 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
309 header->priv_assoc = g_new0(Plugin, 1); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
310 header->priv_assoc->handle = module; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
311 header->priv_assoc->filename = g_strdup(filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
312 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
313 if (header->ip_list) |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
314 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
315 for (ip_iter = header->ip_list; *ip_iter != NULL; ip_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
316 { |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
317 PLUGIN(*ip_iter)->filename = g_strdup(filename); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
318 input_plugin_init(PLUGIN(*ip_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
319 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
320 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
321 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
322 if (header->op_list) |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
323 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
324 for (op_iter = header->op_list; *op_iter != NULL; op_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
325 { |
| 2801 | 326 PLUGIN(*op_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
327 output_plugin_init(PLUGIN(*op_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
328 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
329 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
330 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
331 if (header->ep_list) |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
332 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
333 for (ep_iter = header->ep_list; *ep_iter != NULL; ep_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
334 { |
| 2801 | 335 PLUGIN(*ep_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
336 effect_plugin_init(PLUGIN(*ep_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
337 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
338 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
339 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
340 if (header->gp_list) |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
341 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
342 for (gp_iter = header->gp_list; *gp_iter != NULL; gp_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
343 { |
| 2801 | 344 PLUGIN(*gp_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
345 general_plugin_init(PLUGIN(*gp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
346 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
347 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
348 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
349 if (header->vp_list) |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
350 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
351 for (vp_iter = header->vp_list; *vp_iter != NULL; vp_iter++) |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
352 { |
| 2801 | 353 PLUGIN(*vp_iter)->filename = g_strdup(filename); |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
354 vis_plugin_init(PLUGIN(*vp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
355 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
356 } |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
357 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
358 if (header->dp_list) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
359 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
360 for (dp_iter = header->dp_list; *dp_iter != NULL; dp_iter++) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
361 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
362 PLUGIN(*dp_iter)->filename = g_strdup(filename); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
363 discovery_plugin_init(PLUGIN(*dp_iter)); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
364 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
365 } |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
366 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
367 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
368 void |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
369 plugin2_unload(PluginHeader *header) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
370 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
371 GModule *module; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
372 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
373 g_return_if_fail(header->priv_assoc != NULL); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
374 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
375 module = header->priv_assoc->handle; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
376 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
377 g_free(header->priv_assoc->filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
378 g_free(header->priv_assoc); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
379 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
380 if (header->fini) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
381 header->fini(); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
382 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
383 g_module_close(module); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
384 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
385 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
386 /******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
387 |
| 2313 | 388 static void |
| 389 add_plugin(const gchar * filename) | |
| 390 { | |
| 391 GModule *module; | |
| 392 gpointer func; | |
| 393 | |
| 394 if (plugin_is_duplicate(filename)) | |
| 395 return; | |
| 396 | |
| 2623 | 397 g_message("Loaded plugin (%s)", filename); |
| 398 | |
| 2313 | 399 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 400 printf("Failed to load plugin (%s): %s\n", | |
| 401 filename, g_module_error()); | |
| 402 return; | |
| 403 } | |
| 404 | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
405 /* v2 plugin loading */ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
406 if (g_module_symbol(module, "get_plugin_info", &func)) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
407 { |
|
3682
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
408 PluginHeader *(*header_func_p)(struct _AudaciousFuncTableV1 *) = func; |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
409 PluginHeader *header; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
410 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
411 /* this should never happen. */ |
|
3682
84bc78954db5
Start working on exporting all public functions via a vtable. The API version will be bumped to 7 once I am done and -Wl,-export-dynamic is removed.
William Pitcock <nenolod@atheme.org>
parents:
3631
diff
changeset
|
412 g_return_if_fail((header = header_func_p(&_aud_papi_v1)) != NULL); |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
413 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
414 plugin2_process(header, module, filename); |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
415 return; |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
416 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
417 |
| 2313 | 418 printf("Invalid plugin (%s)\n", filename); |
| 419 g_module_close(module); | |
| 420 } | |
| 421 | |
| 422 static gboolean | |
| 423 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 424 { | |
| 425 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 426 return FALSE; | |
| 427 | |
| 428 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 429 return FALSE; | |
| 430 | |
| 431 add_plugin(path); | |
| 432 | |
| 433 return FALSE; | |
| 434 } | |
| 435 | |
| 436 static void | |
| 437 scan_plugins(const gchar * path) | |
| 438 { | |
| 439 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 440 } | |
| 441 | |
| 442 void | |
| 443 plugin_system_init(void) | |
| 444 { | |
| 445 gchar *dir, **disabled; | |
| 446 GList *node; | |
| 447 OutputPlugin *op; | |
| 448 InputPlugin *ip; | |
| 449 LowlevelPlugin *lp; | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
450 DiscoveryPlugin *dp; |
| 2313 | 451 gint dirsel = 0, i = 0; |
| 452 | |
| 453 if (!g_module_supported()) { | |
| 454 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 455 return; | |
| 456 } | |
| 457 | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
458 plugin_dict = mowgli_dictionary_create(g_ascii_strcasecmp); |
| 2313 | 459 |
| 460 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 461 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 462 /* | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
463 * This is in a separate lo |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
464 * DiscoveryPlugin *dpop so if the user puts them in the |
| 2313 | 465 * wrong dir we'll still get them in the right order (home dir |
| 466 * first) - Zinx | |
| 467 */ | |
| 468 while (plugin_dir_list[dirsel]) { | |
| 469 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 470 plugin_dir_list[dirsel++], NULL); | |
| 471 scan_plugins(dir); | |
| 472 g_free(dir); | |
| 473 } | |
| 474 dirsel = 0; | |
| 475 #endif | |
| 476 | |
| 477 while (plugin_dir_list[dirsel]) { | |
| 478 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 479 scan_plugins(dir); | |
| 480 g_free(dir); | |
| 481 } | |
| 482 | |
| 483 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 484 if (!op_data.current_output_plugin | |
| 485 && g_list_length(op_data.output_list)) { | |
| 486 op_data.current_output_plugin = op_data.output_list->data; | |
| 487 } | |
| 488 | |
| 489 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 490 | |
| 491 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 492 ep_data.enabled_list = NULL; | |
| 493 | |
| 494 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 495 gp_data.enabled_list = NULL; | |
| 496 | |
| 497 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 498 vp_data.enabled_list = NULL; | |
| 499 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
500 dp_data.discovery_list = g_list_sort(dp_data.discovery_list, discoverylist_compare_func); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
501 dp_data.enabled_list = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
502 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
503 |
| 2313 | 504 general_enable_from_stringified_list(cfg.enabled_gplugins); |
| 505 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 506 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
507 discovery_enable_from_stringified_list(cfg.enabled_dplugins); |
| 2313 | 508 |
| 509 g_free(cfg.enabled_gplugins); | |
| 510 cfg.enabled_gplugins = NULL; | |
| 511 | |
| 512 g_free(cfg.enabled_vplugins); | |
| 513 cfg.enabled_vplugins = NULL; | |
| 514 | |
| 515 g_free(cfg.enabled_eplugins); | |
| 516 cfg.enabled_eplugins = NULL; | |
| 517 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
518 g_free(cfg.enabled_dplugins); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
519 cfg.enabled_dplugins = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
520 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
521 |
| 2313 | 522 for (node = op_data.output_list; node; node = g_list_next(node)) { |
| 523 op = OUTPUT_PLUGIN(node->data); | |
| 524 /* | |
| 525 * Only test basename to avoid problems when changing | |
| 526 * prefix. We will only see one plugin with the same | |
| 527 * basename, so this is usually what the user want. | |
| 528 */ | |
|
3631
6aea4fb32ef4
Missing NULL-pointer checks are bad, mkay?
Jonathan Schleifer <js@h3c.de>
parents:
3454
diff
changeset
|
529 if (cfg.outputplugin && !strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) |
| 2313 | 530 op_data.current_output_plugin = op; |
| 531 if (op->init) | |
| 532 op->init(); | |
| 533 } | |
| 534 | |
| 535 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 536 ip = INPUT_PLUGIN(node->data); | |
| 537 if (ip->init) | |
| 538 ip->init(); | |
| 539 } | |
| 540 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
541 for (node = dp_data.discovery_list; node; node = g_list_next(node)) { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
542 dp = DISCOVERY_PLUGIN(node->data); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
543 if (dp->init) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
544 dp->init(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
545 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
546 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
547 |
| 2313 | 548 for (node = lowlevel_list; node; node = g_list_next(node)) { |
| 549 lp = LOWLEVEL_PLUGIN(node->data); | |
| 550 if (lp->init) | |
| 551 lp->init(); | |
| 552 } | |
| 553 | |
| 554 if (cfg.disabled_iplugins) { | |
| 555 disabled = g_strsplit(cfg.disabled_iplugins, ":", 0); | |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
556 |
| 2313 | 557 while (disabled[i]) { |
|
3454
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
558 Plugin *plugintmp = plugin_get_plugin(disabled[i]); |
|
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
559 if (plugintmp) |
|
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
560 INPUT_PLUGIN(plugintmp)->enabled = FALSE; |
| 2313 | 561 i++; |
| 562 } | |
| 563 | |
| 564 g_free(disabled); | |
| 565 | |
| 566 g_free(cfg.disabled_iplugins); | |
| 567 cfg.disabled_iplugins = NULL; | |
| 568 } | |
| 569 } | |
| 570 | |
| 571 void | |
| 572 plugin_system_cleanup(void) | |
| 573 { | |
| 574 InputPlugin *ip; | |
| 575 OutputPlugin *op; | |
| 576 EffectPlugin *ep; | |
| 577 GeneralPlugin *gp; | |
| 578 VisPlugin *vp; | |
| 579 LowlevelPlugin *lp; | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
580 DiscoveryPlugin *dp; |
| 2313 | 581 GList *node; |
| 582 | |
| 583 g_message("Shutting down plugin system"); | |
| 584 | |
| 585 if (playback_get_playing()) { | |
| 586 ip_data.stop = TRUE; | |
| 587 playback_stop(); | |
| 588 ip_data.stop = FALSE; | |
| 589 } | |
| 590 | |
| 2623 | 591 /* FIXME: race condition -nenolod */ |
| 592 op_data.current_output_plugin = NULL; | |
| 593 | |
| 2313 | 594 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 595 ip = INPUT_PLUGIN(node->data); | |
| 596 if (ip && ip->cleanup) { | |
| 597 ip->cleanup(); | |
| 598 GDK_THREADS_LEAVE(); | |
| 599 while (g_main_context_iteration(NULL, FALSE)); | |
| 600 GDK_THREADS_ENTER(); | |
| 601 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
602 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
603 if (ip->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
604 g_module_close(ip->handle); |
| 2313 | 605 } |
| 606 | |
| 2623 | 607 if (ip_data.input_list != NULL) |
| 608 { | |
| 2313 | 609 g_list_free(ip_data.input_list); |
| 2623 | 610 ip_data.input_list = NULL; |
| 611 } | |
| 2313 | 612 |
| 613 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 614 op = OUTPUT_PLUGIN(node->data); | |
| 615 if (op && op->cleanup) { | |
| 616 op->cleanup(); | |
| 617 GDK_THREADS_LEAVE(); | |
| 618 while (g_main_context_iteration(NULL, FALSE)); | |
| 619 GDK_THREADS_ENTER(); | |
| 620 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
621 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
622 if (op->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
623 g_module_close(op->handle); |
| 2313 | 624 } |
| 625 | |
| 2623 | 626 if (op_data.output_list != NULL) |
| 627 { | |
| 2313 | 628 g_list_free(op_data.output_list); |
| 2623 | 629 op_data.output_list = NULL; |
| 630 } | |
| 2313 | 631 |
| 632 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 633 ep = EFFECT_PLUGIN(node->data); | |
| 634 if (ep && ep->cleanup) { | |
| 635 ep->cleanup(); | |
| 636 GDK_THREADS_LEAVE(); | |
| 637 while (g_main_context_iteration(NULL, FALSE)); | |
| 638 GDK_THREADS_ENTER(); | |
| 639 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
640 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
641 if (ep->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
642 g_module_close(ep->handle); |
| 2313 | 643 } |
| 644 | |
| 2623 | 645 if (ep_data.effect_list != NULL) |
| 646 { | |
| 2313 | 647 g_list_free(ep_data.effect_list); |
| 2623 | 648 ep_data.effect_list = NULL; |
| 2313 | 649 } |
| 650 | |
| 651 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 652 gp = GENERAL_PLUGIN(node->data); | |
| 653 if (gp && gp->cleanup) { | |
| 654 gp->cleanup(); | |
| 655 GDK_THREADS_LEAVE(); | |
| 656 while (g_main_context_iteration(NULL, FALSE)); | |
| 657 GDK_THREADS_ENTER(); | |
| 658 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
659 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
660 if (gp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
661 g_module_close(gp->handle); |
| 2313 | 662 } |
| 663 | |
| 2623 | 664 if (gp_data.general_list != NULL) |
| 665 { | |
| 2313 | 666 g_list_free(gp_data.general_list); |
| 2623 | 667 gp_data.general_list = NULL; |
| 2313 | 668 } |
| 669 | |
| 670 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 671 vp = VIS_PLUGIN(node->data); | |
| 672 if (vp && vp->cleanup) { | |
| 673 vp->cleanup(); | |
| 674 GDK_THREADS_LEAVE(); | |
| 675 while (g_main_context_iteration(NULL, FALSE)); | |
| 676 GDK_THREADS_ENTER(); | |
| 677 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
678 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
679 if (vp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
680 g_module_close(vp->handle); |
| 2313 | 681 } |
| 682 | |
| 2623 | 683 if (vp_data.vis_list != NULL) |
| 684 { | |
| 2313 | 685 g_list_free(vp_data.vis_list); |
| 2623 | 686 vp_data.vis_list = NULL; |
| 687 } | |
| 2313 | 688 |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
689 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
690 for (node = get_discovery_list(); node; node = g_list_next(node)) { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
691 dp = DISCOVERY_PLUGIN(node->data); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
692 if (dp && dp->cleanup) { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
693 dp->cleanup(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
694 GDK_THREADS_LEAVE(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
695 while (g_main_context_iteration(NULL, FALSE)); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
696 GDK_THREADS_ENTER(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
697 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
698 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
699 if (dp->handle) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
700 g_module_close(dp->handle); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
701 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
702 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
703 if (dp_data.discovery_list != NULL) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
704 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
705 g_list_free(dp_data.discovery_list); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
706 dp_data.discovery_list = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
707 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
708 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
709 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
710 |
| 2313 | 711 for (node = lowlevel_list; node; node = g_list_next(node)) { |
| 712 lp = LOWLEVEL_PLUGIN(node->data); | |
| 713 if (lp && lp->cleanup) { | |
| 714 lp->cleanup(); | |
| 715 GDK_THREADS_LEAVE(); | |
| 716 while (g_main_context_iteration(NULL, FALSE)); | |
| 717 GDK_THREADS_ENTER(); | |
| 718 } | |
|
2797
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
719 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
720 if (lp->handle) |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
721 g_module_close(lp->handle); |
| 2313 | 722 } |
| 723 | |
| 2623 | 724 if (lowlevel_list != NULL) |
| 725 { | |
| 2313 | 726 g_list_free(lowlevel_list); |
| 2623 | 727 lowlevel_list = NULL; |
| 728 } | |
| 729 | |
| 730 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 731 if (vfs_transports != NULL) | |
| 732 { | |
| 733 g_list_free(vfs_transports); | |
| 734 vfs_transports = NULL; | |
| 735 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
736 |
|
3437
3092a8b3fe34
Big plugin system changes (part 1 of who knows, it's still a big mess):
William Pitcock <nenolod@atheme.org>
parents:
3247
diff
changeset
|
737 mowgli_dictionary_destroy(plugin_dict, NULL, NULL); |
| 2313 | 738 } |
