add audioOutput.c
git-svn-id: https://svn.musicpd.org/mpd/trunk@2205 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
parent
de48cf67b4
commit
d05c3b510e
43
src/audioOutput.c
Normal file
43
src/audioOutput.c
Normal file
@ -0,0 +1,43 @@
|
||||
#include <audioOutput.h>
|
||||
|
||||
#include <list.h>
|
||||
|
||||
static List * audioOutputPluginList;
|
||||
|
||||
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) {
|
||||
insertInList(audioOutputPluginList, audioOutputPlugin->name,
|
||||
audioOutputPlugin);
|
||||
}
|
||||
|
||||
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin) {
|
||||
deleteFromList(audioOutputPluginList, audioOutputPlugin->name);
|
||||
}
|
||||
|
||||
void initAudioOutputPlugins() {
|
||||
audioOutputPluginList = makeList(NULL);
|
||||
}
|
||||
|
||||
void finishAudioOutputPlugins() {
|
||||
freeList(audioOutputPluginList);
|
||||
}
|
||||
|
||||
AudioOutput * newAudioOutput(char * name) {
|
||||
AudioOutput * ret = NULL;
|
||||
void * data = NULL;
|
||||
|
||||
if(findInList(audioOutputPluginList, name, &data)) {
|
||||
AudioOutputPlugin * plugin = (AudioOutputPlugin *) data;
|
||||
ret = malloc(sizeof(AudioOutput));
|
||||
ret->initConfigFunc = plugin->initConfigFunc;
|
||||
ret->finishConfigFunc = plugin->finishConfigFunc;
|
||||
ret->initDriverFunc = plugin->initDriverFunc;
|
||||
ret->finishDriverFunc = plugin->initDriverFunc;
|
||||
ret->openDeviceFunc = plugin->openDeviceFunc;
|
||||
ret->playFunc = plugin->playFunc;
|
||||
ret->closeDeviceFunc = plugin->closeDeviceFunc;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void closeAudioOutput(AudioOutput * audioOutput);
|
@ -69,4 +69,10 @@ typedef struct _AudioOutputPlugin {
|
||||
AudioOutputCloseDevicFunc closeDeviceFunc;
|
||||
} AudioOutputPlugin;
|
||||
|
||||
void loadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
|
||||
void unloadAudioOutputPlugin(AudioOutputPlugin * audioOutputPlugin);
|
||||
|
||||
AudioOutput * newAudioOutput(char * name);
|
||||
void closeAudioOutput(AudioOutput * audioOutput);
|
||||
|
||||
#endif
|
||||
|
@ -26,4 +26,3 @@ unsigned char * utf8StrToLatin1Dup(unsigned char * utf8);
|
||||
int validUtf8String(unsigned char * string);
|
||||
|
||||
#endif
|
||||
/* vim:set shiftwidth=4 tabstop=8 expandtab: */
|
||||
|
Loading…
Reference in New Issue
Block a user