Support 32 bit float and integer formats in ao_pcm.c

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26636 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
reimar 2008-05-01 16:58:52 +00:00
parent 71247a97b3
commit 0f5ee4b7bd
1 changed files with 12 additions and 1 deletions

View File

@ -36,6 +36,7 @@ static int fast = 0;
#define WAV_ID_FMT 0x20746d66 /* "fmt " */
#define WAV_ID_DATA 0x61746164 /* "data" */
#define WAV_ID_PCM 0x0001
#define WAV_ID_FLOAT_PCM 0x0003
struct WaveHeader
{
@ -91,6 +92,16 @@ static int init(int rate,int channels,int format,int flags){
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:
@ -115,7 +126,7 @@ static int init(int rate,int channels,int format,int flags){
wavhdr.wave = le2me_32(WAV_ID_WAVE);
wavhdr.fmt = le2me_32(WAV_ID_FMT);
wavhdr.fmt_length = le2me_32(16);
wavhdr.fmt_tag = le2me_16(WAV_ID_PCM);
wavhdr.fmt_tag = le2me_16(format == AF_FORMAT_FLOAT_LE ? WAV_ID_FLOAT_PCM : WAV_ID_PCM);
wavhdr.channels = le2me_16(ao_data.channels);
wavhdr.sample_rate = le2me_32(ao_data.samplerate);
wavhdr.bytes_per_second = le2me_32(ao_data.bps);