aboutsummaryrefslogtreecommitdiffstats
path: root/src/output_api.h
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_api.h
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_api.h')
-rw-r--r--src/output_api.h54
1 files changed, 10 insertions, 44 deletions
diff --git a/src/output_api.h b/src/output_api.h
index c8869c47b..e1dce077d 100644
--- a/src/output_api.h
+++ b/src/output_api.h
@@ -21,12 +21,10 @@
#define OUTPUT_API_H
#include "../config.h"
-#include "pcm_utils.h"
#include "audio_format.h"
#include "tag.h"
#include "conf.h"
#include "log.h"
-#include "notify.h"
#include "os_compat.h"
#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) const struct audio_output_plugin plugin;
@@ -38,24 +36,21 @@ struct audio_output_plugin {
int (*test_default_device)(void);
- int (*init)(struct audio_output *ao,
- const struct audio_format *audio_format,
- ConfigParam *param);
+ void *(*init)(struct audio_output *ao,
+ const struct audio_format *audio_format,
+ ConfigParam *param);
- void (*finish)(struct audio_output *ao);
+ void (*finish)(void *data);
- int (*open)(struct audio_output *ao,
- struct audio_format *audio_format);
+ int (*open)(void *data, struct audio_format *audio_format);
- int (*play)(struct audio_output *ao,
- const char *playChunk, size_t size);
+ int (*play)(void *data, const char *playChunk, size_t size);
- void (*cancel)(struct audio_output *ao);
+ void (*cancel)(void *data);
- void (*close)(struct audio_output *ao);
+ void (*close)(void *data);
- void (*send_tag)(struct audio_output *audioOutput,
- const struct tag *tag);
+ void (*send_tag)(void *data, const struct tag *tag);
};
enum audio_output_command {
@@ -68,36 +63,7 @@ enum audio_output_command {
AO_COMMAND_KILL
};
-struct audio_output {
- int open;
- const char *name;
-
- const struct audio_output_plugin *plugin;
-
- struct audio_format inAudioFormat;
- struct audio_format outAudioFormat;
- struct audio_format reqAudioFormat;
- ConvState convState;
- char *convBuffer;
- size_t convBufferLen;
-
- pthread_t thread;
- struct notify notify;
- enum audio_output_command command;
- union {
- struct {
- const char *data;
- size_t size;
- } play;
-
- const struct tag *tag;
- } args;
- int result;
-
- void *data;
-};
-
-extern struct notify audio_output_client_notify;
+struct audio_output;
const char *audio_output_get_name(const struct audio_output *ao);