aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_plugin.h
diff options
context:
space:
mode:
Diffstat (limited to '')
-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)