Old fashion design for PC-104
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.

107 lines
2.4 KiB

4 years ago
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. //----------------------------------------------------------------------------
  2. // Laser Guard Ltd.
  3. // Copyright � 2000-2002. All Rights Reserved.
  4. // Version 1.0 01/01/2000
  5. // Last modification: 08/10/2003
  6. // PROJECT:
  7. // SUBSYSTEM:
  8. // FILE: VideoWnd.h
  9. // AUTHOR: Sergey Chizhevskiy
  10. // OVERVIEW
  11. // ~~~~~~~~
  12. // Header file of VideoWnd.h
  13. //----------------------------------------------------------------------------
  14. #ifndef __VIDEO__FOR__WINDOWS__WND__H__INCLUDED__
  15. #define __VIDEO__FOR__WINDOWS__WND__H__INCLUDED__
  16. #if _MSC_VER > 1000
  17. #pragma once
  18. #endif
  19. #include "VideoCaptureWnd.h"
  20. #include "..\..\LgLib\Templ.h"
  21. class CVideoFrameDIB
  22. {
  23. public:
  24. CVideoFrameDIB();
  25. virtual ~CVideoFrameDIB();
  26. public:
  27. BOOL Create( LPBITMAPINFO pBitmapInfo, PBYTE pBytes );
  28. void Destroy();
  29. public:
  30. operator LPBITMAPINFO() { return m_pBitmapInfo; }
  31. operator LPBYTE() { return m_pBytes; }
  32. public:
  33. BOOL Draw( HDC hDC, PRECT pRect );
  34. HBITMAP CreateBitmap();
  35. HBITMAP CreateBitmap( LPBITMAPINFO* );
  36. private:
  37. LPBITMAPINFO m_pBitmapInfo;
  38. PBYTE m_pBytes;
  39. INT m_nBitmapInfoSize;
  40. CLgCriticalSection m_CriticalSection;
  41. };
  42. class CVideoForWindowsWnd :
  43. public CVideoCaptureWnd
  44. {
  45. public:
  46. CVideoForWindowsWnd();
  47. virtual ~CVideoForWindowsWnd();
  48. public:
  49. //{{AFX_VIRTUAL(CVideoForWindowsWnd)
  50. public:
  51. virtual BOOL DestroyWindow();
  52. protected:
  53. //}}AFX_VIRTUAL
  54. public:
  55. BOOL Create( CWnd *pParentWnd, int x, int y, int cx, int cy, int ccx = 320, int ccy = 240 );
  56. public:
  57. virtual HBITMAP Capture( LPBITMAPINFO *ppBmi, LPBYTE *pBytes, DWORD dwPreviewTime = 0 );
  58. public:
  59. BOOL FileSaveDIB( LPSTR pFileName );
  60. BOOL GrabFrameNoStop();
  61. BOOL DlgVideoDisplay();
  62. BOOL DlgVideoFormat();
  63. BOOL DlgVideoSource();
  64. protected:
  65. //{{AFX_MSG(CVideoForWindowsWnd)
  66. //}}AFX_MSG
  67. DECLARE_MESSAGE_MAP()
  68. private:
  69. struct CAPTURE
  70. {
  71. LPBYTE pBuffer;
  72. LPBITMAPINFO pBmi;
  73. HBITMAP hBitmap;
  74. }m_Capture;
  75. CVideoFrameDIB m_VideoFrameDIB;
  76. private:
  77. BOOL CaptureDone();
  78. BOOL CaptureInit( HWND hWnd );
  79. private:
  80. LRESULT OnErrorCallback( HWND hWnd, int nErrID, LPSTR lpErrorText );
  81. LRESULT OnFrameCallback( HWND hWnd, LPVIDEOHDR lpVHdr );
  82. static LRESULT CALLBACK ErrorCallbackProc( HWND hWnd, int nErrID, LPSTR lpErrorText );
  83. static LRESULT CALLBACK FrameCallbackProc( HWND hWnd, LPVIDEOHDR lpVHdr );
  84. };
  85. //{{AFX_INSERT_LOCATION}}
  86. #endif