Debian Codegraph @

sys/directshow/strmbase/baseclasses/sysclock.cpp

raw
1 //------------------------------------------------------------------------------
2 // File: SysClock.cpp
3 //
4 // Desc: DirectShow base classes - implements a system clock based on
5 // IReferenceClock.
6 //
7 // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
8 //------------------------------------------------------------------------------
9
10
11 #include <streams.h>
12 #include <limits.h>
13
14
15 #ifdef FILTER_DLL
16
17 /* List of class IDs and creator functions for the class factory. This
18 provides the link between the OLE entry point in the DLL and an object
19 being created. The class factory will call the static CreateInstance
20 function when it is asked to create a CLSID_SystemClock object */
21
22 CFactoryTemplate g_Templates[1] = {
23 {&CLSID_SystemClock, CSystemClock::CreateInstance}
24 };
25
26 int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
27 #endif
28
29 /* This goes in the factory template table to create new instances */
30 CUnknown * WINAPI CSystemClock::CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
31 {
32 return new CSystemClock(NAME("System reference clock"),pUnk, phr);
33 }
34
35
36 CSystemClock::CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr) :
37 CBaseReferenceClock(pName, pUnk, phr)
38 {
39 }
40
41 STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
42 REFIID riid,
43 __deref_out void ** ppv)
44 {
45 if (riid == IID_IPersist)
46 {
47 return GetInterface(static_cast<IPersist *>(this), ppv);
48 }
49 else if (riid == IID_IAMClockAdjust)
50 {
51 return GetInterface(static_cast<IAMClockAdjust *>(this), ppv);
52 }
53 else
54 {
55 return CBaseReferenceClock::NonDelegatingQueryInterface(riid, ppv);
56 }
57 }
58
59 /* Return the clock's clsid */
60 STDMETHODIMP
61 CSystemClock::GetClassID(__out CLSID *pClsID)
62 {
63 CheckPointer(pClsID,E_POINTER);
64 ValidateReadWritePtr(pClsID,sizeof(CLSID));
65 *pClsID = CLSID_SystemClock;
66 return NOERROR;
67 }
68
69
70 STDMETHODIMP
71 CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta)
72 {
73 return SetTimeDelta(rtDelta);
74 }