dsound: Add support for WAVEFORMATEXTENSIBLE format.
This commit is contained in:
parent
15eb4c6fc9
commit
2a117a2017
|
@ -495,8 +495,9 @@ static HRESULT WINAPI IDirectSoundBufferImpl_GetFormat(
|
||||||
*wfwritten = size;
|
*wfwritten = size;
|
||||||
} else {
|
} else {
|
||||||
WARN("invalid parameter: wfsize too small\n");
|
WARN("invalid parameter: wfsize too small\n");
|
||||||
|
CopyMemory(lpwf,This->pwfx,wfsize);
|
||||||
if (wfwritten)
|
if (wfwritten)
|
||||||
*wfwritten = 0;
|
*wfwritten = wfsize;
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,6 +31,10 @@
|
||||||
#include "mmsystem.h"
|
#include "mmsystem.h"
|
||||||
#include "winternl.h"
|
#include "winternl.h"
|
||||||
#include "mmddk.h"
|
#include "mmddk.h"
|
||||||
|
#include "wingdi.h"
|
||||||
|
#include "mmreg.h"
|
||||||
|
#include "ks.h"
|
||||||
|
#include "ksmedia.h"
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "dsound.h"
|
#include "dsound.h"
|
||||||
#include "dsdriver.h"
|
#include "dsdriver.h"
|
||||||
|
@ -1522,6 +1526,7 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
|
||||||
WARN("invalid parameter: ppdsb == NULL\n");
|
WARN("invalid parameter: ppdsb == NULL\n");
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
*ppdsb = NULL;
|
||||||
|
|
||||||
if (TRACE_ON(dsound)) {
|
if (TRACE_ON(dsound)) {
|
||||||
TRACE("(structsize=%d)\n",dsbd->dwSize);
|
TRACE("(structsize=%d)\n",dsbd->dwSize);
|
||||||
|
@ -1558,12 +1563,51 @@ HRESULT DirectSoundDevice_CreateSoundBuffer(
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
IDirectSoundBufferImpl * dsb;
|
IDirectSoundBufferImpl * dsb;
|
||||||
|
WAVEFORMATEXTENSIBLE *pwfxe;
|
||||||
|
|
||||||
if (dsbd->lpwfxFormat == NULL) {
|
if (dsbd->lpwfxFormat == NULL) {
|
||||||
WARN("invalid parameter: dsbd->lpwfxFormat can't be NULL for "
|
WARN("invalid parameter: dsbd->lpwfxFormat can't be NULL for "
|
||||||
"secondary buffer\n");
|
"secondary buffer\n");
|
||||||
return DSERR_INVALIDPARAM;
|
return DSERR_INVALIDPARAM;
|
||||||
}
|
}
|
||||||
|
pwfxe = (WAVEFORMATEXTENSIBLE*)dsbd->lpwfxFormat;
|
||||||
|
|
||||||
|
if (pwfxe->Format.wBitsPerSample != 16 && pwfxe->Format.wBitsPerSample != 8 && pwfxe->Format.wFormatTag != WAVE_FORMAT_EXTENSIBLE)
|
||||||
|
{
|
||||||
|
WARN("wBitsPerSample=%d needs a WAVEFORMATEXTENSIBLE\n", dsbd->lpwfxFormat->wBitsPerSample);
|
||||||
|
return DSERR_CONTROLUNAVAIL;
|
||||||
|
}
|
||||||
|
if (pwfxe->Format.wFormatTag == WAVE_FORMAT_EXTENSIBLE)
|
||||||
|
{
|
||||||
|
if (pwfxe->Format.cbSize < (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)))
|
||||||
|
{
|
||||||
|
WARN("Too small a cbSize (%d/%d)\n", pwfxe->Format.cbSize, (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)));
|
||||||
|
return DSERR_INVALIDPARAM;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pwfxe->Format.cbSize > (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)))
|
||||||
|
{
|
||||||
|
WARN("Too big a cbSize (%d/%d)\n", pwfxe->Format.cbSize, (sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX)));
|
||||||
|
return DSERR_CONTROLUNAVAIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsEqualGUID(&pwfxe->SubFormat, &KSDATAFORMAT_SUBTYPE_PCM))
|
||||||
|
{
|
||||||
|
if (!IsEqualGUID(&pwfxe->SubFormat, &GUID_NULL))
|
||||||
|
FIXME("SubFormat %s not supported right now.\n", debugstr_guid(&pwfxe->SubFormat));
|
||||||
|
return DSERR_INVALIDPARAM;
|
||||||
|
}
|
||||||
|
if (pwfxe->Samples.wValidBitsPerSample > dsbd->lpwfxFormat->wBitsPerSample)
|
||||||
|
{
|
||||||
|
WARN("Samples.wValidBitsPerSample(%d) > Format.wBitsPerSample (%d)\n", pwfxe->Samples.wValidBitsPerSample, pwfxe->Format.wBitsPerSample);
|
||||||
|
return DSERR_INVALIDPARAM;
|
||||||
|
}
|
||||||
|
if (pwfxe->Samples.wValidBitsPerSample && pwfxe->Samples.wValidBitsPerSample < dsbd->lpwfxFormat->wBitsPerSample)
|
||||||
|
{
|
||||||
|
FIXME("Non-packed formats not supported right now: %d/%d\n", pwfxe->Samples.wValidBitsPerSample, dsbd->lpwfxFormat->wBitsPerSample);
|
||||||
|
return DSERR_CONTROLUNAVAIL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
|
TRACE("(formattag=0x%04x,chans=%d,samplerate=%d,"
|
||||||
"bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
|
"bytespersec=%d,blockalign=%d,bitspersamp=%d,cbSize=%d)\n",
|
||||||
|
|
|
@ -48,8 +48,11 @@
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "dsound.h"
|
#include "dsound.h"
|
||||||
#include "dsconf.h"
|
#include "dsconf.h"
|
||||||
|
#include "ks.h"
|
||||||
#include "initguid.h"
|
#include "initguid.h"
|
||||||
|
#include "ksmedia.h"
|
||||||
#include "dsdriver.h"
|
#include "dsdriver.h"
|
||||||
|
|
||||||
#include "dsound_private.h"
|
#include "dsound_private.h"
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
WINE_DEFAULT_DEBUG_CHANNEL(dsound);
|
||||||
|
|
Loading…
Reference in New Issue