1 /* IReferenceClock Implementation
3 * Copyright (C) 2003 Rok Mandeljc
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILIY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "wine/debug.h"
26 #include "dmusic_private.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(dmusic
);
30 /* IReferenceClock IUnknown parts follow: */
31 HRESULT WINAPI
IReferenceClockImpl_QueryInterface (IReferenceClock
*iface
, REFIID riid
, LPVOID
*ppobj
)
33 ICOM_THIS(IReferenceClockImpl
,iface
);
35 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
36 IsEqualGUID(riid
, &IID_IReferenceClock
))
38 IReferenceClockImpl_AddRef(iface
);
42 WARN("(%p)->(%s,%p),not found\n", This
, debugstr_guid(riid
), ppobj
);
46 ULONG WINAPI
IReferenceClockImpl_AddRef (IReferenceClock
*iface
)
48 ICOM_THIS(IReferenceClockImpl
,iface
);
49 TRACE("(%p) : AddRef from %ld\n", This
, This
->ref
);
53 ULONG WINAPI
IReferenceClockImpl_Release (IReferenceClock
*iface
)
55 ICOM_THIS(IReferenceClockImpl
,iface
);
56 ULONG ref
= --This
->ref
;
57 TRACE("(%p) : ReleaseRef to %ld\n", This
, This
->ref
);
60 HeapFree(GetProcessHeap(), 0, This
);
65 /* IReferenceClock Interface follow: */
66 HRESULT WINAPI
IReferenceClockImpl_GetTime (IReferenceClock
*iface
, REFERENCE_TIME
* pTime
)
68 ICOM_THIS(IReferenceClockImpl
,iface
);
70 TRACE("(%p, %p)\n", This
, pTime
);
71 *pTime
= This
->rtTime
;
76 HRESULT WINAPI
IReferenceClockImpl_AdviseTime (IReferenceClock
*iface
, REFERENCE_TIME baseTime
, REFERENCE_TIME streamTime
, HANDLE hEvent
, DWORD
* pdwAdviseCookie
)
78 ICOM_THIS(IReferenceClockImpl
,iface
);
80 FIXME("(%p, %lli, %lli, %p, %p): stub\n", This
, baseTime
, streamTime
, hEvent
, pdwAdviseCookie
);
85 HRESULT WINAPI
IReferenceClockImpl_AdvisePeriodic (IReferenceClock
*iface
, REFERENCE_TIME startTime
, REFERENCE_TIME periodTime
, HANDLE hSemaphore
, DWORD
* pdwAdviseCookie
)
87 ICOM_THIS(IReferenceClockImpl
,iface
);
89 FIXME("(%p, %lli, %lli, %p, %p): stub\n", This
, startTime
, periodTime
, hSemaphore
, pdwAdviseCookie
);
94 HRESULT WINAPI
IReferenceClockImpl_Unadvise (IReferenceClock
*iface
, DWORD dwAdviseCookie
)
96 ICOM_THIS(IReferenceClockImpl
,iface
);
98 FIXME("(%p, %ld): stub\n", This
, dwAdviseCookie
);
103 ICOM_VTABLE(IReferenceClock
) ReferenceClock_Vtbl
=
105 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
106 IReferenceClockImpl_QueryInterface
,
107 IReferenceClockImpl_AddRef
,
108 IReferenceClockImpl_Release
,
109 IReferenceClockImpl_GetTime
,
110 IReferenceClockImpl_AdviseTime
,
111 IReferenceClockImpl_AdvisePeriodic
,
112 IReferenceClockImpl_Unadvise
115 /* for ClassFactory */
116 HRESULT WINAPI
DMUSIC_CreateReferenceClock (LPCGUID lpcGUID
, IReferenceClock
** ppRC
, LPUNKNOWN pUnkOuter
)
118 IReferenceClockImpl
* clock
;
120 if (IsEqualGUID (lpcGUID
, &IID_IReferenceClock
))
122 clock
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(IReferenceClockImpl
));
125 return E_OUTOFMEMORY
;
127 clock
->lpVtbl
= &ReferenceClock_Vtbl
;
130 clock
->pClockInfo
.dwSize
= sizeof (DMUS_CLOCKINFO
);
132 *ppRC
= (IReferenceClock
*) clock
;
135 WARN("No interface found\n");
137 return E_NOINTERFACE
;