Mercurial > audlegacy
annotate audacious/plugin.h @ 515:802a8ed87f67 trunk
[svn] Add support for tell_audio(), an output plugin accessor which will give us the information the input plugin passed to
open_audio()... XMMS design sucks and we WILL be getting rid of most of these kludges in 0.3. :P
| author | nenolod |
|---|---|
| date | Thu, 26 Jan 2006 11:11:20 -0800 |
| parents | b04ce1c98b6f |
| children | 69a70ab41ed7 |
| rev | line source |
|---|---|
| 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); | |
|
515
802a8ed87f67
[svn] Add support for tell_audio(), an output plugin accessor which will give us the information the input plugin passed to
nenolod
parents:
309
diff
changeset
|
100 |
|
802a8ed87f67
[svn] Add support for tell_audio(), an output plugin accessor which will give us the information the input plugin passed to
nenolod
parents:
309
diff
changeset
|
101 gint (*tell_audio) (AFormat * fmt, gint * rate, gint * nch); |
| 0 | 102 }; |
| 103 | |
| 104 struct _EffectPlugin { | |
| 105 gpointer handle; | |
| 106 gchar *filename; | |
| 107 | |
| 108 gchar *description; | |
| 109 | |
| 110 void (*init) (void); | |
| 111 void (*cleanup) (void); | |
| 112 void (*about) (void); | |
| 113 void (*configure) (void); | |
| 114 | |
| 115 gint (*mod_samples) (gpointer * data, gint length, AFormat fmt, gint srate, gint nch); | |
| 116 void (*query_format) (AFormat * fmt, gint * rate, gint * nch); | |
| 117 }; | |
| 118 | |
| 119 struct _InputPlugin { | |
| 120 gpointer handle; | |
| 121 gchar *filename; | |
| 122 | |
| 123 gchar *description; | |
| 124 | |
| 125 void (*init) (void); | |
| 126 void (*about) (void); | |
| 127 void (*configure) (void); | |
| 128 | |
| 129 gint (*is_our_file) (gchar * filename); | |
| 130 GList *(*scan_dir) (gchar * dirname); | |
| 131 | |
| 132 void (*play_file) (gchar * filename); | |
| 133 void (*stop) (void); | |
| 134 void (*pause) (gshort paused); | |
| 135 void (*seek) (gint time); | |
| 136 | |
| 137 void (*set_eq) (gint on, gfloat preamp, gfloat * bands); | |
| 138 | |
| 139 gint (*get_time) (void); | |
| 140 | |
| 141 void (*get_volume) (gint * l, gint * r); | |
| 142 void (*set_volume) (gint l, gint r); | |
| 143 | |
| 144 void (*cleanup) (void); | |
| 145 | |
| 146 InputVisType (*get_vis_type) (void); | |
| 147 void (*add_vis_pcm) (gint time, AFormat fmt, gint nch, gint length, gpointer ptr); | |
| 148 | |
| 149 void (*set_info) (gchar * title, gint length, gint rate, gint freq, gint nch); | |
| 150 void (*set_info_text) (gchar * text); | |
| 151 void (*get_song_info) (gchar * filename, gchar ** title, gint * length); | |
| 152 void (*file_info_box) (gchar * filename); | |
| 153 | |
| 154 OutputPlugin *output; | |
| 155 }; | |
| 156 | |
| 157 struct _GeneralPlugin { | |
| 158 gpointer handle; | |
| 159 gchar *filename; | |
| 160 | |
| 161 gint xmms_session; | |
| 162 gchar *description; | |
| 163 | |
| 164 void (*init) (void); | |
| 165 void (*about) (void); | |
| 166 void (*configure) (void); | |
| 167 void (*cleanup) (void); | |
| 168 }; | |
| 169 | |
| 170 struct _VisPlugin { | |
| 171 gpointer handle; | |
| 172 gchar *filename; | |
| 173 | |
| 174 gint xmms_session; | |
| 175 gchar *description; | |
| 176 | |
| 177 gint num_pcm_chs_wanted; | |
| 178 gint num_freq_chs_wanted; | |
| 179 | |
| 180 void (*init) (void); | |
| 181 void (*cleanup) (void); | |
| 182 void (*about) (void); | |
| 183 void (*configure) (void); | |
| 184 void (*disable_plugin) (struct _VisPlugin *); | |
| 185 void (*playback_start) (void); | |
| 186 void (*playback_stop) (void); | |
| 187 void (*render_pcm) (gint16 pcm_data[2][512]); | |
| 188 void (*render_freq) (gint16 freq_data[2][256]); | |
| 189 }; | |
| 190 | |
| 191 | |
| 192 G_BEGIN_DECLS | |
| 193 | |
| 194 /* So that input plugins can get the title formatting information */ | |
| 195 G_CONST_RETURN gchar * xmms_get_gentitle_format(void); | |
| 196 | |
| 197 /* So that output plugins can communicate with effect plugins */ | |
| 198 EffectPlugin *get_current_effect_plugin(void); | |
| 199 gboolean effects_enabled(void); | |
| 200 gboolean plugin_set_errortext(const gchar * text); | |
| 201 | |
| 202 G_END_DECLS | |
| 203 | |
| 204 #endif |
