0
|
1 /* BMP - Cross-platform multimedia player
|
|
2 * Copyright (C) 2003-2004 BMP development team.
|
|
3 *
|
|
4 * Based on XMMS:
|
|
5 * Copyright (C) 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson and 4Front Technologies
|
|
6 *
|
|
7 * Redistribution and use in source and binary forms, with or without
|
|
8 * modification, are permitted provided that the following conditions are
|
|
9 * met: 1. Redistributions of source code must retain the above copyright
|
|
10 * notice, this list of conditions and the following disclaimer. 2.
|
|
11 * Redistributions in binary form must reproduce the above copyright notice,
|
|
12 * this list of conditions and the following disclaimer in the documentation
|
|
13 * and/or other materials provided with the distribution.
|
|
14 *
|
|
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
|
|
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
18 * DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR
|
|
19 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
25 * SUCH DAMAGE.
|
|
26 */
|
|
27
|
|
28 /* Please see the BMP Wiki for information about the plugin interface */
|
|
29
|
|
30 #ifndef BMP_PLUGIN_H
|
|
31 #define BMP_PLUGIN_H
|
|
32
|
|
33
|
|
34 #include <glib.h>
|
|
35
|
|
36
|
|
37 #define INPUT_PLUGIN(x) ((InputPlugin *)(x))
|
|
38 #define OUTPUT_PLUGIN(x) ((OutputPlugin *)(x))
|
|
39 #define EFFECT_PLUGIN(x) ((EffectPlugin *)(x))
|
|
40 #define GENERAL_PLUGIN(x) ((GeneralPlugin *)(x))
|
|
41 #define VIS_PLUGIN(x) ((VisPlugin *)(x))
|
|
42
|
|
43
|
|
44 typedef enum {
|
|
45 FMT_U8,
|
|
46 FMT_S8,
|
|
47 FMT_U16_LE,
|
|
48 FMT_U16_BE,
|
|
49 FMT_U16_NE,
|
|
50 FMT_S16_LE,
|
|
51 FMT_S16_BE,
|
|
52 FMT_S16_NE
|
|
53 } AFormat;
|
|
54
|
|
55 typedef enum {
|
|
56 INPUT_VIS_ANALYZER,
|
|
57 INPUT_VIS_SCOPE,
|
|
58 INPUT_VIS_VU,
|
|
59 INPUT_VIS_OFF
|
|
60 } InputVisType;
|
|
61
|
|
62
|
|
63 typedef struct _Plugin Plugin;
|
|
64 typedef struct _InputPlugin InputPlugin;
|
|
65 typedef struct _OutputPlugin OutputPlugin;
|
|
66 typedef struct _EffectPlugin EffectPlugin;
|
|
67 typedef struct _GeneralPlugin GeneralPlugin;
|
|
68 typedef struct _VisPlugin VisPlugin;
|
|
69
|
|
70 /* Sadly, this is the most we can generalize out of the disparate
|
|
71 plugin structs usable with typecasts - descender */
|
|
72 struct _Plugin {
|
|
73 gpointer handle;
|
|
74 gchar *filename;
|
|
75 };
|
|
76
|
|
77 struct _OutputPlugin {
|
|
78 gpointer handle;
|
|
79 gchar *filename;
|
|
80
|
|
81 gchar *description;
|
|
82
|
|
83 void (*init) (void);
|
309
|
84 void (*cleanup) (void);
|
0
|
85 void (*about) (void);
|
|
86 void (*configure) (void);
|
|
87 void (*get_volume) (gint * l, gint * r);
|
|
88 void (*set_volume) (gint l, gint r);
|
|
89
|
|
90 gint (*open_audio) (AFormat fmt, gint rate, gint nch);
|
|
91 void (*write_audio) (gpointer ptr, gint length);
|
|
92 void (*close_audio) (void);
|
|
93
|
|
94 void (*flush) (gint time);
|
|
95 void (*pause) (gshort paused);
|
|
96 gint (*buffer_free) (void);
|
|
97 gint (*buffer_playing) (void);
|
|
98 gint (*output_time) (void);
|
|
99 gint (*written_time) (void);
|
|
100 };
|
|
101
|
|
102 struct _EffectPlugin {
|
|
103 gpointer handle;
|
|
104 gchar *filename;
|
|
105
|
|
106 gchar *description;
|
|
107
|
|
108 void (*init) (void);
|
|
109 void (*cleanup) (void);
|
|
110 void (*about) (void);
|
|
111 void (*configure) (void);
|
|
112
|
|
113 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch);
|
|
114 void (*query_format) (AFormat * fmt, gint * rate, gint * nch);
|
|
115 };
|
|
116
|
|
117 struct _InputPlugin {
|
|
118 gpointer handle;
|
|
119 gchar *filename;
|
|
120
|
|
121 gchar *description;
|
|
122
|
|
123 void (*init) (void);
|
|
124 void (*about) (void);
|
|
125 void (*configure) (void);
|
|
126
|
|
127 gint (*is_our_file) (gchar * filename);
|
|
128 GList *(*scan_dir) (gchar * dirname);
|
|
129
|
|
130 void (*play_file) (gchar * filename);
|
|
131 void (*stop) (void);
|
|
132 void (*pause) (gshort paused);
|
|
133 void (*seek) (gint time);
|
|
134
|
|
135 void (*set_eq) (gint on, gfloat preamp, gfloat * bands);
|
|
136
|
|
137 gint (*get_time) (void);
|
|
138
|
|
139 void (*get_volume) (gint * l, gint * r);
|
|
140 void (*set_volume) (gint l, gint r);
|
|
141
|
|
142 void (*cleanup) (void);
|
|
143
|
|
144 InputVisType (*get_vis_type) (void);
|
|
145 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr);
|
|
146
|
|
147 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch);
|
|
148 void (*set_info_text) (gchar * text);
|
|
149 void (*get_song_info) (gchar * filename, gchar ** title, gint * length);
|
|
150 void (*file_info_box) (gchar * filename);
|
|
151
|
|
152 OutputPlugin *output;
|
|
153 };
|
|
154
|
|
155 struct _GeneralPlugin {
|
|
156 gpointer handle;
|
|
157 gchar *filename;
|
|
158
|
|
159 gint xmms_session;
|
|
160 gchar *description;
|
|
161
|
|
162 void (*init) (void);
|
|
163 void (*about) (void);
|
|
164 void (*configure) (void);
|
|
165 void (*cleanup) (void);
|
|
166 };
|
|
167
|
|
168 struct _VisPlugin {
|
|
169 gpointer handle;
|
|
170 gchar *filename;
|
|
171
|
|
172 gint xmms_session;
|
|
173 gchar *description;
|
|
174
|
|
175 gint num_pcm_chs_wanted;
|
|
176 gint num_freq_chs_wanted;
|
|
177
|
|
178 void (*init) (void);
|
|
179 void (*cleanup) (void);
|
|
180 void (*about) (void);
|
|
181 void (*configure) (void);
|
|
182 void (*disable_plugin) (struct _VisPlugin *);
|
|
183 void (*playback_start) (void);
|
|
184 void (*playback_stop) (void);
|
|
185 void (*render_pcm) (gint16 pcm_data[2][512]);
|
|
186 void (*render_freq) (gint16 freq_data[2][256]);
|
|
187 };
|
|
188
|
|
189
|
|
190 G_BEGIN_DECLS
|
|
191
|
|
192 /* So that input plugins can get the title formatting information */
|
|
193 G_CONST_RETURN gchar * xmms_get_gentitle_format(void);
|
|
194
|
|
195 /* So that output plugins can communicate with effect plugins */
|
|
196 EffectPlugin *get_current_effect_plugin(void);
|
|
197 gboolean effects_enabled(void);
|
|
198 gboolean plugin_set_errortext(const gchar * text);
|
|
199
|
|
200 G_END_DECLS
|
|
201
|
|
202 #endif
|