From 2dc6ed7b3a2faf27d33fa8bbcf924031fde0e21a Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 5 Nov 2010 08:02:38 +0100 Subject: output_plugin: add method delay() This method is used to reduce the delay of commands issued to the shout plugin. --- src/output_plugin.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/output_plugin.h') diff --git a/src/output_plugin.h b/src/output_plugin.h index fabfe0dfa..36e17ed1b 100644 --- a/src/output_plugin.h +++ b/src/output_plugin.h @@ -100,6 +100,16 @@ struct audio_output_plugin { */ void (*close)(void *data); + /** + * Returns a positive number if the output thread shall delay + * the next call to play() or pause(). This should be + * implemented instead of doing a sleep inside the plugin, + * because this allows MPD to listen to commands meanwhile. + * + * @return the number of milliseconds to wait + */ + unsigned (*delay)(void *data); + /** * Display metadata for the next chunk. Optional method, * because not all devices can display metadata. @@ -202,6 +212,14 @@ ao_plugin_close(const struct audio_output_plugin *plugin, void *data) plugin->close(data); } +static inline unsigned +ao_plugin_delay(const struct audio_output_plugin *plugin, void *data) +{ + return plugin->delay != NULL + ? plugin->delay(data) + : 0; +} + static inline void ao_plugin_send_tag(const struct audio_output_plugin *plugin, void *data, const struct tag *tag) -- cgit v1.2.3