[xiph-commits] r16999 - trunk/ao/src/plugins/oss

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Mon Mar 22 22:58:57 PDT 2010


Author: xiphmont
Date: 2010-03-22 22:58:57 -0700 (Mon, 22 Mar 2010)
New Revision: 16999

Modified:
   trunk/ao/src/plugins/oss/ao_oss.c
Log:
Commit patch for Trac #1630



Modified: trunk/ao/src/plugins/oss/ao_oss.c
===================================================================
--- trunk/ao/src/plugins/oss/ao_oss.c	2010-03-23 05:45:43 UTC (rev 16998)
+++ trunk/ao/src/plugins/oss/ao_oss.c	2010-03-23 05:58:57 UTC (rev 16999)
@@ -170,7 +170,6 @@
 
 	device->internal = internal;
         device->output_matrix_order = AO_OUTPUT_MATRIX_FIXED;
-        device->output_matrix=strdup("L,R");
 
 	return 1; /* Memory alloc successful */
 }
@@ -220,6 +219,16 @@
 
 	/* Now set all of the parameters */
 
+#ifdef SNDCTL_DSP_CHANNELS
+        /* OSS versions > 2 */
+        tmp = format->channels;
+        if (ioctl(internal->fd,SNDCTL_DSP_CHANNELS,&tmp) < 0 ||
+            tmp != format->channels) {
+          aerror("cannot set channels to %d\n", format->channels);
+          goto ERR;
+        }
+#else
+        /* OSS versions < 4 */
 	switch (device->output_channels)
 	{
 	case 1: tmp = 0;
@@ -237,6 +246,7 @@
                  device->output_channels);
           goto ERR;
 	}
+#endif
 
 	/* To eliminate the need for a swap buffer, we set the device
 	   to use whatever byte format the client selected. */
@@ -286,6 +296,13 @@
           internal->buf_size=1024;
 	}
 
+        if(!device->inter_matrix){
+          /* set up matrix such that users are warned about > stereo playback */
+          if(device->output_channels<=2)
+            device->inter_matrix=strdup("L,R");
+          //else no matrix, which results in a warning
+        }
+
 	return 1; /* Open successful */
 
  ERR:



More information about the commits mailing list