AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
sysclock.cpp
Go to the documentation of this file.
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 
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 
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  {
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 }
CSystemClock::SetClockDelta
STDMETHODIMP SetClockDelta(REFERENCE_TIME rtDelta)
Definition: sysclock.cpp:71
streams.h
CSystemClock::CreateInstance
static CUnknown *WINAPI CreateInstance(__inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
Definition: sysclock.cpp:30
CSystemClock::CSystemClock
CSystemClock(__in_opt LPCTSTR pName, __inout_opt LPUNKNOWN pUnk, __inout HRESULT *phr)
Definition: sysclock.cpp:36
NAME
#define NAME(_x_)
Definition: wxdebug.h:179
CSystemClock::NonDelegatingQueryInterface
DECLARE_IUNKNOWN STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
Definition: sysclock.cpp:41
ValidateReadWritePtr
#define ValidateReadWritePtr(p, cb)
Definition: wxdebug.h:241
CSystemClock::GetClassID
STDMETHODIMP GetClassID(__out CLSID *pClsID)
Definition: sysclock.cpp:61
CFactoryTemplate
Definition: combase.h:260
CBaseReferenceClock
Definition: refclock.h:74
pName
CHAR * pName
Definition: amvideo.cpp:26
riid
__in REFIID riid
Definition: dllentry.cpp:192
CUnknown
Definition: combase.h:200
g_Templates
CFactoryTemplate g_Templates[]
CBaseReferenceClock::NonDelegatingQueryInterface
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, __deref_out void **ppv)
Definition: refclock.cpp:22
g_cTemplates
int g_cTemplates
CBaseReferenceClock::SetTimeDelta
STDMETHODIMP SetTimeDelta(const REFERENCE_TIME &TimeDelta)
Definition: refclock.cpp:264
CheckPointer
#define CheckPointer(p, ret)
Definition: wxdebug.h:225
GetInterface
STDAPI GetInterface(LPUNKNOWN pUnk, __out void **ppv)
Definition: combase.cpp:213