ReactOS 0.4.15-dev-7842-g558ab78
clock.c
Go to the documentation of this file.
1/*
2 * IReferenceClock Implementation
3 *
4 * Copyright (C) 2003-2004 Rok Mandeljc
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21#include "dmusic_private.h"
22
24
26{
27 return CONTAINING_RECORD(iface, IReferenceClockImpl, IReferenceClock_iface);
28}
29
30/* IReferenceClockImpl IUnknown part: */
32{
34 TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj);
35
36 if (IsEqualIID (riid, &IID_IUnknown) ||
37 IsEqualIID (riid, &IID_IReferenceClock)) {
38 IUnknown_AddRef(iface);
39 *ppobj = This;
40 return S_OK;
41 }
42 WARN("(%p, %s, %p): not found\n", This, debugstr_dmguid(riid), ppobj);
43 return E_NOINTERFACE;
44}
45
47{
50
51 TRACE("(%p)->(): new ref = %u\n", This, ref);
52
53 return ref;
54}
55
57{
60
61 TRACE("(%p)->(): new ref = %u\n", This, ref);
62
63 if (!ref) {
66 }
67
68 return ref;
69}
70
71/* IReferenceClockImpl IReferenceClock part: */
73{
75
76 TRACE("(%p)->(%p)\n", This, pTime);
77
78 *pTime = This->rtTime;
79
80 return S_OK;
81}
82
84{
86
87 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(baseTime), wine_dbgstr_longlong(streamTime), hEvent, pdwAdviseCookie);
88
89 return S_OK;
90}
91
93{
95
96 FIXME("(%p)->(0x%s, 0x%s, %p, %p): stub\n", This, wine_dbgstr_longlong(startTime), wine_dbgstr_longlong(periodTime), hSemaphore, pdwAdviseCookie);
97
98 return S_OK;
99}
100
102{
104
105 FIXME("(%p)->(%d): stub\n", This, dwAdviseCookie);
106
107 return S_OK;
108}
109
110static const IReferenceClockVtbl ReferenceClock_Vtbl = {
118};
119
120/* for ClassFactory */
122{
124 HRESULT hr;
125
126 TRACE("(%s, %p, %p)\n", debugstr_guid(riid), ret_iface, unkouter);
127
129 if (!clock) {
130 *ret_iface = NULL;
131 return E_OUTOFMEMORY;
132 }
133
134 clock->IReferenceClock_iface.lpVtbl = &ReferenceClock_Vtbl;
135 clock->ref = 1;
136 clock->rtTime = 0;
137 clock->pClockInfo.dwSize = sizeof (DMUS_CLOCKINFO);
138
140 hr = IReferenceClockImpl_QueryInterface(&clock->IReferenceClock_iface, riid, ret_iface);
141 IReferenceClock_Release(&clock->IReferenceClock_iface);
142
143 return hr;
144}
#define InterlockedIncrement
Definition: armddk.h:53
#define InterlockedDecrement
Definition: armddk.h:52
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
const GUID IID_IUnknown
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD *pdwAdviseCookie)
Definition: clock.c:92
static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
Definition: clock.c:56
static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
Definition: clock.c:31
static IReferenceClockImpl * impl_from_IReferenceClock(IReferenceClock *iface)
Definition: clock.c:25
HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID *ret_iface, LPUNKNOWN unkouter)
Definition: clock.c:121
static const IReferenceClockVtbl ReferenceClock_Vtbl
Definition: clock.c:110
static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD *pdwAdviseCookie)
Definition: clock.c:83
static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
Definition: clock.c:46
static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME *pTime)
Definition: clock.c:72
static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
Definition: clock.c:101
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
static ULONGLONG startTime
Definition: main.c:113
const char * debugstr_dmguid(const GUID *id)
Definition: dmusic_main.c:237
static void DMUSIC_UnlockModule(void)
static void DMUSIC_LockModule(void)
DMUS_CLOCKINFO8 DMUS_CLOCKINFO
Definition: dmusicc.h:277
#define IReferenceClock_Release(p)
Definition: dmusicc.h:752
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
unsigned long DWORD
Definition: ntddk_ex.h:95
REFIID riid
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define debugstr_guid
Definition: kernel32.h:35
static HANDLE hEvent
Definition: comm.c:54
static LPUNKNOWN
Definition: ndr_ole.c:49
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
#define REFIID
Definition: guiddef.h:118
_Check_return_ _CRTIMP clock_t __cdecl clock(void)
Definition: clock.c:23
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
Definition: send.c:48
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4837
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:2364