Abolish uaudio_apis[]. Instead, define UAUDIO_DEFAULT to indicate
authorRichard Kettlewell <rjk@greenend.org.uk>
Sun, 1 Mar 2009 18:07:39 +0000 (18:07 +0000)
committerRichard Kettlewell <rjk@greenend.org.uk>
Sun, 1 Mar 2009 18:07:39 +0000 (18:07 +0000)
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.

clients/playrtp.c
lib/uaudio.c
lib/uaudio.h

index 03e4ad2..4ea5e3b 100644 (file)
@@ -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();
index 266846e..3625901 100644 (file)
@@ -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
index a6996f8..3e62aad 100644 (file)
@@ -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 */