Source code of Windows XP (NT5)
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.

95 lines
3.0 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 <dmo.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 CDirectSoundDMOBaseClass :
  33. public IPersistStream
  34. , public IMediaObjectInPlace
  35. , public IDirectSoundDMOProxy
  36. {
  37. public:
  38. CDirectSoundDMOBaseClass();
  39. virtual ~CDirectSoundDMOBaseClass();
  40. /* IPersist */
  41. STDMETHODIMP GetClassID (THIS_ CLSID *pClassID);
  42. /* IPersistStream */
  43. STDMETHODIMP IsDirty (THIS);
  44. STDMETHODIMP Load (THIS_ IStream *pStm);
  45. STDMETHODIMP Save (THIS_ IStream *pStm, BOOL fClearDirty);
  46. STDMETHODIMP GetSizeMax (THIS_ ULARGE_INTEGER *pcbSize);
  47. /* IMediaObjectInPlace */
  48. STDMETHODIMP Process (THIS_ ULONG ulSize, BYTE *pData, REFERENCE_TIME rtStart, DWORD dwFlags);
  49. STDMETHODIMP GetLatency (THIS_ REFERENCE_TIME *prt);
  50. /* IDirectSoundDMOProxy */
  51. STDMETHODIMP AcquireResources (THIS_ IKsPropertySet *pKsPropertySet);
  52. STDMETHODIMP ReleaseResources (THIS);
  53. STDMETHODIMP InitializeNode (THIS_ HANDLE hPin, ULONG ulNodeId);
  54. protected:
  55. // Information about each parameter. This is only needed by the
  56. // author time object.
  57. //
  58. // Process in place
  59. //
  60. virtual HRESULT ProcessInPlace(ULONG ulQuanta, LPBYTE pcbData, REFERENCE_TIME rtStart, DWORD dwFlags) = 0;
  61. // Send a parameter to the hardware. Called by the base class on SetParam if
  62. // hardware is connected. This is virtual so a DMO can use the base class but
  63. // override the way it talks to hardware.
  64. //
  65. virtual HRESULT ProxySetParam(DWORD dwParamIndex, MP_DATA value);
  66. // Derived class can use this to determine if hardware is turned on.
  67. //
  68. inline bool IsInHardware()
  69. { return m_fInHardware; }
  70. protected:
  71. HANDLE m_hPin;
  72. ULONG m_ulNodeId;
  73. private:
  74. MP_DATA *m_mpvCache;
  75. IKsPropertySet *m_pKsPropertySet;
  76. bool m_fInHardware;
  77. };
  78. #endif