aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_plugin.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-10-29 15:59:40 +0100
committerMax Kellermann <max@duempel.org>2009-10-29 15:59:40 +0100
commit1403172ef397c3dfc58a64c999a362cca977241b (patch)
tree5fcd866c62528295dfa697cc06dfba862ed3ff61 /src/output_plugin.h
parentf74ee1a352a0fb39fd0a0b42ab740f2f6e6957a3 (diff)
downloadmpd-1403172ef397c3dfc58a64c999a362cca977241b.tar.gz
mpd-1403172ef397c3dfc58a64c999a362cca977241b.tar.xz
mpd-1403172ef397c3dfc58a64c999a362cca977241b.zip
output_plugin: added method "drain"
drain() is the opposite of cancel(): it waits until all data in the buffer has finished playing. Instead of implicitly draining in the close() method like the ALSA plugin has been doing it forever, let the output thread decide whether to drain or to cancel.
Diffstat (limited to '')
-rw-r--r--src/output_plugin.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/output_plugin.h b/src/output_plugin.h
index 3a9748d46..ee7f7c73d 100644
--- a/src/output_plugin.h
+++ b/src/output_plugin.h
@@ -117,6 +117,11 @@ struct audio_output_plugin {
GError **error);
/**
+ * Wait until the device has finished playing.
+ */
+ void (*drain)(void *data);
+
+ /**
* Try to cancel data which may still be in the device's
* buffers.
*/
@@ -214,6 +219,13 @@ ao_plugin_play(const struct audio_output_plugin *plugin,
}
static inline void
+ao_plugin_drain(const struct audio_output_plugin *plugin, void *data)
+{
+ if (plugin->drain != NULL)
+ plugin->drain(data);
+}
+
+static inline void
ao_plugin_cancel(const struct audio_output_plugin *plugin, void *data)
{
if (plugin->cancel != NULL)