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.

96 lines
3.1 KiB

  1. /*
  2. * DirectSound DirectMediaObject base classes
  3. *
  4. * Copyright (c) 1999 - 2000 Microsoft Corporation. All Rights Reserved.
  5. */
  6. #ifndef _DsDmoBase_
  7. #define _DsDmoBase_
  8. #define DMO_NOATL
  9. #include <objbase.h>
  10. #include <dmobase.h>
  11. #include <medparam.h>
  12. #include <mmsystem.h>
  13. #include <dsoundp.h>
  14. #ifndef RELEASE
  15. #define RELEASE(x) { if (x) (x)->Release(); x = NULL; }
  16. #endif
  17. // Macro to handle QueryInterface in the derived class for interfaces
  18. // implemented by this base class.
  19. //
  20. #define IMP_DSDMO_QI(iid, ppv) \
  21. { \
  22. *ppv = NULL; \
  23. if (iid == IID_IPersistStream) *ppv = (void**)static_cast<IPersistStream*>(this); \
  24. else if (iid == IID_IMediaObjectInPlace) *ppv = (void**)static_cast<IMediaObjectInPlace*>(this); \
  25. else if (iid == IID_IDirectSoundDMOProxy) *ppv = (void**)static_cast<IDirectSoundDMOProxy*>(this); \
  26. if (*ppv) \
  27. { \
  28. AddRef(); \
  29. return S_OK; \
  30. } \
  31. }
  32. class CDirectSoundDMO :
  33. public CPCMDMO,
  34. public IPersistStream,
  35. public IMediaObjectInPlace,
  36. public IDirectSoundDMOProxy
  37. {
  38. public:
  39. CDirectSoundDMO();
  40. virtual ~CDirectSoundDMO();
  41. /* IPersist */
  42. STDMETHODIMP GetClassID (THIS_ CLSID *pClassID);
  43. /* IPersistStream */
  44. STDMETHODIMP IsDirty (THIS);
  45. STDMETHODIMP Load (THIS_ IStream *pStm);
  46. STDMETHODIMP Save (THIS_ IStream *pStm, BOOL fClearDirty);
  47. STDMETHODIMP GetSizeMax (THIS_ ULARGE_INTEGER *pcbSize);
  48. /* IMediaObjectInPlace */
  49. STDMETHODIMP Process (THIS_ ULONG ulSize, BYTE *pData, REFERENCE_TIME rtStart, DWORD dwFlags);
  50. STDMETHODIMP GetLatency (THIS_ REFERENCE_TIME *prt);
  51. /* IDirectSoundDMOProxy */
  52. STDMETHODIMP AcquireResources (THIS_ IKsPropertySet *pKsPropertySet);
  53. STDMETHODIMP ReleaseResources (THIS);
  54. STDMETHODIMP InitializeNode (THIS_ HANDLE hPin, ULONG ulNodeId);
  55. protected:
  56. // Information about each parameter. This is only needed by the
  57. // author time object.
  58. //
  59. // Process in place
  60. //
  61. virtual HRESULT ProcessInPlace(ULONG ulQuanta, LPBYTE pcbData, REFERENCE_TIME rtStart, DWORD dwFlags) = 0;
  62. // Send a parameter to the hardware. Called by the base class on SetParam if
  63. // hardware is connected. This is virtual so a DMO can use the base class but
  64. // override the way it talks to hardware.
  65. //
  66. virtual HRESULT ProxySetParam(DWORD dwParamIndex, MP_DATA value);
  67. // Derived class can use this to determine if hardware is turned on.
  68. //
  69. inline bool IsInHardware()
  70. { return m_fInHardware; }
  71. protected:
  72. HANDLE m_hPin;
  73. ULONG m_ulNodeId;
  74. private:
  75. MP_DATA *m_mpvCache;
  76. IKsPropertySet *m_pKsPropertySet;
  77. bool m_fInHardware;
  78. };
  79. #endif