From 540ae18f69e9cd5d5be74a1c839319982a5bb0ec Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Mon, 14 May 2012 08:06:22 +0200 Subject: [PATCH] dmusic: COM cleanup of IReferenceClock. --- dlls/dmusic/clock.c | 74 ++++++++++++++++++++++++++++---------------- dlls/dmusic/dmusic_private.h | 12 +++---- 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/dlls/dmusic/clock.c b/dlls/dmusic/clock.c index c54992c24a0..4d9a1b40454 100644 --- a/dlls/dmusic/clock.c +++ b/dlls/dmusic/clock.c @@ -1,4 +1,5 @@ -/* IReferenceClock Implementation +/* + * IReferenceClock Implementation * * Copyright (C) 2003-2004 Rok Mandeljc * @@ -21,9 +22,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmusic); +static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface) +{ + return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface); +} + /* IReferenceClockImpl IUnknown part: */ -static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; +static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); if (IsEqualIID (riid, &IID_IUnknown) || @@ -36,8 +43,9 @@ static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface return E_NOINTERFACE; } -static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; +static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); ULONG refCount = InterlockedIncrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount - 1); @@ -47,8 +55,9 @@ static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) { return refCount; } -static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; +static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); ULONG refCount = InterlockedDecrement(&This->ref); TRACE("(%p)->(ref before=%u)\n", This, refCount + 1); @@ -63,29 +72,42 @@ static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) { } /* IReferenceClockImpl IReferenceClock part: */ -static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; - TRACE("(%p, %p)\n", This, pTime); - *pTime = This->rtTime; - return S_OK; +static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); + + TRACE("(%p)->(%p)\n", This, pTime); + + *pTime = This->rtTime; + + return S_OK; } -static HRESULT WINAPI IReferenceClockImpl_AdviseTime (IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; - FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie); - return S_OK; +static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD* pdwAdviseCookie) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); + + FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie); + + return S_OK; } -static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic (IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; - FIXME("(%p, 0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie); - return S_OK; +static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD* pdwAdviseCookie) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); + + FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie); + + return S_OK; } -static HRESULT WINAPI IReferenceClockImpl_Unadvise (IReferenceClock *iface, DWORD dwAdviseCookie) { - IReferenceClockImpl *This = (IReferenceClockImpl *)iface; - FIXME("(%p, %d): stub\n", This, dwAdviseCookie); - return S_OK; +static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie) +{ + IReferenceClockImpl *This = impl_from_IReferenceClock(iface); + + FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie); + + return S_OK; } static const IReferenceClockVtbl ReferenceClock_Vtbl = { @@ -111,8 +133,8 @@ HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNO return E_OUTOFMEMORY; } - clock->lpVtbl = &ReferenceClock_Vtbl; - clock->ref = 0; /* will be inited by QueryInterface */ + clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl; + clock->ref = 0; /* Will be inited by QueryInterface */ clock->rtTime = 0; clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); diff --git a/dlls/dmusic/dmusic_private.h b/dlls/dmusic/dmusic_private.h index 4f2247e79d1..3cfffba58aa 100644 --- a/dlls/dmusic/dmusic_private.h +++ b/dlls/dmusic/dmusic_private.h @@ -166,13 +166,13 @@ extern HRESULT DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj, * IReferenceClockImpl implementation structure */ struct IReferenceClockImpl { - /* IUnknown fields */ - const IReferenceClockVtbl *lpVtbl; - LONG ref; + /* IUnknown fields */ + IReferenceClock IReferenceClock_iface; + LONG ref; - /* IReferenceClockImpl fields */ - REFERENCE_TIME rtTime; - DMUS_CLOCKINFO pClockInfo; + /* IReferenceClockImpl fields */ + REFERENCE_TIME rtTime; + DMUS_CLOCKINFO pClockInfo; }; typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY { -- 2.11.4.GIT