changeset 12570:148f3c98a041

additional formats - 8bit & float
author henry
date Fri, 11 Jun 2004 15:20:49 +0000
parents 3c83f9e72664
children eba4d274e0a0
files libao2/ao_alsa.c
diffstat 1 files changed, 17 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_alsa.c	Fri Jun 11 15:16:26 2004 +0000
+++ b/libao2/ao_alsa.c	Fri Jun 11 15:20:49 2004 +0000
@@ -275,6 +275,9 @@
       case AFMT_S32_BE:
 	alsa_format = SND_PCM_FORMAT_S32_BE;
 	break;
+      case AFMT_FLOAT:
+	alsa_format = SND_PCM_FORMAT_FLOAT_LE;
+	break;
 
       default:
 	alsa_format = SND_PCM_FORMAT_MPEG; //? default should be -1
@@ -285,12 +288,17 @@
     //u16_le so 32bit is probably obsolet. 
     switch(alsa_format)
       {
+      case SND_PCM_FORMAT_S8:
+      case SND_PCM_FORMAT_U8:
+	ao_data.bps *= 1;
+	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:
+      case SND_PCM_FORMAT_FLOAT_LE:
 	ao_data.bps *= 4;
 	break;
       case -1:
@@ -364,12 +372,19 @@
 	  mp_msg(MSGT_AO,MSGL_V,"alsa-init: setup for 1/2 channel(s)\n");
 	  break;
 	case 4:
-	  strcpy(devstr, "surround40");
+	    if (alsa_format == SND_PCM_FORMAT_FLOAT_LE)
+		// hack - use the converter plugin
+		strcpy(devstr, "plug:surround40");
+	    else
+		strcpy(devstr, "surround40");
 	  alsa_device = devstr;
 	  mp_msg(MSGT_AO,MSGL_V,"alsa-init: device set to surround40\n");
 	  break;
 	case 6:
-	  strcpy(devstr, "surround51");
+	    if (alsa_format == SND_PCM_FORMAT_FLOAT_LE)
+		strcpy(devstr, "plug:surround51");
+	    else
+		strcpy(devstr, "surround51");
 	  alsa_device = devstr;
 	  mp_msg(MSGT_AO,MSGL_V,"alsa-init: device set to surround51\n");
 	  break;