Mercurial > audlegacy
annotate src/audacious/plugin.h @ 3227:2619f4c62abe trunk
added Discovery plugin type
author | Cristi Magherusan <majeru@atheme-project.org> |
---|---|
date | Fri, 03 Aug 2007 07:20:58 +0300 |
parents | 1596dcb77acd |
children | 2453bf125b4f |
rev | line source |
---|---|
2313 | 1 /* Audacious |
2 * Copyright (C) 2005-2007 Audacious team. | |
3 * | |
4 * BMP - Cross-platform multimedia player | |
5 * Copyright (C) 2003-2004 BMP development team. | |
6 * | |
7 * Based on XMMS: | |
8 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies | |
9 * | |
10 * Redistribution and use in source and binary forms, with or without | |
11 * modification, are permitted provided that the following conditions are | |
12 * met: | |
13 * | |
14 * 1. Redistributions of source code must retain the above copyright | |
15 * notice, this list of conditions and the following disclaimer. | |
16 * | |
17 * 2. Redistributions in binary form must reproduce the above copyright | |
18 * notice, this list of conditions and the following disclaimer in | |
19 * the documentation and/or other materials provided with the | |
20 * distribution. | |
21 * | |
22 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY | |
23 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | |
24 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | |
25 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR | |
26 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | |
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
28 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | |
29 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
32 * SUCH DAMAGE. | |
33 */ | |
34 | |
35 #ifndef BMP_PLUGIN_H | |
36 #define BMP_PLUGIN_H | |
37 | |
38 #include <glib.h> | |
39 #include "audacious/vfs.h" | |
40 #include "audacious/titlestring.h" | |
3149
84c44d369969
Add eventqueue interface.
William Pitcock <nenolod@atheme-project.org>
parents:
3126
diff
changeset
|
41 #include "audacious/eventqueue.h" |
2313 | 42 |
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:
2796
diff
changeset
|
43 #define PLUGIN(x) ((Plugin *)(x)) |
2313 | 44 #define INPUT_PLUGIN(x) ((InputPlugin *)(x)) |
45 #define OUTPUT_PLUGIN(x) ((OutputPlugin *)(x)) | |
46 #define EFFECT_PLUGIN(x) ((EffectPlugin *)(x)) | |
47 #define GENERAL_PLUGIN(x) ((GeneralPlugin *)(x)) | |
48 #define VIS_PLUGIN(x) ((VisPlugin *)(x)) | |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
49 #define DISCOVERY_PLUGIN(x) ((DiscoveryPlugin *)(x)) |
2313 | 50 |
51 #define LOWLEVEL_PLUGIN(x) ((LowlevelPlugin *)(x)) | |
52 | |
53 #define __AUDACIOUS_NEWVFS__ | |
3160
03ff51c6412f
__AUDACIOUS_PLUGIN_API__ is now 3.
William Pitcock <nenolod@atheme-project.org>
parents:
3149
diff
changeset
|
54 #define __AUDACIOUS_PLUGIN_API__ 3 |
03ff51c6412f
__AUDACIOUS_PLUGIN_API__ is now 3.
William Pitcock <nenolod@atheme-project.org>
parents:
3149
diff
changeset
|
55 #define __AUDACIOUS_INPUT_PLUGIN_API__ 4 |
2313 | 56 |
57 typedef enum { | |
58 FMT_U8, | |
59 FMT_S8, | |
60 FMT_U16_LE, | |
61 FMT_U16_BE, | |
62 FMT_U16_NE, | |
63 FMT_S16_LE, | |
64 FMT_S16_BE, | |
65 FMT_S16_NE | |
66 } AFormat; | |
67 | |
68 typedef enum { | |
69 INPUT_VIS_ANALYZER, | |
70 INPUT_VIS_SCOPE, | |
71 INPUT_VIS_VU, | |
72 INPUT_VIS_OFF | |
73 } InputVisType; | |
74 | |
75 | |
76 typedef struct _Plugin Plugin; | |
77 typedef struct _InputPlugin InputPlugin; | |
78 typedef struct _OutputPlugin OutputPlugin; | |
79 typedef struct _EffectPlugin EffectPlugin; | |
80 typedef struct _GeneralPlugin GeneralPlugin; | |
81 typedef struct _VisPlugin VisPlugin; | |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
82 typedef struct _DiscoveryPlugin DiscoveryPlugin; |
2313 | 83 typedef struct _LowlevelPlugin LowlevelPlugin; |
84 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
85 typedef struct _InputPlayback InputPlayback; |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
86 |
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
87 /* |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
88 * The v2 Module header. |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
89 * |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
90 * _list fields contain a null-terminated list of "plugins" to register. |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
91 * A single library can provide multiple plugins. |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
92 * --nenolod |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
93 */ |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
94 typedef struct { |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
95 gint magic; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
96 gint api_version; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
97 gchar *name; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
98 GCallback init; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
99 GCallback fini; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
100 Plugin *priv_assoc; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
101 InputPlugin **ip_list; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
102 OutputPlugin **op_list; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
103 EffectPlugin **ep_list; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
104 GeneralPlugin **gp_list; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
105 VisPlugin **vp_list; |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
106 DiscoveryPlugin **dp_list; |
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
107 } PluginHeader; |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
108 |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
109 #define PLUGIN_MAGIC 0x8EAC8DE2 |
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
110 |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
111 #define DECLARE_PLUGIN(name, init, fini, ip_list, op_list, ep_list, gp_list, vp_list, dp_list) \ |
2802
c799098c396f
[svn] - guard v2 module header with G_BEGIN_DECLS and G_END_DECLS
nenolod
parents:
2797
diff
changeset
|
112 G_BEGIN_DECLS \ |
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
113 static PluginHeader _pluginInfo = { PLUGIN_MAGIC, __AUDACIOUS_PLUGIN_API__, \ |
2841
b2fb6a4e02b8
add a cast to DECLARE_PLUGIN() to suppress warnings.
Yoshiki Yazawa <yaz@cc.rim.or.jp>
parents:
2802
diff
changeset
|
114 (gchar *)#name, init, fini, NULL, ip_list, op_list, ep_list, gp_list, \ |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
115 vp_list,dp_list }; \ |
3061
7d858d2b4031
Use G_MODULE_EXPORT to ensure the plugin header is exported.
William Pitcock <nenolod@atheme-project.org>
parents:
3009
diff
changeset
|
116 G_MODULE_EXPORT PluginHeader *get_plugin_info(void) { \ |
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
117 return &_pluginInfo; \ |
2802
c799098c396f
[svn] - guard v2 module header with G_BEGIN_DECLS and G_END_DECLS
nenolod
parents:
2797
diff
changeset
|
118 } \ |
c799098c396f
[svn] - guard v2 module header with G_BEGIN_DECLS and G_END_DECLS
nenolod
parents:
2797
diff
changeset
|
119 G_END_DECLS |
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
120 |
2313 | 121 /* Sadly, this is the most we can generalize out of the disparate |
122 plugin structs usable with typecasts - descender */ | |
123 struct _Plugin { | |
124 gpointer handle; | |
125 gchar *filename; | |
2794
2685fc11cd9a
[svn] - begin work on the host side of plugin API v2.
nenolod
parents:
2763
diff
changeset
|
126 gchar *description; |
2313 | 127 }; |
128 | |
129 /* | |
130 * LowlevelPlugin is used for lowlevel system services, such as PlaylistContainers, | |
131 * VFSContainers and the like. | |
132 * | |
133 * They are not GUI visible at this time. | |
134 */ | |
135 struct _LowlevelPlugin { | |
136 gpointer handle; | |
137 gchar *filename; | |
138 | |
139 gchar *description; | |
140 | |
141 void (*init) (void); | |
142 void (*cleanup) (void); | |
143 }; | |
144 | |
145 struct _OutputPlugin { | |
146 gpointer handle; | |
147 gchar *filename; | |
148 | |
149 gchar *description; | |
150 | |
151 void (*init) (void); | |
152 void (*cleanup) (void); | |
153 void (*about) (void); | |
154 void (*configure) (void); | |
155 void (*get_volume) (gint * l, gint * r); | |
156 void (*set_volume) (gint l, gint r); | |
157 | |
158 gint (*open_audio) (AFormat fmt, gint rate, gint nch); | |
159 void (*write_audio) (gpointer ptr, gint length); | |
160 void (*close_audio) (void); | |
161 | |
162 void (*flush) (gint time); | |
163 void (*pause) (gshort paused); | |
164 gint (*buffer_free) (void); | |
165 gint (*buffer_playing) (void); | |
166 gint (*output_time) (void); | |
167 gint (*written_time) (void); | |
168 | |
169 void (*tell_audio) (AFormat * fmt, gint * rate, gint * nch); | |
170 }; | |
171 | |
172 struct _EffectPlugin { | |
173 gpointer handle; | |
174 gchar *filename; | |
175 | |
176 gchar *description; | |
177 | |
178 void (*init) (void); | |
179 void (*cleanup) (void); | |
180 void (*about) (void); | |
181 void (*configure) (void); | |
182 | |
183 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch); | |
184 void (*query_format) (AFormat * fmt, gint * rate, gint * nch); | |
185 }; | |
186 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
187 struct _InputPlayback { |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
188 gchar *filename; |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
189 InputPlugin *plugin; |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
190 void *data; |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
191 OutputPlugin *output; |
2438
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
192 |
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
193 int playing; |
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
194 gboolean error; |
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
195 gboolean eof; |
3181
1596dcb77acd
Track playback monitor thread in InputPlayback.thread.
William Pitcock <nenolod@atheme-project.org>
parents:
3160
diff
changeset
|
196 |
1596dcb77acd
Track playback monitor thread in InputPlayback.thread.
William Pitcock <nenolod@atheme-project.org>
parents:
3160
diff
changeset
|
197 GThread *thread; |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
198 }; |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
199 |
2313 | 200 struct _InputPlugin { |
201 gpointer handle; | |
202 gchar *filename; | |
203 | |
204 gchar *description; | |
205 | |
206 void (*init) (void); | |
207 void (*about) (void); | |
208 void (*configure) (void); | |
209 | |
210 gint (*is_our_file) (gchar * filename); | |
211 GList *(*scan_dir) (gchar * dirname); | |
212 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
213 void (*play_file) (InputPlayback * playback); |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
214 void (*stop) (InputPlayback * playback); |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
215 void (*pause) (InputPlayback * playback, gshort paused); |
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
216 void (*seek) (InputPlayback * playback, gint time); |
2313 | 217 |
218 void (*set_eq) (gint on, gfloat preamp, gfloat * bands); | |
219 | |
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
220 gint (*get_time) (InputPlayback * playback); |
2313 | 221 |
2437 | 222 gint (*get_volume) (gint * l, gint * r); |
223 gint (*set_volume) (gint l, gint r); | |
2313 | 224 |
225 void (*cleanup) (void); | |
226 | |
227 InputVisType (*get_vis_type) (void); | |
228 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr); | |
229 | |
230 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch); | |
231 void (*set_info_text) (gchar * text); | |
232 void (*get_song_info) (gchar * filename, gchar ** title, gint * length); | |
233 void (*file_info_box) (gchar * filename); | |
234 | |
2437 | 235 OutputPlugin *output; /* deprecated */ |
2313 | 236 |
237 /* Added in Audacious 1.1.0 */ | |
238 TitleInput *(*get_song_tuple) (gchar * filename); | |
239 void (*set_song_tuple) (TitleInput * tuple); | |
240 void (*set_status_buffering) (gboolean status); | |
241 | |
242 /* Added in Audacious 1.3.0 */ | |
243 gint (*is_our_file_from_vfs) (gchar *filename, VFSFile *fd); | |
244 gchar **vfs_extensions; | |
2620
6393862824e5
[svn] - add millisecond seek function to InputPlugin API. with this function, cuesheet and encoder plugins can achieve higher accuracy.
yaz
parents:
2473
diff
changeset
|
245 |
6393862824e5
[svn] - add millisecond seek function to InputPlugin API. with this function, cuesheet and encoder plugins can achieve higher accuracy.
yaz
parents:
2473
diff
changeset
|
246 /* Added in Audacious 1.4.0 */ |
6393862824e5
[svn] - add millisecond seek function to InputPlugin API. with this function, cuesheet and encoder plugins can achieve higher accuracy.
yaz
parents:
2473
diff
changeset
|
247 void (*mseek) (InputPlayback * playback, gulong millisecond); |
3126
ce5c6a5d64e2
Add new probe_for_tuple() function. Replaces all old probing interfaces.
William Pitcock <nenolod@atheme-project.org>
parents:
3092
diff
changeset
|
248 TitleInput *(*probe_for_tuple)(gchar *uri, VFSFile *fd); |
2313 | 249 }; |
250 | |
251 struct _GeneralPlugin { | |
252 gpointer handle; | |
253 gchar *filename; | |
254 | |
255 gchar *description; | |
256 | |
257 void (*init) (void); | |
258 void (*about) (void); | |
259 void (*configure) (void); | |
260 void (*cleanup) (void); | |
261 }; | |
262 | |
263 struct _VisPlugin { | |
264 gpointer handle; | |
265 gchar *filename; | |
266 | |
267 gchar *description; | |
268 | |
269 gint num_pcm_chs_wanted; | |
270 gint num_freq_chs_wanted; | |
271 | |
272 void (*init) (void); | |
273 void (*cleanup) (void); | |
274 void (*about) (void); | |
275 void (*configure) (void); | |
276 void (*disable_plugin) (struct _VisPlugin *); | |
277 void (*playback_start) (void); | |
278 void (*playback_stop) (void); | |
279 void (*render_pcm) (gint16 pcm_data[2][512]); | |
280 void (*render_freq) (gint16 freq_data[2][256]); | |
281 }; | |
282 | |
3227
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
283 struct _DiscoveryPlugin { |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
284 gpointer handle; |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
285 gchar *filename; |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
286 gchar *description; |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
287 |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
288 void (*init) (void); |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
289 void (*cleanup) (void); |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
290 void (*about) (void); |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
291 void (*configure) (void); |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
292 gchar *(*get_devices); |
2619f4c62abe
added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents:
3181
diff
changeset
|
293 }; |
2313 | 294 |
295 G_BEGIN_DECLS | |
296 | |
297 /* So that input plugins can get the title formatting information */ | |
298 G_CONST_RETURN gchar * xmms_get_gentitle_format(void); | |
299 | |
300 /* So that output plugins can communicate with effect plugins */ | |
301 EffectPlugin *get_current_effect_plugin(void); | |
302 gboolean effects_enabled(void); | |
303 gboolean plugin_set_errortext(const gchar * text); | |
304 | |
305 G_END_DECLS | |
306 | |
3009
9976e065e2f5
Mimetype system.
William Pitcock <nenolod@atheme-project.org>
parents:
2841
diff
changeset
|
307 #include "audacious/mime.h" |
9976e065e2f5
Mimetype system.
William Pitcock <nenolod@atheme-project.org>
parents:
2841
diff
changeset
|
308 |
2313 | 309 #endif |