dmusic: COM cleanup of IReferenceClock.

This commit is contained in:
Christian Costa 2012-05-14 08:06:22 +02:00 committed by Alexandre Julliard
parent a188587aee
commit 540ae18f69
2 changed files with 54 additions and 32 deletions

View File

@ -1,4 +1,5 @@
/* IReferenceClock Implementation /*
* IReferenceClock Implementation
* *
* Copyright (C) 2003-2004 Rok Mandeljc * Copyright (C) 2003-2004 Rok Mandeljc
* *
@ -21,9 +22,15 @@
WINE_DEFAULT_DEBUG_CHANNEL(dmusic); WINE_DEFAULT_DEBUG_CHANNEL(dmusic);
static inline IReferenceClockImpl *impl_from_IReferenceClock(IReferenceClock *iface)
{
return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
}
/* IReferenceClockImpl IUnknown part: */ /* IReferenceClockImpl IUnknown part: */
static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface, REFIID riid, LPVOID *ppobj) { static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
if (IsEqualIID (riid, &IID_IUnknown) || if (IsEqualIID (riid, &IID_IUnknown) ||
@ -36,8 +43,9 @@ static HRESULT WINAPI IReferenceClockImpl_QueryInterface (IReferenceClock *iface
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) { static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
IReferenceClockImpl *This = impl_from_IReferenceClock(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);
@ -47,8 +55,9 @@ static ULONG WINAPI IReferenceClockImpl_AddRef (IReferenceClock *iface) {
return refCount; return refCount;
} }
static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) { static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
IReferenceClockImpl *This = impl_from_IReferenceClock(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);
@ -63,29 +72,42 @@ static ULONG WINAPI IReferenceClockImpl_Release (IReferenceClock *iface) {
} }
/* IReferenceClockImpl IReferenceClock part: */ /* IReferenceClockImpl IReferenceClock part: */
static HRESULT WINAPI IReferenceClockImpl_GetTime (IReferenceClock *iface, REFERENCE_TIME* pTime) { static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME* pTime)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
TRACE("(%p, %p)\n", This, pTime); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
*pTime = This->rtTime;
return S_OK; 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) { 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); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
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) { 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); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
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) { static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
IReferenceClockImpl *This = (IReferenceClockImpl *)iface; {
FIXME("(%p, %d): stub\n", This, dwAdviseCookie); IReferenceClockImpl *This = impl_from_IReferenceClock(iface);
return S_OK;
FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
return S_OK;
} }
static const IReferenceClockVtbl ReferenceClock_Vtbl = { static const IReferenceClockVtbl ReferenceClock_Vtbl = {
@ -111,8 +133,8 @@ HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID* ret_iface, LPUNKNO
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
} }
clock->lpVtbl = &ReferenceClock_Vtbl; clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
clock->ref = 0; /* will be inited by QueryInterface */ clock->ref = 0; /* Will be inited by QueryInterface */
clock->rtTime = 0; clock->rtTime = 0;
clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO); clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);

View File

@ -166,13 +166,13 @@ extern HRESULT DMUSIC_CreateDirectMusicPortImpl (LPCGUID lpcGUID, LPVOID *ppobj,
* IReferenceClockImpl implementation structure * IReferenceClockImpl implementation structure
*/ */
struct IReferenceClockImpl { struct IReferenceClockImpl {
/* IUnknown fields */ /* IUnknown fields */
const IReferenceClockVtbl *lpVtbl; IReferenceClock IReferenceClock_iface;
LONG ref; LONG ref;
/* IReferenceClockImpl fields */ /* IReferenceClockImpl fields */
REFERENCE_TIME rtTime; REFERENCE_TIME rtTime;
DMUS_CLOCKINFO pClockInfo; DMUS_CLOCKINFO pClockInfo;
}; };
typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY { typedef struct _DMUS_PRIVATE_INSTRUMENT_ENTRY {