From 662887576254386b8e3481f6f3e6f0289f2500aa Mon Sep 17 00:00:00 2001 Message-Id: <662887576254386b8e3481f6f3e6f0289f2500aa.1713566442.git.mdw@distorted.org.uk> From: Mark Wooding Date: Sun, 1 Mar 2009 18:07:39 +0000 Subject: [PATCH] Abolish uaudio_apis[]. Instead, define UAUDIO_DEFAULT to indicate default sound API. This saves e.g. uaudio_rtp being linked into disorder-playrtp. It does mean that users need more knowledge of available APIs, but since they need to know what options to set that's not much of an extra burden. Organization: Straylight/Edgeware From: Richard Kettlewell --- clients/playrtp.c | 2 +- lib/uaudio.c | 22 ---------------------- lib/uaudio.h | 15 +++++++++++++-- 3 files changed, 14 insertions(+), 25 deletions(-) diff --git a/clients/playrtp.c b/clients/playrtp.c index 03e4ad2..4ea5e3b 100644 --- a/clients/playrtp.c +++ b/clients/playrtp.c @@ -590,7 +590,7 @@ int main(int argc, char **argv) { mem_init(); if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale"); - backend = uaudio_apis[0]; + backend = &UAUDIO_DEFAULT; while((n = getopt_long(argc, argv, "hVdD:m:b:x:L:R:M:aocC:re:", options, 0)) >= 0) { switch(n) { case 'h': help(); diff --git a/lib/uaudio.c b/lib/uaudio.c index 266846e..3625901 100644 --- a/lib/uaudio.c +++ b/lib/uaudio.c @@ -89,28 +89,6 @@ void uaudio_set_format(int rate, int channels, int bits, int signed_) { uaudio_sample_size = bits / CHAR_BIT; } -/** @brief List of known APIs - * - * Terminated by a null pointer. - * - * The first one will be used as a default, so putting ALSA before OSS - * constitutes a policy decision. - */ -const struct uaudio *uaudio_apis[] = { -#if HAVE_COREAUDIO_AUDIOHARDWARE_H - &uaudio_coreaudio, -#endif -#if HAVE_ALSA_ASOUNDLIB_H - &uaudio_alsa, -#endif -#if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST - &uaudio_oss, -#endif - &uaudio_rtp, - &uaudio_command, - NULL, -}; - /* Local Variables: c-basic-offset:2 diff --git a/lib/uaudio.h b/lib/uaudio.h index a6996f8..3e62aad 100644 --- a/lib/uaudio.h +++ b/lib/uaudio.h @@ -106,20 +106,31 @@ void uaudio_thread_deactivate(void); #if HAVE_COREAUDIO_AUDIOHARDWARE_H extern const struct uaudio uaudio_coreaudio; +#ifndef UAUDIO_DEFAULT +# define UAUDIO_DEFAULT uaudio_coreaudio +#endif #endif #if HAVE_ALSA_ASOUNDLIB_H extern const struct uaudio uaudio_alsa; +#ifndef UAUDIO_DEFAULT +# define UAUDIO_DEFAULT uaudio_alsa +#endif #endif #if HAVE_SYS_SOUNDCARD_H || EMPEG_HOST extern const struct uaudio uaudio_oss; +#ifndef UAUDIO_DEFAULT +# define UAUDIO_DEFAULT uaudio_oss +#endif #endif extern const struct uaudio uaudio_rtp; -extern const struct uaudio uaudio_command; +#ifndef UAUDIO_DEFAULT +# define UAUDIO_DEFAULT uaudio_rtp +#endif -extern const struct uaudio *uaudio_apis[]; +extern const struct uaudio uaudio_command; #endif /* UAUDIO_H */ -- [mdw]