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