initial support for ac3+wma spdif passthrough for pa_win_wmme. see flags in pa_win_wmme.h. flags currently work for OpenStream but are ignored for IsFormatSupported

This commit is contained in:
rossb 2009-01-21 12:07:32 +00:00
commit 1de1b421f9
5 changed files with 77 additions and 32 deletions

View file

@ -47,30 +47,27 @@
#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
#endif
#if !defined(WAVE_FORMAT_IEEE_FLOAT)
#define WAVE_FORMAT_IEEE_FLOAT 0x0003
#endif
static GUID pawin_ksDataFormatSubtypePcm =
static GUID pawin_ksDataFormatSubtypeGuidBase =
{ (USHORT)(WAVE_FORMAT_PCM), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
static GUID pawin_ksDataFormatSubtypeIeeeFloat =
{ (USHORT)(WAVE_FORMAT_IEEE_FLOAT), 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71 };
int PaWin_SampleFormatToLinearWaveFormatTag( PaSampleFormat sampleFormat )
{
if( sampleFormat == paFloat32 )
return PAWIN_WAVE_FORMAT_IEEE_FLOAT;
return PAWIN_WAVE_FORMAT_PCM;
}
void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
int numChannels, PaSampleFormat sampleFormat, double sampleRate )
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate )
{
WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
int bytesPerSample = Pa_GetSampleSize(sampleFormat);
unsigned long bytesPerFrame = numChannels * bytesPerSample;
if( sampleFormat == paFloat32 )
waveFormatEx->wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
else
waveFormatEx->wFormatTag = WAVE_FORMAT_PCM;
waveFormatEx->wFormatTag = waveFormatTag;
waveFormatEx->nChannels = (WORD)numChannels;
waveFormatEx->nSamplesPerSec = (DWORD)sampleRate;
waveFormatEx->nAvgBytesPerSec = waveFormatEx->nSamplesPerSec * bytesPerFrame;
@ -81,12 +78,13 @@ void PaWin_InitializeWaveFormatEx( PaWinWaveFormat *waveFormat,
void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
int numChannels, PaSampleFormat sampleFormat, double sampleRate,
int numChannels, PaSampleFormat sampleFormat, int waveFormatTag, double sampleRate,
PaWinWaveFormatChannelMask channelMask )
{
WAVEFORMATEX *waveFormatEx = (WAVEFORMATEX*)waveFormat;
int bytesPerSample = Pa_GetSampleSize(sampleFormat);
unsigned long bytesPerFrame = numChannels * bytesPerSample;
GUID guid;
waveFormatEx->wFormatTag = WAVE_FORMAT_EXTENSIBLE;
waveFormatEx->nChannels = (WORD)numChannels;
@ -100,13 +98,10 @@ void PaWin_InitializeWaveFormatExtensible( PaWinWaveFormat *waveFormat,
waveFormatEx->wBitsPerSample;
*((DWORD*)&waveFormat->fields[PAWIN_INDEXOF_DWCHANNELMASK]) = channelMask;
if( sampleFormat == paFloat32 )
*((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) =
pawin_ksDataFormatSubtypeIeeeFloat;
else
*((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) =
pawin_ksDataFormatSubtypePcm;
guid = pawin_ksDataFormatSubtypeGuidBase;
guid.Data1 = (USHORT)waveFormatTag;
*((GUID*)&waveFormat->fields[PAWIN_INDEXOF_SUBFORMAT]) = guid;
}