[Mplayer-cvslog] CVS: main/libao2 ao_alsa9.c,1.22,1.23

joy_ping joyping at mplayerhq.hu
Tue Aug 20 16:15:41 CEST 2002


Update of /cvsroot/mplayer/main/libao2
In directory mail:/var/tmp.root/cvs-serv792

Modified Files:
	ao_alsa9.c 
Log Message:
changed spdif default from "hw:0,2" to general alias "iec958"
based on a patch by Benedikt Hunz <hunz at hunz.org>
corrected typo in ugly spdif-warning message
added 32/20bit modes for 'high-end'-soundcards
disabled hw-mixer-access for big-endian machines 
(mplayer seems to screw up hw-mixer on LinuxPPC running ALSA
needs more testing, but its safer to disable it for now.)



Index: ao_alsa9.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_alsa9.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- ao_alsa9.c	18 Jul 2002 16:09:54 -0000	1.22
+++ ao_alsa9.c	20 Aug 2002 14:15:25 -0000	1.23
@@ -140,17 +140,9 @@
        }
        if ((err = snd_ctl_elem_write(ctl_handler, ctl)) < 0) {
 	 //fprintf(stderr, "Unable to update the IEC958 control: %s\n", snd_strerror(err));
-	 printf("alsa-spdif-init: cant set spdif-trough automatically\n");
+	 printf("alsa-spdif-init: cant set spdif-through automatically\n");
         goto __diga_end;
        }
-       	//test area
-       /* elem_device = snd_ctl_elem_id_get_device(elem_id); */
-       /* elem_name = snd_ctl_elem_value_get_name(ctl);  */
-       /* snd_ctl_elem_value_get_iec958(ctl, &spdif); */
-       /* printf("spdif = %i, device = %i\n", &spdif, elem_device); */
-       /* printf("name = %s\n", elem_name); */
-	//end test area
-
 
       snd_ctl_close(ctl_handler);
       __diga_end:                                                       
@@ -211,6 +203,8 @@
     return CONTROL_TRUE;
   case AOCONTROL_GET_VOLUME:
   case AOCONTROL_SET_VOLUME:
+#ifndef WORDS_BIGENDIAN 
+{ //seems to be a problem on macs?
     {
       ao_control_vol_t *vol = (ao_control_vol_t *)arg;
 
@@ -303,7 +297,17 @@
       snd_mixer_close(handle);
       return CONTROL_OK;
     }
+}// end big-endian
+#endif
+#ifdef WORDS_BIGENDIAN
+{
+  {
+    return (CONTROL_UNKNOWN);
   }
+}
+#endif
+    
+  } //end witch
   return(CONTROL_UNKNOWN);
 }
 
@@ -344,49 +348,60 @@
     //ao_data.buffersize = MAX_OUTBURST; // was 16384
 
     switch (format)
-    {
-	case AFMT_S8:
-	    alsa_format = SND_PCM_FORMAT_S8;
-	    break;
-	case AFMT_U8:
-	    alsa_format = SND_PCM_FORMAT_U8;
-	    break;
-	case AFMT_U16_LE:
-	    alsa_format = SND_PCM_FORMAT_U16_LE;
-	    break;
-	case AFMT_U16_BE:
-	    alsa_format = SND_PCM_FORMAT_U16_BE;
-	    break;
+      {
+      case AFMT_S8:
+	alsa_format = SND_PCM_FORMAT_S8;
+	break;
+      case AFMT_U8:
+	alsa_format = SND_PCM_FORMAT_U8;
+	break;
+      case AFMT_U16_LE:
+	alsa_format = SND_PCM_FORMAT_U16_LE;
+	break;
+      case AFMT_U16_BE:
+	alsa_format = SND_PCM_FORMAT_U16_BE;
+	break;
 #ifndef WORDS_BIGENDIAN
-	case AFMT_AC3:
+      case AFMT_AC3:
 #endif
-	case AFMT_S16_LE:
-	    alsa_format = SND_PCM_FORMAT_S16_LE;
-	    break;
+      case AFMT_S16_LE:
+	alsa_format = SND_PCM_FORMAT_S16_LE;
+	break;
 #ifdef WORDS_BIGENDIAN
-	case AFMT_AC3:
+      case AFMT_AC3:
 #endif
-	case AFMT_S16_BE:
-	    alsa_format = SND_PCM_FORMAT_S16_BE;
-	    break;
-	default:
-	    alsa_format = SND_PCM_FORMAT_MPEG;
-	    break;
-    }
+      case AFMT_S16_BE:
+	alsa_format = SND_PCM_FORMAT_S16_BE;
+	break;
+      case AFMT_S32_LE:
+	alsa_format = SND_PCM_FORMAT_S32_LE;
+	break;
+      case AFMT_S32_BE:
+	alsa_format = SND_PCM_FORMAT_S32_BE;
+	break;
+
+      default:
+	alsa_format = SND_PCM_FORMAT_MPEG;
+	break;
+      }
     
     switch(alsa_format)
-    {
-	case SND_PCM_FORMAT_S16_LE:
-	case SND_PCM_FORMAT_U16_LE:
-	    ao_data.bps *= 2;
-	    break;
-	case -1:
-	    printf("alsa-init: invalid format (%s) requested - output disabled\n",
-		audio_out_format_name(format));
-	    return(0);
-	default:
-	    break;	    
-    }
+      {
+      case SND_PCM_FORMAT_S16_LE:
+      case SND_PCM_FORMAT_U16_LE:
+	ao_data.bps *= 2;
+	break;
+      case SND_PCM_FORMAT_S32_LE:
+      case SND_PCM_FORMAT_S32_BE:
+	ao_data.bps *= 4;
+	break;
+      case -1:
+	printf("alsa-init: invalid format (%s) requested - output disabled\n",
+	       audio_out_format_name(format));
+	return(0);
+      default:
+	break;	    
+      }
     
     if (ao_subdevice) {
       //start parsing ao_subdevice, ugly and not thread safe!
@@ -498,7 +513,7 @@
       if (device_set)
 	alsa_handler = spdif_init(alsa_device);
       else
-	alsa_handler = spdif_init("hw:0,2");
+	alsa_handler = spdif_init("iec958");
     }
 
     //setting modes for block or nonblock-mode
@@ -512,7 +527,7 @@
       set_block_mode = 0;
       str_block_mode = "block-mode";
     }
-    //cvs cosmetics fix
+
     //sets buff/chunksize if its set manually
     if (ao_data.buffersize) {
       switch (ao_data.buffersize)




More information about the MPlayer-cvslog mailing list