Mercurial > audlegacy
annotate src/audacious/plugin.h @ 2473:119cca341280 trunk
[svn] - define __AUDACIOUS_INPUT_PLUGIN_API__ to 2 by request of shd
| author | nenolod |
|---|---|
| date | Sat, 03 Feb 2007 11:19:07 -0800 |
| parents | b0674600339d |
| children | 6393862824e5 |
| 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 /* Please see the BMP Wiki for information about the plugin interface */ | |
| 36 | |
| 37 #ifndef BMP_PLUGIN_H | |
| 38 #define BMP_PLUGIN_H | |
| 39 | |
| 40 | |
| 41 #include <glib.h> | |
| 42 #include "audacious/vfs.h" | |
| 43 #include "audacious/titlestring.h" | |
| 44 | |
| 45 #define INPUT_PLUGIN(x) ((InputPlugin *)(x)) | |
| 46 #define OUTPUT_PLUGIN(x) ((OutputPlugin *)(x)) | |
| 47 #define EFFECT_PLUGIN(x) ((EffectPlugin *)(x)) | |
| 48 #define GENERAL_PLUGIN(x) ((GeneralPlugin *)(x)) | |
| 49 #define VIS_PLUGIN(x) ((VisPlugin *)(x)) | |
| 50 | |
| 51 #define LOWLEVEL_PLUGIN(x) ((LowlevelPlugin *)(x)) | |
| 52 | |
| 53 #define __AUDACIOUS_NEWVFS__ | |
|
2473
119cca341280
[svn] - define __AUDACIOUS_INPUT_PLUGIN_API__ to 2 by request of shd
nenolod
parents:
2453
diff
changeset
|
54 #define __AUDACIOUS_INPUT_PLUGIN_API__ 2 |
| 2313 | 55 |
| 56 typedef enum { | |
| 57 FMT_U8, | |
| 58 FMT_S8, | |
| 59 FMT_U16_LE, | |
| 60 FMT_U16_BE, | |
| 61 FMT_U16_NE, | |
| 62 FMT_S16_LE, | |
| 63 FMT_S16_BE, | |
| 64 FMT_S16_NE | |
| 65 } AFormat; | |
| 66 | |
| 67 typedef enum { | |
| 68 INPUT_VIS_ANALYZER, | |
| 69 INPUT_VIS_SCOPE, | |
| 70 INPUT_VIS_VU, | |
| 71 INPUT_VIS_OFF | |
| 72 } InputVisType; | |
| 73 | |
| 74 | |
| 75 typedef struct _Plugin Plugin; | |
| 76 typedef struct _InputPlugin InputPlugin; | |
| 77 typedef struct _OutputPlugin OutputPlugin; | |
| 78 typedef struct _EffectPlugin EffectPlugin; | |
| 79 typedef struct _GeneralPlugin GeneralPlugin; | |
| 80 typedef struct _VisPlugin VisPlugin; | |
| 81 | |
| 82 typedef struct _LowlevelPlugin LowlevelPlugin; | |
| 83 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
84 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
|
85 |
| 2313 | 86 /* Sadly, this is the most we can generalize out of the disparate |
| 87 plugin structs usable with typecasts - descender */ | |
| 88 struct _Plugin { | |
| 89 gpointer handle; | |
| 90 gchar *filename; | |
| 91 }; | |
| 92 | |
| 93 /* | |
| 94 * LowlevelPlugin is used for lowlevel system services, such as PlaylistContainers, | |
| 95 * VFSContainers and the like. | |
| 96 * | |
| 97 * They are not GUI visible at this time. | |
| 98 */ | |
| 99 struct _LowlevelPlugin { | |
| 100 gpointer handle; | |
| 101 gchar *filename; | |
| 102 | |
| 103 gchar *description; | |
| 104 | |
| 105 void (*init) (void); | |
| 106 void (*cleanup) (void); | |
| 107 }; | |
| 108 | |
| 109 struct _OutputPlugin { | |
| 110 gpointer handle; | |
| 111 gchar *filename; | |
| 112 | |
| 113 gchar *description; | |
| 114 | |
| 115 void (*init) (void); | |
| 116 void (*cleanup) (void); | |
| 117 void (*about) (void); | |
| 118 void (*configure) (void); | |
| 119 void (*get_volume) (gint * l, gint * r); | |
| 120 void (*set_volume) (gint l, gint r); | |
| 121 | |
| 122 gint (*open_audio) (AFormat fmt, gint rate, gint nch); | |
| 123 void (*write_audio) (gpointer ptr, gint length); | |
| 124 void (*close_audio) (void); | |
| 125 | |
| 126 void (*flush) (gint time); | |
| 127 void (*pause) (gshort paused); | |
| 128 gint (*buffer_free) (void); | |
| 129 gint (*buffer_playing) (void); | |
| 130 gint (*output_time) (void); | |
| 131 gint (*written_time) (void); | |
| 132 | |
| 133 void (*tell_audio) (AFormat * fmt, gint * rate, gint * nch); | |
| 134 }; | |
| 135 | |
| 136 struct _EffectPlugin { | |
| 137 gpointer handle; | |
| 138 gchar *filename; | |
| 139 | |
| 140 gchar *description; | |
| 141 | |
| 142 void (*init) (void); | |
| 143 void (*cleanup) (void); | |
| 144 void (*about) (void); | |
| 145 void (*configure) (void); | |
| 146 | |
| 147 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch); | |
| 148 void (*query_format) (AFormat * fmt, gint * rate, gint * nch); | |
| 149 }; | |
| 150 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
151 struct _InputPlayback { |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
152 gchar *filename; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
153 InputPlugin *plugin; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
154 void *data; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
155 OutputPlugin *output; |
|
2438
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
156 |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
157 int playing; |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
158 gboolean error; |
|
8750a62abed8
[svn] Provide flags in InputPlayback for common plugin flag needs, and provide a
iabervon
parents:
2437
diff
changeset
|
159 gboolean eof; |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
160 }; |
|
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
161 |
| 2313 | 162 struct _InputPlugin { |
| 163 gpointer handle; | |
| 164 gchar *filename; | |
| 165 | |
| 166 gchar *description; | |
| 167 | |
| 168 void (*init) (void); | |
| 169 void (*about) (void); | |
| 170 void (*configure) (void); | |
| 171 | |
| 172 gint (*is_our_file) (gchar * filename); | |
| 173 GList *(*scan_dir) (gchar * dirname); | |
| 174 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
175 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
|
176 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
|
177 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
|
178 void (*seek) (InputPlayback * playback, gint time); |
| 2313 | 179 |
| 180 void (*set_eq) (gint on, gfloat preamp, gfloat * bands); | |
| 181 | |
|
2436
f346d30bf5ab
[svn] Change the input plugin API to use a struct for the currently-playing file.
iabervon
parents:
2313
diff
changeset
|
182 gint (*get_time) (InputPlayback * playback); |
| 2313 | 183 |
| 2437 | 184 gint (*get_volume) (gint * l, gint * r); |
| 185 gint (*set_volume) (gint l, gint r); | |
| 2313 | 186 |
| 187 void (*cleanup) (void); | |
| 188 | |
| 189 InputVisType (*get_vis_type) (void); | |
| 190 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr); | |
| 191 | |
| 192 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch); | |
| 193 void (*set_info_text) (gchar * text); | |
| 194 void (*get_song_info) (gchar * filename, gchar ** title, gint * length); | |
| 195 void (*file_info_box) (gchar * filename); | |
| 196 | |
| 2437 | 197 OutputPlugin *output; /* deprecated */ |
| 2313 | 198 |
| 199 /* Added in Audacious 1.1.0 */ | |
| 200 TitleInput *(*get_song_tuple) (gchar * filename); | |
| 201 void (*set_song_tuple) (TitleInput * tuple); | |
| 202 void (*set_status_buffering) (gboolean status); | |
| 203 | |
| 204 /* Added in Audacious 1.3.0 */ | |
| 205 gint (*is_our_file_from_vfs) (gchar *filename, VFSFile *fd); | |
| 206 gchar **vfs_extensions; | |
| 207 }; | |
| 208 | |
| 209 struct _GeneralPlugin { | |
| 210 gpointer handle; | |
| 211 gchar *filename; | |
| 212 | |
| 213 gint xmms_session; | |
| 214 gchar *description; | |
| 215 | |
| 216 void (*init) (void); | |
| 217 void (*about) (void); | |
| 218 void (*configure) (void); | |
| 219 void (*cleanup) (void); | |
| 220 }; | |
| 221 | |
| 222 struct _VisPlugin { | |
| 223 gpointer handle; | |
| 224 gchar *filename; | |
| 225 | |
| 226 gint xmms_session; | |
| 227 gchar *description; | |
| 228 | |
| 229 gint num_pcm_chs_wanted; | |
| 230 gint num_freq_chs_wanted; | |
| 231 | |
| 232 void (*init) (void); | |
| 233 void (*cleanup) (void); | |
| 234 void (*about) (void); | |
| 235 void (*configure) (void); | |
| 236 void (*disable_plugin) (struct _VisPlugin *); | |
| 237 void (*playback_start) (void); | |
| 238 void (*playback_stop) (void); | |
| 239 void (*render_pcm) (gint16 pcm_data[2][512]); | |
| 240 void (*render_freq) (gint16 freq_data[2][256]); | |
| 241 }; | |
| 242 | |
| 243 | |
| 244 G_BEGIN_DECLS | |
| 245 | |
| 246 /* So that input plugins can get the title formatting information */ | |
| 247 G_CONST_RETURN gchar * xmms_get_gentitle_format(void); | |
| 248 | |
| 249 /* So that output plugins can communicate with effect plugins */ | |
| 250 EffectPlugin *get_current_effect_plugin(void); | |
| 251 gboolean effects_enabled(void); | |
| 252 gboolean plugin_set_errortext(const gchar * text); | |
| 253 | |
| 254 G_END_DECLS | |
| 255 | |
| 256 #endif |
