winecoreaudio: Added WAVEFORMATEXTENSIBLE support, for PCM only.

This commit is contained in:
Jörg Höhle 2009-09-11 08:12:53 +02:00 committed by Alexandre Julliard
parent e6770a4011
commit c5b2acfb04
1 changed files with 28 additions and 2 deletions

View File

@ -40,8 +40,12 @@
#include "wingdi.h"
#include "winerror.h"
#include "mmddk.h"
#include "mmreg.h"
#include "dsound.h"
#include "dsdriver.h"
#include "ks.h"
#include "ksguid.h"
#include "ksmedia.h"
#include "coreaudio.h"
#include "wine/unicode.h"
#include "wine/library.h"
@ -441,12 +445,34 @@ static BOOL supportedFormat(LPWAVEFORMATEX wf)
if (wf->wBitsPerSample==8||wf->wBitsPerSample==16)
return TRUE;
}
} else if (wf->wFormatTag == WAVE_FORMAT_EXTENSIBLE) {
WAVEFORMATEXTENSIBLE * wfex = (WAVEFORMATEXTENSIBLE *)wf;
if (wf->cbSize == 22 && IsEqualGUID(&wfex->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM)) {
if (wf->nChannels >=1 && wf->nChannels <= 2) {
if (wf->wBitsPerSample==wfex->Samples.wValidBitsPerSample) {
if (wf->wBitsPerSample==8||wf->wBitsPerSample==16)
return TRUE;
} else
WARN("wBitsPerSample != wValidBitsPerSample not supported yet\n");
}
} else
WARN("only KSDATAFORMAT_SUBTYPE_PCM supported\n");
} else
WARN("only WAVE_FORMAT_PCM supported\n");
return FALSE;
}
void copyFormat(LPWAVEFORMATEX wf1, LPPCMWAVEFORMAT wf2)
{
memcpy(wf2, wf1, sizeof(PCMWAVEFORMAT));
/* Downgrade WAVE_FORMAT_EXTENSIBLE KSDATAFORMAT_SUBTYPE_PCM
* to smaller yet compatible WAVE_FORMAT_PCM structure */
if (wf2->wf.wFormatTag == WAVE_FORMAT_EXTENSIBLE)
wf2->wf.wFormatTag = WAVE_FORMAT_PCM;
}
/**************************************************************************
* CoreAudio_GetDevCaps [internal]
*/
@ -915,7 +941,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwo->wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
wwo->waveDesc = *lpDesc;
memcpy(&wwo->format, lpDesc->lpFormat, sizeof(PCMWAVEFORMAT));
copyFormat(lpDesc->lpFormat, &wwo->format);
wwo->dwPlayedTotal = 0;
wwo->dwWrittenTotal = 0;
@ -1941,7 +1967,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
wwi->wFlags = HIWORD(dwFlags & CALLBACK_TYPEMASK);
wwi->waveDesc = *lpDesc;
memcpy(&wwi->format, lpDesc->lpFormat, sizeof(PCMWAVEFORMAT));
copyFormat(lpDesc->lpFormat, &wwi->format);
wwi->dwTotalRecorded = 0;