[MPlayer-dev-eng] oss devfs fix
doj
doj at cubic.org
Fri Jan 11 01:38:36 CET 2002
Hello coders,
I have patched the contributed libao to recognize an oss audio device
mounted under a devfs filesystem. See the attached diff.
--
----> doj / cubic
-----> http://www.cubic.org
-----> http://llg.cubic.org
-------------- next part --------------
diff -u -U 5 -r -P -x *~ -x *.[oa] MPlayer-0.60/libao2/ao_oss.c MPlayer-0.60.doj/libao2/ao_oss.c
--- MPlayer-0.60/libao2/ao_oss.c Tue Dec 11 10:23:57 2001
+++ MPlayer-0.60.doj/libao2/ao_oss.c Fri Jan 11 00:51:39 2002
@@ -28,11 +28,15 @@
/* Support for >2 output channels added 2001-11-25 - Steve Davies <steve at daviesfam.org> */
LIBAO_EXTERN(oss)
-static char *dsp="/dev/dsp";
+static char *dspList[]= {
+ "/dev/dsp",
+ "/dev/sound/dsp",
+};
+static char *dsp=0;
static audio_buf_info zz;
static int audio_fd=-1;
char *oss_mixer_device = "/dev/mixer";
int oss_mixer_usemaster = 0;
@@ -105,14 +109,28 @@
if (verbose)
printf("audio_setup: using '%s' dsp device\n", dsp);
audio_fd=open(dsp, O_WRONLY);
- if(audio_fd<0){
- printf("Can't open audio device %s -> nosound\n",dsp);
- return 0;
- }
+ if(audio_fd<0)
+ {
+ int i;
+ for(i=0; i<sizeof(dspList)/sizeof(char*); i++)
+ {
+ dsp=dspList[i];
+ if((audio_fd=open(dsp, O_WRONLY)) >= 0)
+ break;
+ else
+ printf("Can't open audio device %s\n",dsp);
+ }
+ }
+ if(audio_fd<0)
+ {
+ printf("Can't open any audio device -> nosound\n");
+ return 0;
+ }
+
ao_data.bps=channels*rate;
if(format != AFMT_U8 && format != AFMT_S8)
ao_data.bps*=2;
More information about the MPlayer-dev-eng
mailing list