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.

178 lines
7.6 KiB

  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. TCHAR * WINAPI StringFromResource(TCHAR *pBuffer, int iResourceID);
  17. #ifdef UNICODE
  18. #define WideStringFromResource StringFromResource
  19. char* WINAPI StringFromResource(char*pBuffer, int iResourceID);
  20. #else
  21. WCHAR * WINAPI WideStringFromResource(WCHAR *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. 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,void **ppv);
  35. // Constructor and destructor
  36. CAggDirectDraw(TCHAR *pName,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(LPDIRECTDRAW pDirectDraw) {
  42. m_pDirectDraw = pDirectDraw;
  43. }
  44. // IDirectDraw methods
  45. STDMETHODIMP Compact();
  46. STDMETHODIMP CreateClipper(DWORD dwFlags,LPDIRECTDRAWCLIPPER *lplpDDClipper,IUnknown *pUnkOuter);
  47. STDMETHODIMP CreatePalette(DWORD dwFlags,LPPALETTEENTRY lpColorTable,LPDIRECTDRAWPALETTE *lplpDDPalette,IUnknown *pUnkOuter);
  48. STDMETHODIMP CreateSurface(LPDDSURFACEDESC lpDDSurfaceDesc,LPDIRECTDRAWSURFACE *lplpDDSurface,IUnknown *pUnkOuter);
  49. STDMETHODIMP DuplicateSurface(LPDIRECTDRAWSURFACE lpDDSurface,LPDIRECTDRAWSURFACE *lplpDupDDSurface);
  50. STDMETHODIMP EnumDisplayModes(DWORD dwSurfaceDescCount,LPDDSURFACEDESC lplpDDSurfaceDescList,LPVOID lpContext,LPDDENUMMODESCALLBACK lpEnumCallback);
  51. STDMETHODIMP EnumSurfaces(DWORD dwFlags,LPDDSURFACEDESC lpDDSD,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumCallback);
  52. STDMETHODIMP FlipToGDISurface();
  53. STDMETHODIMP GetCaps(LPDDCAPS lpDDDriverCaps,LPDDCAPS lpDDHELCaps);
  54. STDMETHODIMP GetDisplayMode(LPDDSURFACEDESC lpDDSurfaceDesc);
  55. STDMETHODIMP GetFourCCCodes(LPDWORD lpNumCodes,LPDWORD lpCodes);
  56. STDMETHODIMP GetGDISurface(LPDIRECTDRAWSURFACE *lplpGDIDDSurface);
  57. STDMETHODIMP GetMonitorFrequency(LPDWORD lpdwFrequency);
  58. STDMETHODIMP GetScanLine(LPDWORD lpdwScanLine);
  59. STDMETHODIMP GetVerticalBlankStatus(LPBOOL lpblsInVB);
  60. STDMETHODIMP Initialize(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,void **ppv);
  74. // Constructor and destructor
  75. CAggDrawSurface(TCHAR *pName,LPUNKNOWN pUnk) :
  76. CUnknown(pName,pUnk),
  77. m_pDirectDrawSurface(NULL) { };
  78. virtual ~CAggDrawSurface() { };
  79. // Set the object we should be aggregating
  80. void SetDirectDrawSurface(LPDIRECTDRAWSURFACE pDirectDrawSurface) {
  81. m_pDirectDrawSurface = pDirectDrawSurface;
  82. }
  83. // IDirectDrawSurface methods
  84. STDMETHODIMP AddAttachedSurface(LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
  85. STDMETHODIMP AddOverlayDirtyRect(LPRECT lpRect);
  86. STDMETHODIMP Blt(LPRECT lpDestRect,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwFlags,LPDDBLTFX lpDDBltFx);
  87. STDMETHODIMP BltBatch(LPDDBLTBATCH lpDDBltBatch,DWORD dwCount,DWORD dwFlags);
  88. STDMETHODIMP BltFast(DWORD dwX,DWORD dwY,LPDIRECTDRAWSURFACE lpDDSrcSurface,LPRECT lpSrcRect,DWORD dwTrans);
  89. STDMETHODIMP DeleteAttachedSurface(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSAttachedSurface);
  90. STDMETHODIMP EnumAttachedSurfaces(LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpEnumSurfacesCallback);
  91. STDMETHODIMP EnumOverlayZOrders(DWORD dwFlags,LPVOID lpContext,LPDDENUMSURFACESCALLBACK lpfnCallback);
  92. STDMETHODIMP Flip(LPDIRECTDRAWSURFACE lpDDSurfaceTargetOverride,DWORD dwFlags);
  93. STDMETHODIMP GetAttachedSurface(LPDDSCAPS lpDDSCaps,LPDIRECTDRAWSURFACE *lplpDDAttachedSurface);
  94. STDMETHODIMP GetBltStatus(DWORD dwFlags);
  95. STDMETHODIMP GetCaps(LPDDSCAPS lpDDSCaps);
  96. STDMETHODIMP GetClipper(LPDIRECTDRAWCLIPPER *lplpDDClipper);
  97. STDMETHODIMP GetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey);
  98. STDMETHODIMP GetDC(HDC *lphDC);
  99. STDMETHODIMP GetFlipStatus(DWORD dwFlags);
  100. STDMETHODIMP GetOverlayPosition(LPLONG lpdwX,LPLONG lpdwY);
  101. STDMETHODIMP GetPalette(LPDIRECTDRAWPALETTE *lplpDDPalette);
  102. STDMETHODIMP GetPixelFormat(LPDDPIXELFORMAT lpDDPixelFormat);
  103. STDMETHODIMP GetSurfaceDesc(LPDDSURFACEDESC lpDDSurfaceDesc);
  104. STDMETHODIMP Initialize(LPDIRECTDRAW lpDD,LPDDSURFACEDESC lpDDSurfaceDesc);
  105. STDMETHODIMP IsLost();
  106. STDMETHODIMP Lock(LPRECT lpDestRect,LPDDSURFACEDESC lpDDSurfaceDesc,DWORD dwFlags,HANDLE hEvent);
  107. STDMETHODIMP ReleaseDC(HDC hDC);
  108. STDMETHODIMP Restore();
  109. STDMETHODIMP SetClipper(LPDIRECTDRAWCLIPPER lpDDClipper);
  110. STDMETHODIMP SetColorKey(DWORD dwFlags,LPDDCOLORKEY lpDDColorKey);
  111. STDMETHODIMP SetOverlayPosition(LONG dwX,LONG dwY);
  112. STDMETHODIMP SetPalette(LPDIRECTDRAWPALETTE lpDDPalette);
  113. STDMETHODIMP Unlock(LPVOID lpSurfaceData);
  114. STDMETHODIMP UpdateOverlay(LPRECT lpSrcRect,LPDIRECTDRAWSURFACE lpDDDestSurface,LPRECT lpDestRect,DWORD dwFlags,LPDDOVERLAYFX lpDDOverlayFX);
  115. STDMETHODIMP UpdateOverlayDisplay(DWORD dwFlags);
  116. STDMETHODIMP UpdateOverlayZOrder(DWORD dwFlags,LPDIRECTDRAWSURFACE lpDDSReference);
  117. };
  118. // DirectShow must work on multiple platforms. In particular, it also runs on
  119. // Windows NT 3.51 which does not have DirectDraw capabilities. The filters
  120. // cannot therefore link statically to the DirectDraw library. To make their
  121. // lives that little bit easier we provide this class that manages loading
  122. // and unloading the library and creating the initial IDirectDraw interface
  123. typedef DWORD (WINAPI *PGETFILEVERSIONINFOSIZE)(LPTSTR,LPDWORD);
  124. typedef BOOL (WINAPI *PGETFILEVERSIONINFO)(LPTSTR,DWORD,DWORD,LPVOID);
  125. typedef BOOL (WINAPI *PVERQUERYVALUE)(LPVOID,LPTSTR,LPVOID,PUINT);
  126. class CLoadDirectDraw
  127. {
  128. LPDIRECTDRAW m_pDirectDraw; // The DirectDraw driver instance
  129. HINSTANCE m_hDirectDraw; // Handle to the loaded library
  130. public:
  131. CLoadDirectDraw();
  132. ~CLoadDirectDraw();
  133. HRESULT LoadDirectDraw(LPSTR szDevice);
  134. void ReleaseDirectDraw();
  135. HRESULT IsDirectDrawLoaded();
  136. LPDIRECTDRAW GetDirectDraw();
  137. BOOL IsDirectDrawVersion1();
  138. };
  139. #endif // __VIDEOCTL__