Mercurial > audlegacy
annotate src/audacious/plugin.h @ 2796:e9af66a1be74 trunk
[svn] - add functions for defining the v2 plugin header
| author | nenolod |
|---|---|
| date | Thu, 24 May 2007 02:03:17 -0700 |
| parents | 2685fc11cd9a |
| children | f0c1c8b22c88 |
| 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" | |
| 41 | |
| 42 #define INPUT_PLUGIN(x) ((InputPlugin *)(x)) | |
| 43 #define OUTPUT_PLUGIN(x) ((OutputPlugin *)(x)) | |
| 44 #define EFFECT_PLUGIN(x) ((EffectPlugin *)(x)) | |
| 45 #define GENERAL_PLUGIN(x) ((GeneralPlugin *)(x)) | |
| 46 #define VIS_PLUGIN(x) ((VisPlugin *)(x)) | |
| 47 | |
| 48 #define LOWLEVEL_PLUGIN(x) ((LowlevelPlugin *)(x)) | |
| 49 | |
| 50 #define __AUDACIOUS_NEWVFS__ | |
|
2794
2685fc11cd9a
[svn] - begin work on the host side of plugin API v2.
nenolod
parents:
2763
diff
changeset
|
51 #define __AUDACIOUS_PLUGIN_API__ 2 |
|
2685fc11cd9a
[svn] - begin work on the host side of plugin API v2.
nenolod
parents:
2763
diff
changeset
|
52 #define __AUDACIOUS_INPUT_PLUGIN_API__ 3 |
| 2313 | 53 |
| 54 typedef enum { | |
| 55 FMT_U8, | |
| 56 FMT_S8, | |
| 57 FMT_U16_LE, | |
| 58 FMT_U16_BE, | |
| 59 FMT_U16_NE, | |
| 60 FMT_S16_LE, | |
| 61 FMT_S16_BE, | |
| 62 FMT_S16_NE | |
| 63 } AFormat; | |
| 64 | |
| 65 typedef enum { | |
| 66 INPUT_VIS_ANALYZER, | |
| 67 INPUT_VIS_SCOPE, | |
| 68 INPUT_VIS_VU, | |
| 69 INPUT_VIS_OFF | |
| 70 } InputVisType; | |
| 71 | |
| 72 | |
| 73 typedef struct _Plugin Plugin; | |
| 74 typedef struct _InputPlugin InputPlugin; | |
| 75 typedef struct _OutputPlugin OutputPlugin; | |
| 76 typedef struct _EffectPlugin EffectPlugin; | |
| 77 typedef struct _GeneralPlugin GeneralPlugin; | |
| 78 typedef struct _VisPlugin VisPlugin; | |
| 79 | |
| 80 typedef struct _LowlevelPlugin LowlevelPlugin; | |
| 81 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
82 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
|
83 |
|
2796
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
84 /* |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
85 * The v2 Module header. |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
86 * |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
87 * _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
|
88 * A single library can provide multiple plugins. |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
89 * --nenolod |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
90 */ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
91 typedef struct { |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
92 gint magic; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
93 gint api_version; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
94 gchar *name; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
95 GCallback init; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
96 GCallback fini; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
97 Plugin *priv_assoc; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
98 InputPlugin **ip_list; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
99 OutputPlugin **op_list; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
100 EffectPlugin **ep_list; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
101 GeneralPlugin **gp_list; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
102 VisPlugin **vp_list; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
103 } PluginHeader; |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
104 |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
105 #define PLUGIN_MAGIC 0x8EAC8DE2 |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
106 |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
107 #define DECLARE_PLUGIN(name, init, fini, ip_list, op_list, ep_list, gp_list, vp_list) \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
108 static PluginHeader _pluginInfo = { PLUGIN_MAGIC, __AUDACIOUS_PLUGIN_API__, \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
109 #name, init, fini, NULL, ip_list, op_list, ep_list, gp_list, \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
110 vp_list }; \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
111 PluginHeader *get_plugin_info(void) { \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
112 return &_pluginInfo; \ |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
113 } |
|
e9af66a1be74
[svn] - add functions for defining the v2 plugin header
nenolod
parents:
2794
diff
changeset
|
114 |
| 2313 | 115 /* Sadly, this is the most we can generalize out of the disparate |
| 116 plugin structs usable with typecasts - descender */ | |
| 117 struct _Plugin { | |
| 118 gpointer handle; | |
| 119 gchar *filename; | |
|
2794
2685fc11cd9a
[svn] - begin work on the host side of plugin API v2.
nenolod
parents:
2763
diff
changeset
|
120 gchar *description; |
| 2313 | 121 }; |
| 122 | |
| 123 /* | |
| 124 * LowlevelPlugin is used for lowlevel system services, such as PlaylistContainers, | |
| 125 * VFSContainers and the like. | |
| 126 * | |
| 127 * They are not GUI visible at this time. | |
| 128 */ | |
| 129 struct _LowlevelPlugin { | |
| 130 gpointer handle; | |
| 131 gchar *filename; | |
| 132 | |
| 133 gchar *description; | |
| 134 | |
| 135 void (*init) (void); | |
| 136 void (*cleanup) (void); | |
| 137 }; | |
| 138 | |
| 139 struct _OutputPlugin { | |
| 140 gpointer handle; | |
| 141 gchar *filename; | |
| 142 | |
| 143 gchar *description; | |
| 144 | |
| 145 void (*init) (void); | |
| 146 void (*cleanup) (void); | |
| 147 void (*about) (void); | |
| 148 void (*configure) (void); | |
| 149 void (*get_volume) (gint * l, gint * r); | |
| 150 void (*set_volume) (gint l, gint r); | |
| 151 | |
| 152 gint (*open_audio) (AFormat fmt, gint rate, gint nch); | |
| 153 void (*write_audio) (gpointer ptr, gint length); | |
| 154 void (*close_audio) (void); | |
| 155 | |
| 156 void (*flush) (gint time); | |
| 157 void (*pause) (gshort paused); | |
| 158 gint (*buffer_free) (void); | |
| 159 gint (*buffer_playing) (void); | |
| 160 gint (*output_time) (void); | |
| 161 gint (*written_time) (void); | |
| 162 | |
| 163 void (*tell_audio) (AFormat * fmt, gint * rate, gint * nch); | |
| 164 }; | |
| 165 | |
| 166 struct _EffectPlugin { | |
| 167 gpointer handle; | |
| 168 gchar *filename; | |
| 169 | |
| 170 gchar *description; | |
| 171 | |
| 172 void (*init) (void); | |
| 173 void (*cleanup) (void); | |
| 174 void (*about) (void); | |
| 175 void (*configure) (void); | |
| 176 | |
| 177 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch); | |
| 178 void (*query_format) (AFormat * fmt, gint * rate, gint * nch); | |
| 179 }; | |
| 180 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
181 struct _InputPlayback { |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
182 gchar *filename; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
183 InputPlugin *plugin; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
184 void *data; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
185 OutputPlugin *output; |
|
2438
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
186 |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
187 int playing; |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
188 gboolean error; |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
189 gboolean eof; |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
190 }; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
191 |
| 2313 | 192 struct _InputPlugin { |
| 193 gpointer handle; | |
| 194 gchar *filename; | |
| 195 | |
| 196 gchar *description; | |
| 197 | |
| 198 void (*init) (void); | |
| 199 void (*about) (void); | |
| 200 void (*configure) (void); | |
| 201 | |
| 202 gint (*is_our_file) (gchar * filename); | |
| 203 GList *(*scan_dir) (gchar * dirname); | |
| 204 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
205 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
|
206 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
|
207 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
|
208 void (*seek) (InputPlayback * playback, gint time); |
| 2313 | 209 |
| 210 void (*set_eq) (gint on, gfloat preamp, gfloat * bands); | |
| 211 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
212 gint (*get_time) (InputPlayback * playback); |
| 2313 | 213 |
| 2437 | 214 gint (*get_volume) (gint * l, gint * r); |
| 215 gint (*set_volume) (gint l, gint r); | |
| 2313 | 216 |
| 217 void (*cleanup) (void); | |
| 218 | |
| 219 InputVisType (*get_vis_type) (void); | |
| 220 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr); | |
| 221 | |
| 222 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch); | |
| 223 void (*set_info_text) (gchar * text); | |
| 224 void (*get_song_info) (gchar * filename, gchar ** title, gint * length); | |
| 225 void (*file_info_box) (gchar * filename); | |
| 226 | |
| 2437 | 227 OutputPlugin *output; /* deprecated */ |
| 2313 | 228 |
| 229 /* Added in Audacious 1.1.0 */ | |
| 230 TitleInput *(*get_song_tuple) (gchar * filename); | |
| 231 void (*set_song_tuple) (TitleInput * tuple); | |
| 232 void (*set_status_buffering) (gboolean status); | |
| 233 | |
| 234 /* Added in Audacious 1.3.0 */ | |
| 235 gint (*is_our_file_from_vfs) (gchar *filename, VFSFile *fd); | |
| 236 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
|
237 |
|
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
|
238 /* 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
|
239 void (*mseek) (InputPlayback * playback, gulong millisecond); |
| 2313 | 240 }; |
| 241 | |
| 242 struct _GeneralPlugin { | |
| 243 gpointer handle; | |
| 244 gchar *filename; | |
| 245 | |
| 246 gchar *description; | |
| 247 | |
| 248 void (*init) (void); | |
| 249 void (*about) (void); | |
| 250 void (*configure) (void); | |
| 251 void (*cleanup) (void); | |
| 252 }; | |
| 253 | |
| 254 struct _VisPlugin { | |
| 255 gpointer handle; | |
| 256 gchar *filename; | |
| 257 | |
| 258 gchar *description; | |
| 259 | |
| 260 gint num_pcm_chs_wanted; | |
| 261 gint num_freq_chs_wanted; | |
| 262 | |
| 263 void (*init) (void); | |
| 264 void (*cleanup) (void); | |
| 265 void (*about) (void); | |
| 266 void (*configure) (void); | |
| 267 void (*disable_plugin) (struct _VisPlugin *); | |
| 268 void (*playback_start) (void); | |
| 269 void (*playback_stop) (void); | |
| 270 void (*render_pcm) (gint16 pcm_data[2][512]); | |
| 271 void (*render_freq) (gint16 freq_data[2][256]); | |
| 272 }; | |
| 273 | |
| 274 | |
| 275 G_BEGIN_DECLS | |
| 276 | |
| 277 /* So that input plugins can get the title formatting information */ | |
| 278 G_CONST_RETURN gchar * xmms_get_gentitle_format(void); | |
| 279 | |
| 280 /* So that output plugins can communicate with effect plugins */ | |
| 281 EffectPlugin *get_current_effect_plugin(void); | |
| 282 gboolean effects_enabled(void); | |
| 283 gboolean plugin_set_errortext(const gchar * text); | |
| 284 | |
| 285 G_END_DECLS | |
| 286 | |
| 287 #endif |
