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);
|
|
84 void (*about) (void);
|
|
85 void (*configure) (void);
|
|
86 void (*get_volume) (gint * l, gint * r);
|
|
87 void (*set_volume) (gint l, gint r);
|
|
88
|
|
89 gint (*open_audio) (AFormat fmt, gint rate, gint nch);
|
|
90 void (*write_audio) (gpointer ptr, gint length);
|
|
91 void (*close_audio) (void);
|
|
92
|
|
93 void (*flush) (gint time);
|
|
94 void (*pause) (gshort paused);
|
|
95 gint (*buffer_free) (void);
|
|
96 gint (*buffer_playing) (void);
|
|
97 gint (*output_time) (void);
|
|
98 gint (*written_time) (void);
|
|
99 };
|
|
100
|
|
101 struct _EffectPlugin {
|
|
102 gpointer handle;
|
|
103 gchar *filename;
|
|
104
|
|
105 gchar *description;
|
|
106
|
|
107 void (*init) (void);
|
|
108 void (*cleanup) (void);
|
|
109 void (*about) (void);
|
|
110 void (*configure) (void);
|
|
111
|
|
112 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch);
|
|
113 void (*query_format) (AFormat * fmt, gint * rate, gint * nch);
|
|
114 };
|
|
115
|
|
116 struct _InputPlugin {
|
|
117 gpointer handle;
|
|
118 gchar *filename;
|
|
119
|
|
120 gchar *description;
|
|
121
|
|
122 void (*init) (void);
|
|
123 void (*about) (void);
|
|
124 void (*configure) (void);
|
|
125
|
|
126 gint (*is_our_file) (gchar * filename);
|
|
127 GList *(*scan_dir) (gchar * dirname);
|
|
128
|
|
129 void (*play_file) (gchar * filename);
|
|
130 void (*stop) (void);
|
|
131 void (*pause) (gshort paused);
|
|
132 void (*seek) (gint time);
|
|
133
|
|
134 void (*set_eq) (gint on, gfloat preamp, gfloat * bands);
|
|
135
|
|
136 gint (*get_time) (void);
|
|
137
|
|
138 void (*get_volume) (gint * l, gint * r);
|
|
139 void (*set_volume) (gint l, gint r);
|
|
140
|
|
141 void (*cleanup) (void);
|
|
142
|
|
143 InputVisType (*get_vis_type) (void);
|
|
144 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr);
|
|
145
|
|
146 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch);
|
|
147 void (*set_info_text) (gchar * text);
|
|
148 void (*get_song_info) (gchar * filename, gchar ** title, gint * length);
|
|
149 void (*file_info_box) (gchar * filename);
|
|
150
|
|
151 OutputPlugin *output;
|
|
152 };
|
|
153
|
|
154 struct _GeneralPlugin {
|
|
155 gpointer handle;
|
|
156 gchar *filename;
|
|
157
|
|
158 gint xmms_session;
|
|
159 gchar *description;
|
|
160
|
|
161 void (*init) (void);
|
|
162 void (*about) (void);
|
|
163 void (*configure) (void);
|
|
164 void (*cleanup) (void);
|
|
165 };
|
|
166
|
|
167 struct _VisPlugin {
|
|
168 gpointer handle;
|
|
169 gchar *filename;
|
|
170
|
|
171 gint xmms_session;
|
|
172 gchar *description;
|
|
173
|
|
174 gint num_pcm_chs_wanted;
|
|
175 gint num_freq_chs_wanted;
|
|
176
|
|
177 void (*init) (void);
|
|
178 void (*cleanup) (void);
|
|
179 void (*about) (void);
|
|
180 void (*configure) (void);
|
|
181 void (*disable_plugin) (struct _VisPlugin *);
|
|
182 void (*playback_start) (void);
|
|
183 void (*playback_stop) (void);
|
|
184 void (*render_pcm) (gint16 pcm_data[2][512]);
|
|
185 void (*render_freq) (gint16 freq_data[2][256]);
|
|
186 };
|
|
187
|
|
188
|
|
189 G_BEGIN_DECLS
|
|
190
|
|
191 /* So that input plugins can get the title formatting information */
|
|
192 G_CONST_RETURN gchar * xmms_get_gentitle_format(void);
|
|
193
|
|
194 /* So that output plugins can communicate with effect plugins */
|
|
195 EffectPlugin *get_current_effect_plugin(void);
|
|
196 gboolean effects_enabled(void);
|
|
197 gboolean plugin_set_errortext(const gchar * text);
|
|
198
|
|
199 G_END_DECLS
|
|
200
|
|
201 #endif
|