videoctl.h 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. //------------------------------------------------------------------------------
  2. // File: VideoCtl.h
  3. //
  4. // Desc: DirectShow base classes.
  5. //
  6. // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
  7. //------------------------------------------------------------------------------
  8. #ifndef __VIDEOCTL__
  9. #define __VIDEOCTL__
  10. // These help with property page implementations. The first can be used to
  11. // load any string from a resource file. The buffer to load into is passed
  12. // as an input parameter. The same buffer is the return value if the string
  13. // was found otherwise it returns TEXT(""). The GetDialogSize is passed the
  14. // resource ID of a dialog box and returns the size of it in screen pixels
  15. #define STR_MAX_LENGTH 256
  16. LPTSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPTSTR pBuffer, int iResourceID);
  17. #ifdef UNICODE
  18. #define WideStringFromResource StringFromResource
  19. LPSTR WINAPI StringFromResource(__out_ecount(STR_MAX_LENGTH) LPSTR pBuffer, int iResourceID);
  20. #else
  21. LPWSTR WINAPI WideStringFromResource(__out_ecount(STR_MAX_LENGTH) LPWSTR pBuffer, int iResourceID);
  22. #endif
  23. BOOL WINAPI GetDialogSize(int iResourceID, // Dialog box resource identifier
  24. DLGPROC pDlgProc, // Pointer to dialog procedure
  25. LPARAM lParam, // Any user data wanted in pDlgProc
  26. __out SIZE *pResult);// Returns the size of dialog box
  27. // Class that aggregates an IDirectDraw interface
  28. class CAggDirectDraw : public IDirectDraw, public CUnknown
  29. {
  30. protected:
  31. LPDIRECTDRAW m_pDirectDraw;
  32. public:
  33. DECLARE_IUNKNOWN
  34. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
  35. // Constructor and destructor
  36. CAggDirectDraw(__in_opt LPCTSTR pName,__inout_opt LPUNKNOWN pUnk) :
  37. CUnknown(pName,pUnk),
  38. m_pDirectDraw(NULL) { };
  39. virtual CAggDirectDraw::~CAggDirectDraw() { };
  40. // Set the object we should be aggregating
  41. void SetDirectDraw(__inout LPDIRECTDRAW pDirectDraw) {
  42. m_pDirectDraw = pDirectDraw;
  43. }
  44. // IDirectDraw methods
  45. STDMETHODIMP Compact();
  46. STDMETHODIMP CreateClipper(DWORD dwFlags,__deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper,__inout_opt IUnknown *pUnkOuter);
  47. STDMETHODIMP CreatePalette(DWORD dwFlags,__in LPPALETTEENTRY lpColorTable,__deref_out LPDIRECTDRAWPALETTE *lplpDDPalette,__inout_opt IUnknown *pUnkOuter);
  48. STDMETHODIMP CreateSurface(__in LPDDSURFACEDESC lpDDSurfaceDesc,__deref_out LPDIRECTDRAWSURFACE *lplpDDSurface,__inout_opt IUnknown *pUnkOuter);
  49. STDMETHODIMP DuplicateSurface(__in LPDIRECTDRAWSURFACE lpDDSurface,__deref_out LPDIRECTDRAWSURFACE *lplpDupDDSurface);
  50. STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount,__in LPDDSURFACEDESC lplpDDSurfaceDescList,__in LPVOID lpContext,__in LPDDENUMMODESCALLBACK lpEnumCallback);
  51. STDMETHODIMP EnumSurfaces(DWORD dwFlags,__in LPDDSURFACEDESC lpDDSD,__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpEnumCallback);
  52. STDMETHODIMP FlipToGDISurface();
  53. STDMETHODIMP GetCaps(__out LPDDCAPS lpDDDriverCaps,__out LPDDCAPS lpDDHELCaps);
  54. STDMETHODIMP GetDisplayMode(__out LPDDSURFACEDESC lpDDSurfaceDesc);
  55. STDMETHODIMP GetFourCCCodes(__inout LPDWORD lpNumCodes,__out_ecount(*lpNumCodes) LPDWORD lpCodes);
  56. STDMETHODIMP GetGDISurface(__deref_out LPDIRECTDRAWSURFACE *lplpGDIDDSurface);
  57. STDMETHODIMP GetMonitorFrequency(__out LPDWORD lpdwFrequency);
  58. STDMETHODIMP GetScanLine(__out LPDWORD lpdwScanLine);
  59. STDMETHODIMP GetVerticalBlankStatus(__out LPBOOL lpblsInVB);
  60. STDMETHODIMP Initialize(__in GUID *lpGUID);
  61. STDMETHODIMP RestoreDisplayMode();
  62. STDMETHODIMP SetCooperativeLevel(HWND hWnd,DWORD dwFlags);
  63. STDMETHODIMP SetDisplayMode(DWORD dwWidth,DWORD dwHeight,DWORD dwBpp);
  64. STDMETHODIMP WaitForVerticalBlank(DWORD dwFlags,HANDLE hEvent);
  65. };
  66. // Class that aggregates an IDirectDrawSurface interface
  67. class CAggDrawSurface : public IDirectDrawSurface, public CUnknown
  68. {
  69. protected:
  70. LPDIRECTDRAWSURFACE m_pDirectDrawSurface;
  71. public:
  72. DECLARE_IUNKNOWN
  73. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,__deref_out void **ppv);
  74. // Constructor and destructor
  75. CAggDrawSurface(__in_opt LPCTSTR pName,__inout_opt LPUNKNOWN pUnk) :
  76. CUnknown(pName,pUnk),
  77. m_pDirectDrawSurface(NULL) { };
  78. virtual ~CAggDrawSurface() { };
  79. // Set the object we should be aggregating
  80. void SetDirectDrawSurface(__inout LPDIRECTDRAWSURFACE pDirectDrawSurface) {
  81. m_pDirectDrawSurface = pDirectDrawSurface;
  82. }
  83. // IDirectDrawSurface methods
  84. STDMETHODIMP AddAttachedSurface(__in LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
  85. STDMETHODIMP AddOverlayDirtyRect(__in LPRECT lpRect);
  86. STDMETHODIMP Blt(__in LPRECT lpDestRect,__in LPDIRECTDRAWSURFACE lpDDSrcSurface,__in LPRECT lpSrcRect,DWORD dwFlags,__in LPDDBLTFX lpDDBltFx);
  87. STDMETHODIMP BltBatch(__in_ecount(dwCount) LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags);
  88. STDMETHODIMP BltFast(DWORD dwX,DWORD dwY,__in LPDIRECTDRAWSURFACE lpDDSrcSurface,__in LPRECT lpSrcRect,DWORD dwTrans);
  89. STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags,__in LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
  90. STDMETHODIMP EnumAttachedSurfaces(__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
  91. STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags,__in LPVOID lpContext,__in LPDDENUMSURFACESCALLBACK lpfnCallback);
  92. STDMETHODIMP Flip(__in LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags);
  93. STDMETHODIMP GetAttachedSurface(__in LPDDSCAPS lpDDSCaps,__deref_out LPDIRECTDRAWSURFACE *lplpDDAttachedSurface);
  94. STDMETHODIMP GetBltStatus(DWORD dwFlags);
  95. STDMETHODIMP GetCaps(__out LPDDSCAPS lpDDSCaps);
  96. STDMETHODIMP GetClipper(__deref_out LPDIRECTDRAWCLIPPER *lplpDDClipper);
  97. STDMETHODIMP GetColorKey(DWORD dwFlags,__out LPDDCOLORKEY lpDDColorKey);
  98. STDMETHODIMP GetDC(__out HDC *lphDC);
  99. STDMETHODIMP GetFlipStatus(DWORD dwFlags);
  100. STDMETHODIMP GetOverlayPosition(__out LPLONG lpdwX,__out LPLONG lpdwY);
  101. STDMETHODIMP GetPalette(__deref_out LPDIRECTDRAWPALETTE *lplpDDPalette);
  102. STDMETHODIMP GetPixelFormat(__out LPDDPIXELFORMAT lpDDPixelFormat);
  103. STDMETHODIMP GetSurfaceDesc(__out LPDDSURFACEDESC lpDDSurfaceDesc);
  104. STDMETHODIMP Initialize(__in LPDIRECTDRAW lpDD,__in LPDDSURFACEDESC lpDDSurfaceDesc);
  105. STDMETHODIMP IsLost();
  106. STDMETHODIMP Lock(__in LPRECT lpDestRect,__inout LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent);
  107. STDMETHODIMP ReleaseDC(HDC hDC);
  108. STDMETHODIMP Restore();
  109. STDMETHODIMP SetClipper(__in LPDIRECTDRAWCLIPPER lpDDClipper);
  110. STDMETHODIMP SetColorKey(DWORD dwFlags,__in LPDDCOLORKEY lpDDColorKey);
  111. STDMETHODIMP SetOverlayPosition(LONG dwX,LONG dwY);
  112. STDMETHODIMP SetPalette(__in LPDIRECTDRAWPALETTE lpDDPalette);
  113. STDMETHODIMP Unlock(__in LPVOID lpSurfaceData);
  114. STDMETHODIMP UpdateOverlay(__in LPRECT lpSrcRect,__in LPDIRECTDRAWSURFACE lpDDDestSurface,__in LPRECT lpDestRect,DWORD dwFlags,__in LPDDOVERLAYFX lpDDOverlayFX);
  115. STDMETHODIMP UpdateOverlayDisplay(DWORD dwFlags);
  116. STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags,__in LPDIRECTDRAWSURFACE lpDDSReference);
  117. };
  118. class CLoadDirectDraw
  119. {
  120. LPDIRECTDRAW m_pDirectDraw; // The DirectDraw driver instance
  121. HINSTANCE m_hDirectDraw; // Handle to the loaded library
  122. public:
  123. CLoadDirectDraw();
  124. ~CLoadDirectDraw();
  125. HRESULT LoadDirectDraw(__in LPSTR szDevice);
  126. void ReleaseDirectDraw();
  127. HRESULT IsDirectDrawLoaded();
  128. LPDIRECTDRAW GetDirectDraw();
  129. BOOL IsDirectDrawVersion1();
  130. };
  131. #endif // __VIDEOCTL__