diff options
author | Max Kellermann <max@duempel.org> | 2009-02-16 01:38:10 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2009-02-16 01:38:10 +0100 |
commit | 79b50b7d9c2ef84e0b74345a31a9b2f96d2690cd (patch) | |
tree | 65e6a728b46e085ebe24e2302640df350a082cd6 /src/output_plugin.h | |
parent | 67da4cfe3c4c2ffc1e7fc98a6ea164b860f788cb (diff) | |
download | mpd-79b50b7d9c2ef84e0b74345a31a9b2f96d2690cd.tar.gz mpd-79b50b7d9c2ef84e0b74345a31a9b2f96d2690cd.tar.xz mpd-79b50b7d9c2ef84e0b74345a31a9b2f96d2690cd.zip |
output_plugin: added inline wrapper functions
Similar to the decoder plugin API: added wrapper functions to increase
code readability.
Diffstat (limited to 'src/output_plugin.h')
-rw-r--r-- | src/output_plugin.h | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/src/output_plugin.h b/src/output_plugin.h index 925982a9c..0166322fc 100644 --- a/src/output_plugin.h +++ b/src/output_plugin.h @@ -112,4 +112,70 @@ struct audio_output_plugin { bool (*control)(void *data, int cmd, void *arg); }; +static inline bool +ao_plugin_test_default_device(const struct audio_output_plugin *plugin) +{ + return plugin->test_default_device != NULL + ? plugin->test_default_device() + : false; +} + +static inline void * +ao_plugin_init(const struct audio_output_plugin *plugin, + struct audio_output *ao, + const struct audio_format *audio_format, + const struct config_param *param) +{ + return plugin->init(ao, audio_format, param); +} + +static inline void +ao_plugin_finish(const struct audio_output_plugin *plugin, void *data) +{ + plugin->finish(data); +} + +static inline bool +ao_plugin_open(const struct audio_output_plugin *plugin, + void *data, struct audio_format *audio_format) +{ + return plugin->open(data, audio_format); +} + +static inline void +ao_plugin_close(const struct audio_output_plugin *plugin, void *data) +{ + plugin->close(data); +} + +static inline void +ao_plugin_send_tag(const struct audio_output_plugin *plugin, + void *data, const struct tag *tag) +{ + if (plugin->send_tag != NULL) + plugin->send_tag(data, tag); +} + +static inline bool +ao_plugin_play(const struct audio_output_plugin *plugin, + void *data, const void *chunk, size_t size) +{ + return plugin->play(data, chunk, size); +} + +static inline void +ao_plugin_cancel(const struct audio_output_plugin *plugin, void *data) +{ + if (plugin->cancel != NULL) + plugin->cancel(data); +} + +static inline bool +ao_plugin_pause(const struct audio_output_plugin *plugin, void *data) +{ + return plugin->pause != NULL + ? plugin->pause(data) + : false; +} + #endif |