[MPlayer-cvslog] CVS: main/libao2 ao_oss.c,1.54,1.55

Alban Bedel CVS syncmail at mplayerhq.hu
Thu Nov 10 10:02:58 CET 2005


CVS change done by Alban Bedel CVS

Update of /cvsroot/mplayer/main/libao2
In directory mail:/var2/tmp/cvs-serv12165/libao2

Modified Files:
	ao_oss.c 
Log Message:
Allow setting the mixer per instance so one can fallback between
several oos device and still have correct mixer settings all the
time.
The sytax is now: oss[:dsp_device[:mixer_device[:mixer_channel]]]


Index: ao_oss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- ao_oss.c	3 Jul 2005 11:38:35 -0000	1.54
+++ ao_oss.c	10 Nov 2005 09:02:56 -0000	1.55
@@ -215,17 +215,32 @@
 static int init(int rate,int channels,int format,int flags){
   char *mixer_channels [SOUND_MIXER_NRDEVICES] = SOUND_DEVICE_NAMES;
   int oss_format;
+  char *mdev = mixer_device, *mchan = mixer_channel;
 
   mp_msg(MSGT_AO,MSGL_V,"ao2: %d Hz  %d chans  %s\n",rate,channels,
     af_fmt2str_short(format));
 
-  if (ao_subdevice)
+  if (ao_subdevice) {
+    char *m,*c;
+    m = strchr(ao_subdevice,':');
+    if(m) {
+      c = strchr(m+1,':');
+      if(c) {
+        mchan = c+1;
+        c[0] = '\0';
+      }
+      mdev = m+1;
+      m[0] = '\0';
+    }
     dsp = ao_subdevice;
+  }
 
-  if(mixer_device)
-    oss_mixer_device=mixer_device;
-
-  if(mixer_channel){
+  if(mdev)
+    oss_mixer_device=mdev;
+  else
+    oss_mixer_device=PATH_DEV_MIXER;
+  
+  if(mchan){
     int fd, devs, i;
     
     if ((fd = open(oss_mixer_device, O_RDONLY)) == -1){
@@ -236,10 +251,9 @@
       close(fd);
       
       for (i=0; i<SOUND_MIXER_NRDEVICES; i++){
-        if(!strcasecmp(mixer_channels[i], mixer_channel)){
+        if(!strcasecmp(mixer_channels[i], mchan)){
           if(!(devs & (1 << i))){
-            mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,
-              mixer_channel);
+            mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
             i = SOUND_MIXER_NRDEVICES+1;
             break;
           }
@@ -248,11 +262,11 @@
         }
       }
       if(i==SOUND_MIXER_NRDEVICES){
-        mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,
-          mixer_channel);
+        mp_msg(MSGT_AO,MSGL_ERR,MSGTR_AO_OSS_ChanNotFound,mchan);
       }
     }
-  }
+  } else
+    oss_mixer_channel = SOUND_MIXER_PCM;
 
   mp_msg(MSGT_AO,MSGL_V,"audio_setup: using '%s' dsp device\n", dsp);
   mp_msg(MSGT_AO,MSGL_V,"audio_setup: using '%s' mixer device\n", oss_mixer_device);




More information about the MPlayer-cvslog mailing list