Commit 540ae18f authored by Christian Costa's avatar Christian Costa Committed by Alexandre Julliard

dmusic: COM cleanup of IReferenceClock.

parent a188587a
/* 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);
......
......@@ -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 {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment