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.

103 lines
4.9 KiB

  1. #ifndef __TOOLPARAM_H__
  2. #define __TOOLPARAM_H__
  3. #include "medparam.h"
  4. #include "alist.h"
  5. typedef struct _ParamInfo
  6. {
  7. DWORD dwIndex; // Which parameter.
  8. MP_PARAMINFO MParamInfo; // Standard MediaParams structure.
  9. WCHAR * pwchText; // Array of text names for enumerated types.
  10. } ParamInfo;
  11. class CCurveItem : public AListItem
  12. {
  13. public:
  14. CCurveItem* GetNext() { return (CCurveItem*)AListItem::GetNext();}
  15. MP_ENVELOPE_SEGMENT m_Envelope; // Envelope segment.
  16. };
  17. class CCurveList : public AList
  18. {
  19. public:
  20. // void Clear();
  21. void AddHead(CCurveItem* pCurveItem) { AList::AddHead((AListItem*)pCurveItem);}
  22. // void Insert(CCurveItem* pCurveItem);
  23. CCurveItem* GetHead(){return (CCurveItem*)AList::GetHead();}
  24. // CCurveItem* GetItem(LONG lIndex){return (CCurveItem*)AList::GetItem(lIndex);}
  25. CCurveItem* RemoveHead(){ return (CCurveItem*)AList::RemoveHead();}
  26. // void Remove(CCurveItem* pCurveItem){AList::Remove((AListItem*)pCurveItem);}
  27. // void AddTail(CCurveItem* pCurveItem){AList::AddTail((AListItem*)pCurveItem);}
  28. // CCurveItem* GetTail(){ return (CCurveItem*)AList::GetTail();}
  29. ~CCurveList();
  30. };
  31. #define MAX_REF_TIME 0x7FFFFFFFFFFFFFFF
  32. #define MP_CAPS_ALL MP_CAPS_CURVE_JUMP | MP_CAPS_CURVE_LINEAR | MP_CAPS_CURVE_SQUARE | MP_CAPS_CURVE_INVSQUARE | MP_CAPS_CURVE_SINE
  33. class CParamsManager : public IMediaParams, public IMediaParamInfo
  34. {
  35. public:
  36. CParamsManager();
  37. ~CParamsManager();
  38. // IUnknown
  39. STDMETHOD(QueryInterface)(REFIID, LPVOID FAR *) PURE;
  40. STDMETHOD_(ULONG, AddRef)() PURE;
  41. STDMETHOD_(ULONG, Release)() PURE;
  42. // IMediaParams
  43. STDMETHODIMP GetParam(DWORD dwParamIndex, MP_DATA *pValue);
  44. STDMETHODIMP SetParam(DWORD dwParamIndex,MP_DATA value);
  45. STDMETHODIMP AddEnvelope(DWORD dwParamIndex,DWORD cPoints,MP_ENVELOPE_SEGMENT *ppEnvelope);
  46. STDMETHODIMP FlushEnvelope( DWORD dwParamIndex,REFERENCE_TIME refTimeStart,REFERENCE_TIME refTimeEnd);
  47. STDMETHODIMP SetTimeFormat( GUID guidTimeFormat,MP_TIMEDATA mpTimeData);
  48. // IMediaParamInfo
  49. STDMETHODIMP GetParamCount(DWORD *pdwParams);
  50. STDMETHODIMP GetParamInfo(DWORD dwParamIndex,MP_PARAMINFO *pInfo);
  51. STDMETHODIMP GetParamText(DWORD dwParamIndex,WCHAR **ppwchText);
  52. STDMETHODIMP GetNumTimeFormats(DWORD *pdwNumTimeFormats);
  53. STDMETHODIMP GetSupportedTimeFormat(DWORD dwFormatIndex,GUID *pguidTimeFormat);
  54. STDMETHODIMP GetCurrentTimeFormat( GUID *pguidTimeFormat,MP_TIMEDATA *pTimeData);
  55. // other (non-COM) functions
  56. HRESULT InitParams(DWORD cTimeFormats, const GUID *pguidTimeFormats, DWORD dwFormatIndex, MP_TIMEDATA mptdTimeData, DWORD cParams, ParamInfo *pParamInfos);
  57. HRESULT GetParamFloat(DWORD dwParamIndex,REFERENCE_TIME rtTime,float *pval); // returns S_FALSE if rtTime is after the end time of the last curve
  58. HRESULT GetParamInt (DWORD dwParamIndex,REFERENCE_TIME rt,long *pval); // returns S_FALSE if rtTime is after the end time of the last curve
  59. HRESULT CopyParamsFromSource(CParamsManager * pSource);
  60. // parameter control curve handling
  61. class UpdateCallback
  62. {
  63. public:
  64. // Define this in derived classes if you are going to use UpdateActiveParams.
  65. // Called by CParamsManager inside UpdateActiveParams to update the effect's internal state variables.
  66. // SetParamUpdate should be the same as SetParam, except that DMO defer the call to the base class
  67. // (CParamsManager::SetParam) in SetParam but should not do so in SetParamUpdate.
  68. virtual HRESULT SetParamUpdate(DWORD dwParamIndex, MP_DATA value) = 0;
  69. };
  70. // function that calls SetParam to adjust the value of all parameters that may have changed to their
  71. // new values at time rtTime
  72. void UpdateActiveParams(REFERENCE_TIME rtTime, UpdateCallback &rThis); // rThis should be the derived class (*this)
  73. DWORD GetActiveParamBits() { return m_dwActiveBits; }
  74. protected:
  75. // data
  76. CRITICAL_SECTION m_ParamsCriticalSection;
  77. BOOL m_fDirty; // Has data changed since last file load or save?
  78. DWORD m_cTimeFormats; // Number of supported time formats.
  79. GUID *m_pguidTimeFormats; // Array of supported time formats.
  80. GUID m_guidCurrentTimeFormat; // The time format we're set to.
  81. MP_TIMEDATA m_mptdCurrentTimeData; // The unit of measure for the current time format.
  82. DWORD m_cParams; // Number of parameters.
  83. ParamInfo *m_pParamInfos; // Array of ParamInfo structures, one for each parameter.
  84. CCurveList *m_pCurveLists; // Array of Curve lists, one for each parameter.
  85. DWORD m_dwActiveBits; // Tracks the params that currently have curves active.
  86. };
  87. #endif // __TOOLPARAM_H__