Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.0 KiB

  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. #include <streams.h>
  10. #include <limits.h>
  11. #ifdef FILTER_DLL
  12. /* List of class IDs and creator functions for the class factory. This
  13. provides the link between the OLE entry point in the DLL and an object
  14. being created. The class factory will call the static CreateInstance
  15. function when it is asked to create a CLSID_SystemClock object */
  16. CFactoryTemplate g_Templates[1] = {
  17. {&CLSID_SystemClock, CSystemClock::CreateInstance}
  18. };
  19. int g_cTemplates = sizeof(g_Templates) / sizeof(g_Templates[0]);
  20. #endif
  21. /* This goes in the factory template table to create new instances */
  22. CUnknown * WINAPI CSystemClock::CreateInstance(LPUNKNOWN pUnk,HRESULT *phr)
  23. {
  24. return new CSystemClock(NAME("System reference clock"),pUnk, phr);
  25. }
  26. CSystemClock::CSystemClock(TCHAR *pName,LPUNKNOWN pUnk,HRESULT *phr) :
  27. CBaseReferenceClock(pName, pUnk, phr)
  28. {
  29. }
  30. STDMETHODIMP CSystemClock::NonDelegatingQueryInterface(
  31. REFIID riid,
  32. void ** ppv)
  33. {
  34. if (riid == IID_IPersist)
  35. {
  36. return GetInterface(static_cast<IPersist *>(this), ppv);
  37. }
  38. else if (riid == IID_IAMClockAdjust)
  39. {
  40. return GetInterface(static_cast<IAMClockAdjust *>(this), ppv);
  41. }
  42. else
  43. {
  44. return CBaseReferenceClock::NonDelegatingQueryInterface(riid, ppv);
  45. }
  46. }
  47. /* Return the clock's clsid */
  48. STDMETHODIMP
  49. CSystemClock::GetClassID(CLSID *pClsID)
  50. {
  51. CheckPointer(pClsID,E_POINTER);
  52. ValidateReadWritePtr(pClsID,sizeof(CLSID));
  53. *pClsID = CLSID_SystemClock;
  54. return NOERROR;
  55. }
  56. STDMETHODIMP
  57. CSystemClock::SetClockDelta(REFERENCE_TIME rtDelta)
  58. {
  59. return SetTimeDelta(rtDelta);
  60. }