diff options
-rw-r--r-- | src/audioOutput.c | 43 | ||||
-rw-r--r-- | src/audioOutput.h | 6 | ||||
-rw-r--r-- | src/utf8.h | 1 |
3 files changed, 49 insertions, 1 deletions
diff --git a/src/audioOutput.c b/src/audioOutput.c new file mode 100644 index 000000000..aedfda59f --- /dev/null +++ b/src/audioOutput.c @@ -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); diff --git a/src/audioOutput.h b/src/audioOutput.h index 30d3b996e..1a01263b8 100644 --- a/src/audioOutput.h +++ b/src/audioOutput.h @@ -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 diff --git a/src/utf8.h b/src/utf8.h index 75f1b3226..ef3af91f5 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -26,4 +26,3 @@ unsigned char * utf8StrToLatin1Dup(unsigned char * utf8); int validUtf8String(unsigned char * string); #endif -/* vim:set shiftwidth=4 tabstop=8 expandtab: */ |