[xiph-cvs] cvs commit: ao/src/plugins/oss ao_oss.c
Ralph Giles
giles at xiph.org
Fri Feb 2 02:02:07 PST 2001
giles 01/02/02 02:02:06
Modified: doc DRIVERS
src/plugins/oss ao_oss.c
Log:
Try /dev/sound/dsp (the devfs default) before /dev/dsp in the oss output
driver
also some esd doc cleanup
Revision Changes Path
1.2 +7 -14 ao/doc/DRIVERS
Index: DRIVERS
===================================================================
RCS file: /usr/local/cvsroot/ao/doc/DRIVERS,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DRIVERS 2000/10/31 07:08:41 1.1
+++ DRIVERS 2001/02/02 10:02:06 1.2
@@ -13,8 +13,8 @@
Open Sound System. This is the audio driver system for
Linux and Free/Net/OpenBSD as well as other UNIX-like systems.
Option keys:
- "dsp" - set the dsp device. By default, this is
- "/dev/dsp".
+ "dsp" - set the dsp device. By default, it tries
+ "/dev/sound/dsp", followed by "/dev/dsp".
irix
----
@@ -29,14 +29,6 @@
original libao. Same caveats apply.
Option keys: None.
-esd
----
-ESounD audio driver. This driver by default connects to the ESounD
-Daemon on the localhost.
- Option keys:
- "host" - The hostname where esd is running. This can include
- a port number after a colon, as in "whizbang.com:555".
-
alsa
----
Advanced Linux Sound Architecture. This driver borrows some code from
@@ -52,11 +44,12 @@
esd
---
-ESounD audio driver. Uses libesd to communicate with the audio
-server.
+ESounD audio driver. This driver by default connects to the ESounD
+Daemon on the localhost.
Option keys:
- "host" - Hostname where esd is running. By default, this is
- the localhost.
+ "host" - The hostname where esd is running. by default sound
+ is played on the local host. A port number can be
+ specified after a colon, as in "whizbang.com:555".
wav
---
1.5 +37 -8 ao/src/plugins/oss/ao_oss.c
Index: ao_oss.c
===================================================================
RCS file: /usr/local/cvsroot/ao/src/plugins/oss/ao_oss.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ao_oss.c 2001/01/29 04:07:38 1.4
+++ ao_oss.c 2001/02/02 10:02:06 1.5
@@ -75,8 +75,8 @@
options = options->next;
}
- if (state->dev == NULL)
- state->dev = strdup("/dev/dsp");
+ /* otherwise, the NULL setting indicates the open()
+ routine should choose something from hardwired defaults */
}
/*
@@ -102,12 +102,40 @@
/* Open the device driver */
- state->fd=open(state->dev,O_WRONLY);
- if(state->fd < 0)
- {
- fprintf(stderr,"libao - %s: Opening audio device %s\n",
- strerror(errno), state->dev);
- goto ERR;
+ if (state->dev != NULL) {
+ /* open the user-specified path */
+ state->fd=open(state->dev,O_WRONLY);
+ if(state->fd < 0)
+ {
+ fprintf(stderr,"libao - %s: Opening audio device %s\n",
+ strerror(errno), state->dev);
+ goto ERR;
+ }
+ } else {
+ /* default: first try the devfs path */
+ state->dev = strdup("/dev/sound/dsp");
+ state->fd=open(state->dev,O_WRONLY);
+ if(state->fd < 0)
+ {
+ /* no? then try the traditional path */
+ char *err = strdup(strerror(errno));
+ char *dev = strdup(state->dev);
+ free(state->dev);
+ state->dev = strdup("/dev/dsp");
+ state->fd=open(state->dev,O_WRONLY);
+ if(state->fd < 0)
+ {
+ fprintf(stderr,
+ "libao - error: Could not open either default device:\n"
+ " %s - %s\n"
+ " %s - %s\n",
+ err, dev,
+ strerror(errno), state->dev);
+ free(err);
+ free(dev);
+ goto ERR;
+ }
+ }
}
switch (channels)
@@ -144,6 +172,7 @@
if(state != NULL)
{
if (state->fd >= 0) { close(state->fd); }
+ if (state->dev) { free(state->dev); }
free(state);
}
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list