changeset 30358:26d336c4a7a4

Support more formats for -ao pcm in raw mode. Patch by Peter Fordham [peter.fordham gmail com]
author reimar
date Sat, 23 Jan 2010 11:21:56 +0000
parents 3fdf04500df2
children 44b8f698fd15
files libao2/ao_pcm.c
diffstat 1 files changed, 19 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- a/libao2/ao_pcm.c	Sat Jan 23 11:14:18 2010 +0000
+++ b/libao2/ao_pcm.c	Sat Jan 23 11:21:56 2010 +0000
@@ -111,32 +111,27 @@
             strdup(ao_pcm_waveheader?"audiodump.wav":"audiodump.pcm");
     }
 
-    bits=8;
-    switch(format){
-    case AF_FORMAT_S32_BE:
-        format=AF_FORMAT_S32_LE;
-    case AF_FORMAT_S32_LE:
-        bits=32;
-        break;
-    case AF_FORMAT_FLOAT_BE:
-        format=AF_FORMAT_FLOAT_LE;
-    case AF_FORMAT_FLOAT_LE:
-        bits=32;
-        break;
-    case AF_FORMAT_S8:
-        format=AF_FORMAT_U8;
-    case AF_FORMAT_U8:
-        break;
-    case AF_FORMAT_AC3_BE:
-    case AF_FORMAT_AC3_LE:
-        bits=16;
-        break;
-    default:
-        format=AF_FORMAT_S16_LE;
-        bits=16;
-        break;
+    if (ao_pcm_waveheader)
+    {
+        // WAV files must have one of the following formats
+
+        switch(format){
+        case AF_FORMAT_U8:
+        case AF_FORMAT_S16_LE:
+        case AF_FORMAT_S24_LE:
+        case AF_FORMAT_S32_LE:
+        case AF_FORMAT_FLOAT_LE:
+        case AF_FORMAT_AC3_BE:
+        case AF_FORMAT_AC3_LE:
+             break;
+        default:
+            format = AF_FORMAT_S16_LE;
+            break;
+        }
     }
 
+    bits = af_fmt2bits(format);
+
     ao_data.outburst = 65536;
     ao_data.buffersize= 2*65536;
     ao_data.channels=channels;