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.

113 lines
4.5 KiB

  1. // Copyright (c) 1994 - 1998 Microsoft Corporation. All Rights Reserved.
  2. // Defines a window management object, Anthony Phillips, January 1995
  3. #ifndef __VMRWINDOW__
  4. #define __VMRWINDOW__
  5. #define OCR_ARROW_DEFAULT 100 // Default Windows OEM arrow cursor
  6. // This class looks after the management of a video window. When the window
  7. // object is first created the constructor spawns off a worker thread that
  8. // does all the window work. The original thread waits until it is signaled
  9. // to continue. The worker thread firstly registers the window class if it
  10. // is not already done. Then it creates a window and sets it's size to match
  11. // the video dimensions (the dimensions are returned through GetDefaultRect)
  12. // Notice that the worker thread MUST be the thread that creates the window
  13. // as it is the one who calls GetMessage. When it has done all this it will
  14. // signal the original thread which lets it continue, this ensures a window
  15. // is created and valid before the constructor returns. The thread's start
  16. // address is the WindowMessageLoop function. The thread's parameter we pass
  17. // it is the CBaseWindow this pointer for the window object that created it
  18. #define WindowClassName TEXT("VideoRenderer")
  19. #define VMR_ACTIVATE_WINDOW TEXT("WM_VMR_ACTIVATE_WINDOW")
  20. // The window class name isn't used only as a class name for the base window
  21. // classes, it is also used by the overlay selection code as a name to base
  22. // a mutex creation on. Basicly it has a shared memory block where the next
  23. // available overlay colour is returned from. The creation and preparation
  24. // of the shared memory must be serialised through all ActiveMovie instances
  25. class CVMRFilter;
  26. class CVMRVideoWindow : public CVMRBaseControlWindow, public CVMRBaseControlVideo
  27. {
  28. CVMRFilter *m_pRenderer; // The owning renderer object
  29. BOOL m_bTargetSet; // Do we use the default rectangle
  30. CCritSec *m_pInterfaceLock; // Main renderer interface lock
  31. HCURSOR m_hCursor; // Used to display a normal cursor
  32. VIDEOINFOHEADER *m_pFormat; // holds our video format
  33. int m_FormatSize; // length of m_pFormat
  34. UINT m_VMRActivateWindow; // Makes the window WS_EX_TOPMOST
  35. // Handle the drawing and repainting of the window
  36. BOOL RefreshImage(COLORREF WindowColour);
  37. // Overriden method to handle window messages
  38. LRESULT OnReceiveMessage(HWND hwnd, // Window handle
  39. UINT uMsg, // Message ID
  40. WPARAM wParam, // First parameter
  41. LPARAM lParam); // Other parameter
  42. // Window message handlers
  43. void OnEraseBackground();
  44. BOOL OnClose();
  45. BOOL OnPaint();
  46. BOOL OnSetCursor(LPARAM lParam);
  47. BOOL OnSize(LONG Width, LONG Height);
  48. public:
  49. CVMRVideoWindow(CVMRFilter *pRenderer, // The owning renderer
  50. CCritSec *pLock, // Object to use for lock
  51. LPUNKNOWN pUnk, // Owning object
  52. HRESULT *phr); // OLE return code
  53. ~CVMRVideoWindow();
  54. STDMETHODIMP NonDelegatingQueryInterface(REFIID riid,VOID **ppv);
  55. // Return the minimum and maximum ideal sizes
  56. STDMETHODIMP GetMinIdealImageSize(long *pWidth,long *pHeight);
  57. STDMETHODIMP GetMaxIdealImageSize(long *pWidth,long *pHeight);
  58. // IBasicVideo2
  59. STDMETHODIMP GetPreferredAspectRatio(long *plAspectX, long *plAspectY);
  60. LPTSTR GetClassWindowStyles(DWORD *pClassStyles, // Class styles
  61. DWORD *pWindowStyles, // Window styles
  62. DWORD *pWindowStylesEx); // Extended styles
  63. HRESULT PrepareWindow();
  64. HRESULT ActivateWindowAsync(BOOL fAvtivate);
  65. // These are called by the renderer control interfaces
  66. HRESULT SetDefaultTargetRect();
  67. HRESULT IsDefaultTargetRect();
  68. HRESULT SetTargetRect(RECT *pTargetRect);
  69. HRESULT GetTargetRect(RECT *pTargetRect);
  70. HRESULT SetDefaultSourceRect();
  71. HRESULT IsDefaultSourceRect();
  72. HRESULT SetSourceRect(RECT *pSourceRect);
  73. HRESULT GetSourceRect(RECT *pSourceRect);
  74. HRESULT OnUpdateRectangles();
  75. HRESULT GetStaticImage(long *pVideoSize,long *pVideoImage);
  76. VIDEOINFOHEADER *GetVideoFormat();
  77. RECT GetDefaultRect();
  78. void EraseVideoBackground();
  79. #ifdef DEBUG
  80. #define FRAME_RATE_TIMER 76872
  81. void StartFrameRateTimer();
  82. #endif
  83. // Synchronise with decoder thread
  84. CCritSec *LockWindowUpdate() {
  85. return (&m_WindowLock);
  86. };
  87. };
  88. #endif // __WINDOW__