UB530View.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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. std::mutex m_mut_cpature;
  84. std::condition_variable m_capture_cond;
  85. // 单次截图;
  86. void CaptureSingleImageEx(LPTSTR lpszFileName, BOOL bIsJPG = TRUE);
  87. // 单次截图并自动命名;
  88. std::string CaptureSingleImageAutoNameEx(LPCTSTR lpszDir, BOOL bIsJPG = TRUE);
  89. // 连续截图;//默认持续1000ms;
  90. void CaptureMultiImageEx(LPCTSTR lpszDir, LPCTSTR lpszPrefix, BOOL bIsJPG, int nDurationTime = 1000);
  91. // 截图;
  92. BOOL SaveImageByCaptureInfo(const CaptureInfo& capInfo);
  93. // 截图线程;
  94. BYTE* m_pBuffer;
  95. DWORD m_dwBufferLen;
  96. std::mutex m_mut_thread;
  97. std::condition_variable m_thread_cond; //使用std::condition_variable等待数据
  98. static void CaptureImageThread(CUB530View* pView);
  99. // 录屏;
  100. void StartRecord(DWORD dwDuration, LPCTSTR lpSavePath);
  101. void StopRecord();
  102. public:
  103. public:
  104. // 截图路径;
  105. enum SHOTDir{
  106. ShotLocal = 0,
  107. ShotSystem = 1,
  108. ShotSpec = 2
  109. };
  110. SHOTDir m_shotDir;
  111. TCHAR m_szSpecDir[MAX_PATH];
  112. void SetRibbonStatusBarText(CString strText, int uId);
  113. friend class CMemoryClient;
  114. afx_msg void OnTimer(UINT_PTR nIDEvent);
  115. afx_msg void OnCutBmp();
  116. afx_msg void OnCutJpg();
  117. afx_msg void OnStartRecord();
  118. afx_msg void OnStopRecord();
  119. afx_msg void OnCheckVertically();
  120. afx_msg void OnCheckHoriontal();
  121. afx_msg void OnUpdateCheckVertically(CCmdUI* pCmdUI);
  122. afx_msg void OnUpdateCheckHoriontal(CCmdUI* pCmdUI);
  123. afx_msg void OnTraymenuReconnect();
  124. afx_msg void OnCheckSuportGpu();
  125. afx_msg void OnCheckFormatMp4();
  126. afx_msg void OnCheckFormatAvi();
  127. afx_msg void OnUpdateCheckSuportGpu(CCmdUI* pCmdUI);
  128. afx_msg void OnUpdateCheckFormatMp4(CCmdUI* pCmdUI);
  129. afx_msg void OnUpdateCheckFormatAvi(CCmdUI* pCmdUI);
  130. afx_msg void OnUpdateStartRecord(CCmdUI* pCmdUI);
  131. afx_msg void OnUpdateStopRecord(CCmdUI* pCmdUI);
  132. afx_msg void OnCheckShotLocal();
  133. afx_msg void OnUpdateCheckShotLocal(CCmdUI* pCmdUI);
  134. afx_msg void OnCheckShotSystem();
  135. afx_msg void OnUpdateCheckShotSystem(CCmdUI* pCmdUI);
  136. afx_msg void OnCheckShotSpec();
  137. afx_msg void OnUpdateCheckShotSpec(CCmdUI* pCmdUI);
  138. afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
  139. afx_msg void OnCheckIrShot();
  140. afx_msg void OnUpdateCheckIrShot(CCmdUI* pCmdUI);
  141. };