chiark / gitweb /
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 03e4ad2e297de1a3c10601f3c8c3c6418953a234..4ea5e3b43bd782b1f8f72c83f61bdc4a72e815a0 100644 (file)
@@ -590,7 +590,7 @@ int main(int argc, char **argv) {
 
   mem_init();
   if(!setlocale(LC_CTYPE, "")) fatal(errno, "error calling setlocale");
 
   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();
   while((n = getopt_long(argc, argv, "hVdD:m:b:x:L:R:M:aocC:re:", options, 0)) >= 0) {
     switch(n) {
     case 'h': help();
index 266846e07f225c5751c3bbbfc84b4610470cb83c..3625901eeccc44e1ef29c3c199ba133c9ae96b6a 100644 (file)
@@ -89,28 +89,6 @@ void uaudio_set_format(int rate, int channels, int bits, int signed_) {
   uaudio_sample_size = bits / CHAR_BIT;
 }
 
   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
 /*
 Local Variables:
 c-basic-offset:2
index a6996f897ec8570f9f1cd6a59c26cbd059e12529..3e62aadeb463a54b1a2d4bf765a2caee8b057d86 100644 (file)
@@ -106,20 +106,31 @@ void uaudio_thread_deactivate(void);
 
 #if HAVE_COREAUDIO_AUDIOHARDWARE_H
 extern const struct uaudio uaudio_coreaudio;
 
 #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;
 #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;
 #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;
 #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 */
 
 
 #endif /* UAUDIO_H */