aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_plugin.h
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-02-23 09:29:56 +0100
committerMax Kellermann <max@duempel.org>2009-02-23 09:29:56 +0100
commit5a898c15e79ab87d2466e61549fcc20ce115c67e (patch)
treecb65b88718b0b8f3cf05221816b193833c41fe8a /src/output_plugin.h
parentd50a3d513eb0452e762f1e4eeb717318958cd83c (diff)
downloadmpd-5a898c15e79ab87d2466e61549fcc20ce115c67e.tar.gz
mpd-5a898c15e79ab87d2466e61549fcc20ce115c67e.tar.xz
mpd-5a898c15e79ab87d2466e61549fcc20ce115c67e.zip
output_api: play() returns a length
The old API required an output plugin to not return until all data passed to the play() method is consumed. Some output plugins have to loop to fulfill that requirement, and may block during that. Simplify these, by letting them consume only part of the buffer: make play() return the length of the consumed data.
Diffstat (limited to 'src/output_plugin.h')
-rw-r--r--src/output_plugin.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/output_plugin.h b/src/output_plugin.h
index b652dc44e..8a2bcadac 100644
--- a/src/output_plugin.h
+++ b/src/output_plugin.h
@@ -92,8 +92,10 @@ struct audio_output_plugin {
/**
* Play a chunk of audio data.
+ *
+ * @return the number of bytes played, or 0 on error
*/
- bool (*play)(void *data, const char *playChunk, size_t size);
+ size_t (*play)(void *data, const char *chunk, size_t size);
/**
* Try to cancel data which may still be in the device's
@@ -167,7 +169,7 @@ ao_plugin_send_tag(const struct audio_output_plugin *plugin,
plugin->send_tag(data, tag);
}
-static inline bool
+static inline size_t
ao_plugin_play(const struct audio_output_plugin *plugin,
void *data, const void *chunk, size_t size)
{