Mercurial > audlegacy
annotate src/audacious/pluginenum.c @ 3687:12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
The bmp_cfg_db_* aliases will be removed later once people have done sed on
the plugins.
| author | William Pitcock <nenolod@atheme.org> |
|---|---|
| date | Tue, 02 Oct 2007 21:41:06 -0500 |
| parents | 0ba593887cae |
| children | 0ef1a18a5583 |
| 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" |
|
3685
0ba593887cae
Export VfsBufferedFile functions.
William Pitcock <nenolod@atheme.org>
parents:
3684
diff
changeset
|
56 #include "vfs_buffered_file.h" |
|
3684
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
57 |
| 2313 | 58 const gchar *plugin_dir_list[] = { |
| 59 PLUGINSUBS, | |
| 60 NULL | |
| 61 }; | |
| 62 | |
|
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
|
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 |
|
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 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
|
66 .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
|
67 .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
|
68 .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
|
69 .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
|
70 .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
|
71 .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
|
72 .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
|
73 .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
|
74 .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
|
75 .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
|
76 .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
|
77 .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
|
78 .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
|
79 .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
|
80 .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
|
81 .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
|
82 .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
|
83 .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
|
84 .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
|
85 .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
|
86 .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
|
87 .vfs_is_streaming = vfs_is_streaming, |
|
3684
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
88 |
|
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
89 .vfs_buffer_new = vfs_buffer_new, |
|
2f9d8b987e40
Export VfsBuffer functions.
William Pitcock <nenolod@atheme.org>
parents:
3683
diff
changeset
|
90 .vfs_buffer_new_from_string = vfs_buffer_new_from_string, |
|
3685
0ba593887cae
Export VfsBufferedFile functions.
William Pitcock <nenolod@atheme.org>
parents:
3684
diff
changeset
|
91 |
|
0ba593887cae
Export VfsBufferedFile functions.
William Pitcock <nenolod@atheme.org>
parents:
3684
diff
changeset
|
92 .vfs_buffered_file_new_from_uri = vfs_buffered_file_new_from_uri, |
|
0ba593887cae
Export VfsBufferedFile functions.
William Pitcock <nenolod@atheme.org>
parents:
3684
diff
changeset
|
93 .vfs_buffered_file_release_live_fd = vfs_buffered_file_release_live_fd, |
|
3687
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
94 |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
95 .cfg_db_open = cfg_db_open, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
96 .cfg_db_close = cfg_db_close, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
97 |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
98 .cfg_db_get_string = cfg_db_get_string, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
99 .cfg_db_get_int = cfg_db_get_int, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
100 .cfg_db_get_bool = cfg_db_get_bool, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
101 .cfg_db_get_float = cfg_db_get_float, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
102 .cfg_db_get_double = cfg_db_get_double, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
103 |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
104 .cfg_db_set_string = cfg_db_set_string, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
105 .cfg_db_set_int = cfg_db_set_int, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
106 .cfg_db_set_bool = cfg_db_set_bool, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
107 .cfg_db_set_float = cfg_db_set_float, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
108 .cfg_db_set_double = cfg_db_set_double, |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
109 |
|
12e11b15b549
Export ConfigDB API via vtable, adding public aliases: bmp_cfg_db_*, aud_cfg_db_*.
William Pitcock <nenolod@atheme.org>
parents:
3685
diff
changeset
|
110 .cfg_db_unset_key = cfg_db_unset_key, |
| 3683 | 111 }; |
|
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
|
112 |
|
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
|
113 /*****************************************************************/ |
|
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
|
114 |
| 2313 | 115 GList *lowlevel_list = NULL; |
| 2623 | 116 extern GList *vfs_transports; |
| 117 | |
|
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
|
118 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
|
119 |
| 2313 | 120 static gint |
| 121 inputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 122 { | |
| 123 const InputPlugin *ap = a, *bp = b; | |
| 2804 | 124 if(ap->description && bp->description) |
| 125 return strcasecmp(ap->description, bp->description); | |
| 126 else | |
| 127 return 0; | |
| 2313 | 128 } |
| 129 | |
| 130 static gint | |
| 131 outputlist_compare_func(gconstpointer a, gconstpointer b) | |
| 132 { | |
| 133 const OutputPlugin *ap = a, *bp = b; | |
| 2804 | 134 if(ap->description && bp->description) |
| 135 return strcasecmp(ap->description, bp->description); | |
| 136 else | |
| 137 return 0; | |
| 2313 | 138 } |
| 139 | |
| 140 static gint | |
| 141 effectlist_compare_func(gconstpointer a, gconstpointer b) | |
| 142 { | |
| 143 const EffectPlugin *ap = a, *bp = b; | |
| 2804 | 144 if(ap->description && bp->description) |
| 145 return strcasecmp(ap->description, bp->description); | |
| 146 else | |
| 147 return 0; | |
| 2313 | 148 } |
| 149 | |
| 150 static gint | |
| 151 generallist_compare_func(gconstpointer a, gconstpointer b) | |
| 152 { | |
| 153 const GeneralPlugin *ap = a, *bp = b; | |
| 2804 | 154 if(ap->description && bp->description) |
| 155 return strcasecmp(ap->description, bp->description); | |
| 156 else | |
| 157 return 0; | |
| 2313 | 158 } |
| 159 | |
| 160 static gint | |
| 161 vislist_compare_func(gconstpointer a, gconstpointer b) | |
| 162 { | |
| 163 const VisPlugin *ap = a, *bp = b; | |
| 2804 | 164 if(ap->description && bp->description) |
| 165 return strcasecmp(ap->description, bp->description); | |
| 166 else | |
| 167 return 0; | |
| 2313 | 168 } |
| 169 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
170 static gint |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
171 discoverylist_compare_func(gconstpointer a, gconstpointer b) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
172 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
173 const DiscoveryPlugin *ap = a, *bp = b; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
174 if(ap->description && bp->description) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
175 return strcasecmp(ap->description, bp->description); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
176 else |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
177 return 0; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
178 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
179 |
| 2313 | 180 static gboolean |
| 181 plugin_is_duplicate(const gchar * filename) | |
| 182 { | |
|
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
|
183 gchar *base_filename = g_path_get_basename(filename); |
| 2313 | 184 |
|
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
|
185 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
|
186 { |
|
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 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
|
188 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
|
189 } |
| 2313 | 190 |
|
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
|
191 g_free(base_filename); |
| 2313 | 192 |
| 193 return FALSE; | |
| 194 } | |
| 195 | |
|
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
|
196 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
|
197 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
|
198 { |
|
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 Plugin *plugin = mowgli_dictionary_retrieve(plugin_dict, filename); |
| 2313 | 200 |
|
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
|
201 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
|
202 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
|
203 |
|
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
|
204 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
|
205 } |
|
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
|
206 |
|
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
|
207 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
|
208 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
|
209 { |
|
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
|
210 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
|
211 |
|
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
|
212 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
|
213 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
|
214 |
|
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
|
215 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
|
216 } |
|
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
|
217 |
|
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
|
218 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
|
219 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
|
220 { |
|
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 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
|
222 } |
| 2313 | 223 |
| 224 static void | |
| 225 input_plugin_init(Plugin * plugin) | |
| 226 { | |
| 227 InputPlugin *p = INPUT_PLUGIN(plugin); | |
| 228 | |
| 229 p->get_vis_type = input_get_vis_type; | |
| 230 p->add_vis_pcm = input_add_vis_pcm; | |
| 231 | |
| 232 /* Pretty const casts courtesy of XMMS's plugin.h legacy. Anyone | |
| 233 else thinks we could use a CONST macro to solve the warnings? | |
| 234 - descender */ | |
| 235 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
|
236 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
|
237 p->set_status_buffering = input_set_status_buffering; |
| 2313 | 238 |
| 239 ip_data.input_list = g_list_append(ip_data.input_list, p); | |
| 240 | |
|
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 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
|
242 |
|
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
|
243 /* 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
|
244 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
|
245 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 246 } |
| 247 | |
| 248 static void | |
| 249 output_plugin_init(Plugin * plugin) | |
| 250 { | |
| 251 OutputPlugin *p = OUTPUT_PLUGIN(plugin); | |
| 252 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
|
253 |
|
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
|
254 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 255 } |
| 256 | |
| 257 static void | |
| 258 effect_plugin_init(Plugin * plugin) | |
| 259 { | |
| 260 EffectPlugin *p = EFFECT_PLUGIN(plugin); | |
| 261 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
|
262 |
|
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
|
263 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 264 } |
| 265 | |
| 266 static void | |
| 267 general_plugin_init(Plugin * plugin) | |
| 268 { | |
| 269 GeneralPlugin *p = GENERAL_PLUGIN(plugin); | |
| 270 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
|
271 |
|
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
|
272 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 273 } |
| 274 | |
| 275 static void | |
| 276 vis_plugin_init(Plugin * plugin) | |
| 277 { | |
| 278 VisPlugin *p = VIS_PLUGIN(plugin); | |
| 279 p->disable_plugin = vis_disable_plugin; | |
| 280 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
|
281 |
|
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
|
282 mowgli_dictionary_add(plugin_dict, g_basename(p->filename), p); |
| 2313 | 283 } |
| 284 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
285 static void |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
286 discovery_plugin_init(Plugin * plugin) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
287 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
288 DiscoveryPlugin *p = DISCOVERY_PLUGIN(plugin); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
289 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
|
290 |
|
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
|
291 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
|
292 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
293 |
|
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
|
294 /*******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
295 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
297 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
|
298 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
300 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
|
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 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
|
303 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
|
304 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
|
305 |
|
3247
e21930ccd5a8
remove old debugging notices that aren't very relevant anymore.
William Pitcock <nenolod@atheme-project.org>
parents:
3232
diff
changeset
|
306 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
|
307 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
|
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 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
311 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
|
312 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
313 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
|
314 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
|
315 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
|
316 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
|
317 VisPlugin **vp_iter; |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
318 DiscoveryPlugin **dp_iter; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
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 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
|
321 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
|
322 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 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
|
324 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
|
325 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
|
326 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
327 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
|
328 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
|
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 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
|
331 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
|
332 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
|
333 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
334 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
|
335 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
336 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
|
337 { |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
338 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
|
339 input_plugin_init(PLUGIN(*ip_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
340 } |
|
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 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
342 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
343 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
|
344 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
345 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
|
346 { |
| 2801 | 347 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
|
348 output_plugin_init(PLUGIN(*op_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
349 } |
|
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 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
351 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
352 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
|
353 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
354 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
|
355 { |
| 2801 | 356 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
|
357 effect_plugin_init(PLUGIN(*ep_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
358 } |
|
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
|
359 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
360 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
361 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
|
362 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
363 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
|
364 { |
| 2801 | 365 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
|
366 general_plugin_init(PLUGIN(*gp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
367 } |
|
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
|
368 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
370 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
|
371 { |
|
2799
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
372 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
|
373 { |
| 2801 | 374 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
|
375 vis_plugin_init(PLUGIN(*vp_iter)); |
|
febdfe7a482b
[svn] - improve plugin2 loader's robustness (e.g. make it not crash)
nenolod
parents:
2798
diff
changeset
|
376 } |
|
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
|
377 } |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
378 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
379 if (header->dp_list) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
380 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
381 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
|
382 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
383 PLUGIN(*dp_iter)->filename = g_strdup(filename); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
384 discovery_plugin_init(PLUGIN(*dp_iter)); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
385 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
386 } |
|
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
|
387 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
388 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
389 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
|
390 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
|
391 { |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
392 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
|
393 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
394 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
|
395 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
396 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
|
397 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
398 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
|
399 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
|
400 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
401 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
|
402 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
|
403 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
404 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
|
405 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 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 /******************************************************************/ |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
408 |
| 2313 | 409 static void |
| 410 add_plugin(const gchar * filename) | |
| 411 { | |
| 412 GModule *module; | |
| 413 gpointer func; | |
| 414 | |
| 415 if (plugin_is_duplicate(filename)) | |
| 416 return; | |
| 417 | |
| 2623 | 418 g_message("Loaded plugin (%s)", filename); |
| 419 | |
| 2313 | 420 if (!(module = g_module_open(filename, G_MODULE_BIND_LOCAL))) { |
| 421 printf("Failed to load plugin (%s): %s\n", | |
| 422 filename, g_module_error()); | |
| 423 return; | |
| 424 } | |
| 425 | |
|
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
|
426 /* 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
|
427 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
|
428 { |
|
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
|
429 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
|
430 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
|
431 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
432 /* 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
|
433 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
|
434 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
435 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
|
436 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
|
437 } |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
438 |
| 2313 | 439 printf("Invalid plugin (%s)\n", filename); |
| 440 g_module_close(module); | |
| 441 } | |
| 442 | |
| 443 static gboolean | |
| 444 scan_plugin_func(const gchar * path, const gchar * basename, gpointer data) | |
| 445 { | |
| 446 if (!str_has_suffix_nocase(basename, SHARED_SUFFIX)) | |
| 447 return FALSE; | |
| 448 | |
| 449 if (!g_file_test(path, G_FILE_TEST_IS_REGULAR)) | |
| 450 return FALSE; | |
| 451 | |
| 452 add_plugin(path); | |
| 453 | |
| 454 return FALSE; | |
| 455 } | |
| 456 | |
| 457 static void | |
| 458 scan_plugins(const gchar * path) | |
| 459 { | |
| 460 dir_foreach(path, scan_plugin_func, NULL, NULL); | |
| 461 } | |
| 462 | |
| 463 void | |
| 464 plugin_system_init(void) | |
| 465 { | |
| 466 gchar *dir, **disabled; | |
| 467 GList *node; | |
| 468 OutputPlugin *op; | |
| 469 InputPlugin *ip; | |
| 470 LowlevelPlugin *lp; | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
471 DiscoveryPlugin *dp; |
| 2313 | 472 gint dirsel = 0, i = 0; |
| 473 | |
| 474 if (!g_module_supported()) { | |
| 475 report_error("Module loading not supported! Plugins will not be loaded.\n"); | |
| 476 return; | |
| 477 } | |
| 478 | |
|
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
|
479 plugin_dict = mowgli_dictionary_create(g_ascii_strcasecmp); |
| 2313 | 480 |
| 481 #ifndef DISABLE_USER_PLUGIN_DIR | |
| 482 scan_plugins(bmp_paths[BMP_PATH_USER_PLUGIN_DIR]); | |
| 483 /* | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
484 * This is in a separate lo |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
485 * DiscoveryPlugin *dpop so if the user puts them in the |
| 2313 | 486 * wrong dir we'll still get them in the right order (home dir |
| 487 * first) - Zinx | |
| 488 */ | |
| 489 while (plugin_dir_list[dirsel]) { | |
| 490 dir = g_build_filename(bmp_paths[BMP_PATH_USER_PLUGIN_DIR], | |
| 491 plugin_dir_list[dirsel++], NULL); | |
| 492 scan_plugins(dir); | |
| 493 g_free(dir); | |
| 494 } | |
| 495 dirsel = 0; | |
| 496 #endif | |
| 497 | |
| 498 while (plugin_dir_list[dirsel]) { | |
| 499 dir = g_build_filename(PLUGIN_DIR, plugin_dir_list[dirsel++], NULL); | |
| 500 scan_plugins(dir); | |
| 501 g_free(dir); | |
| 502 } | |
| 503 | |
| 504 op_data.output_list = g_list_sort(op_data.output_list, outputlist_compare_func); | |
| 505 if (!op_data.current_output_plugin | |
| 506 && g_list_length(op_data.output_list)) { | |
| 507 op_data.current_output_plugin = op_data.output_list->data; | |
| 508 } | |
| 509 | |
| 510 ip_data.input_list = g_list_sort(ip_data.input_list, inputlist_compare_func); | |
| 511 | |
| 512 ep_data.effect_list = g_list_sort(ep_data.effect_list, effectlist_compare_func); | |
| 513 ep_data.enabled_list = NULL; | |
| 514 | |
| 515 gp_data.general_list = g_list_sort(gp_data.general_list, generallist_compare_func); | |
| 516 gp_data.enabled_list = NULL; | |
| 517 | |
| 518 vp_data.vis_list = g_list_sort(vp_data.vis_list, vislist_compare_func); | |
| 519 vp_data.enabled_list = NULL; | |
| 520 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
521 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
|
522 dp_data.enabled_list = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
523 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
524 |
| 2313 | 525 general_enable_from_stringified_list(cfg.enabled_gplugins); |
| 526 vis_enable_from_stringified_list(cfg.enabled_vplugins); | |
| 527 effect_enable_from_stringified_list(cfg.enabled_eplugins); | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
528 discovery_enable_from_stringified_list(cfg.enabled_dplugins); |
| 2313 | 529 |
| 530 g_free(cfg.enabled_gplugins); | |
| 531 cfg.enabled_gplugins = NULL; | |
| 532 | |
| 533 g_free(cfg.enabled_vplugins); | |
| 534 cfg.enabled_vplugins = NULL; | |
| 535 | |
| 536 g_free(cfg.enabled_eplugins); | |
| 537 cfg.enabled_eplugins = NULL; | |
| 538 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
539 g_free(cfg.enabled_dplugins); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
540 cfg.enabled_dplugins = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
541 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
542 |
| 2313 | 543 for (node = op_data.output_list; node; node = g_list_next(node)) { |
| 544 op = OUTPUT_PLUGIN(node->data); | |
| 545 /* | |
| 546 * Only test basename to avoid problems when changing | |
| 547 * prefix. We will only see one plugin with the same | |
| 548 * basename, so this is usually what the user want. | |
| 549 */ | |
|
3631
6aea4fb32ef4
Missing NULL-pointer checks are bad, mkay?
Jonathan Schleifer <js@h3c.de>
parents:
3454
diff
changeset
|
550 if (cfg.outputplugin && !strcmp(g_basename(cfg.outputplugin), g_basename(op->filename))) |
| 2313 | 551 op_data.current_output_plugin = op; |
| 552 if (op->init) | |
| 553 op->init(); | |
| 554 } | |
| 555 | |
| 556 for (node = ip_data.input_list; node; node = g_list_next(node)) { | |
| 557 ip = INPUT_PLUGIN(node->data); | |
| 558 if (ip->init) | |
| 559 ip->init(); | |
| 560 } | |
| 561 | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
562 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
|
563 dp = DISCOVERY_PLUGIN(node->data); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
564 if (dp->init) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
565 dp->init(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
566 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
567 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
568 |
| 2313 | 569 for (node = lowlevel_list; node; node = g_list_next(node)) { |
| 570 lp = LOWLEVEL_PLUGIN(node->data); | |
| 571 if (lp->init) | |
| 572 lp->init(); | |
| 573 } | |
| 574 | |
| 575 if (cfg.disabled_iplugins) { | |
| 576 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
|
577 |
| 2313 | 578 while (disabled[i]) { |
|
3454
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
579 Plugin *plugintmp = plugin_get_plugin(disabled[i]); |
|
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
580 if (plugintmp) |
|
c0eb377bb4e5
Check pointer to prevent NULL dereference.
Matti Hamalainen <ccr@tnsp.org>
parents:
3438
diff
changeset
|
581 INPUT_PLUGIN(plugintmp)->enabled = FALSE; |
| 2313 | 582 i++; |
| 583 } | |
| 584 | |
| 585 g_free(disabled); | |
| 586 | |
| 587 g_free(cfg.disabled_iplugins); | |
| 588 cfg.disabled_iplugins = NULL; | |
| 589 } | |
| 590 } | |
| 591 | |
| 592 void | |
| 593 plugin_system_cleanup(void) | |
| 594 { | |
| 595 InputPlugin *ip; | |
| 596 OutputPlugin *op; | |
| 597 EffectPlugin *ep; | |
| 598 GeneralPlugin *gp; | |
| 599 VisPlugin *vp; | |
| 600 LowlevelPlugin *lp; | |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
601 DiscoveryPlugin *dp; |
| 2313 | 602 GList *node; |
| 603 | |
| 604 g_message("Shutting down plugin system"); | |
| 605 | |
| 606 if (playback_get_playing()) { | |
| 607 ip_data.stop = TRUE; | |
| 608 playback_stop(); | |
| 609 ip_data.stop = FALSE; | |
| 610 } | |
| 611 | |
| 2623 | 612 /* FIXME: race condition -nenolod */ |
| 613 op_data.current_output_plugin = NULL; | |
| 614 | |
| 2313 | 615 for (node = get_input_list(); node; node = g_list_next(node)) { |
| 616 ip = INPUT_PLUGIN(node->data); | |
| 617 if (ip && ip->cleanup) { | |
| 618 ip->cleanup(); | |
| 619 GDK_THREADS_LEAVE(); | |
| 620 while (g_main_context_iteration(NULL, FALSE)); | |
| 621 GDK_THREADS_ENTER(); | |
| 622 } | |
|
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
|
623 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
624 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
|
625 g_module_close(ip->handle); |
| 2313 | 626 } |
| 627 | |
| 2623 | 628 if (ip_data.input_list != NULL) |
| 629 { | |
| 2313 | 630 g_list_free(ip_data.input_list); |
| 2623 | 631 ip_data.input_list = NULL; |
| 632 } | |
| 2313 | 633 |
| 634 for (node = get_output_list(); node; node = g_list_next(node)) { | |
| 635 op = OUTPUT_PLUGIN(node->data); | |
| 636 if (op && op->cleanup) { | |
| 637 op->cleanup(); | |
| 638 GDK_THREADS_LEAVE(); | |
| 639 while (g_main_context_iteration(NULL, FALSE)); | |
| 640 GDK_THREADS_ENTER(); | |
| 641 } | |
|
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
|
642 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
643 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
|
644 g_module_close(op->handle); |
| 2313 | 645 } |
| 646 | |
| 2623 | 647 if (op_data.output_list != NULL) |
| 648 { | |
| 2313 | 649 g_list_free(op_data.output_list); |
| 2623 | 650 op_data.output_list = NULL; |
| 651 } | |
| 2313 | 652 |
| 653 for (node = get_effect_list(); node; node = g_list_next(node)) { | |
| 654 ep = EFFECT_PLUGIN(node->data); | |
| 655 if (ep && ep->cleanup) { | |
| 656 ep->cleanup(); | |
| 657 GDK_THREADS_LEAVE(); | |
| 658 while (g_main_context_iteration(NULL, FALSE)); | |
| 659 GDK_THREADS_ENTER(); | |
| 660 } | |
|
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
|
661 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
662 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
|
663 g_module_close(ep->handle); |
| 2313 | 664 } |
| 665 | |
| 2623 | 666 if (ep_data.effect_list != NULL) |
| 667 { | |
| 2313 | 668 g_list_free(ep_data.effect_list); |
| 2623 | 669 ep_data.effect_list = NULL; |
| 2313 | 670 } |
| 671 | |
| 672 for (node = get_general_list(); node; node = g_list_next(node)) { | |
| 673 gp = GENERAL_PLUGIN(node->data); | |
| 674 if (gp && gp->cleanup) { | |
| 675 gp->cleanup(); | |
| 676 GDK_THREADS_LEAVE(); | |
| 677 while (g_main_context_iteration(NULL, FALSE)); | |
| 678 GDK_THREADS_ENTER(); | |
| 679 } | |
|
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
|
680 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
681 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
|
682 g_module_close(gp->handle); |
| 2313 | 683 } |
| 684 | |
| 2623 | 685 if (gp_data.general_list != NULL) |
| 686 { | |
| 2313 | 687 g_list_free(gp_data.general_list); |
| 2623 | 688 gp_data.general_list = NULL; |
| 2313 | 689 } |
| 690 | |
| 691 for (node = get_vis_list(); node; node = g_list_next(node)) { | |
| 692 vp = VIS_PLUGIN(node->data); | |
| 693 if (vp && vp->cleanup) { | |
| 694 vp->cleanup(); | |
| 695 GDK_THREADS_LEAVE(); | |
| 696 while (g_main_context_iteration(NULL, FALSE)); | |
| 697 GDK_THREADS_ENTER(); | |
| 698 } | |
|
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
|
699 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
700 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
|
701 g_module_close(vp->handle); |
| 2313 | 702 } |
| 703 | |
| 2623 | 704 if (vp_data.vis_list != NULL) |
| 705 { | |
| 2313 | 706 g_list_free(vp_data.vis_list); |
| 2623 | 707 vp_data.vis_list = NULL; |
| 708 } | |
| 2313 | 709 |
|
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
710 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
711 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
|
712 dp = DISCOVERY_PLUGIN(node->data); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
713 if (dp && dp->cleanup) { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
714 dp->cleanup(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
715 GDK_THREADS_LEAVE(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
716 while (g_main_context_iteration(NULL, FALSE)); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
717 GDK_THREADS_ENTER(); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
718 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
719 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
720 if (dp->handle) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
721 g_module_close(dp->handle); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
722 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
723 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
724 if (dp_data.discovery_list != NULL) |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
725 { |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
726 g_list_free(dp_data.discovery_list); |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
727 dp_data.discovery_list = NULL; |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
728 } |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
729 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
730 |
|
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3165
diff
changeset
|
731 |
| 2313 | 732 for (node = lowlevel_list; node; node = g_list_next(node)) { |
| 733 lp = LOWLEVEL_PLUGIN(node->data); | |
| 734 if (lp && lp->cleanup) { | |
| 735 lp->cleanup(); | |
| 736 GDK_THREADS_LEAVE(); | |
| 737 while (g_main_context_iteration(NULL, FALSE)); | |
| 738 GDK_THREADS_ENTER(); | |
| 739 } | |
|
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
|
740 |
|
f0c1c8b22c88
[svn] - first attempt at an plugin API2 loader. this is entirely implemented inside the plugin2 namespace, so please respect that if you go editing this ;p
nenolod
parents:
2795
diff
changeset
|
741 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
|
742 g_module_close(lp->handle); |
| 2313 | 743 } |
| 744 | |
| 2623 | 745 if (lowlevel_list != NULL) |
| 746 { | |
| 2313 | 747 g_list_free(lowlevel_list); |
| 2623 | 748 lowlevel_list = NULL; |
| 749 } | |
| 750 | |
| 751 /* XXX: vfs will crash otherwise. -nenolod */ | |
| 752 if (vfs_transports != NULL) | |
| 753 { | |
| 754 g_list_free(vfs_transports); | |
| 755 vfs_transports = NULL; | |
| 756 } | |
|
2682
c3cd6e47faf6
[svn] - make the evil 'reload plugins' button behave a bit better
giacomo
parents:
2624
diff
changeset
|
757 |
|
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
|
758 mowgli_dictionary_destroy(plugin_dict, NULL, NULL); |
| 2313 | 759 } |
