aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_thread.c
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-24 07:20:55 +0200
committerMax Kellermann <max@duempel.org>2008-09-24 07:20:55 +0200
commitacc4a0ba2dd0be3f28c4ca009e08d1cc1bbc534a (patch)
tree7d4ea0359c85f67d0366fb58ae80c8aa35f3a473 /src/output_thread.c
parent63fb1efb5cd6665b73ced155ba89a5c7f094d9ab (diff)
downloadmpd-acc4a0ba2dd0be3f28c4ca009e08d1cc1bbc534a.tar.gz
mpd-acc4a0ba2dd0be3f28c4ca009e08d1cc1bbc534a.tar.xz
mpd-acc4a0ba2dd0be3f28c4ca009e08d1cc1bbc534a.zip
output: make "struct audio_output" opaque for output plugins
We have eliminated direct accesses to the audio_output struct from the all output plugins. Make it opaque for them, and move its real declaration to output_internal.h, similar to decoder_internal.h. Pass the opaque structure to plugin.init() only, which will return the plugin's data pointer on success, and NULL on failure. This data pointer will be passed to all other methods instead of the audio_output struct.
Diffstat (limited to 'src/output_thread.c')
-rw-r--r--src/output_thread.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/output_thread.c b/src/output_thread.c
index 3f410958c..a92f0bafd 100644
--- a/src/output_thread.c
+++ b/src/output_thread.c
@@ -18,6 +18,7 @@
#include "output_thread.h"
#include "output_api.h"
+#include "output_internal.h"
#include "utils.h"
static void ao_command_finished(struct audio_output *ao)
@@ -58,7 +59,7 @@ static void ao_play(struct audio_output *ao)
if (!audio_format_equals(&ao->inAudioFormat, &ao->outAudioFormat))
convertAudioFormat(ao, &data, &size);
- ao->result = ao->plugin->play(ao, data, size);
+ ao->result = ao->plugin->play(ao->data, data, size);
ao_command_finished(ao);
}
@@ -75,7 +76,8 @@ static void *audio_output_task(void *arg)
case AO_COMMAND_OPEN:
assert(!ao->open);
- ao->result = ao->plugin->open(ao, &ao->outAudioFormat);
+ ao->result = ao->plugin->open(ao->data,
+ &ao->outAudioFormat);
assert(!ao->open);
if (ao->result == 0)
@@ -86,7 +88,7 @@ static void *audio_output_task(void *arg)
case AO_COMMAND_CLOSE:
assert(ao->open);
- ao->plugin->close(ao);
+ ao->plugin->close(ao->data);
ao->open = 0;
ao_command_finished(ao);
break;
@@ -96,12 +98,12 @@ static void *audio_output_task(void *arg)
break;
case AO_COMMAND_CANCEL:
- ao->plugin->cancel(ao);
+ ao->plugin->cancel(ao->data);
ao_command_finished(ao);
break;
case AO_COMMAND_SEND_TAG:
- ao->plugin->send_tag(ao, ao->args.tag);
+ ao->plugin->send_tag(ao->data, ao->args.tag);
ao_command_finished(ao);
break;