X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/5b053666c0488ce2b0f0acc4304ac1a1d92a7035..7f7c38193f1f45a70710bc922d110bf08022c175:/lib/uaudio-apis.c diff --git a/lib/uaudio-apis.c b/lib/uaudio-apis.c index b864aa0..568ae36 100644 --- a/lib/uaudio-apis.c +++ b/lib/uaudio-apis.c @@ -22,6 +22,7 @@ #include "common.h" #include "uaudio.h" +#include "log.h" /** @brief List of known APIs * @@ -30,7 +31,7 @@ * The first one will be used as a default, so putting ALSA before OSS * constitutes a policy decision. */ -const struct uaudio *const uaudio_apis[] = { +const struct uaudio *const uaudio_apis[] = { #if HAVE_COREAUDIO_AUDIOHARDWARE_H &uaudio_coreaudio, #endif @@ -45,6 +46,18 @@ const struct uaudio *const uaudio_apis[] = { NULL, }; +/** @brief Look up an audio API by name */ +const struct uaudio *uaudio_find(const char *name) { + int n; + + for(n = 0; uaudio_apis[n]; ++n) + if(!strcmp(uaudio_apis[n]->name, name)) + return uaudio_apis[n]; + if(!strcmp(name, "network")) + return &uaudio_rtp; + disorder_fatal(0, "cannot find audio API '%s'", name); +} + /* Local Variables: c-basic-offset:2