diff libao2/ao_oss.c @ 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 815f03b7cee5
children cb5fbade8a5c
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",