00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef MPD_OUTPUT_PLUGIN_H
00021 #define MPD_OUTPUT_PLUGIN_H
00022
00023 #include <glib.h>
00024
00025 #include <stdbool.h>
00026 #include <stddef.h>
00027
00028 struct config_param;
00029 struct audio_format;
00030 struct tag;
00031
00035 struct audio_output_plugin {
00039 const char *name;
00040
00045 bool (*test_default_device)(void);
00046
00058 struct audio_output *(*init)(const struct config_param *param,
00059 GError **error);
00060
00064 void (*finish)(struct audio_output *data);
00065
00076 bool (*enable)(struct audio_output *data, GError **error_r);
00077
00082 void (*disable)(struct audio_output *data);
00083
00092 bool (*open)(struct audio_output *data, struct audio_format *audio_format,
00093 GError **error);
00094
00098 void (*close)(struct audio_output *data);
00099
00108 unsigned (*delay)(struct audio_output *data);
00109
00114 void (*send_tag)(struct audio_output *data, const struct tag *tag);
00115
00123 size_t (*play)(struct audio_output *data,
00124 const void *chunk, size_t size,
00125 GError **error);
00126
00130 void (*drain)(struct audio_output *data);
00131
00136 void (*cancel)(struct audio_output *data);
00137
00149 bool (*pause)(struct audio_output *data);
00150
00157 const struct mixer_plugin *mixer_plugin;
00158 };
00159
00160 static inline bool
00161 ao_plugin_test_default_device(const struct audio_output_plugin *plugin)
00162 {
00163 return plugin->test_default_device != NULL
00164 ? plugin->test_default_device()
00165 : false;
00166 }
00167
00168 G_GNUC_MALLOC
00169 struct audio_output *
00170 ao_plugin_init(const struct audio_output_plugin *plugin,
00171 const struct config_param *param,
00172 GError **error);
00173
00174 void
00175 ao_plugin_finish(struct audio_output *ao);
00176
00177 bool
00178 ao_plugin_enable(struct audio_output *ao, GError **error_r);
00179
00180 void
00181 ao_plugin_disable(struct audio_output *ao);
00182
00183 bool
00184 ao_plugin_open(struct audio_output *ao, struct audio_format *audio_format,
00185 GError **error);
00186
00187 void
00188 ao_plugin_close(struct audio_output *ao);
00189
00190 G_GNUC_PURE
00191 unsigned
00192 ao_plugin_delay(struct audio_output *ao);
00193
00194 void
00195 ao_plugin_send_tag(struct audio_output *ao, const struct tag *tag);
00196
00197 size_t
00198 ao_plugin_play(struct audio_output *ao, const void *chunk, size_t size,
00199 GError **error);
00200
00201 void
00202 ao_plugin_drain(struct audio_output *ao);
00203
00204 void
00205 ao_plugin_cancel(struct audio_output *ao);
00206
00207 bool
00208 ao_plugin_pause(struct audio_output *ao);
00209
00210 #endif