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_thread.c | |
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 '')
-rw-r--r-- | src/output_thread.c | 48 |
1 files changed, 20 insertions, 28 deletions
diff --git a/src/output_thread.c b/src/output_thread.c index 196aaf142..098e1b427 100644 --- a/src/output_thread.c +++ b/src/output_thread.c @@ -43,7 +43,7 @@ ao_close(struct audio_output *ao) { assert(ao->open); - ao->plugin->close(ao->data); + ao_plugin_close(ao->plugin, ao->data); pcm_convert_deinit(&ao->convert_state); ao->open = false; } @@ -69,9 +69,9 @@ static void ao_play(struct audio_output *ao) return; } - ret = ao->plugin->play(ao->data, data, size); + ret = ao_plugin_play(ao->plugin, ao->data, data, size); if (!ret) { - ao->plugin->cancel(ao->data); + ao_plugin_cancel(ao->plugin, ao->data); ao_close(ao); } @@ -80,26 +80,18 @@ static void ao_play(struct audio_output *ao) static void ao_pause(struct audio_output *ao) { - ao->plugin->cancel(ao->data); - - if (ao->plugin->pause != NULL) { - /* pause is supported */ - ao_command_finished(ao); - - do { - bool ret; - - ret = ao->plugin->pause(ao->data); - if (!ret) { - ao_close(ao); - break; - } - } while (ao->command == AO_COMMAND_NONE); - } else { - /* pause is not supported - simply close the device */ - ao_close(ao); - ao_command_finished(ao); - } + bool ret; + + ao_plugin_cancel(ao->plugin, ao->data); + ao_command_finished(ao); + + do { + ret = ao_plugin_pause(ao->plugin, ao->data); + if (!ret) { + ao_close(ao); + break; + } + } while (ao->command == AO_COMMAND_NONE); } static gpointer audio_output_task(gpointer arg) @@ -115,8 +107,8 @@ static gpointer audio_output_task(gpointer arg) case AO_COMMAND_OPEN: assert(!ao->open); - ret = ao->plugin->open(ao->data, - &ao->out_audio_format); + ret = ao_plugin_open(ao->plugin, ao->data, + &ao->out_audio_format); assert(!ao->open); if (ret) { @@ -130,8 +122,8 @@ static gpointer audio_output_task(gpointer arg) case AO_COMMAND_CLOSE: assert(ao->open); - ao->plugin->cancel(ao->data); + ao_plugin_cancel(ao->plugin, ao->data); ao_close(ao); ao_command_finished(ao); break; @@ -145,12 +137,12 @@ static gpointer audio_output_task(gpointer arg) break; case AO_COMMAND_CANCEL: - ao->plugin->cancel(ao->data); + ao_plugin_cancel(ao->plugin, ao->data); ao_command_finished(ao); break; case AO_COMMAND_SEND_TAG: - ao->plugin->send_tag(ao->data, ao->args.tag); + ao_plugin_send_tag(ao->plugin, ao->data, ao->args.tag); ao_command_finished(ao); break; |