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.

205 lines
6.0 KiB

  1. /*****************************************************************************
  2. *
  3. * (C) COPYRIGHT MICROSOFT CORPORATION, 2000
  4. *
  5. * TITLE: PrvGrph.h
  6. *
  7. * VERSION: 1.0
  8. *
  9. * AUTHOR: OrenR
  10. *
  11. * DATE: 2000/10/25
  12. *
  13. * DESCRIPTION: Implements preview graph for capture still images
  14. *
  15. *****************************************************************************/
  16. #ifndef _PRVGRPH_H_
  17. #define _PRVGRPH_H_
  18. #include "StillPrc.h"
  19. #include "WiaLink.h"
  20. /////////////////////////////////////////////////////////////////////////////
  21. // CPreviewGraph
  22. class CPreviewGraph
  23. {
  24. public:
  25. ///////////////////////////////
  26. // Constructor
  27. //
  28. CPreviewGraph();
  29. ///////////////////////////////
  30. // Destructor
  31. //
  32. virtual ~CPreviewGraph();
  33. ///////////////////////////////
  34. // Init
  35. //
  36. HRESULT Init(class CWiaVideo *pWiaVideo);
  37. ///////////////////////////////
  38. // Term
  39. //
  40. HRESULT Term();
  41. ///////////////////////////////
  42. // CreateVideo
  43. //
  44. // bAutoPlay = TRUE will begin
  45. // graph playback after graph
  46. // is completely built.
  47. //
  48. HRESULT CreateVideo(const TCHAR *pszOptionalWiaDeviceID,
  49. IMoniker *pCaptureDeviceMoniker,
  50. HWND hwndParent,
  51. BOOL bStretchToFitParent,
  52. BOOL bAutoPlay);
  53. ///////////////////////////////
  54. // DestroyVideo
  55. //
  56. HRESULT DestroyVideo();
  57. ///////////////////////////////
  58. // TakePicture
  59. //
  60. HRESULT TakePicture(CSimpleString *pstrNewImageFileName);
  61. ///////////////////////////////
  62. // ShowPreview
  63. //
  64. HRESULT ShowVideo(BOOL bShow);
  65. ///////////////////////////////
  66. // IsPreviewVisible
  67. //
  68. BOOL IsPreviewVisible()
  69. {
  70. return m_bPreviewVisible;
  71. }
  72. ///////////////////////////////
  73. // ResizeVideo
  74. //
  75. HRESULT ResizeVideo(BOOL bSizeVideoToWindow);
  76. ///////////////////////////////
  77. // Play
  78. //
  79. HRESULT Play();
  80. ///////////////////////////////
  81. // Pause
  82. //
  83. HRESULT Pause();
  84. ///////////////////////////////
  85. // GetState
  86. //
  87. WIAVIDEO_STATE GetState();
  88. ///////////////////////////////
  89. // GetImagesDirectory
  90. //
  91. HRESULT GetImagesDirectory(CSimpleString *pImagesDir);
  92. ///////////////////////////////
  93. // SetImagesDirectory
  94. //
  95. HRESULT SetImagesDirectory(const CSimpleString *pImagesDir);
  96. ///////////////////////////////
  97. // ProcessAsyncImage
  98. //
  99. // Called by Still Processor
  100. // when user presses hardware
  101. // button and it is delivered to
  102. // Still Pin.
  103. //
  104. HRESULT ProcessAsyncImage(const CSimpleString *pNewImage);
  105. private:
  106. HRESULT Stop();
  107. HRESULT GetStillPinCaps(IBaseFilter *pCaptureFilter,
  108. IPin **ppStillPin,
  109. IAMVideoControl **ppVideoControl,
  110. LONG *plCaps);
  111. HRESULT AddStillFilterToGraph(LPCWSTR pwszFilterName,
  112. IBaseFilter **ppFilter,
  113. IStillSnapshot **ppSnapshot);
  114. HRESULT AddColorConverterToGraph(LPCWSTR pwszFilterName,
  115. IBaseFilter **ppColorSpaceConverter);
  116. HRESULT AddCaptureFilterToGraph(IBaseFilter *pCaptureFilter,
  117. IPin **ppCapturePin);
  118. HRESULT AddVideoRendererToGraph(LPCWSTR pwszFilterName,
  119. IBaseFilter **ppVideoRenderer);
  120. HRESULT InitVideoWindows(HWND hwndParent,
  121. IBaseFilter *pCaptureFilter,
  122. IVideoWindow **ppPreviewVideoWindow,
  123. BOOL bStretchToFitParent);
  124. HRESULT CreateCaptureFilter(IMoniker *pCaptureDeviceMoniker,
  125. IBaseFilter **ppCaptureFilter);
  126. HRESULT BuildPreviewGraph(IMoniker *pCaptureDeviceMoniker,
  127. BOOL bStretchToFitParent);
  128. HRESULT TeardownPreviewGraph();
  129. HRESULT RemoveAllFilters();
  130. HRESULT SetState(WIAVIDEO_STATE NewState);
  131. HRESULT ConnectFilters(IGraphBuilder *pGraphBuilder,
  132. IPin *pMediaSourceOutputPin,
  133. IBaseFilter *pColorSpaceFilter,
  134. IBaseFilter *pWiaFilter,
  135. IBaseFilter *pVideoRenderer);
  136. LRESULT HandlePowerEvent(WPARAM wParam,
  137. LPARAM lParam);
  138. HRESULT CreateHiddenWindow();
  139. HRESULT DestroyHiddenWindow();
  140. static LRESULT CALLBACK HiddenWndProc(HWND hwnd,
  141. UINT uiMessage,
  142. WPARAM wParam,
  143. LPARAM lParam);
  144. CStillProcessor m_StillProcessor;
  145. CSimpleString m_strImagesDirectory;
  146. class CWiaVideo *m_pWiaVideo;
  147. CComPtr<IAMVideoControl> m_pVideoControl;
  148. CComPtr<IPin> m_pStillPin;
  149. CComPtr<IStillSnapshot> m_pCapturePinSnapshot;
  150. CComPtr<IStillSnapshot> m_pStillPinSnapshot;
  151. CComPtr<IVideoWindow> m_pPreviewVW;
  152. CComPtr<ICaptureGraphBuilder2> m_pCaptureGraphBuilder;
  153. CComPtr<IGraphBuilder> m_pGraphBuilder;
  154. CComPtr<IBaseFilter> m_pCaptureFilter;
  155. LONG m_lStillPinCaps;
  156. LONG m_lStyle;
  157. BOOL m_bPreviewVisible;
  158. WIAVIDEO_STATE m_CurrentState;
  159. HWND m_hwndParent;
  160. BOOL m_bSizeVideoToWindow;
  161. CWiaVideoProperties *m_pVideoProperties;
  162. HWND m_hwndPowerMgmt;
  163. };
  164. #endif // _PRVGRPH_H_