ReactOS  0.4.15-dev-994-ga9f6032
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 
110 static 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 REFIID
Definition: guiddef.h:118
#define E_NOINTERFACE
Definition: winerror.h:2364
static ULONG WINAPI IReferenceClockImpl_AddRef(IReferenceClock *iface)
Definition: clock.c:46
HRESULT hr
Definition: shlfolder.c:183
const char * debugstr_dmguid(const GUID *id)
Definition: dmusic_main.c:237
REFIID riid
Definition: precomp.h:44
static ULONGLONG startTime
Definition: main.c:113
#define WARN(fmt,...)
Definition: debug.h:112
WINE_DEFAULT_DEBUG_CHANNEL(dmusic)
DMUS_CLOCKINFO8 DMUS_CLOCKINFO
Definition: dmusicc.h:277
Definition: send.c:48
static HRESULT WINAPI IReferenceClockImpl_AdvisePeriodic(IReferenceClock *iface, REFERENCE_TIME startTime, REFERENCE_TIME periodTime, HANDLE hSemaphore, DWORD *pdwAdviseCookie)
Definition: clock.c:92
static HANDLE hEvent
Definition: comm.c:54
static void DMUSIC_UnlockModule(void)
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static LPUNKNOWN
Definition: ndr_ole.c:49
GLenum GLint ref
Definition: glext.h:6028
#define FIXME(fmt,...)
Definition: debug.h:111
_In_ PCCERT_CONTEXT _In_opt_ LPFILETIME pTime
Definition: wincrypt.h:4836
static IReferenceClockImpl * impl_from_IReferenceClock(IReferenceClock *iface)
Definition: clock.c:25
smooth NULL
Definition: ftsmooth.c:416
static void DMUSIC_LockModule(void)
static const IReferenceClockVtbl ReferenceClock_Vtbl
Definition: clock.c:110
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
static HRESULT WINAPI IReferenceClockImpl_QueryInterface(IReferenceClock *iface, REFIID riid, LPVOID *ppobj)
Definition: clock.c:31
static HRESULT WINAPI IReferenceClockImpl_Unadvise(IReferenceClock *iface, DWORD dwAdviseCookie)
Definition: clock.c:101
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static ULONG WINAPI IReferenceClockImpl_Release(IReferenceClock *iface)
Definition: clock.c:56
LONGLONG REFERENCE_TIME
Definition: dmusicks.h:9
LONG HRESULT
Definition: typedefs.h:79
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
unsigned long DWORD
Definition: ntddk_ex.h:95
#define InterlockedDecrement
Definition: armddk.h:52
clock_t clock(void)
Definition: clock.c:23
#define S_OK
Definition: intsafe.h:59
#define InterlockedIncrement
Definition: armddk.h:53
#define IReferenceClock_Release(p)
Definition: dmusicc.h:752
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
unsigned int ULONG
Definition: retypes.h:1
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
static HRESULT WINAPI IReferenceClockImpl_AdviseTime(IReferenceClock *iface, REFERENCE_TIME baseTime, REFERENCE_TIME streamTime, HANDLE hEvent, DWORD *pdwAdviseCookie)
Definition: clock.c:83
static HRESULT WINAPI IReferenceClockImpl_GetTime(IReferenceClock *iface, REFERENCE_TIME *pTime)
Definition: clock.c:72
#define HeapFree(x, y, z)
Definition: compat.h:483
#define IsEqualIID(riid1, riid2)
Definition: guiddef.h:95
HRESULT DMUSIC_CreateReferenceClockImpl(LPCGUID riid, LPVOID *ret_iface, LPUNKNOWN unkouter)
Definition: clock.c:121