[xiph-commits] r16835 - trunk/ao/src/plugins/sun
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Wed Jan 27 01:52:40 PST 2010
Author: xiphmont
Date: 2010-01-27 01:52:40 -0800 (Wed, 27 Jan 2010)
New Revision: 16835
Modified:
trunk/ao/src/plugins/sun/ao_sun.c
Log:
Update ao_sun driver for channel mapping 'support'
Modified: trunk/ao/src/plugins/sun/ao_sun.c
===================================================================
--- trunk/ao/src/plugins/sun/ao_sun.c 2010-01-27 09:49:46 UTC (rev 16834)
+++ trunk/ao/src/plugins/sun/ao_sun.c 2010-01-27 09:52:40 UTC (rev 16835)
@@ -20,8 +20,12 @@
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
- */
+ ********************************************************************
+ last mod: $Id$
+
+ ********************************************************************/
+
#include <sys/types.h>
#include <sys/ioctl.h>
#include <errno.h>
@@ -45,7 +49,7 @@
#endif
-static char *ao_sun_options[] = {"dev"};
+static char *ao_sun_options[] = {"dev","verbose","quiet","matrix"};
ao_info ao_sun_info = {
AO_TYPE_LIVE,
"Sun audio driver output",
@@ -55,7 +59,7 @@
AO_FMT_NATIVE,
20,
ao_sun_options,
- 1
+ 4
};
@@ -90,16 +94,16 @@
internal = (ao_sun_internal *) malloc(sizeof(ao_sun_internal));
- if (internal == NULL)
+ if (internal == NULL)
return 0; /* Could not initialize device memory */
-
+
internal->dev = strdup(AO_SUN_DEFAULT_DEV);
-
+
if (internal->dev == NULL) {
free(internal);
return 0;
}
-
+
device->internal = internal;
return 1; /* Memory alloc successful */
@@ -112,7 +116,7 @@
if (!strcmp(key, "dev")) {
/* Free old string in case "dsp" set twice in options */
- free(internal->dev);
+ free(internal->dev);
internal->dev = strdup(value);
}
@@ -123,7 +127,7 @@
int ao_plugin_open(ao_device *device, ao_sample_format *format)
{
ao_sun_internal *internal = (ao_sun_internal *) device->internal;
-
+
audio_info_t info;
if ( (internal->fd = open(internal->dev, O_WRONLY)) < 0 )
@@ -145,15 +149,22 @@
device->driver_byte_format = AO_FMT_NATIVE;
+ if(!device->output_matrix){
+ /* set up out matrix such that users are warned about > stereo playback */
+ if(format->channels<=2)
+ device->output_matrix=strdup("L,R");
+ //else no matrix, which results in a warning
+ }
+
return 1;
}
-int ao_plugin_play(ao_device *device, const char *output_samples,
+int ao_plugin_play(ao_device *device, const char *output_samples,
uint_32 num_bytes)
{
ao_sun_internal *internal = (ao_sun_internal *) device->internal;
-
+
if (write(internal->fd, output_samples, num_bytes) < 0)
return 0;
else
More information about the commits
mailing list