summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-09-07 22:41:22 +0200
committerMax Kellermann <max@duempel.org>2008-09-07 22:41:22 +0200
commit3b09c54b6769c7e0c8152dde2850a88f51e2f3d9 (patch)
tree30f28b2bfb230ce6674a08231ead1d3eac032164
parentbed2a49fe97b8f070ace2dd37909bb06540c66bd (diff)
output: renamed typedef AudioOutput to struct audio_output
Also rename AudioOutputPlugin to struct audio_output_plugin, and use forward declarations to reduce include dependencies.
-rw-r--r--src/audio.c9
-rw-r--r--src/audioOutput.c31
-rw-r--r--src/audioOutput.h43
-rw-r--r--src/audioOutputs/audioOutput_alsa.c15
-rw-r--r--src/audioOutputs/audioOutput_ao.c14
-rw-r--r--src/audioOutputs/audioOutput_fifo.c15
-rw-r--r--src/audioOutputs/audioOutput_jack.c24
-rw-r--r--src/audioOutputs/audioOutput_mvp.c15
-rw-r--r--src/audioOutputs/audioOutput_null.c12
-rw-r--r--src/audioOutputs/audioOutput_oss.c21
-rw-r--r--src/audioOutputs/audioOutput_osx.c15
-rw-r--r--src/audioOutputs/audioOutput_pulse.c15
-rw-r--r--src/audioOutputs/audioOutput_shout.c20
-rw-r--r--src/output_api.h24
14 files changed, 142 insertions, 131 deletions
diff --git a/src/audio.c b/src/audio.c
index 0650f364c..b6242b425 100644
--- a/src/audio.c
+++ b/src/audio.c
@@ -19,6 +19,7 @@
#include "audio.h"
#include "audio_format.h"
#include "audioOutput.h"
+#include "output_api.h"
#include "log.h"
#include "path.h"
#include "client.h"
@@ -33,7 +34,7 @@ static struct audio_format audio_format;
static struct audio_format *audio_configFormat;
-static AudioOutput *audioOutputArray;
+static struct audio_output *audioOutputArray;
static unsigned int audioOutputArraySize;
enum ad_state {
@@ -107,11 +108,11 @@ void initAudioDriver(void)
audioOutputArraySize = audio_output_count();
audioDeviceStates = xmalloc(sizeof(enum ad_state) *
audioOutputArraySize);
- audioOutputArray = xmalloc(sizeof(AudioOutput) * audioOutputArraySize);
+ audioOutputArray = xmalloc(sizeof(struct audio_output) * audioOutputArraySize);
for (i = 0; i < audioOutputArraySize; i++)
{
- AudioOutput *output = &audioOutputArray[i];
+ struct audio_output *output = &audioOutputArray[i];
unsigned int j;
param = getNextConfigParam(CONF_AUDIO_OUTPUT, param);
@@ -266,7 +267,7 @@ int isCurrentAudioFormat(const struct audio_format *audioFormat)
static void syncAudioDeviceStates(void)
{
- AudioOutput *audioOutput;
+ struct audio_output *audioOutput;
unsigned int i;
if (!audio_format.channels)
diff --git a/src/audioOutput.c b/src/audioOutput.c
index 47e6dbc94..0326f135f 100644
--- a/src/audioOutput.c
+++ b/src/audioOutput.c
@@ -17,6 +17,7 @@
*/
#include "audioOutput.h"
+#include "output_api.h"
#include "list.h"
#include "log.h"
@@ -31,7 +32,7 @@
static List *audioOutputPluginList;
-void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
+void loadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin)
{
if (!audioOutputPlugin->name)
return;
@@ -39,7 +40,7 @@ void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
audioOutputPlugin);
}
-void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
+void unloadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin)
{
if (!audioOutputPlugin->name)
return;
@@ -66,14 +67,14 @@ void finishAudioOutputPlugins(void)
if(bp) str = bp->value; \
}
-int initAudioOutput(AudioOutput *ao, ConfigParam * param)
+int initAudioOutput(struct audio_output *ao, ConfigParam * param)
{
void *data = NULL;
const char *name = NULL;
char *format = NULL;
const char *type = NULL;
BlockParam *bp = NULL;
- AudioOutputPlugin *plugin = NULL;
+ struct audio_output_plugin *plugin = NULL;
if (param) {
getBlockParam(AUDIO_OUTPUT_NAME, name, 1);
@@ -85,7 +86,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
"\"%s\" at line %i\n", type, param->line);
}
- plugin = (AudioOutputPlugin *) data;
+ plugin = (struct audio_output_plugin *) data;
} else {
ListNode *node = audioOutputPluginList->firstNode;
@@ -94,7 +95,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
WARNING("Attempt to detect audio output device\n");
while (node) {
- plugin = (AudioOutputPlugin *) node->data;
+ plugin = (struct audio_output_plugin *) node->data;
if (plugin->testDefaultDeviceFunc) {
WARNING("Attempting to detect a %s audio "
"device\n", plugin->name);
@@ -152,7 +153,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
return 1;
}
-int openAudioOutput(AudioOutput * audioOutput,
+int openAudioOutput(struct audio_output *audioOutput,
const struct audio_format *audioFormat)
{
int ret = 0;
@@ -184,7 +185,7 @@ int openAudioOutput(AudioOutput * audioOutput,
return ret;
}
-static void convertAudioFormat(AudioOutput * audioOutput,
+static void convertAudioFormat(struct audio_output *audioOutput,
const char **chunkArgPtr, size_t *sizeArgPtr)
{
size_t size = pcm_sizeOfConvBuffer(&(audioOutput->inAudioFormat),
@@ -207,7 +208,7 @@ static void convertAudioFormat(AudioOutput * audioOutput,
*chunkArgPtr = audioOutput->convBuffer;
}
-int playAudioOutput(AudioOutput * audioOutput,
+int playAudioOutput(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
int ret;
@@ -224,19 +225,19 @@ int playAudioOutput(AudioOutput * audioOutput,
return ret;
}
-void dropBufferedAudioOutput(AudioOutput * audioOutput)
+void dropBufferedAudioOutput(struct audio_output *audioOutput)
{
if (audioOutput->open)
audioOutput->dropBufferedAudioFunc(audioOutput);
}
-void closeAudioOutput(AudioOutput * audioOutput)
+void closeAudioOutput(struct audio_output *audioOutput)
{
if (audioOutput->open)
audioOutput->closeDeviceFunc(audioOutput);
}
-void finishAudioOutput(AudioOutput * audioOutput)
+void finishAudioOutput(struct audio_output *audioOutput)
{
closeAudioOutput(audioOutput);
if (audioOutput->finishDriverFunc)
@@ -245,7 +246,7 @@ void finishAudioOutput(AudioOutput * audioOutput)
free(audioOutput->convBuffer);
}
-void sendMetadataToAudioOutput(AudioOutput * audioOutput,
+void sendMetadataToAudioOutput(struct audio_output *audioOutput,
const struct tag *tag)
{
if (!audioOutput->sendMetdataFunc)
@@ -256,10 +257,10 @@ void sendMetadataToAudioOutput(AudioOutput * audioOutput,
void printAllOutputPluginTypes(FILE * fp)
{
ListNode *node = audioOutputPluginList->firstNode;
- AudioOutputPlugin *plugin;
+ struct audio_output_plugin *plugin;
while (node) {
- plugin = (AudioOutputPlugin *) node->data;
+ plugin = (struct audio_output_plugin *) node->data;
fprintf(fp, "%s ", plugin->name);
node = node->nextNode;
}
diff --git a/src/audioOutput.h b/src/audioOutput.h
index 82767343b..fa8c9824d 100644
--- a/src/audioOutput.h
+++ b/src/audioOutput.h
@@ -19,44 +19,45 @@
#ifndef AUDIO_OUTPUT_H
#define AUDIO_OUTPUT_H
-#include "output_api.h"
#include "../config.h"
#include "conf.h"
#include "os_compat.h"
+struct audio_output;
+struct audio_output_plugin;
struct audio_format;
struct tag;
void initAudioOutputPlugins(void);
void finishAudioOutputPlugins(void);
-void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
-void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
+void loadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin);
+void unloadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin);
-int initAudioOutput(AudioOutput *, ConfigParam * param);
-int openAudioOutput(AudioOutput * audioOutput,
+int initAudioOutput(struct audio_output *, ConfigParam * param);
+int openAudioOutput(struct audio_output *audioOutput,
const struct audio_format *audioFormat);
-int playAudioOutput(AudioOutput * audioOutput,
+int playAudioOutput(struct audio_output *audioOutput,
const char *playChunk, size_t size);
-void dropBufferedAudioOutput(AudioOutput * audioOutput);
-void closeAudioOutput(AudioOutput * audioOutput);
-void finishAudioOutput(AudioOutput * audioOutput);
-int keepAudioOutputAlive(AudioOutput * audioOutput, int ms);
-void sendMetadataToAudioOutput(AudioOutput * audioOutput,
+void dropBufferedAudioOutput(struct audio_output *audioOutput);
+void closeAudioOutput(struct audio_output *audioOutput);
+void finishAudioOutput(struct audio_output *audioOutput);
+int keepAudioOutputAlive(struct audio_output *audioOutput, int ms);
+void sendMetadataToAudioOutput(struct audio_output *audioOutput,
const struct tag *tag);
void printAllOutputPluginTypes(FILE * fp);
-extern AudioOutputPlugin shoutPlugin;
-extern AudioOutputPlugin nullPlugin;
-extern AudioOutputPlugin fifoPlugin;
-extern AudioOutputPlugin alsaPlugin;
-extern AudioOutputPlugin aoPlugin;
-extern AudioOutputPlugin ossPlugin;
-extern AudioOutputPlugin osxPlugin;
-extern AudioOutputPlugin pulsePlugin;
-extern AudioOutputPlugin mvpPlugin;
-extern AudioOutputPlugin jackPlugin;
+extern struct audio_output_plugin shoutPlugin;
+extern struct audio_output_plugin nullPlugin;
+extern struct audio_output_plugin fifoPlugin;
+extern struct audio_output_plugin alsaPlugin;
+extern struct audio_output_plugin aoPlugin;
+extern struct audio_output_plugin ossPlugin;
+extern struct audio_output_plugin osxPlugin;
+extern struct audio_output_plugin pulsePlugin;
+extern struct audio_output_plugin mvpPlugin;
+extern struct audio_output_plugin jackPlugin;
#endif
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 3021d59da..9917c4629 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -72,7 +72,8 @@ static void freeAlsaData(AlsaData * ad)
free(ad);
}
-static int alsa_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int alsa_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
AlsaData *ad = newAlsaData();
@@ -94,7 +95,7 @@ static int alsa_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0;
}
-static void alsa_finishDriver(AudioOutput * audioOutput)
+static void alsa_finishDriver(struct audio_output *audioOutput)
{
AlsaData *ad = audioOutput->data;
@@ -119,7 +120,7 @@ static int alsa_testDefault(void)
return 0;
}
-static int alsa_openDevice(AudioOutput * audioOutput)
+static int alsa_openDevice(struct audio_output *audioOutput)
{
AlsaData *ad = audioOutput->data;
struct audio_format *audioFormat = &audioOutput->outAudioFormat;
@@ -358,14 +359,14 @@ static int alsa_errorRecovery(AlsaData * ad, int err)
return err;
}
-static void alsa_dropBufferedAudio(AudioOutput * audioOutput)
+static void alsa_dropBufferedAudio(struct audio_output *audioOutput)
{
AlsaData *ad = audioOutput->data;
alsa_errorRecovery(ad, snd_pcm_drop(ad->pcmHandle));
}
-static void alsa_closeDevice(AudioOutput * audioOutput)
+static void alsa_closeDevice(struct audio_output *audioOutput)
{
AlsaData *ad = audioOutput->data;
@@ -380,7 +381,7 @@ static void alsa_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0;
}
-static int alsa_playAudio(AudioOutput * audioOutput,
+static int alsa_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
AlsaData *ad = audioOutput->data;
@@ -412,7 +413,7 @@ static int alsa_playAudio(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin alsaPlugin = {
+struct audio_output_plugin alsaPlugin = {
"alsa",
alsa_testDefault,
alsa_initDriver,
diff --git a/src/audioOutputs/audioOutput_ao.c b/src/audioOutputs/audioOutput_ao.c
index 8c049fb2f..b02884751 100644
--- a/src/audioOutputs/audioOutput_ao.c
+++ b/src/audioOutputs/audioOutput_ao.c
@@ -54,7 +54,7 @@ static void audioOutputAo_error(void)
}
}
-static int audioOutputAo_initDriver(AudioOutput * audioOutput,
+static int audioOutputAo_initDriver(struct audio_output *audioOutput,
ConfigParam * param)
{
ao_info *ai;
@@ -146,7 +146,7 @@ static void freeAoData(AoData * ad)
free(ad);
}
-static void audioOutputAo_finishDriver(AudioOutput * audioOutput)
+static void audioOutputAo_finishDriver(struct audio_output *audioOutput)
{
AoData *ad = (AoData *) audioOutput->data;
freeAoData(ad);
@@ -157,12 +157,12 @@ static void audioOutputAo_finishDriver(AudioOutput * audioOutput)
ao_shutdown();
}
-static void audioOutputAo_dropBufferedAudio(mpd_unused AudioOutput * audioOutput)
+static void audioOutputAo_dropBufferedAudio(mpd_unused struct audio_output *audioOutput)
{
/* not supported by libao */
}
-static void audioOutputAo_closeDevice(AudioOutput * audioOutput)
+static void audioOutputAo_closeDevice(struct audio_output *audioOutput)
{
AoData *ad = (AoData *) audioOutput->data;
@@ -174,7 +174,7 @@ static void audioOutputAo_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0;
}
-static int audioOutputAo_openDevice(AudioOutput * audioOutput)
+static int audioOutputAo_openDevice(struct audio_output *audioOutput)
{
ao_sample_format format;
AoData *ad = (AoData *) audioOutput->data;
@@ -215,7 +215,7 @@ static int ao_play_deconst(ao_device *device, const void *output_samples,
return ao_play(device, u.out, num_bytes);
}
-static int audioOutputAo_play(AudioOutput * audioOutput,
+static int audioOutputAo_play(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
size_t chunk_size;
@@ -242,7 +242,7 @@ static int audioOutputAo_play(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin aoPlugin = {
+struct audio_output_plugin aoPlugin = {
"ao",
NULL,
audioOutputAo_initDriver,
diff --git a/src/audioOutputs/audioOutput_fifo.c b/src/audioOutputs/audioOutput_fifo.c
index a539856c1..60c951387 100644
--- a/src/audioOutputs/audioOutput_fifo.c
+++ b/src/audioOutputs/audioOutput_fifo.c
@@ -151,7 +151,8 @@ static int openFifo(FifoData *fd)
return 0;
}
-static int fifo_initDriver(AudioOutput *audioOutput, ConfigParam *param)
+static int fifo_initDriver(struct audio_output *audioOutput,
+ ConfigParam *param)
{
FifoData *fd;
BlockParam *blockParam;
@@ -181,7 +182,7 @@ static int fifo_initDriver(AudioOutput *audioOutput, ConfigParam *param)
return 0;
}
-static void fifo_finishDriver(AudioOutput *audioOutput)
+static void fifo_finishDriver(struct audio_output *audioOutput)
{
FifoData *fd = (FifoData *)audioOutput->data;
@@ -189,7 +190,7 @@ static void fifo_finishDriver(AudioOutput *audioOutput)
freeFifoData(fd);
}
-static int fifo_openDevice(AudioOutput *audioOutput)
+static int fifo_openDevice(struct audio_output *audioOutput)
{
FifoData *fd = (FifoData *)audioOutput->data;
@@ -203,7 +204,7 @@ static int fifo_openDevice(AudioOutput *audioOutput)
return 0;
}
-static void fifo_closeDevice(AudioOutput *audioOutput)
+static void fifo_closeDevice(struct audio_output *audioOutput)
{
FifoData *fd = (FifoData *)audioOutput->data;
@@ -215,7 +216,7 @@ static void fifo_closeDevice(AudioOutput *audioOutput)
audioOutput->open = 0;
}
-static void fifo_dropBufferedAudio(AudioOutput *audioOutput)
+static void fifo_dropBufferedAudio(struct audio_output *audioOutput)
{
FifoData *fd = (FifoData *)audioOutput->data;
char buf[FIFO_BUFFER_SIZE];
@@ -232,7 +233,7 @@ static void fifo_dropBufferedAudio(AudioOutput *audioOutput)
}
}
-static int fifo_playAudio(AudioOutput *audioOutput,
+static int fifo_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
FifoData *fd = (FifoData *)audioOutput->data;
@@ -271,7 +272,7 @@ static int fifo_playAudio(AudioOutput *audioOutput,
return 0;
}
-AudioOutputPlugin fifoPlugin = {
+struct audio_output_plugin fifoPlugin = {
"fifo",
NULL, /* testDefaultDeviceFunc */
fifo_initDriver,
diff --git a/src/audioOutputs/audioOutput_jack.c b/src/audioOutputs/audioOutput_jack.c
index 9fef6f439..884a3d197 100644
--- a/src/audioOutputs/audioOutput_jack.c
+++ b/src/audioOutputs/audioOutput_jack.c
@@ -87,7 +87,7 @@ static void freeJackClient(JackData *jd)
pthread_cond_destroy(&jd->play_audio);
}
-static void freeJackData(AudioOutput *audioOutput)
+static void freeJackData(struct audio_output *audioOutput)
{
JackData *jd = audioOutput->data;
int i;
@@ -108,7 +108,7 @@ static void freeJackData(AudioOutput *audioOutput)
free(jd);
}
-static void jack_finishDriver(AudioOutput *audioOutput)
+static void jack_finishDriver(struct audio_output *audioOutput)
{
freeJackData(audioOutput);
DEBUG("disconnect_jack (pid=%d)\n", getpid ());
@@ -116,8 +116,8 @@ static void jack_finishDriver(AudioOutput *audioOutput)
static int srate(mpd_unused jack_nframes_t rate, void *data)
{
- JackData *jd = (JackData *) ((AudioOutput*) data)->data;
- struct audio_format *audioFormat = &(((AudioOutput*) data)->outAudioFormat);
+ JackData *jd = (JackData *) ((struct audio_output *) data)->data;
+ struct audio_format *audioFormat = &(((struct audio_output *) data)->outAudioFormat);
audioFormat->sampleRate = (int)jack_get_sample_rate(jd->client);
@@ -179,7 +179,7 @@ static void shutdown_callback(void *arg)
jd->shutdown = 1;
}
-static void set_audioformat(AudioOutput *audioOutput)
+static void set_audioformat(struct audio_output *audioOutput)
{
JackData *jd = audioOutput->data;
struct audio_format *audioFormat = &audioOutput->outAudioFormat;
@@ -198,7 +198,7 @@ static void error_callback(const char *msg)
ERROR("jack: %s\n", msg);
}
-static int jack_initDriver(AudioOutput *audioOutput, ConfigParam *param)
+static int jack_initDriver(struct audio_output *audioOutput, ConfigParam *param)
{
JackData *jd;
BlockParam *bp;
@@ -264,7 +264,7 @@ static int jack_testDefault(void)
return 0;
}
-static int connect_jack(AudioOutput *audioOutput)
+static int connect_jack(struct audio_output *audioOutput)
{
JackData *jd = audioOutput->data;
const char **jports;
@@ -345,7 +345,7 @@ static int connect_jack(AudioOutput *audioOutput)
return 1;
}
-static int jack_openDevice(AudioOutput *audioOutput)
+static int jack_openDevice(struct audio_output *audioOutput)
{
JackData *jd = audioOutput->data;
@@ -365,18 +365,18 @@ static int jack_openDevice(AudioOutput *audioOutput)
}
-static void jack_closeDevice(AudioOutput * audioOutput)
+static void jack_closeDevice(struct audio_output *audioOutput)
{
/*jack_finishDriver(audioOutput);*/
audioOutput->open = 0;
DEBUG("jack_closeDevice (pid=%d)\n", getpid());
}
-static void jack_dropBufferedAudio (mpd_unused AudioOutput * audioOutput)
+static void jack_dropBufferedAudio (mpd_unused struct audio_output *audioOutput)
{
}
-static int jack_playAudio(AudioOutput * audioOutput,
+static int jack_playAudio(struct audio_output *audioOutput,
const char *buff, size_t size)
{
JackData *jd = audioOutput->data;
@@ -430,7 +430,7 @@ static int jack_playAudio(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin jackPlugin = {
+struct audio_output_plugin jackPlugin = {
"jack",
jack_testDefault,
jack_initDriver,
diff --git a/src/audioOutputs/audioOutput_mvp.c b/src/audioOutputs/audioOutput_mvp.c
index 59e40f472..c232b73b1 100644
--- a/src/audioOutputs/audioOutput_mvp.c
+++ b/src/audioOutputs/audioOutput_mvp.c
@@ -93,7 +93,8 @@ static int mvp_testDefault(void)
return -1;
}
-static int mvp_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int mvp_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
MvpData *md = xmalloc(sizeof(MvpData));
md->fd = -1;
@@ -102,7 +103,7 @@ static int mvp_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0;
}
-static void mvp_finishDriver(AudioOutput * audioOutput)
+static void mvp_finishDriver(struct audio_output *audioOutput)
{
MvpData *md = audioOutput->data;
free(md);
@@ -171,7 +172,7 @@ static int mvp_setPcmParams(MvpData * md, unsigned long rate, int channels,
return 0;
}
-static int mvp_openDevice(AudioOutput * audioOutput)
+static int mvp_openDevice(struct audio_output *audioOutput)
{
long long int stc = 0;
MvpData *md = audioOutput->data;
@@ -210,7 +211,7 @@ static int mvp_openDevice(AudioOutput * audioOutput)
return 0;
}
-static void mvp_closeDevice(AudioOutput * audioOutput)
+static void mvp_closeDevice(struct audio_output *audioOutput)
{
MvpData *md = audioOutput->data;
if (md->fd >= 0)
@@ -219,7 +220,7 @@ static void mvp_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0;
}
-static void mvp_dropBufferedAudio(AudioOutput * audioOutput)
+static void mvp_dropBufferedAudio(struct audio_output *audioOutput)
{
MvpData *md = audioOutput->data;
if (md->fd >= 0) {
@@ -230,7 +231,7 @@ static void mvp_dropBufferedAudio(AudioOutput * audioOutput)
}
}
-static int mvp_playAudio(AudioOutput * audioOutput,
+static int mvp_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
MvpData *md = audioOutput->data;
@@ -256,7 +257,7 @@ static int mvp_playAudio(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin mvpPlugin = {
+struct audio_output_plugin mvpPlugin = {
"mvp",
mvp_testDefault,
mvp_initDriver,
diff --git a/src/audioOutputs/audioOutput_null.c b/src/audioOutputs/audioOutput_null.c
index ed4c46309..eea1cfcbe 100644
--- a/src/audioOutputs/audioOutput_null.c
+++ b/src/audioOutputs/audioOutput_null.c
@@ -19,21 +19,21 @@
#include "../output_api.h"
#include "../timer.h"
-static int null_initDriver(AudioOutput *audioOutput,
+static int null_initDriver(struct audio_output *audioOutput,
mpd_unused ConfigParam *param)
{
audioOutput->data = NULL;
return 0;
}
-static int null_openDevice(AudioOutput *audioOutput)
+static int null_openDevice(struct audio_output *audioOutput)
{
audioOutput->data = timer_new(&audioOutput->outAudioFormat);
audioOutput->open = 1;
return 0;
}
-static void null_closeDevice(AudioOutput *audioOutput)
+static void null_closeDevice(struct audio_output *audioOutput)
{
if (audioOutput->data) {
timer_free(audioOutput->data);
@@ -43,7 +43,7 @@ static void null_closeDevice(AudioOutput *audioOutput)
audioOutput->open = 0;
}
-static int null_playAudio(AudioOutput *audioOutput,
+static int null_playAudio(struct audio_output *audioOutput,
mpd_unused const char *playChunk, size_t size)
{
Timer *timer = audioOutput->data;
@@ -58,12 +58,12 @@ static int null_playAudio(AudioOutput *audioOutput,
return 0;
}
-static void null_dropBufferedAudio(AudioOutput *audioOutput)
+static void null_dropBufferedAudio(struct audio_output *audioOutput)
{
timer_reset(audioOutput->data);
}
-AudioOutputPlugin nullPlugin = {
+struct audio_output_plugin nullPlugin = {
"null",
NULL,
null_initDriver,
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c
index aea33be82..a6c385c71 100644
--- a/src/audioOutputs/audioOutput_oss.c
+++ b/src/audioOutputs/audioOutput_oss.c
@@ -333,8 +333,8 @@ static int oss_testDefault(void)
return -1;
}
-static int oss_open_default(mpd_unused AudioOutput *ao, ConfigParam *param,
- OssData *od)
+static int oss_open_default(mpd_unused struct audio_output *ao,
+ ConfigParam *param, OssData *od)
{
int i;
int err[ARRAY_SIZE(default_devices)];
@@ -374,7 +374,8 @@ static int oss_open_default(mpd_unused AudioOutput *ao, ConfigParam *param,
return 0; /* some compilers can be dumb... */
}
-static int oss_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int oss_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
OssData *od = newOssData();
audioOutput->data = od;
@@ -388,7 +389,7 @@ static int oss_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return oss_open_default(audioOutput, param, od);
}
-static void oss_finishDriver(AudioOutput * audioOutput)
+static void oss_finishDriver(struct audio_output *audioOutput)
{
OssData *od = audioOutput->data;
@@ -432,7 +433,7 @@ static void oss_close(OssData * od)
od->fd = -1;
}
-static int oss_open(AudioOutput * audioOutput)
+static int oss_open(struct audio_output *audioOutput)
{
int tmp;
OssData *od = audioOutput->data;
@@ -479,7 +480,7 @@ fail:
return -1;
}
-static int oss_openDevice(AudioOutput * audioOutput)
+static int oss_openDevice(struct audio_output *audioOutput)
{
int ret;
OssData *od = audioOutput->data;
@@ -502,7 +503,7 @@ static int oss_openDevice(AudioOutput * audioOutput)
return ret;
}
-static void oss_closeDevice(AudioOutput * audioOutput)
+static void oss_closeDevice(struct audio_output *audioOutput)
{
OssData *od = audioOutput->data;
@@ -511,7 +512,7 @@ static void oss_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0;
}
-static void oss_dropBufferedAudio(AudioOutput * audioOutput)
+static void oss_dropBufferedAudio(struct audio_output *audioOutput)
{
OssData *od = audioOutput->data;
@@ -521,7 +522,7 @@ static void oss_dropBufferedAudio(AudioOutput * audioOutput)
}
}
-static int oss_playAudio(AudioOutput * audioOutput,
+static int oss_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
OssData *od = audioOutput->data;
@@ -548,7 +549,7 @@ static int oss_playAudio(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin ossPlugin = {
+struct audio_output_plugin ossPlugin = {
"oss",
oss_testDefault,
oss_initDriver,
diff --git a/src/audioOutputs/audioOutput_osx.c b/src/audioOutputs/audioOutput_osx.c
index f0fee15e9..1cdcb473c 100644
--- a/src/audioOutputs/audioOutput_osx.c
+++ b/src/audioOutputs/audioOutput_osx.c
@@ -80,7 +80,8 @@ static int osx_testDefault()
return 0;
}
-static int osx_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int osx_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
OsxData *od = newOsxData();
@@ -98,13 +99,13 @@ static void freeOsxData(OsxData * od)
free(od);
}
-static void osx_finishDriver(AudioOutput * audioOutput)
+static void osx_finishDriver(struct audio_output *audioOutput)
{
OsxData *od = (OsxData *) audioOutput->data;
freeOsxData(od);
}
-static void osx_dropBufferedAudio(AudioOutput * audioOutput)
+static void osx_dropBufferedAudio(struct audio_output *audioOutput)
{
OsxData *od = (OsxData *) audioOutput->data;
@@ -113,7 +114,7 @@ static void osx_dropBufferedAudio(AudioOutput * audioOutput)
pthread_mutex_unlock(&od->mutex);
}
-static void osx_closeDevice(AudioOutput * audioOutput)
+static void osx_closeDevice(struct audio_output *audioOutput)
{
OsxData *od = (OsxData *) audioOutput->data;
@@ -215,7 +216,7 @@ static OSStatus osx_render(void *vdata,
return 0;
}
-static int osx_openDevice(AudioOutput * audioOutput)
+static int osx_openDevice(struct audio_output *audioOutput)
{
OsxData *od = (OsxData *) audioOutput->data;
ComponentDescription desc;
@@ -295,7 +296,7 @@ static int osx_openDevice(AudioOutput * audioOutput)
return 0;
}
-static int osx_play(AudioOutput * audioOutput,
+static int osx_play(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
OsxData *od = (OsxData *) audioOutput->data;
@@ -354,7 +355,7 @@ static int osx_play(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin osxPlugin = {
+struct audio_output_plugin osxPlugin = {
"osx",
osx_testDefault,
osx_initDriver,
diff --git a/src/audioOutputs/audioOutput_pulse.c b/src/audioOutputs/audioOutput_pulse.c
index 6151787f0..6d9b385ca 100644
--- a/src/audioOutputs/audioOutput_pulse.c
+++ b/src/audioOutputs/audioOutput_pulse.c
@@ -61,7 +61,8 @@ static void freePulseData(PulseData * pd)
free(pd);
}
-static int pulse_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int pulse_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
BlockParam *server = NULL;
BlockParam *sink = NULL;
@@ -80,7 +81,7 @@ static int pulse_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0;
}
-static void pulse_finishDriver(AudioOutput * audioOutput)
+static void pulse_finishDriver(struct audio_output *audioOutput)
{
freePulseData((PulseData *) audioOutput->data);
}
@@ -108,7 +109,7 @@ static int pulse_testDefault(void)
return 0;
}
-static int pulse_openDevice(AudioOutput * audioOutput)
+static int pulse_openDevice(struct audio_output *audioOutput)
{
PulseData *pd;
struct audio_format *audioFormat;
@@ -157,7 +158,7 @@ static int pulse_openDevice(AudioOutput * audioOutput)
return 0;
}
-static void pulse_dropBufferedAudio(AudioOutput * audioOutput)
+static void pulse_dropBufferedAudio(struct audio_output *audioOutput)
{
PulseData *pd;
int error;
@@ -168,7 +169,7 @@ static void pulse_dropBufferedAudio(AudioOutput * audioOutput)
audioOutput->name, pa_strerror(error));
}
-static void pulse_closeDevice(AudioOutput * audioOutput)
+static void pulse_closeDevice(struct audio_output *audioOutput)
{
PulseData *pd;
@@ -181,7 +182,7 @@ static void pulse_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0;
}
-static int pulse_playAudio(AudioOutput * audioOutput,
+static int pulse_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
PulseData *pd;
@@ -199,7 +200,7 @@ static int pulse_playAudio(AudioOutput * audioOutput,
return 0;
}
-AudioOutputPlugin pulsePlugin = {
+struct audio_output_plugin pulsePlugin = {
"pulse",
pulse_testDefault,
pulse_initDriver,
diff --git a/src/audioOutputs/audioOutput_shout.c b/src/audioOutputs/audioOutput_shout.c
index c7677555c..ee21fabe6 100644
--- a/src/audioOutputs/audioOutput_shout.c
+++ b/src/audioOutputs/audioOutput_shout.c
@@ -107,7 +107,8 @@ static void freeShoutData(ShoutData * sd)
} \
}
-static int myShout_initDriver(AudioOutput * audioOutput, ConfigParam * param)
+static int myShout_initDriver(struct audio_output *audioOutput,
+ ConfigParam * param)
{
ShoutData *sd;
char *test;
@@ -351,7 +352,7 @@ static void myShout_closeShoutConn(ShoutData * sd)
sd->opened = 0;
}
-static void myShout_finishDriver(AudioOutput * audioOutput)
+static void myShout_finishDriver(struct audio_output *audioOutput)
{
ShoutData *sd = (ShoutData *) audioOutput->data;
@@ -365,7 +366,7 @@ static void myShout_finishDriver(AudioOutput * audioOutput)
shout_shutdown();
}
-static void myShout_dropBufferedAudio(AudioOutput * audioOutput)
+static void myShout_dropBufferedAudio(struct audio_output *audioOutput)
{
ShoutData *sd = (ShoutData *)audioOutput->data;
timer_reset(sd->timer);
@@ -373,7 +374,7 @@ static void myShout_dropBufferedAudio(AudioOutput * audioOutput)
/* needs to be implemented for shout */
}
-static void myShout_closeDevice(AudioOutput * audioOutput)
+static void myShout_closeDevice(struct audio_output *audioOutput)
{
ShoutData *sd = (ShoutData *) audioOutput->data;
@@ -509,7 +510,7 @@ static int myShout_connect(ShoutData *sd)
}
}
-static int myShout_openShoutConn(AudioOutput * audioOutput)
+static int myShout_openShoutConn(struct audio_output *audioOutput)
{
ShoutData *sd = (ShoutData *) audioOutput->data;
int status;
@@ -550,7 +551,7 @@ static int myShout_openShoutConn(AudioOutput * audioOutput)
return 0;
}
-static int myShout_openDevice(AudioOutput * audioOutput)
+static int myShout_openDevice(struct audio_output *audioOutput)
{
ShoutData *sd = (ShoutData *) audioOutput->data;
@@ -598,7 +599,7 @@ static void myShout_sendMetadata(ShoutData * sd)
sd->tagToSend = 0;
}
-static int myShout_play(AudioOutput * audioOutput,
+static int myShout_play(struct audio_output *audioOutput,
const char *playChunk, size_t size)
{
unsigned int i;
@@ -662,7 +663,8 @@ static int myShout_play(AudioOutput * audioOutput,
return 0;
}
-static void myShout_setTag(AudioOutput * audioOutput, const struct tag *tag)
+static void myShout_setTag(struct audio_output *audioOutput,
+ const struct tag *tag)
{
ShoutData *sd = (ShoutData *) audioOutput->data;
@@ -678,7 +680,7 @@ static void myShout_setTag(AudioOutput * audioOutput, const struct tag *tag)
sd->tagToSend = 1;
}
-AudioOutputPlugin shoutPlugin = {
+struct audio_output_plugin shoutPlugin = {
"shout",
NULL,
myShout_initDriver,
diff --git a/src/output_api.h b/src/output_api.h
index 7391af1c7..c73e30a20 100644
--- a/src/output_api.h
+++ b/src/output_api.h
@@ -28,30 +28,30 @@
#include "log.h"
#include "os_compat.h"
-#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) AudioOutputPlugin plugin;
+#define DISABLED_AUDIO_OUTPUT_PLUGIN(plugin) struct audio_output_plugin plugin;
-typedef struct _AudioOutput AudioOutput;
+struct audio_output;
typedef int (*AudioOutputTestDefaultDeviceFunc) (void);
-typedef int (*AudioOutputInitDriverFunc) (AudioOutput * audioOutput,
+typedef int (*AudioOutputInitDriverFunc) (struct audio_output *audioOutput,
ConfigParam * param);
-typedef void (*AudioOutputFinishDriverFunc) (AudioOutput * audioOutput);
+typedef void (*AudioOutputFinishDriverFunc) (struct audio_output *audioOutput);
-typedef int (*AudioOutputOpenDeviceFunc) (AudioOutput * audioOutput);
+typedef int (*AudioOutputOpenDeviceFunc) (struct audio_output *audioOutput);
-typedef int (*AudioOutputPlayFunc) (AudioOutput * audioOutput,
+typedef int (*AudioOutputPlayFunc) (struct audio_output *audioOutput,
const char *playChunk, size_t size);
-typedef void (*AudioOutputDropBufferedAudioFunc) (AudioOutput * audioOutput);
+typedef void (*AudioOutputDropBufferedAudioFunc) (struct audio_output *audioOutput);
-typedef void (*AudioOutputCloseDeviceFunc) (AudioOutput * audioOutput);
+typedef void (*AudioOutputCloseDeviceFunc) (struct audio_output *audioOutput);
-typedef void (*AudioOutputSendMetadataFunc) (AudioOutput * audioOutput,
+typedef void (*AudioOutputSendMetadataFunc) (struct audio_output *audioOutput,
const struct tag *tag);
-typedef struct _AudioOutputPlugin {
+struct audio_output_plugin {
const char *name;
AudioOutputTestDefaultDeviceFunc testDefaultDeviceFunc;
@@ -62,9 +62,9 @@ typedef struct _AudioOutputPlugin {
AudioOutputDropBufferedAudioFunc dropBufferedAudioFunc;
AudioOutputCloseDeviceFunc closeDeviceFunc;
AudioOutputSendMetadataFunc sendMetdataFunc;
-} AudioOutputPlugin;
+};
-struct _AudioOutput {
+struct audio_output {
int open;
const char *name;
const char *type;