quartz/dsoundrender: Get rid of the DSoundRenderImpl typedef.

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-03-31 23:48:19 -05:00 committed by Alexandre Julliard
parent e1bdc1e7a0
commit 5a5db91edd
1 changed files with 48 additions and 43 deletions

View File

@ -39,7 +39,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
*/
static const REFERENCE_TIME DSoundRenderer_Max_Fill = 150 * 10000;
typedef struct DSoundRenderImpl
struct dsound_render
{
struct strmbase_renderer renderer;
@ -57,31 +57,33 @@ typedef struct DSoundRenderImpl
LONG volume;
LONG pan;
} DSoundRenderImpl;
};
static inline DSoundRenderImpl *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
static struct dsound_render *impl_from_strmbase_renderer(struct strmbase_renderer *iface)
{
return CONTAINING_RECORD(iface, DSoundRenderImpl, renderer);
return CONTAINING_RECORD(iface, struct dsound_render, renderer);
}
static inline DSoundRenderImpl *impl_from_IBasicAudio(IBasicAudio *iface)
static struct dsound_render *impl_from_IBasicAudio(IBasicAudio *iface)
{
return CONTAINING_RECORD(iface, DSoundRenderImpl, IBasicAudio_iface);
return CONTAINING_RECORD(iface, struct dsound_render, IBasicAudio_iface);
}
static inline DSoundRenderImpl *impl_from_IAMDirectSound(IAMDirectSound *iface)
static struct dsound_render *impl_from_IAMDirectSound(IAMDirectSound *iface)
{
return CONTAINING_RECORD(iface, DSoundRenderImpl, IAMDirectSound_iface);
return CONTAINING_RECORD(iface, struct dsound_render, IAMDirectSound_iface);
}
static REFERENCE_TIME time_from_pos(DSoundRenderImpl *This, DWORD pos) {
static REFERENCE_TIME time_from_pos(struct dsound_render *This, DWORD pos)
{
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mt.pbFormat;
REFERENCE_TIME ret = 10000000;
ret = ret * pos / wfx->nAvgBytesPerSec;
return ret;
}
static DWORD pos_from_time(DSoundRenderImpl *This, REFERENCE_TIME time) {
static DWORD pos_from_time(struct dsound_render *This, REFERENCE_TIME time)
{
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mt.pbFormat;
REFERENCE_TIME ret = time;
ret *= wfx->nAvgBytesPerSec;
@ -90,7 +92,8 @@ static DWORD pos_from_time(DSoundRenderImpl *This, REFERENCE_TIME time) {
return ret;
}
static void DSoundRender_UpdatePositions(DSoundRenderImpl *This, DWORD *seqwritepos, DWORD *minwritepos) {
static void DSoundRender_UpdatePositions(struct dsound_render *This, DWORD *seqwritepos, DWORD *minwritepos)
{
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mt.pbFormat;
BYTE *buf1, *buf2;
DWORD size1, size2, playpos, writepos, old_writepos, old_playpos, adv;
@ -127,7 +130,8 @@ static void DSoundRender_UpdatePositions(DSoundRenderImpl *This, DWORD *seqwrite
*seqwritepos = This->writepos;
}
static HRESULT DSoundRender_GetWritePos(DSoundRenderImpl *This, DWORD *ret_writepos, REFERENCE_TIME write_at, DWORD *pfree, DWORD *skip)
static HRESULT DSoundRender_GetWritePos(struct dsound_render *This,
DWORD *ret_writepos, REFERENCE_TIME write_at, DWORD *pfree, DWORD *skip)
{
WAVEFORMATEX *wfx = (WAVEFORMATEX *)This->renderer.sink.pin.mt.pbFormat;
DWORD writepos, min_writepos, playpos;
@ -206,7 +210,7 @@ end:
return S_OK;
}
static HRESULT DSoundRender_HandleEndOfStream(DSoundRenderImpl *This)
static HRESULT DSoundRender_HandleEndOfStream(struct dsound_render *This)
{
while (This->renderer.filter.state == State_Running)
{
@ -225,7 +229,8 @@ static HRESULT DSoundRender_HandleEndOfStream(DSoundRenderImpl *This)
return S_OK;
}
static HRESULT DSoundRender_SendSampleData(DSoundRenderImpl* This, REFERENCE_TIME tStart, REFERENCE_TIME tStop, const BYTE *data, DWORD size)
static HRESULT DSoundRender_SendSampleData(struct dsound_render *This,
REFERENCE_TIME tStart, REFERENCE_TIME tStop, const BYTE *data, DWORD size)
{
HRESULT hr;
@ -286,7 +291,7 @@ static HRESULT WINAPI DSoundRender_ShouldDrawSampleNow(struct strmbase_renderer
static HRESULT WINAPI DSoundRender_PrepareReceive(struct strmbase_renderer *iface, IMediaSample *pSample)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
HRESULT hr;
AM_MEDIA_TYPE *amt;
@ -321,7 +326,7 @@ static HRESULT WINAPI DSoundRender_PrepareReceive(struct strmbase_renderer *ifac
static HRESULT WINAPI DSoundRender_DoRenderSample(struct strmbase_renderer *iface, IMediaSample *pSample)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
LPBYTE pbSrcStream = NULL;
LONG cbSrcStream = 0;
REFERENCE_TIME tStart, tStop;
@ -389,7 +394,7 @@ static HRESULT WINAPI DSoundRender_CheckMediaType(struct strmbase_renderer *ifac
static void dsound_render_stop_stream(struct strmbase_renderer *iface)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
TRACE("(%p/%p)->()\n", This, iface);
@ -399,7 +404,7 @@ static void dsound_render_stop_stream(struct strmbase_renderer *iface)
static void dsound_render_start_stream(struct strmbase_renderer *iface)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
TRACE("(%p)\n", This);
@ -411,7 +416,7 @@ static void dsound_render_start_stream(struct strmbase_renderer *iface)
static HRESULT dsound_render_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE *mt)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
const WAVEFORMATEX *format = (WAVEFORMATEX *)mt->pbFormat;
HRESULT hr = S_OK;
DSBUFFERDESC buf_desc;
@ -454,7 +459,7 @@ static HRESULT dsound_render_connect(struct strmbase_renderer *iface, const AM_M
static HRESULT WINAPI DSoundRender_BreakConnect(struct strmbase_renderer *iface)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
TRACE("(%p)->()\n", iface);
@ -467,13 +472,13 @@ static HRESULT WINAPI DSoundRender_BreakConnect(struct strmbase_renderer *iface)
static HRESULT WINAPI DSoundRender_EndOfStream(struct strmbase_renderer *iface)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
return DSoundRender_HandleEndOfStream(This);
}
static HRESULT WINAPI DSoundRender_EndFlush(struct strmbase_renderer *iface)
{
DSoundRenderImpl *This = impl_from_strmbase_renderer(iface);
struct dsound_render *This = impl_from_strmbase_renderer(iface);
if (This->dsbuffer)
{
@ -492,7 +497,7 @@ static HRESULT WINAPI DSoundRender_EndFlush(struct strmbase_renderer *iface)
static void dsound_render_destroy(struct strmbase_renderer *iface)
{
DSoundRenderImpl *filter = impl_from_strmbase_renderer(iface);
struct dsound_render *filter = impl_from_strmbase_renderer(iface);
if (filter->dsbuffer)
IDirectSoundBuffer_Release(filter->dsbuffer);
@ -509,7 +514,7 @@ static void dsound_render_destroy(struct strmbase_renderer *iface)
static HRESULT dsound_render_query_interface(struct strmbase_renderer *iface, REFIID iid, void **out)
{
DSoundRenderImpl *filter = impl_from_strmbase_renderer(iface);
struct dsound_render *filter = impl_from_strmbase_renderer(iface);
if (IsEqualGUID(iid, &IID_IBasicAudio))
*out = &filter->IBasicAudio_iface;
@ -544,7 +549,7 @@ static const struct strmbase_renderer_ops renderer_ops =
static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface,
REFIID riid,
LPVOID*ppvObj) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
@ -552,7 +557,7 @@ static HRESULT WINAPI Basicaudio_QueryInterface(IBasicAudio *iface,
}
static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->()\n", This, iface);
@ -560,7 +565,7 @@ static ULONG WINAPI Basicaudio_AddRef(IBasicAudio *iface) {
}
static ULONG WINAPI Basicaudio_Release(IBasicAudio *iface) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->()\n", This, iface);
@ -617,7 +622,7 @@ static HRESULT WINAPI basic_audio_Invoke(IBasicAudio *iface, DISPID id, REFIID i
static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface,
LONG lVolume) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, lVolume);
@ -635,7 +640,7 @@ static HRESULT WINAPI Basicaudio_put_Volume(IBasicAudio *iface,
static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface,
LONG *plVolume) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, plVolume);
@ -648,7 +653,7 @@ static HRESULT WINAPI Basicaudio_get_Volume(IBasicAudio *iface,
static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface,
LONG lBalance) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->(%d)\n", This, iface, lBalance);
@ -666,7 +671,7 @@ static HRESULT WINAPI Basicaudio_put_Balance(IBasicAudio *iface,
static HRESULT WINAPI Basicaudio_get_Balance(IBasicAudio *iface,
LONG *plBalance) {
DSoundRenderImpl *This = impl_from_IBasicAudio(iface);
struct dsound_render *This = impl_from_IBasicAudio(iface);
TRACE("(%p/%p)->(%p)\n", This, iface, plBalance);
@ -697,7 +702,7 @@ static HRESULT WINAPI AMDirectSound_QueryInterface(IAMDirectSound *iface,
REFIID riid,
LPVOID*ppvObj)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppvObj);
@ -706,7 +711,7 @@ static HRESULT WINAPI AMDirectSound_QueryInterface(IAMDirectSound *iface,
static ULONG WINAPI AMDirectSound_AddRef(IAMDirectSound *iface)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
TRACE("(%p/%p)->()\n", This, iface);
@ -715,7 +720,7 @@ static ULONG WINAPI AMDirectSound_AddRef(IAMDirectSound *iface)
static ULONG WINAPI AMDirectSound_Release(IAMDirectSound *iface)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
TRACE("(%p/%p)->()\n", This, iface);
@ -725,7 +730,7 @@ static ULONG WINAPI AMDirectSound_Release(IAMDirectSound *iface)
/*** IAMDirectSound methods ***/
static HRESULT WINAPI AMDirectSound_GetDirectSoundInterface(IAMDirectSound *iface, IDirectSound **ds)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, ds);
@ -734,7 +739,7 @@ static HRESULT WINAPI AMDirectSound_GetDirectSoundInterface(IAMDirectSound *ifac
static HRESULT WINAPI AMDirectSound_GetPrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, buf);
@ -743,7 +748,7 @@ static HRESULT WINAPI AMDirectSound_GetPrimaryBufferInterface(IAMDirectSound *if
static HRESULT WINAPI AMDirectSound_GetSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer **buf)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, buf);
@ -752,7 +757,7 @@ static HRESULT WINAPI AMDirectSound_GetSecondaryBufferInterface(IAMDirectSound *
static HRESULT WINAPI AMDirectSound_ReleaseDirectSoundInterface(IAMDirectSound *iface, IDirectSound *ds)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, ds);
@ -761,7 +766,7 @@ static HRESULT WINAPI AMDirectSound_ReleaseDirectSoundInterface(IAMDirectSound *
static HRESULT WINAPI AMDirectSound_ReleasePrimaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, buf);
@ -770,7 +775,7 @@ static HRESULT WINAPI AMDirectSound_ReleasePrimaryBufferInterface(IAMDirectSound
static HRESULT WINAPI AMDirectSound_ReleaseSecondaryBufferInterface(IAMDirectSound *iface, IDirectSoundBuffer *buf)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p): stub\n", This, iface, buf);
@ -779,7 +784,7 @@ static HRESULT WINAPI AMDirectSound_ReleaseSecondaryBufferInterface(IAMDirectSou
static HRESULT WINAPI AMDirectSound_SetFocusWindow(IAMDirectSound *iface, HWND hwnd, BOOL bgaudible)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p,%d): stub\n", This, iface, hwnd, bgaudible);
@ -788,7 +793,7 @@ static HRESULT WINAPI AMDirectSound_SetFocusWindow(IAMDirectSound *iface, HWND h
static HRESULT WINAPI AMDirectSound_GetFocusWindow(IAMDirectSound *iface, HWND *hwnd, BOOL *bgaudible)
{
DSoundRenderImpl *This = impl_from_IAMDirectSound(iface);
struct dsound_render *This = impl_from_IAMDirectSound(iface);
FIXME("(%p/%p)->(%p,%p): stub\n", This, iface, hwnd, bgaudible);
@ -817,8 +822,8 @@ HRESULT dsound_render_create(IUnknown *outer, IUnknown **out)
.dwFlags = DSBCAPS_PRIMARYBUFFER,
};
struct dsound_render *object;
IDirectSoundBuffer *buffer;
DSoundRenderImpl *object;
HRESULT hr;
if (!(object = calloc(1, sizeof(*object))))