Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/dsoundrender.c | 91 ++++++++++++++++++++------------------ 1 file changed, 48 insertions(+), 43 deletions(-)
diff --git a/dlls/quartz/dsoundrender.c b/dlls/quartz/dsoundrender.c index 4d682a3ec7f..8d9b1b3ee88 100644 --- a/dlls/quartz/dsoundrender.c +++ b/dlls/quartz/dsoundrender.c @@ -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; @@ -370,7 +375,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);
@@ -380,7 +385,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);
@@ -392,7 +397,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; @@ -435,7 +440,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);
@@ -448,13 +453,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) { @@ -473,7 +478,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); @@ -490,7 +495,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; @@ -525,7 +530,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);
@@ -533,7 +538,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);
@@ -541,7 +546,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);
@@ -598,7 +603,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);
@@ -616,7 +621,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);
@@ -629,7 +634,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);
@@ -647,7 +652,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);
@@ -678,7 +683,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);
@@ -687,7 +692,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);
@@ -696,7 +701,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);
@@ -706,7 +711,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);
@@ -715,7 +720,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);
@@ -724,7 +729,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);
@@ -733,7 +738,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);
@@ -742,7 +747,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);
@@ -751,7 +756,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);
@@ -760,7 +765,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);
@@ -769,7 +774,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);
@@ -798,8 +803,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))))