Trailing white space cleanup.
Add IClassFactory->CreateInstance aggregation checks. IID_IDirectSoundCapture and IID_IDirectSoundCapture8 are same so remove redundant check. Allocate capture buffer for hw driver if necessary.
This commit is contained in:
parent
5bc8077511
commit
d4c9f92c65
|
@ -680,6 +680,8 @@ DSOUND_CreateDirectSoundCaptureBuffer(
|
|||
return DSERR_OUTOFMEMORY;
|
||||
} else {
|
||||
HRESULT err = DS_OK;
|
||||
LPBYTE newbuf;
|
||||
DWORD buflen;
|
||||
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)*ppobj;
|
||||
|
||||
This->ref = 1;
|
||||
|
@ -704,6 +706,35 @@ DSOUND_CreateDirectSoundCaptureBuffer(
|
|||
This->lpVtbl = &dscbvt;
|
||||
|
||||
if (ipDSC->driver) {
|
||||
if (This->dsound->drvdesc.dwFlags & DSDDESC_DOMMSYSTEMOPEN)
|
||||
FIXME("DSDDESC_DOMMSYSTEMOPEN not supported\n");
|
||||
|
||||
if (This->dsound->drvdesc.dwFlags & DSDDESC_USESYSTEMMEMORY) {
|
||||
/* allocate buffer from system memory */
|
||||
buflen = lpcDSCBufferDesc->dwBufferBytes;
|
||||
TRACE("desired buflen=%ld, old buffer=%p\n", buflen, ipDSC->buffer);
|
||||
if (ipDSC->buffer)
|
||||
newbuf = HeapReAlloc(GetProcessHeap(),0,ipDSC->buffer,buflen);
|
||||
else
|
||||
newbuf = HeapAlloc(GetProcessHeap(),0,buflen);
|
||||
|
||||
if (newbuf == NULL) {
|
||||
WARN("failed to allocate capture buffer\n");
|
||||
err = DSERR_OUTOFMEMORY;
|
||||
/* but the old buffer might still exist and must be re-prepared */
|
||||
} else {
|
||||
ipDSC->buffer = newbuf;
|
||||
ipDSC->buflen = buflen;
|
||||
}
|
||||
} else {
|
||||
/* let driver allocate memory */
|
||||
ipDSC->buflen = lpcDSCBufferDesc->dwBufferBytes;
|
||||
/* FIXME: */
|
||||
if (ipDSC->buffer)
|
||||
HeapFree( GetProcessHeap(), 0, ipDSC->buffer);
|
||||
ipDSC->buffer = NULL;
|
||||
}
|
||||
|
||||
err = IDsCaptureDriver_CreateCaptureBuffer(ipDSC->driver,
|
||||
ipDSC->pwfx,0,0,&(ipDSC->buflen),&(ipDSC->buffer),(LPVOID*)&(ipDSC->hwbuf));
|
||||
if (err != DS_OK) {
|
||||
|
@ -714,8 +745,6 @@ DSOUND_CreateDirectSoundCaptureBuffer(
|
|||
return err;
|
||||
}
|
||||
} else {
|
||||
LPBYTE newbuf;
|
||||
DWORD buflen;
|
||||
DWORD flags = CALLBACK_FUNCTION;
|
||||
if (ds_hw_accel != DS_HW_ACCEL_EMULATION)
|
||||
flags |= WAVE_DIRECTSOUND;
|
||||
|
@ -1596,6 +1625,11 @@ DSCCF_CreateInstance(
|
|||
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
|
||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
|
||||
if (pOuter) {
|
||||
WARN("aggregation not supported\n");
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
}
|
||||
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return E_INVALIDARG;
|
||||
|
@ -1603,10 +1637,8 @@ DSCCF_CreateInstance(
|
|||
|
||||
*ppobj = NULL;
|
||||
|
||||
if ( IsEqualGUID( &IID_IDirectSoundCapture, riid ) ||
|
||||
IsEqualGUID( &IID_IDirectSoundCapture8, riid ) ) {
|
||||
if ( IsEqualGUID( &IID_IDirectSoundCapture8, riid ) )
|
||||
return DirectSoundCaptureCreate8(0,(LPDIRECTSOUNDCAPTURE8*)ppobj,pOuter);
|
||||
}
|
||||
|
||||
WARN("(%p,%p,%s,%p) Interface not found!\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
return E_NOINTERFACE;
|
||||
|
@ -1820,6 +1852,11 @@ DSFDCF_CreateInstance(
|
|||
|
||||
TRACE("(%p)->(%p,%s,%p)\n",This,pOuter,debugstr_guid(riid),ppobj);
|
||||
|
||||
if (pOuter) {
|
||||
WARN("aggregation not supported\n");
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
}
|
||||
|
||||
if (ppobj == NULL) {
|
||||
WARN("invalid parameter\n");
|
||||
return E_INVALIDARG;
|
||||
|
|
Loading…
Reference in New Issue