X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~mdw/git/disorder/blobdiff_plain/5b053666c0488ce2b0f0acc4304ac1a1d92a7035..f622e663e7fcfb9ad92651e1a277d325dd939e5c:/lib/uaudio-apis.c diff --git a/lib/uaudio-apis.c b/lib/uaudio-apis.c index b864aa0..867b1fd 100644 --- a/lib/uaudio-apis.c +++ b/lib/uaudio-apis.c @@ -1,6 +1,6 @@ /* * This file is part of DisOrder. - * Copyright (C) 2009 Richard Kettlewell + * Copyright (C) 2009, 2013 Richard Kettlewell * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +22,7 @@ #include "common.h" #include "uaudio.h" +#include "log.h" /** @brief List of known APIs * @@ -30,10 +31,13 @@ * 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 +#if HAVE_PULSEAUDIO + &uaudio_pulseaudio, +#endif #if HAVE_ALSA_ASOUNDLIB_H &uaudio_alsa, #endif @@ -45,6 +49,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