output_plugin: add method delay()

This method is used to reduce the delay of commands issued to the
shout plugin.
This commit is contained in:
Max Kellermann
2010-11-05 08:02:38 +01:00
parent ad430c6617
commit 2dc6ed7b3a
3 changed files with 51 additions and 3 deletions

View File

@@ -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)