Commit f1d74149 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

dsound: COM cleanup for the IDirectSoundCaptureBuffer8 iface.

parent 7dac3e09
...@@ -184,15 +184,17 @@ static const char * const captureStateString[] = { ...@@ -184,15 +184,17 @@ static const char * const captureStateString[] = {
/******************************************************************************* /*******************************************************************************
* IDirectSoundCaptureBuffer * IDirectSoundCaptureBuffer
*/ */
static HRESULT WINAPI static inline IDirectSoundCaptureBufferImpl *impl_from_IDirectSoundCaptureBuffer8(IDirectSoundCaptureBuffer8 *iface)
IDirectSoundCaptureBufferImpl_QueryInterface( {
LPDIRECTSOUNDCAPTUREBUFFER8 iface, return CONTAINING_RECORD(iface, IDirectSoundCaptureBufferImpl, IDirectSoundCaptureBuffer8_iface);
REFIID riid, }
LPVOID* ppobj )
static HRESULT WINAPI IDirectSoundCaptureBufferImpl_QueryInterface(IDirectSoundCaptureBuffer8 *iface,
REFIID riid, void **ppobj)
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres; HRESULT hres;
TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj ); TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj );
...@@ -219,28 +221,28 @@ IDirectSoundCaptureBufferImpl_QueryInterface( ...@@ -219,28 +221,28 @@ IDirectSoundCaptureBufferImpl_QueryInterface(
if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) || if ( IsEqualGUID( &IID_IDirectSoundCaptureBuffer, riid ) ||
IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) { IsEqualGUID( &IID_IDirectSoundCaptureBuffer8, riid ) ) {
IDirectSoundCaptureBuffer8_AddRef(iface); IDirectSoundCaptureBuffer8_AddRef(iface);
*ppobj = This; *ppobj = iface;
return NO_ERROR; return S_OK;
} }
FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj); FIXME("(%p,%s,%p) unsupported GUID\n", This, debugstr_guid(riid), ppobj);
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef(IDirectSoundCaptureBuffer8 *iface)
IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
ULONG ref = InterlockedIncrement(&(This->ref)); ULONG ref = InterlockedIncrement(&(This->ref));
TRACE("(%p) ref was %d\n", This, ref - 1); TRACE("(%p) ref was %d\n", This, ref - 1);
return ref; return ref;
} }
static ULONG WINAPI static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release(IDirectSoundCaptureBuffer8 *iface)
IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
ULONG ref = InterlockedDecrement(&(This->ref)); ULONG ref = InterlockedDecrement(&(This->ref));
TRACE("(%p) ref was %d\n", This, ref + 1); TRACE("(%p) ref was %d\n", This, ref + 1);
if (!ref) { if (!ref) {
...@@ -273,12 +275,10 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) ...@@ -273,12 +275,10 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
return ref; return ref;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCaps(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetCaps( DSCBCAPS *lpDSCBCaps)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPDSCBCAPS lpDSCBCaps )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
TRACE( "(%p,%p)\n", This, lpDSCBCaps ); TRACE( "(%p,%p)\n", This, lpDSCBCaps );
if (lpDSCBCaps == NULL) { if (lpDSCBCaps == NULL) {
...@@ -305,13 +305,11 @@ IDirectSoundCaptureBufferImpl_GetCaps( ...@@ -305,13 +305,11 @@ IDirectSoundCaptureBufferImpl_GetCaps(
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetCurrentPosition(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetCurrentPosition( DWORD *lpdwCapturePosition, DWORD *lpdwReadPosition)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPDWORD lpdwCapturePosition,
LPDWORD lpdwReadPosition )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
TRACE( "(%p,%p,%p)\n", This, lpdwCapturePosition, lpdwReadPosition ); TRACE( "(%p,%p,%p)\n", This, lpdwCapturePosition, lpdwReadPosition );
if (This->device == NULL) { if (This->device == NULL) {
...@@ -341,17 +339,13 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition( ...@@ -341,17 +339,13 @@ IDirectSoundCaptureBufferImpl_GetCurrentPosition(
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFormat(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetFormat( WAVEFORMATEX *lpwfxFormat, DWORD dwSizeAllocated, DWORD *lpdwSizeWritten)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPWAVEFORMATEX lpwfxFormat,
DWORD dwSizeAllocated,
LPDWORD lpdwSizeWritten )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres = DS_OK; HRESULT hres = DS_OK;
TRACE( "(%p,%p,0x%08x,%p)\n", This, lpwfxFormat, dwSizeAllocated,
lpdwSizeWritten ); TRACE("(%p,%p,0x%08x,%p)\n", This, lpwfxFormat, dwSizeAllocated, lpdwSizeWritten);
if (This->device == NULL) { if (This->device == NULL) {
WARN("invalid parameter: This->device == NULL\n"); WARN("invalid parameter: This->device == NULL\n");
...@@ -378,12 +372,11 @@ IDirectSoundCaptureBufferImpl_GetFormat( ...@@ -378,12 +372,11 @@ IDirectSoundCaptureBufferImpl_GetFormat(
return hres; return hres;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetStatus(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetStatus( DWORD *lpdwStatus)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPDWORD lpdwStatus )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
TRACE( "(%p, %p), thread is %04x\n", This, lpdwStatus, GetCurrentThreadId() ); TRACE( "(%p, %p), thread is %04x\n", This, lpdwStatus, GetCurrentThreadId() );
if (This->device == NULL) { if (This->device == NULL) {
...@@ -416,32 +409,23 @@ IDirectSoundCaptureBufferImpl_GetStatus( ...@@ -416,32 +409,23 @@ IDirectSoundCaptureBufferImpl_GetStatus(
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Initialize(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_Initialize( IDirectSoundCapture *lpDSC, const DSCBUFFERDESC *lpcDSCBDesc)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPDIRECTSOUNDCAPTURE lpDSC,
LPCDSCBUFFERDESC lpcDSCBDesc )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
FIXME( "(%p,%p,%p): stub\n", This, lpDSC, lpcDSCBDesc ); FIXME( "(%p,%p,%p): stub\n", This, lpDSC, lpcDSCBDesc );
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Lock(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_Lock( DWORD dwReadCusor, DWORD dwReadBytes, void **lplpvAudioPtr1, DWORD *lpdwAudioBytes1,
LPDIRECTSOUNDCAPTUREBUFFER8 iface, void **lplpvAudioPtr2, DWORD *lpdwAudioBytes2, DWORD dwFlags)
DWORD dwReadCusor,
DWORD dwReadBytes,
LPVOID* lplpvAudioPtr1,
LPDWORD lpdwAudioBytes1,
LPVOID* lplpvAudioPtr2,
LPDWORD lpdwAudioBytes2,
DWORD dwFlags )
{ {
IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres = DS_OK; HRESULT hres = DS_OK;
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE( "(%p,%08u,%08u,%p,%p,%p,%p,0x%08x) at %d\n", This, dwReadCusor, TRACE( "(%p,%08u,%08u,%p,%p,%p,%p,0x%08x) at %d\n", This, dwReadCusor,
dwReadBytes, lplpvAudioPtr1, lpdwAudioBytes1, lplpvAudioPtr2, dwReadBytes, lplpvAudioPtr1, lpdwAudioBytes1, lplpvAudioPtr2,
lpdwAudioBytes2, dwFlags, GetTickCount() ); lpdwAudioBytes2, dwFlags, GetTickCount() );
...@@ -489,13 +473,11 @@ IDirectSoundCaptureBufferImpl_Lock( ...@@ -489,13 +473,11 @@ IDirectSoundCaptureBufferImpl_Lock(
return hres; return hres;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Start(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_Start( DWORD dwFlags)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
DWORD dwFlags )
{ {
IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres; HRESULT hres;
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE( "(%p,0x%08x)\n", This, dwFlags ); TRACE( "(%p,0x%08x)\n", This, dwFlags );
...@@ -535,12 +517,12 @@ IDirectSoundCaptureBufferImpl_Start( ...@@ -535,12 +517,12 @@ IDirectSoundCaptureBufferImpl_Start(
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Stop(IDirectSoundCaptureBuffer8 *iface)
IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
{ {
IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres; HRESULT hres;
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE( "(%p)\n", This ); TRACE("(%p)\n", This);
if (This->device == NULL) { if (This->device == NULL) {
WARN("invalid parameter: This->device == NULL\n"); WARN("invalid parameter: This->device == NULL\n");
...@@ -570,16 +552,12 @@ IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) ...@@ -570,16 +552,12 @@ IDirectSoundCaptureBufferImpl_Stop( LPDIRECTSOUNDCAPTUREBUFFER8 iface )
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_Unlock(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_Unlock( void *lpvAudioPtr1, DWORD dwAudioBytes1, void *lpvAudioPtr2, DWORD dwAudioBytes2)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
LPVOID lpvAudioPtr1,
DWORD dwAudioBytes1,
LPVOID lpvAudioPtr2,
DWORD dwAudioBytes2 )
{ {
IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
HRESULT hres = DS_OK; HRESULT hres = DS_OK;
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface;
TRACE( "(%p,%p,%08u,%p,%08u)\n", This, lpvAudioPtr1, dwAudioBytes1, TRACE( "(%p,%p,%08u,%p,%08u)\n", This, lpvAudioPtr1, dwAudioBytes1,
lpvAudioPtr2, dwAudioBytes2 ); lpvAudioPtr2, dwAudioBytes2 );
...@@ -597,15 +575,10 @@ IDirectSoundCaptureBufferImpl_Unlock( ...@@ -597,15 +575,10 @@ IDirectSoundCaptureBufferImpl_Unlock(
return hres; return hres;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetObjectInPath(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetObjectInPath( REFGUID rguidObject, DWORD dwIndex, REFGUID rguidInterface, void **ppObject)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
REFGUID rguidObject,
DWORD dwIndex,
REFGUID rguidInterface,
LPVOID* ppObject )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
FIXME( "(%p,%s,%u,%s,%p): stub\n", This, debugstr_guid(rguidObject), FIXME( "(%p,%s,%u,%s,%p): stub\n", This, debugstr_guid(rguidObject),
dwIndex, debugstr_guid(rguidInterface), ppObject ); dwIndex, debugstr_guid(rguidInterface), ppObject );
...@@ -613,13 +586,10 @@ IDirectSoundCaptureBufferImpl_GetObjectInPath( ...@@ -613,13 +586,10 @@ IDirectSoundCaptureBufferImpl_GetObjectInPath(
return DS_OK; return DS_OK;
} }
static HRESULT WINAPI static HRESULT WINAPI IDirectSoundCaptureBufferImpl_GetFXStatus(IDirectSoundCaptureBuffer8 *iface,
IDirectSoundCaptureBufferImpl_GetFXStatus( DWORD dwFXCount, DWORD *pdwFXStatus)
LPDIRECTSOUNDCAPTUREBUFFER8 iface,
DWORD dwFXCount,
LPDWORD pdwFXStatus )
{ {
IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; IDirectSoundCaptureBufferImpl *This = impl_from_IDirectSoundCaptureBuffer8(iface);
FIXME( "(%p,%u,%p): stub\n", This, dwFXCount, pdwFXStatus ); FIXME( "(%p,%u,%p): stub\n", This, dwFXCount, pdwFXStatus );
...@@ -748,7 +718,7 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create( ...@@ -748,7 +718,7 @@ static HRESULT IDirectSoundCaptureBufferImpl_Create(
return DSERR_OUTOFMEMORY; return DSERR_OUTOFMEMORY;
} }
This->lpVtbl = &dscbvt; This->IDirectSoundCaptureBuffer8_iface.lpVtbl = &dscbvt;
err = IMMDevice_Activate(device->mmdevice, &IID_IAudioClient, err = IMMDevice_Activate(device->mmdevice, &IID_IAudioClient,
CLSCTX_INPROC_SERVER, NULL, (void**)&device->client); CLSCTX_INPROC_SERVER, NULL, (void**)&device->client);
...@@ -857,8 +827,7 @@ static ULONG DirectSoundCaptureDevice_Release( ...@@ -857,8 +827,7 @@ static ULONG DirectSoundCaptureDevice_Release(
LeaveCriticalSection(&DSOUND_capturers_lock); LeaveCriticalSection(&DSOUND_capturers_lock);
if (device->capture_buffer) if (device->capture_buffer)
IDirectSoundCaptureBufferImpl_Release( IDirectSoundCaptureBufferImpl_Release(&device->capture_buffer->IDirectSoundCaptureBuffer8_iface);
(LPDIRECTSOUNDCAPTUREBUFFER8) device->capture_buffer);
if(device->mmdevice) if(device->mmdevice)
IMMDevice_Release(device->mmdevice); IMMDevice_Release(device->mmdevice);
......
...@@ -247,13 +247,10 @@ struct DirectSoundCaptureDevice ...@@ -247,13 +247,10 @@ struct DirectSoundCaptureDevice
*/ */
struct IDirectSoundCaptureBufferImpl struct IDirectSoundCaptureBufferImpl
{ {
/* IUnknown fields */ IDirectSoundCaptureBuffer8 IDirectSoundCaptureBuffer8_iface;
const IDirectSoundCaptureBuffer8Vtbl *lpVtbl;
LONG ref; LONG ref;
/* IDirectSoundCaptureBuffer fields */
/* IDirectSoundCaptureBufferImpl fields */
DirectSoundCaptureDevice* device; DirectSoundCaptureDevice* device;
/* FIXME: don't need this */
LPDSCBUFFERDESC pdscbd; LPDSCBUFFERDESC pdscbd;
DWORD flags; DWORD flags;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment