UB530View.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180
  1. #pragma once
  2. #include "MemoryClient.h"
  3. // CUB530View 窗体视图
  4. class CUB530View : public CFormView
  5. {
  6. DECLARE_DYNCREATE(CUB530View)
  7. protected:
  8. CUB530View(); // 动态创建所使用的受保护的构造函数
  9. virtual ~CUB530View();
  10. public:
  11. #ifdef AFX_DESIGN_TIME
  12. enum { IDD = DLG_UB530VIEW };
  13. #endif
  14. #ifdef _DEBUG
  15. virtual void AssertValid() const;
  16. #ifndef _WIN32_WCE
  17. virtual void Dump(CDumpContext& dc) const;
  18. #endif
  19. #endif
  20. protected:
  21. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
  22. DECLARE_MESSAGE_MAP()
  23. public:
  24. virtual void OnInitialUpdate();
  25. virtual void OnDraw(CDC* /*pDC*/);
  26. //////////////////////////////////////////////////////////////////////////////////////////
  27. public:
  28. // 设备句柄;
  29. PVOID m_hVideoDevice;
  30. // 是否有信号;
  31. BOOL m_bNoSignal;
  32. // 是否在录频;
  33. BOOL m_bIsRecord;
  34. // 录频格式;
  35. BOOL m_bIsMp4; // FALSE= AVI
  36. //////////////////////////////////////////////////////////////////////////
  37. // VIDEO PROPERTIES
  38. // 是否支持GPU;
  39. BOOL m_bSupportGPU;
  40. // 视频流宽度;
  41. ULONG m_nVideoWidth;
  42. // 视频流高度;
  43. ULONG m_nVideoHeight;
  44. BOOL m_bVideoIsInterleaved;
  45. double m_dVideoFrameRate;
  46. BOOL m_bVideoDeinterlaceEnable;
  47. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// AUDIO PROPERTIES
  48. ULONG m_nAudioChannels;
  49. ULONG m_nAudioBitsPerSample;
  50. ULONG m_nAudioSampleFrequency;
  51. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// QUALITY PROPERTIES
  52. ULONG m_nSharpness;
  53. ULONG m_nSaturation;
  54. ULONG m_nHue;
  55. ULONG m_nConstrast;
  56. ULONG m_nBrightness;
  57. //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// RECORD & FILE PROPERTIES
  58. // 截图路径;
  59. CString m_strSnapshotPath;
  60. //
  61. CString m_strFormatChangedOutput;
  62. // 垂直镜像;
  63. BOOL m_bVertically;
  64. // 水平镜像;
  65. BOOL m_bHoriontal;
  66. // 程序退出;
  67. BOOL m_bAppQuit;
  68. public:
  69. // 初始化设备;
  70. BOOL HwInitialize();
  71. // 释放设备;
  72. BOOL HwUninitialize();
  73. // 单次截图;
  74. void CaptureSingleImage(LPTSTR lpszFileName, BOOL bIsJPG = TRUE);
  75. // 单次截图并自动命名;
  76. std::string CaptureSingleImageAutoName(LPCTSTR lpszDir, BOOL bIsJPG = TRUE);
  77. // 连续截图;//默认持续1000ms;
  78. void CaptureMultiImage(LPCTSTR lpszDir, LPCTSTR lpszPrefix, BOOL bIsJPG, int nDurationTime = 1000);
  79. //////////////////////////////////////////////////////////////////////////
  80. // ->预览截图;
  81. CaptureInfo m_CaptureInfo;
  82. BOOL m_bCaptureImage;
  83. BOOL m_bSaveImage;
  84. std::mutex m_mut_cpature;
  85. std::mutex m_mut_saveImg;
  86. std::condition_variable m_saveImg_cond;
  87. // 单次截图;
  88. void CaptureSingleImageEx(LPTSTR lpszFileName, BOOL bIsJPG = TRUE);
  89. // 单次截图并自动命名;
  90. std::string CaptureSingleImageAutoNameEx(LPCTSTR lpszDir, BOOL bIsJPG = TRUE);
  91. // 连续截图;//默认持续1000ms;
  92. void CaptureMultiImageEx(LPCTSTR lpszDir, LPCTSTR lpszPrefix, BOOL bIsJPG, int nDurationTime = 1000);
  93. // 截图;
  94. BOOL SaveImageByCaptureInfo(const CaptureInfo& capInfo);
  95. // 截图线程;
  96. BYTE* m_pBuffer;
  97. DWORD m_dwBufferLen;
  98. std::mutex m_mut_thread;
  99. std::condition_variable m_thread_cond; //使用std::condition_variable等待数据
  100. static void CaptureImageThread(CUB530View* pView);
  101. // 录屏;
  102. void StartRecord(DWORD dwDuration, LPCTSTR lpSavePath);
  103. void StopRecord();
  104. public:
  105. public:
  106. // 截图路径;
  107. enum SHOTDir{
  108. ShotLocal = 0,
  109. ShotSystem = 1,
  110. ShotSpec = 2
  111. };
  112. SHOTDir m_shotDir;
  113. TCHAR m_szSpecDir[MAX_PATH];
  114. void SetRibbonStatusBarText(CString strText, int uId);
  115. friend class CMemoryClient;
  116. afx_msg void OnTimer(UINT_PTR nIDEvent);
  117. afx_msg void OnCutBmp();
  118. afx_msg void OnCutJpg();
  119. afx_msg void OnStartRecord();
  120. afx_msg void OnStopRecord();
  121. afx_msg void OnCheckVertically();
  122. afx_msg void OnCheckHoriontal();
  123. afx_msg void OnUpdateCheckVertically(CCmdUI* pCmdUI);
  124. afx_msg void OnUpdateCheckHoriontal(CCmdUI* pCmdUI);
  125. afx_msg void OnTraymenuReconnect();
  126. afx_msg void OnCheckSuportGpu();
  127. afx_msg void OnCheckFormatMp4();
  128. afx_msg void OnCheckFormatAvi();
  129. afx_msg void OnUpdateCheckSuportGpu(CCmdUI* pCmdUI);
  130. afx_msg void OnUpdateCheckFormatMp4(CCmdUI* pCmdUI);
  131. afx_msg void OnUpdateCheckFormatAvi(CCmdUI* pCmdUI);
  132. afx_msg void OnUpdateStartRecord(CCmdUI* pCmdUI);
  133. afx_msg void OnUpdateStopRecord(CCmdUI* pCmdUI);
  134. afx_msg void OnCheckShotLocal();
  135. afx_msg void OnUpdateCheckShotLocal(CCmdUI* pCmdUI);
  136. afx_msg void OnCheckShotSystem();
  137. afx_msg void OnUpdateCheckShotSystem(CCmdUI* pCmdUI);
  138. afx_msg void OnCheckShotSpec();
  139. afx_msg void OnUpdateCheckShotSpec(CCmdUI* pCmdUI);
  140. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  141. afx_msg void OnCheckIrShot();
  142. afx_msg void OnUpdateCheckIrShot(CCmdUI* pCmdUI);
  143. };