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