output: renamed typedef AudioOutput to struct audio_output

Also rename AudioOutputPlugin to struct audio_output_plugin, and use
forward declarations to reduce include dependencies.
This commit is contained in:
Max Kellermann 2008-09-07 22:41:22 +02:00
parent bed2a49fe9
commit 3b09c54b67
14 changed files with 142 additions and 131 deletions

View File

@ -19,6 +19,7 @@
#include "audio.h" #include "audio.h"
#include "audio_format.h" #include "audio_format.h"
#include "audioOutput.h" #include "audioOutput.h"
#include "output_api.h"
#include "log.h" #include "log.h"
#include "path.h" #include "path.h"
#include "client.h" #include "client.h"
@ -33,7 +34,7 @@ static struct audio_format audio_format;
static struct audio_format *audio_configFormat; static struct audio_format *audio_configFormat;
static AudioOutput *audioOutputArray; static struct audio_output *audioOutputArray;
static unsigned int audioOutputArraySize; static unsigned int audioOutputArraySize;
enum ad_state { enum ad_state {
@ -107,11 +108,11 @@ void initAudioDriver(void)
audioOutputArraySize = audio_output_count(); audioOutputArraySize = audio_output_count();
audioDeviceStates = xmalloc(sizeof(enum ad_state) * audioDeviceStates = xmalloc(sizeof(enum ad_state) *
audioOutputArraySize); audioOutputArraySize);
audioOutputArray = xmalloc(sizeof(AudioOutput) * audioOutputArraySize); audioOutputArray = xmalloc(sizeof(struct audio_output) * audioOutputArraySize);
for (i = 0; i < audioOutputArraySize; i++) for (i = 0; i < audioOutputArraySize; i++)
{ {
AudioOutput *output = &audioOutputArray[i]; struct audio_output *output = &audioOutputArray[i];
unsigned int j; unsigned int j;
param = getNextConfigParam(CONF_AUDIO_OUTPUT, param); param = getNextConfigParam(CONF_AUDIO_OUTPUT, param);
@ -266,7 +267,7 @@ int isCurrentAudioFormat(const struct audio_format *audioFormat)
static void syncAudioDeviceStates(void) static void syncAudioDeviceStates(void)
{ {
AudioOutput *audioOutput; struct audio_output *audioOutput;
unsigned int i; unsigned int i;
if (!audio_format.channels) if (!audio_format.channels)

View File

@ -17,6 +17,7 @@
*/ */
#include "audioOutput.h" #include "audioOutput.h"
#include "output_api.h"
#include "list.h" #include "list.h"
#include "log.h" #include "log.h"
@ -31,7 +32,7 @@
static List *audioOutputPluginList; static List *audioOutputPluginList;
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) void loadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin)
{ {
if (!audioOutputPlugin->name) if (!audioOutputPlugin->name)
return; return;
@ -39,7 +40,7 @@ void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin)
audioOutputPlugin); audioOutputPlugin);
} }
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) void unloadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin)
{ {
if (!audioOutputPlugin->name) if (!audioOutputPlugin->name)
return; return;
@ -66,14 +67,14 @@ void finishAudioOutputPlugins(void)
if(bp) str = bp->value; \ if(bp) str = bp->value; \
} }
int initAudioOutput(AudioOutput *ao, ConfigParam * param) int initAudioOutput(struct audio_output *ao, ConfigParam * param)
{ {
void *data = NULL; void *data = NULL;
const char *name = NULL; const char *name = NULL;
char *format = NULL; char *format = NULL;
const char *type = NULL; const char *type = NULL;
BlockParam *bp = NULL; BlockParam *bp = NULL;
AudioOutputPlugin *plugin = NULL; struct audio_output_plugin *plugin = NULL;
if (param) { if (param) {
getBlockParam(AUDIO_OUTPUT_NAME, name, 1); getBlockParam(AUDIO_OUTPUT_NAME, name, 1);
@ -85,7 +86,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
"\"%s\" at line %i\n", type, param->line); "\"%s\" at line %i\n", type, param->line);
} }
plugin = (AudioOutputPlugin *) data; plugin = (struct audio_output_plugin *) data;
} else { } else {
ListNode *node = audioOutputPluginList->firstNode; ListNode *node = audioOutputPluginList->firstNode;
@ -94,7 +95,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
WARNING("Attempt to detect audio output device\n"); WARNING("Attempt to detect audio output device\n");
while (node) { while (node) {
plugin = (AudioOutputPlugin *) node->data; plugin = (struct audio_output_plugin *) node->data;
if (plugin->testDefaultDeviceFunc) { if (plugin->testDefaultDeviceFunc) {
WARNING("Attempting to detect a %s audio " WARNING("Attempting to detect a %s audio "
"device\n", plugin->name); "device\n", plugin->name);
@ -152,7 +153,7 @@ int initAudioOutput(AudioOutput *ao, ConfigParam * param)
return 1; return 1;
} }
int openAudioOutput(AudioOutput * audioOutput, int openAudioOutput(struct audio_output *audioOutput,
const struct audio_format *audioFormat) const struct audio_format *audioFormat)
{ {
int ret = 0; int ret = 0;
@ -184,7 +185,7 @@ int openAudioOutput(AudioOutput * audioOutput,
return ret; return ret;
} }
static void convertAudioFormat(AudioOutput * audioOutput, static void convertAudioFormat(struct audio_output *audioOutput,
const char **chunkArgPtr, size_t *sizeArgPtr) const char **chunkArgPtr, size_t *sizeArgPtr)
{ {
size_t size = pcm_sizeOfConvBuffer(&(audioOutput->inAudioFormat), size_t size = pcm_sizeOfConvBuffer(&(audioOutput->inAudioFormat),
@ -207,7 +208,7 @@ static void convertAudioFormat(AudioOutput * audioOutput,
*chunkArgPtr = audioOutput->convBuffer; *chunkArgPtr = audioOutput->convBuffer;
} }
int playAudioOutput(AudioOutput * audioOutput, int playAudioOutput(struct audio_output *audioOutput,
const char *playChunk, size_t size) const char *playChunk, size_t size)
{ {
int ret; int ret;
@ -224,19 +225,19 @@ int playAudioOutput(AudioOutput * audioOutput,
return ret; return ret;
} }
void dropBufferedAudioOutput(AudioOutput * audioOutput) void dropBufferedAudioOutput(struct audio_output *audioOutput)
{ {
if (audioOutput->open) if (audioOutput->open)
audioOutput->dropBufferedAudioFunc(audioOutput); audioOutput->dropBufferedAudioFunc(audioOutput);
} }
void closeAudioOutput(AudioOutput * audioOutput) void closeAudioOutput(struct audio_output *audioOutput)
{ {
if (audioOutput->open) if (audioOutput->open)
audioOutput->closeDeviceFunc(audioOutput); audioOutput->closeDeviceFunc(audioOutput);
} }
void finishAudioOutput(AudioOutput * audioOutput) void finishAudioOutput(struct audio_output *audioOutput)
{ {
closeAudioOutput(audioOutput); closeAudioOutput(audioOutput);
if (audioOutput->finishDriverFunc) if (audioOutput->finishDriverFunc)
@ -245,7 +246,7 @@ void finishAudioOutput(AudioOutput * audioOutput)
free(audioOutput->convBuffer); free(audioOutput->convBuffer);
} }
void sendMetadataToAudioOutput(AudioOutput * audioOutput, void sendMetadataToAudioOutput(struct audio_output *audioOutput,
const struct tag *tag) const struct tag *tag)
{ {
if (!audioOutput->sendMetdataFunc) if (!audioOutput->sendMetdataFunc)
@ -256,10 +257,10 @@ void sendMetadataToAudioOutput(AudioOutput * audioOutput,
void printAllOutputPluginTypes(FILE * fp) void printAllOutputPluginTypes(FILE * fp)
{ {
ListNode *node = audioOutputPluginList->firstNode; ListNode *node = audioOutputPluginList->firstNode;
AudioOutputPlugin *plugin; struct audio_output_plugin *plugin;
while (node) { while (node) {
plugin = (AudioOutputPlugin *) node->data; plugin = (struct audio_output_plugin *) node->data;
fprintf(fp, "%s ", plugin->name); fprintf(fp, "%s ", plugin->name);
node = node->nextNode; node = node->nextNode;
} }

View File

@ -19,44 +19,45 @@
#ifndef AUDIO_OUTPUT_H #ifndef AUDIO_OUTPUT_H
#define AUDIO_OUTPUT_H #define AUDIO_OUTPUT_H
#include "output_api.h"
#include "../config.h" #include "../config.h"
#include "conf.h" #include "conf.h"
#include "os_compat.h" #include "os_compat.h"
struct audio_output;
struct audio_output_plugin;
struct audio_format; struct audio_format;
struct tag; struct tag;
void initAudioOutputPlugins(void); void initAudioOutputPlugins(void);
void finishAudioOutputPlugins(void); void finishAudioOutputPlugins(void);
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin); void loadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin);
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin); void unloadAudioOutputPlugin(struct audio_output_plugin *audioOutputPlugin);
int initAudioOutput(AudioOutput *, ConfigParam * param); int initAudioOutput(struct audio_output *, ConfigParam * param);
int openAudioOutput(AudioOutput * audioOutput, int openAudioOutput(struct audio_output *audioOutput,
const struct audio_format *audioFormat); const struct audio_format *audioFormat);
int playAudioOutput(AudioOutput * audioOutput, int playAudioOutput(struct audio_output *audioOutput,
const char *playChunk, size_t size); const char *playChunk, size_t size);
void dropBufferedAudioOutput(AudioOutput * audioOutput); void dropBufferedAudioOutput(struct audio_output *audioOutput);
void closeAudioOutput(AudioOutput * audioOutput); void closeAudioOutput(struct audio_output *audioOutput);
void finishAudioOutput(AudioOutput * audioOutput); void finishAudioOutput(struct audio_output *audioOutput);
int keepAudioOutputAlive(AudioOutput * audioOutput, int ms); int keepAudioOutputAlive(struct audio_output *audioOutput, int ms);
void sendMetadataToAudioOutput(AudioOutput * audioOutput, void sendMetadataToAudioOutput(struct audio_output *audioOutput,
const struct tag *tag); const struct tag *tag);
void printAllOutputPluginTypes(FILE * fp); void printAllOutputPluginTypes(FILE * fp);
extern AudioOutputPlugin shoutPlugin; extern struct audio_output_plugin shoutPlugin;
extern AudioOutputPlugin nullPlugin; extern struct audio_output_plugin nullPlugin;
extern AudioOutputPlugin fifoPlugin; extern struct audio_output_plugin fifoPlugin;
extern AudioOutputPlugin alsaPlugin; extern struct audio_output_plugin alsaPlugin;
extern AudioOutputPlugin aoPlugin; extern struct audio_output_plugin aoPlugin;
extern AudioOutputPlugin ossPlugin; extern struct audio_output_plugin ossPlugin;
extern AudioOutputPlugin osxPlugin; extern struct audio_output_plugin osxPlugin;
extern AudioOutputPlugin pulsePlugin; extern struct audio_output_plugin pulsePlugin;
extern AudioOutputPlugin mvpPlugin; extern struct audio_output_plugin mvpPlugin;
extern AudioOutputPlugin jackPlugin; extern struct audio_output_plugin jackPlugin;
#endif #endif

View File

@ -72,7 +72,8 @@ static void freeAlsaData(AlsaData * ad)
free(ad); free(ad);
} }
static int alsa_initDriver(AudioOutput * audioOutput, ConfigParam * param) static int alsa_initDriver(struct audio_output *audioOutput,
ConfigParam * param)
{ {
AlsaData *ad = newAlsaData(); AlsaData *ad = newAlsaData();
@ -94,7 +95,7 @@ static int alsa_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0; return 0;
} }
static void alsa_finishDriver(AudioOutput * audioOutput) static void alsa_finishDriver(struct audio_output *audioOutput)
{ {
AlsaData *ad = audioOutput->data; AlsaData *ad = audioOutput->data;
@ -119,7 +120,7 @@ static int alsa_testDefault(void)
return 0; return 0;
} }
static int alsa_openDevice(AudioOutput * audioOutput) static int alsa_openDevice(struct audio_output *audioOutput)
{ {
AlsaData *ad = audioOutput->data; AlsaData *ad = audioOutput->data;
struct audio_format *audioFormat = &audioOutput->outAudioFormat; struct audio_format *audioFormat = &audioOutput->outAudioFormat;
@ -358,14 +359,14 @@ static int alsa_errorRecovery(AlsaData * ad, int err)
return err; return err;
} }
static void alsa_dropBufferedAudio(AudioOutput * audioOutput) static void alsa_dropBufferedAudio(struct audio_output *audioOutput)
{ {
AlsaData *ad = audioOutput->data; AlsaData *ad = audioOutput->data;
alsa_errorRecovery(ad, snd_pcm_drop(ad->pcmHandle)); 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; AlsaData *ad = audioOutput->data;
@ -380,7 +381,7 @@ static void alsa_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static int alsa_playAudio(AudioOutput * audioOutput, static int alsa_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size) const char *playChunk, size_t size)
{ {
AlsaData *ad = audioOutput->data; AlsaData *ad = audioOutput->data;
@ -412,7 +413,7 @@ static int alsa_playAudio(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin alsaPlugin = { struct audio_output_plugin alsaPlugin = {
"alsa", "alsa",
alsa_testDefault, alsa_testDefault,
alsa_initDriver, alsa_initDriver,

View File

@ -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) ConfigParam * param)
{ {
ao_info *ai; ao_info *ai;
@ -146,7 +146,7 @@ static void freeAoData(AoData * ad)
free(ad); free(ad);
} }
static void audioOutputAo_finishDriver(AudioOutput * audioOutput) static void audioOutputAo_finishDriver(struct audio_output *audioOutput)
{ {
AoData *ad = (AoData *) audioOutput->data; AoData *ad = (AoData *) audioOutput->data;
freeAoData(ad); freeAoData(ad);
@ -157,12 +157,12 @@ static void audioOutputAo_finishDriver(AudioOutput * audioOutput)
ao_shutdown(); ao_shutdown();
} }
static void audioOutputAo_dropBufferedAudio(mpd_unused AudioOutput * audioOutput) static void audioOutputAo_dropBufferedAudio(mpd_unused struct audio_output *audioOutput)
{ {
/* not supported by libao */ /* not supported by libao */
} }
static void audioOutputAo_closeDevice(AudioOutput * audioOutput) static void audioOutputAo_closeDevice(struct audio_output *audioOutput)
{ {
AoData *ad = (AoData *) audioOutput->data; AoData *ad = (AoData *) audioOutput->data;
@ -174,7 +174,7 @@ static void audioOutputAo_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static int audioOutputAo_openDevice(AudioOutput * audioOutput) static int audioOutputAo_openDevice(struct audio_output *audioOutput)
{ {
ao_sample_format format; ao_sample_format format;
AoData *ad = (AoData *) audioOutput->data; 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); 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) const char *playChunk, size_t size)
{ {
size_t chunk_size; size_t chunk_size;
@ -242,7 +242,7 @@ static int audioOutputAo_play(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin aoPlugin = { struct audio_output_plugin aoPlugin = {
"ao", "ao",
NULL, NULL,
audioOutputAo_initDriver, audioOutputAo_initDriver,

View File

@ -151,7 +151,8 @@ static int openFifo(FifoData *fd)
return 0; return 0;
} }
static int fifo_initDriver(AudioOutput *audioOutput, ConfigParam *param) static int fifo_initDriver(struct audio_output *audioOutput,
ConfigParam *param)
{ {
FifoData *fd; FifoData *fd;
BlockParam *blockParam; BlockParam *blockParam;
@ -181,7 +182,7 @@ static int fifo_initDriver(AudioOutput *audioOutput, ConfigParam *param)
return 0; return 0;
} }
static void fifo_finishDriver(AudioOutput *audioOutput) static void fifo_finishDriver(struct audio_output *audioOutput)
{ {
FifoData *fd = (FifoData *)audioOutput->data; FifoData *fd = (FifoData *)audioOutput->data;
@ -189,7 +190,7 @@ static void fifo_finishDriver(AudioOutput *audioOutput)
freeFifoData(fd); freeFifoData(fd);
} }
static int fifo_openDevice(AudioOutput *audioOutput) static int fifo_openDevice(struct audio_output *audioOutput)
{ {
FifoData *fd = (FifoData *)audioOutput->data; FifoData *fd = (FifoData *)audioOutput->data;
@ -203,7 +204,7 @@ static int fifo_openDevice(AudioOutput *audioOutput)
return 0; return 0;
} }
static void fifo_closeDevice(AudioOutput *audioOutput) static void fifo_closeDevice(struct audio_output *audioOutput)
{ {
FifoData *fd = (FifoData *)audioOutput->data; FifoData *fd = (FifoData *)audioOutput->data;
@ -215,7 +216,7 @@ static void fifo_closeDevice(AudioOutput *audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static void fifo_dropBufferedAudio(AudioOutput *audioOutput) static void fifo_dropBufferedAudio(struct audio_output *audioOutput)
{ {
FifoData *fd = (FifoData *)audioOutput->data; FifoData *fd = (FifoData *)audioOutput->data;
char buf[FIFO_BUFFER_SIZE]; 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) const char *playChunk, size_t size)
{ {
FifoData *fd = (FifoData *)audioOutput->data; FifoData *fd = (FifoData *)audioOutput->data;
@ -271,7 +272,7 @@ static int fifo_playAudio(AudioOutput *audioOutput,
return 0; return 0;
} }
AudioOutputPlugin fifoPlugin = { struct audio_output_plugin fifoPlugin = {
"fifo", "fifo",
NULL, /* testDefaultDeviceFunc */ NULL, /* testDefaultDeviceFunc */
fifo_initDriver, fifo_initDriver,

View File

@ -87,7 +87,7 @@ static void freeJackClient(JackData *jd)
pthread_cond_destroy(&jd->play_audio); pthread_cond_destroy(&jd->play_audio);
} }
static void freeJackData(AudioOutput *audioOutput) static void freeJackData(struct audio_output *audioOutput)
{ {
JackData *jd = audioOutput->data; JackData *jd = audioOutput->data;
int i; int i;
@ -108,7 +108,7 @@ static void freeJackData(AudioOutput *audioOutput)
free(jd); free(jd);
} }
static void jack_finishDriver(AudioOutput *audioOutput) static void jack_finishDriver(struct audio_output *audioOutput)
{ {
freeJackData(audioOutput); freeJackData(audioOutput);
DEBUG("disconnect_jack (pid=%d)\n", getpid ()); 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) static int srate(mpd_unused jack_nframes_t rate, void *data)
{ {
JackData *jd = (JackData *) ((AudioOutput*) data)->data; JackData *jd = (JackData *) ((struct audio_output *) data)->data;
struct audio_format *audioFormat = &(((AudioOutput*) data)->outAudioFormat); struct audio_format *audioFormat = &(((struct audio_output *) data)->outAudioFormat);
audioFormat->sampleRate = (int)jack_get_sample_rate(jd->client); audioFormat->sampleRate = (int)jack_get_sample_rate(jd->client);
@ -179,7 +179,7 @@ static void shutdown_callback(void *arg)
jd->shutdown = 1; jd->shutdown = 1;
} }
static void set_audioformat(AudioOutput *audioOutput) static void set_audioformat(struct audio_output *audioOutput)
{ {
JackData *jd = audioOutput->data; JackData *jd = audioOutput->data;
struct audio_format *audioFormat = &audioOutput->outAudioFormat; struct audio_format *audioFormat = &audioOutput->outAudioFormat;
@ -198,7 +198,7 @@ static void error_callback(const char *msg)
ERROR("jack: %s\n", 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; JackData *jd;
BlockParam *bp; BlockParam *bp;
@ -264,7 +264,7 @@ static int jack_testDefault(void)
return 0; return 0;
} }
static int connect_jack(AudioOutput *audioOutput) static int connect_jack(struct audio_output *audioOutput)
{ {
JackData *jd = audioOutput->data; JackData *jd = audioOutput->data;
const char **jports; const char **jports;
@ -345,7 +345,7 @@ static int connect_jack(AudioOutput *audioOutput)
return 1; return 1;
} }
static int jack_openDevice(AudioOutput *audioOutput) static int jack_openDevice(struct audio_output *audioOutput)
{ {
JackData *jd = audioOutput->data; 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);*/ /*jack_finishDriver(audioOutput);*/
audioOutput->open = 0; audioOutput->open = 0;
DEBUG("jack_closeDevice (pid=%d)\n", getpid()); 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) const char *buff, size_t size)
{ {
JackData *jd = audioOutput->data; JackData *jd = audioOutput->data;
@ -430,7 +430,7 @@ static int jack_playAudio(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin jackPlugin = { struct audio_output_plugin jackPlugin = {
"jack", "jack",
jack_testDefault, jack_testDefault,
jack_initDriver, jack_initDriver,

View File

@ -93,7 +93,8 @@ static int mvp_testDefault(void)
return -1; 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)); MvpData *md = xmalloc(sizeof(MvpData));
md->fd = -1; md->fd = -1;
@ -102,7 +103,7 @@ static int mvp_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0; return 0;
} }
static void mvp_finishDriver(AudioOutput * audioOutput) static void mvp_finishDriver(struct audio_output *audioOutput)
{ {
MvpData *md = audioOutput->data; MvpData *md = audioOutput->data;
free(md); free(md);
@ -171,7 +172,7 @@ static int mvp_setPcmParams(MvpData * md, unsigned long rate, int channels,
return 0; return 0;
} }
static int mvp_openDevice(AudioOutput * audioOutput) static int mvp_openDevice(struct audio_output *audioOutput)
{ {
long long int stc = 0; long long int stc = 0;
MvpData *md = audioOutput->data; MvpData *md = audioOutput->data;
@ -210,7 +211,7 @@ static int mvp_openDevice(AudioOutput * audioOutput)
return 0; return 0;
} }
static void mvp_closeDevice(AudioOutput * audioOutput) static void mvp_closeDevice(struct audio_output *audioOutput)
{ {
MvpData *md = audioOutput->data; MvpData *md = audioOutput->data;
if (md->fd >= 0) if (md->fd >= 0)
@ -219,7 +220,7 @@ static void mvp_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static void mvp_dropBufferedAudio(AudioOutput * audioOutput) static void mvp_dropBufferedAudio(struct audio_output *audioOutput)
{ {
MvpData *md = audioOutput->data; MvpData *md = audioOutput->data;
if (md->fd >= 0) { 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) const char *playChunk, size_t size)
{ {
MvpData *md = audioOutput->data; MvpData *md = audioOutput->data;
@ -256,7 +257,7 @@ static int mvp_playAudio(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin mvpPlugin = { struct audio_output_plugin mvpPlugin = {
"mvp", "mvp",
mvp_testDefault, mvp_testDefault,
mvp_initDriver, mvp_initDriver,

View File

@ -19,21 +19,21 @@
#include "../output_api.h" #include "../output_api.h"
#include "../timer.h" #include "../timer.h"
static int null_initDriver(AudioOutput *audioOutput, static int null_initDriver(struct audio_output *audioOutput,
mpd_unused ConfigParam *param) mpd_unused ConfigParam *param)
{ {
audioOutput->data = NULL; audioOutput->data = NULL;
return 0; return 0;
} }
static int null_openDevice(AudioOutput *audioOutput) static int null_openDevice(struct audio_output *audioOutput)
{ {
audioOutput->data = timer_new(&audioOutput->outAudioFormat); audioOutput->data = timer_new(&audioOutput->outAudioFormat);
audioOutput->open = 1; audioOutput->open = 1;
return 0; return 0;
} }
static void null_closeDevice(AudioOutput *audioOutput) static void null_closeDevice(struct audio_output *audioOutput)
{ {
if (audioOutput->data) { if (audioOutput->data) {
timer_free(audioOutput->data); timer_free(audioOutput->data);
@ -43,7 +43,7 @@ static void null_closeDevice(AudioOutput *audioOutput)
audioOutput->open = 0; 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) mpd_unused const char *playChunk, size_t size)
{ {
Timer *timer = audioOutput->data; Timer *timer = audioOutput->data;
@ -58,12 +58,12 @@ static int null_playAudio(AudioOutput *audioOutput,
return 0; return 0;
} }
static void null_dropBufferedAudio(AudioOutput *audioOutput) static void null_dropBufferedAudio(struct audio_output *audioOutput)
{ {
timer_reset(audioOutput->data); timer_reset(audioOutput->data);
} }
AudioOutputPlugin nullPlugin = { struct audio_output_plugin nullPlugin = {
"null", "null",
NULL, NULL,
null_initDriver, null_initDriver,

View File

@ -333,8 +333,8 @@ static int oss_testDefault(void)
return -1; return -1;
} }
static int oss_open_default(mpd_unused AudioOutput *ao, ConfigParam *param, static int oss_open_default(mpd_unused struct audio_output *ao,
OssData *od) ConfigParam *param, OssData *od)
{ {
int i; int i;
int err[ARRAY_SIZE(default_devices)]; 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... */ 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(); OssData *od = newOssData();
audioOutput->data = od; audioOutput->data = od;
@ -388,7 +389,7 @@ static int oss_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return oss_open_default(audioOutput, param, od); 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; OssData *od = audioOutput->data;
@ -432,7 +433,7 @@ static void oss_close(OssData * od)
od->fd = -1; od->fd = -1;
} }
static int oss_open(AudioOutput * audioOutput) static int oss_open(struct audio_output *audioOutput)
{ {
int tmp; int tmp;
OssData *od = audioOutput->data; OssData *od = audioOutput->data;
@ -479,7 +480,7 @@ fail:
return -1; return -1;
} }
static int oss_openDevice(AudioOutput * audioOutput) static int oss_openDevice(struct audio_output *audioOutput)
{ {
int ret; int ret;
OssData *od = audioOutput->data; OssData *od = audioOutput->data;
@ -502,7 +503,7 @@ static int oss_openDevice(AudioOutput * audioOutput)
return ret; return ret;
} }
static void oss_closeDevice(AudioOutput * audioOutput) static void oss_closeDevice(struct audio_output *audioOutput)
{ {
OssData *od = audioOutput->data; OssData *od = audioOutput->data;
@ -511,7 +512,7 @@ static void oss_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static void oss_dropBufferedAudio(AudioOutput * audioOutput) static void oss_dropBufferedAudio(struct audio_output *audioOutput)
{ {
OssData *od = audioOutput->data; 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) const char *playChunk, size_t size)
{ {
OssData *od = audioOutput->data; OssData *od = audioOutput->data;
@ -548,7 +549,7 @@ static int oss_playAudio(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin ossPlugin = { struct audio_output_plugin ossPlugin = {
"oss", "oss",
oss_testDefault, oss_testDefault,
oss_initDriver, oss_initDriver,

View File

@ -80,7 +80,8 @@ static int osx_testDefault()
return 0; return 0;
} }
static int osx_initDriver(AudioOutput * audioOutput, ConfigParam * param) static int osx_initDriver(struct audio_output *audioOutput,
ConfigParam * param)
{ {
OsxData *od = newOsxData(); OsxData *od = newOsxData();
@ -98,13 +99,13 @@ static void freeOsxData(OsxData * od)
free(od); free(od);
} }
static void osx_finishDriver(AudioOutput * audioOutput) static void osx_finishDriver(struct audio_output *audioOutput)
{ {
OsxData *od = (OsxData *) audioOutput->data; OsxData *od = (OsxData *) audioOutput->data;
freeOsxData(od); freeOsxData(od);
} }
static void osx_dropBufferedAudio(AudioOutput * audioOutput) static void osx_dropBufferedAudio(struct audio_output *audioOutput)
{ {
OsxData *od = (OsxData *) audioOutput->data; OsxData *od = (OsxData *) audioOutput->data;
@ -113,7 +114,7 @@ static void osx_dropBufferedAudio(AudioOutput * audioOutput)
pthread_mutex_unlock(&od->mutex); pthread_mutex_unlock(&od->mutex);
} }
static void osx_closeDevice(AudioOutput * audioOutput) static void osx_closeDevice(struct audio_output *audioOutput)
{ {
OsxData *od = (OsxData *) audioOutput->data; OsxData *od = (OsxData *) audioOutput->data;
@ -215,7 +216,7 @@ static OSStatus osx_render(void *vdata,
return 0; return 0;
} }
static int osx_openDevice(AudioOutput * audioOutput) static int osx_openDevice(struct audio_output *audioOutput)
{ {
OsxData *od = (OsxData *) audioOutput->data; OsxData *od = (OsxData *) audioOutput->data;
ComponentDescription desc; ComponentDescription desc;
@ -295,7 +296,7 @@ static int osx_openDevice(AudioOutput * audioOutput)
return 0; return 0;
} }
static int osx_play(AudioOutput * audioOutput, static int osx_play(struct audio_output *audioOutput,
const char *playChunk, size_t size) const char *playChunk, size_t size)
{ {
OsxData *od = (OsxData *) audioOutput->data; OsxData *od = (OsxData *) audioOutput->data;
@ -354,7 +355,7 @@ static int osx_play(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin osxPlugin = { struct audio_output_plugin osxPlugin = {
"osx", "osx",
osx_testDefault, osx_testDefault,
osx_initDriver, osx_initDriver,

View File

@ -61,7 +61,8 @@ static void freePulseData(PulseData * pd)
free(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 *server = NULL;
BlockParam *sink = NULL; BlockParam *sink = NULL;
@ -80,7 +81,7 @@ static int pulse_initDriver(AudioOutput * audioOutput, ConfigParam * param)
return 0; return 0;
} }
static void pulse_finishDriver(AudioOutput * audioOutput) static void pulse_finishDriver(struct audio_output *audioOutput)
{ {
freePulseData((PulseData *) audioOutput->data); freePulseData((PulseData *) audioOutput->data);
} }
@ -108,7 +109,7 @@ static int pulse_testDefault(void)
return 0; return 0;
} }
static int pulse_openDevice(AudioOutput * audioOutput) static int pulse_openDevice(struct audio_output *audioOutput)
{ {
PulseData *pd; PulseData *pd;
struct audio_format *audioFormat; struct audio_format *audioFormat;
@ -157,7 +158,7 @@ static int pulse_openDevice(AudioOutput * audioOutput)
return 0; return 0;
} }
static void pulse_dropBufferedAudio(AudioOutput * audioOutput) static void pulse_dropBufferedAudio(struct audio_output *audioOutput)
{ {
PulseData *pd; PulseData *pd;
int error; int error;
@ -168,7 +169,7 @@ static void pulse_dropBufferedAudio(AudioOutput * audioOutput)
audioOutput->name, pa_strerror(error)); audioOutput->name, pa_strerror(error));
} }
static void pulse_closeDevice(AudioOutput * audioOutput) static void pulse_closeDevice(struct audio_output *audioOutput)
{ {
PulseData *pd; PulseData *pd;
@ -181,7 +182,7 @@ static void pulse_closeDevice(AudioOutput * audioOutput)
audioOutput->open = 0; audioOutput->open = 0;
} }
static int pulse_playAudio(AudioOutput * audioOutput, static int pulse_playAudio(struct audio_output *audioOutput,
const char *playChunk, size_t size) const char *playChunk, size_t size)
{ {
PulseData *pd; PulseData *pd;
@ -199,7 +200,7 @@ static int pulse_playAudio(AudioOutput * audioOutput,
return 0; return 0;
} }
AudioOutputPlugin pulsePlugin = { struct audio_output_plugin pulsePlugin = {
"pulse", "pulse",
pulse_testDefault, pulse_testDefault,
pulse_initDriver, pulse_initDriver,

View File

@ -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; ShoutData *sd;
char *test; char *test;
@ -351,7 +352,7 @@ static void myShout_closeShoutConn(ShoutData * sd)
sd->opened = 0; sd->opened = 0;
} }
static void myShout_finishDriver(AudioOutput * audioOutput) static void myShout_finishDriver(struct audio_output *audioOutput)
{ {
ShoutData *sd = (ShoutData *) audioOutput->data; ShoutData *sd = (ShoutData *) audioOutput->data;
@ -365,7 +366,7 @@ static void myShout_finishDriver(AudioOutput * audioOutput)
shout_shutdown(); shout_shutdown();
} }
static void myShout_dropBufferedAudio(AudioOutput * audioOutput) static void myShout_dropBufferedAudio(struct audio_output *audioOutput)
{ {
ShoutData *sd = (ShoutData *)audioOutput->data; ShoutData *sd = (ShoutData *)audioOutput->data;
timer_reset(sd->timer); timer_reset(sd->timer);
@ -373,7 +374,7 @@ static void myShout_dropBufferedAudio(AudioOutput * audioOutput)
/* needs to be implemented for shout */ /* 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; 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; ShoutData *sd = (ShoutData *) audioOutput->data;
int status; int status;
@ -550,7 +551,7 @@ static int myShout_openShoutConn(AudioOutput * audioOutput)
return 0; return 0;
} }
static int myShout_openDevice(AudioOutput * audioOutput) static int myShout_openDevice(struct audio_output *audioOutput)
{ {
ShoutData *sd = (ShoutData *) audioOutput->data; ShoutData *sd = (ShoutData *) audioOutput->data;
@ -598,7 +599,7 @@ static void myShout_sendMetadata(ShoutData * sd)
sd->tagToSend = 0; sd->tagToSend = 0;
} }
static int myShout_play(AudioOutput * audioOutput, static int myShout_play(struct audio_output *audioOutput,
const char *playChunk, size_t size) const char *playChunk, size_t size)
{ {
unsigned int i; unsigned int i;
@ -662,7 +663,8 @@ static int myShout_play(AudioOutput * audioOutput,
return 0; 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; ShoutData *sd = (ShoutData *) audioOutput->data;
@ -678,7 +680,7 @@ static void myShout_setTag(AudioOutput * audioOutput, const struct tag *tag)
sd->tagToSend = 1; sd->tagToSend = 1;
} }
AudioOutputPlugin shoutPlugin = { struct audio_output_plugin shoutPlugin = {
"shout", "shout",
NULL, NULL,
myShout_initDriver, myShout_initDriver,

View File

@ -28,30 +28,30 @@
#include "log.h" #include "log.h"
#include "os_compat.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 (*AudioOutputTestDefaultDeviceFunc) (void);
typedef int (*AudioOutputInitDriverFunc) (AudioOutput * audioOutput, typedef int (*AudioOutputInitDriverFunc) (struct audio_output *audioOutput,
ConfigParam * param); 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); 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); const struct tag *tag);
typedef struct _AudioOutputPlugin { struct audio_output_plugin {
const char *name; const char *name;
AudioOutputTestDefaultDeviceFunc testDefaultDeviceFunc; AudioOutputTestDefaultDeviceFunc testDefaultDeviceFunc;
@ -62,9 +62,9 @@ typedef struct _AudioOutputPlugin {
AudioOutputDropBufferedAudioFunc dropBufferedAudioFunc; AudioOutputDropBufferedAudioFunc dropBufferedAudioFunc;
AudioOutputCloseDeviceFunc closeDeviceFunc; AudioOutputCloseDeviceFunc closeDeviceFunc;
AudioOutputSendMetadataFunc sendMetdataFunc; AudioOutputSendMetadataFunc sendMetdataFunc;
} AudioOutputPlugin; };
struct _AudioOutput { struct audio_output {
int open; int open;
const char *name; const char *name;
const char *type; const char *type;