winealsa.drv: Standardize the COM usage in dsoutput.c.
This commit is contained in:
parent
22d645ab4d
commit
820f376985
|
@ -68,7 +68,7 @@ typedef struct IDsDriverBufferImpl IDsDriverBufferImpl;
|
||||||
struct IDsDriverImpl
|
struct IDsDriverImpl
|
||||||
{
|
{
|
||||||
/* IUnknown fields */
|
/* IUnknown fields */
|
||||||
const IDsDriverVtbl *lpVtbl;
|
IDsDriver IDsDriver_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
|
|
||||||
/* IDsDriverImpl fields */
|
/* IDsDriverImpl fields */
|
||||||
|
@ -78,7 +78,7 @@ struct IDsDriverImpl
|
||||||
|
|
||||||
struct IDsDriverBufferImpl
|
struct IDsDriverBufferImpl
|
||||||
{
|
{
|
||||||
const IDsDriverBufferVtbl *lpVtbl;
|
IDsDriverBuffer IDsDriverBuffer_iface;
|
||||||
LONG ref;
|
LONG ref;
|
||||||
IDsDriverImpl* drv;
|
IDsDriverImpl* drv;
|
||||||
|
|
||||||
|
@ -93,6 +93,16 @@ struct IDsDriverBufferImpl
|
||||||
snd_pcm_uframes_t mmap_buflen_frames, mmap_pos, mmap_commitahead;
|
snd_pcm_uframes_t mmap_buflen_frames, mmap_pos, mmap_commitahead;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline IDsDriverImpl *impl_from_IDsDriver(IDsDriver *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IDsDriverImpl, IDsDriver_iface);
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline IDsDriverBufferImpl *impl_from_IDsDriverBuffer(IDsDriverBuffer *iface)
|
||||||
|
{
|
||||||
|
return CONTAINING_RECORD(iface, IDsDriverBufferImpl, IDsDriverBuffer_iface);
|
||||||
|
}
|
||||||
|
|
||||||
/** Fill buffers, for starting and stopping
|
/** Fill buffers, for starting and stopping
|
||||||
* Alsa won't start playing until everything is filled up
|
* Alsa won't start playing until everything is filled up
|
||||||
* This also updates mmap_pos
|
* This also updates mmap_pos
|
||||||
|
@ -281,7 +291,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_QueryInterface(PIDSDRIVERBUFFER iface,
|
||||||
|
|
||||||
static ULONG WINAPI IDsDriverBufferImpl_AddRef(PIDSDRIVERBUFFER iface)
|
static ULONG WINAPI IDsDriverBufferImpl_AddRef(PIDSDRIVERBUFFER iface)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
|
TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
|
||||||
|
@ -291,7 +301,7 @@ static ULONG WINAPI IDsDriverBufferImpl_AddRef(PIDSDRIVERBUFFER iface)
|
||||||
|
|
||||||
static ULONG WINAPI IDsDriverBufferImpl_Release(PIDSDRIVERBUFFER iface)
|
static ULONG WINAPI IDsDriverBufferImpl_Release(PIDSDRIVERBUFFER iface)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
|
TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
|
||||||
|
@ -324,7 +334,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_Lock(PIDSDRIVERBUFFER iface,
|
||||||
DWORD dwWritePosition,DWORD dwWriteLen,
|
DWORD dwWritePosition,DWORD dwWriteLen,
|
||||||
DWORD dwFlags)
|
DWORD dwFlags)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
snd_pcm_uframes_t writepos;
|
snd_pcm_uframes_t writepos;
|
||||||
|
|
||||||
TRACE("%d bytes from %d\n", dwWriteLen, dwWritePosition);
|
TRACE("%d bytes from %d\n", dwWriteLen, dwWritePosition);
|
||||||
|
@ -382,7 +392,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_Unlock(PIDSDRIVERBUFFER iface,
|
||||||
LPVOID pvAudio1,DWORD dwLen1,
|
LPVOID pvAudio1,DWORD dwLen1,
|
||||||
LPVOID pvAudio2,DWORD dwLen2)
|
LPVOID pvAudio2,DWORD dwLen2)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
snd_pcm_uframes_t writepos;
|
snd_pcm_uframes_t writepos;
|
||||||
|
|
||||||
if (!dwLen1)
|
if (!dwLen1)
|
||||||
|
@ -569,7 +579,7 @@ static HRESULT SetFormat(IDsDriverBufferImpl *This, LPWAVEFORMATEX pwfx)
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverBufferImpl_SetFormat(PIDSDRIVERBUFFER iface, LPWAVEFORMATEX pwfx)
|
static HRESULT WINAPI IDsDriverBufferImpl_SetFormat(PIDSDRIVERBUFFER iface, LPWAVEFORMATEX pwfx)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
TRACE("(%p, %p)\n", iface, pwfx);
|
TRACE("(%p, %p)\n", iface, pwfx);
|
||||||
|
@ -594,7 +604,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_SetFrequency(PIDSDRIVERBUFFER iface, D
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverBufferImpl_SetVolumePan(PIDSDRIVERBUFFER iface, PDSVOLUMEPAN pVolPan)
|
static HRESULT WINAPI IDsDriverBufferImpl_SetVolumePan(PIDSDRIVERBUFFER iface, PDSVOLUMEPAN pVolPan)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
FIXME("(%p,%p): stub\n",This,pVolPan);
|
FIXME("(%p,%p): stub\n",This,pVolPan);
|
||||||
/* TODO: Bring volume control back */
|
/* TODO: Bring volume control back */
|
||||||
return DS_OK;
|
return DS_OK;
|
||||||
|
@ -611,7 +621,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_SetPosition(PIDSDRIVERBUFFER iface, DW
|
||||||
static HRESULT WINAPI IDsDriverBufferImpl_GetPosition(PIDSDRIVERBUFFER iface,
|
static HRESULT WINAPI IDsDriverBufferImpl_GetPosition(PIDSDRIVERBUFFER iface,
|
||||||
LPDWORD lpdwPlay, LPDWORD lpdwWrite)
|
LPDWORD lpdwPlay, LPDWORD lpdwWrite)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
snd_pcm_uframes_t hw_pptr, hw_wptr;
|
snd_pcm_uframes_t hw_pptr, hw_wptr;
|
||||||
snd_pcm_state_t state;
|
snd_pcm_state_t state;
|
||||||
|
|
||||||
|
@ -676,7 +686,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_GetPosition(PIDSDRIVERBUFFER iface,
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverBufferImpl_Play(PIDSDRIVERBUFFER iface, DWORD dwRes1, DWORD dwRes2, DWORD dwFlags)
|
static HRESULT WINAPI IDsDriverBufferImpl_Play(PIDSDRIVERBUFFER iface, DWORD dwRes1, DWORD dwRes2, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
TRACE("(%p,%x,%x,%x)\n",iface,dwRes1,dwRes2,dwFlags);
|
TRACE("(%p,%x,%x,%x)\n",iface,dwRes1,dwRes2,dwFlags);
|
||||||
|
|
||||||
/* **** */
|
/* **** */
|
||||||
|
@ -692,7 +702,7 @@ static HRESULT WINAPI IDsDriverBufferImpl_Stop(PIDSDRIVERBUFFER iface)
|
||||||
const snd_pcm_channel_area_t *areas;
|
const snd_pcm_channel_area_t *areas;
|
||||||
snd_pcm_uframes_t avail;
|
snd_pcm_uframes_t avail;
|
||||||
snd_pcm_format_t format;
|
snd_pcm_format_t format;
|
||||||
IDsDriverBufferImpl *This = (IDsDriverBufferImpl *)iface;
|
IDsDriverBufferImpl *This = impl_from_IDsDriverBuffer(iface);
|
||||||
TRACE("(%p)\n",iface);
|
TRACE("(%p)\n",iface);
|
||||||
|
|
||||||
/* **** */
|
/* **** */
|
||||||
|
@ -745,7 +755,7 @@ static HRESULT WINAPI IDsDriverImpl_QueryInterface(PIDSDRIVER iface, REFIID riid
|
||||||
|
|
||||||
static ULONG WINAPI IDsDriverImpl_AddRef(PIDSDRIVER iface)
|
static ULONG WINAPI IDsDriverImpl_AddRef(PIDSDRIVER iface)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
ULONG refCount = InterlockedIncrement(&This->ref);
|
ULONG refCount = InterlockedIncrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
|
TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
|
||||||
|
@ -755,7 +765,7 @@ static ULONG WINAPI IDsDriverImpl_AddRef(PIDSDRIVER iface)
|
||||||
|
|
||||||
static ULONG WINAPI IDsDriverImpl_Release(PIDSDRIVER iface)
|
static ULONG WINAPI IDsDriverImpl_Release(PIDSDRIVER iface)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
ULONG refCount = InterlockedDecrement(&This->ref);
|
ULONG refCount = InterlockedDecrement(&This->ref);
|
||||||
|
|
||||||
TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
|
TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
|
||||||
|
@ -769,7 +779,7 @@ static ULONG WINAPI IDsDriverImpl_Release(PIDSDRIVER iface)
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverImpl_GetDriverDesc(PIDSDRIVER iface, PDSDRIVERDESC pDesc)
|
static HRESULT WINAPI IDsDriverImpl_GetDriverDesc(PIDSDRIVER iface, PDSDRIVERDESC pDesc)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
TRACE("(%p,%p)\n",iface,pDesc);
|
TRACE("(%p,%p)\n",iface,pDesc);
|
||||||
*pDesc = WOutDev[This->wDevID].ds_desc;
|
*pDesc = WOutDev[This->wDevID].ds_desc;
|
||||||
pDesc->dwFlags = DSDDESC_DONTNEEDSECONDARYLOCK | DSDDESC_DONTNEEDWRITELEAD;
|
pDesc->dwFlags = DSDDESC_DONTNEEDSECONDARYLOCK | DSDDESC_DONTNEEDWRITELEAD;
|
||||||
|
@ -790,7 +800,7 @@ static HRESULT WINAPI IDsDriverImpl_GetDriverDesc(PIDSDRIVER iface, PDSDRIVERDES
|
||||||
static HRESULT WINAPI IDsDriverImpl_Open(PIDSDRIVER iface)
|
static HRESULT WINAPI IDsDriverImpl_Open(PIDSDRIVER iface)
|
||||||
{
|
{
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
int err=0;
|
int err=0;
|
||||||
snd_pcm_t *pcm = NULL;
|
snd_pcm_t *pcm = NULL;
|
||||||
snd_pcm_hw_params_t *hw_params;
|
snd_pcm_hw_params_t *hw_params;
|
||||||
|
@ -833,14 +843,14 @@ static HRESULT WINAPI IDsDriverImpl_Open(PIDSDRIVER iface)
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverImpl_Close(PIDSDRIVER iface)
|
static HRESULT WINAPI IDsDriverImpl_Close(PIDSDRIVER iface)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
TRACE("(%p) stub, harmless\n",This);
|
TRACE("(%p) stub, harmless\n",This);
|
||||||
return DS_OK;
|
return DS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI IDsDriverImpl_GetCaps(PIDSDRIVER iface, PDSDRIVERCAPS pCaps)
|
static HRESULT WINAPI IDsDriverImpl_GetCaps(PIDSDRIVER iface, PDSDRIVERCAPS pCaps)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
TRACE("(%p,%p)\n",iface,pCaps);
|
TRACE("(%p,%p)\n",iface,pCaps);
|
||||||
*pCaps = WOutDev[This->wDevID].ds_caps;
|
*pCaps = WOutDev[This->wDevID].ds_caps;
|
||||||
return DS_OK;
|
return DS_OK;
|
||||||
|
@ -853,7 +863,7 @@ static HRESULT WINAPI IDsDriverImpl_CreateSoundBuffer(PIDSDRIVER iface,
|
||||||
LPBYTE *ppbBuffer,
|
LPBYTE *ppbBuffer,
|
||||||
LPVOID *ppvObj)
|
LPVOID *ppvObj)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
IDsDriverBufferImpl** ippdsdb = (IDsDriverBufferImpl**)ppvObj;
|
IDsDriverBufferImpl** ippdsdb = (IDsDriverBufferImpl**)ppvObj;
|
||||||
HRESULT err;
|
HRESULT err;
|
||||||
|
|
||||||
|
@ -876,7 +886,7 @@ static HRESULT WINAPI IDsDriverImpl_CreateSoundBuffer(PIDSDRIVER iface,
|
||||||
HeapFree(GetProcessHeap(), 0, (*ippdsdb)->hw_params);
|
HeapFree(GetProcessHeap(), 0, (*ippdsdb)->hw_params);
|
||||||
return DSERR_OUTOFMEMORY;
|
return DSERR_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
(*ippdsdb)->lpVtbl = &dsdbvt;
|
(*ippdsdb)->IDsDriverBuffer_iface.lpVtbl = &dsdbvt;
|
||||||
(*ippdsdb)->ref = 1;
|
(*ippdsdb)->ref = 1;
|
||||||
(*ippdsdb)->drv = This;
|
(*ippdsdb)->drv = This;
|
||||||
InitializeCriticalSection(&(*ippdsdb)->pcm_crst);
|
InitializeCriticalSection(&(*ippdsdb)->pcm_crst);
|
||||||
|
@ -912,7 +922,7 @@ static HRESULT WINAPI IDsDriverImpl_DuplicateSoundBuffer(PIDSDRIVER iface,
|
||||||
PIDSDRIVERBUFFER pBuffer,
|
PIDSDRIVERBUFFER pBuffer,
|
||||||
LPVOID *ppvObj)
|
LPVOID *ppvObj)
|
||||||
{
|
{
|
||||||
IDsDriverImpl *This = (IDsDriverImpl *)iface;
|
IDsDriverImpl *This = impl_from_IDsDriver(iface);
|
||||||
FIXME("(%p,%p): stub\n",This,pBuffer);
|
FIXME("(%p,%p): stub\n",This,pBuffer);
|
||||||
return DSERR_INVALIDCALL;
|
return DSERR_INVALIDCALL;
|
||||||
}
|
}
|
||||||
|
@ -939,7 +949,7 @@ DWORD wodDsCreate(UINT wDevID, PIDSDRIVER* drv)
|
||||||
*idrv = HeapAlloc(GetProcessHeap(),0,sizeof(IDsDriverImpl));
|
*idrv = HeapAlloc(GetProcessHeap(),0,sizeof(IDsDriverImpl));
|
||||||
if (!*idrv)
|
if (!*idrv)
|
||||||
return MMSYSERR_NOMEM;
|
return MMSYSERR_NOMEM;
|
||||||
(*idrv)->lpVtbl = &dsdvt;
|
(*idrv)->IDsDriver_iface.lpVtbl = &dsdvt;
|
||||||
(*idrv)->ref = 1;
|
(*idrv)->ref = 1;
|
||||||
|
|
||||||
(*idrv)->wDevID = wDevID;
|
(*idrv)->wDevID = wDevID;
|
||||||
|
|
Loading…
Reference in New Issue