aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_plugin.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2010-11-05 08:02:38 +0100
committerMax Kellermann <max@duempel.org>2010-11-05 09:47:43 +0100
commit2dc6ed7b3a2faf27d33fa8bbcf924031fde0e21a (patch)
treeb5ac194133bac616b12a97a875ca87fe24323a6b /src/output_plugin.h
parentad430c661780ed196d772564f9a49d5dacb5df0f (diff)
downloadmpd-2dc6ed7b3a2faf27d33fa8bbcf924031fde0e21a.tar.gz
mpd-2dc6ed7b3a2faf27d33fa8bbcf924031fde0e21a.tar.xz
mpd-2dc6ed7b3a2faf27d33fa8bbcf924031fde0e21a.zip
output_plugin: add method delay()
This method is used to reduce the delay of commands issued to the shout plugin.
Diffstat (limited to 'src/output_plugin.h')
-rw-r--r--src/output_plugin.h18
1 files changed, 18 insertions, 0 deletions
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
@@ -101,6 +101,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)