aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2011-09-16 23:31:48 +0200
committerMax Kellermann <max@duempel.org>2011-09-19 09:41:21 +0200
commit74617389c88ccf630b8cce4b54d9e2fa5afb2259 (patch)
tree3d05faad2c2b3b2e9e885f2c391a35fe8f06553a /src/output_thread.c
parentb4a8b8c0d4bf82fc56572c3f8e79108d22d78132 (diff)
downloadmpd-74617389c88ccf630b8cce4b54d9e2fa5afb2259.tar.gz
mpd-74617389c88ccf630b8cce4b54d9e2fa5afb2259.tar.xz
mpd-74617389c88ccf630b8cce4b54d9e2fa5afb2259.zip
output_plugin: the plugin allocates the audio_output object
Pass audio_output objects around instead of void pointers. This will give some more control to the plugin, and prepares for non-blocking audio outputs.
Diffstat (limited to '')
-rw-r--r--src/output_thread.c31
1 files changed, 14 insertions, 17 deletions
diff --git a/src/output_thread.c b/src/output_thread.c
index c36ba5f4f..e194edc92 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -60,7 +60,7 @@ ao_enable(struct audio_output *ao)
return true;
g_mutex_unlock(ao->mutex);
- success = ao_plugin_enable(ao->plugin, ao->data, &error);
+ success = ao_plugin_enable(ao, &error);
g_mutex_lock(ao->mutex);
if (!success) {
g_warning("Failed to enable \"%s\" [%s]: %s\n",
@@ -86,7 +86,7 @@ ao_disable(struct audio_output *ao)
ao->really_enabled = false;
g_mutex_unlock(ao->mutex);
- ao_plugin_disable(ao->plugin, ao->data);
+ ao_plugin_disable(ao);
g_mutex_lock(ao->mutex);
}
}
@@ -175,9 +175,7 @@ ao_open(struct audio_output *ao)
&ao->config_audio_format);
g_mutex_unlock(ao->mutex);
- success = ao_plugin_open(ao->plugin, ao->data,
- &ao->out_audio_format,
- &error);
+ success = ao_plugin_open(ao, &ao->out_audio_format, &error);
g_mutex_lock(ao->mutex);
assert(!ao->open);
@@ -221,11 +219,11 @@ ao_close(struct audio_output *ao, bool drain)
g_mutex_unlock(ao->mutex);
if (drain)
- ao_plugin_drain(ao->plugin, ao->data);
+ ao_plugin_drain(ao);
else
- ao_plugin_cancel(ao->plugin, ao->data);
+ ao_plugin_cancel(ao);
- ao_plugin_close(ao->plugin, ao->data);
+ ao_plugin_close(ao);
ao_filter_close(ao);
g_mutex_lock(ao->mutex);
@@ -257,7 +255,7 @@ ao_reopen_filter(struct audio_output *ao)
ao->fail_timer = g_timer_new();
g_mutex_unlock(ao->mutex);
- ao_plugin_close(ao->plugin, ao->data);
+ ao_plugin_close(ao);
g_mutex_lock(ao->mutex);
return;
@@ -302,7 +300,7 @@ static bool
ao_wait(struct audio_output *ao)
{
while (true) {
- unsigned delay = ao_plugin_delay(ao->plugin, ao->data);
+ unsigned delay = ao_plugin_delay(ao);
if (delay == 0)
return true;
@@ -434,7 +432,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
if (chunk->tag != NULL) {
g_mutex_unlock(ao->mutex);
- ao_plugin_send_tag(ao->plugin, ao->data, chunk->tag);
+ ao_plugin_send_tag(ao, chunk->tag);
g_mutex_lock(ao->mutex);
}
@@ -456,8 +454,7 @@ ao_play_chunk(struct audio_output *ao, const struct music_chunk *chunk)
break;
g_mutex_unlock(ao->mutex);
- nbytes = ao_plugin_play(ao->plugin, ao->data, data, size,
- &error);
+ nbytes = ao_plugin_play(ao, data, size, &error);
g_mutex_lock(ao->mutex);
if (nbytes == 0) {
/* play()==0 means failure */
@@ -547,7 +544,7 @@ static void ao_pause(struct audio_output *ao)
bool ret;
g_mutex_unlock(ao->mutex);
- ao_plugin_cancel(ao->plugin, ao->data);
+ ao_plugin_cancel(ao);
g_mutex_lock(ao->mutex);
ao->pause = true;
@@ -558,7 +555,7 @@ static void ao_pause(struct audio_output *ao)
break;
g_mutex_unlock(ao->mutex);
- ret = ao_plugin_pause(ao->plugin, ao->data);
+ ret = ao_plugin_pause(ao);
g_mutex_lock(ao->mutex);
if (!ret) {
@@ -632,7 +629,7 @@ static gpointer audio_output_task(gpointer arg)
assert(music_pipe_peek(ao->pipe) == NULL);
g_mutex_unlock(ao->mutex);
- ao_plugin_drain(ao->plugin, ao->data);
+ ao_plugin_drain(ao);
g_mutex_lock(ao->mutex);
}
@@ -644,7 +641,7 @@ static gpointer audio_output_task(gpointer arg)
if (ao->open) {
g_mutex_unlock(ao->mutex);
- ao_plugin_cancel(ao->plugin, ao->data);
+ ao_plugin_cancel(ao);
g_mutex_lock(ao->mutex);
}