changeset 14260:7f3c14830dcd

100l set default format for AF_FORMATs not supported by sound card
author rtognimp
date Tue, 28 Dec 2004 01:59:12 +0000
parents 0126a2f79310
children 710b223604fa
files libao2/ao_oss.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_oss.c	Tue Dec 28 01:53:17 2004 +0000
+++ b/libao2/ao_oss.c	Tue Dec 28 01:59:12 2004 +0000
@@ -256,10 +256,7 @@
 ac3_retry:  
   ao_data.format=format;
   oss_format=format2oss(format);
-  if (oss_format == -1) return 0;
-  if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format)<0 ||
-      oss_format != format2oss(format)) if(format == AF_FORMAT_AC3){
-    mp_msg(MSGT_AO,MSGL_WARN, MSGTR_AO_OSS_CantSetAC3, dsp);
+  if (oss_format == -1) {
 #ifdef WORDS_BIGENDIAN
     oss_format=AFMT_S16_BE;
     format=AF_FORMAT_S16_BE;
@@ -267,6 +264,15 @@
     oss_format=AFMT_S16_LE;
     format=AF_FORMAT_S16_LE;
 #endif
+  }
+  if( ioctl(audio_fd, SNDCTL_DSP_SETFMT, &oss_format)<0 ||
+      oss_format != format2oss(format)) if(format == AF_FORMAT_AC3){
+    mp_msg(MSGT_AO,MSGL_WARN, MSGTR_AO_OSS_CantSetAC3, dsp);
+#ifdef WORDS_BIGENDIAN
+    format=AF_FORMAT_S16_BE;
+#else
+    format=AF_FORMAT_S16_LE;
+#endif
     goto ac3_retry;
   }
 //  mp_msg(MSGT_AO,MSGL_V,"audio_setup: sample format: %s (requested: %s)\n",