PlayerDlg.h 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. /////////////////////////////////////////////////////////////////////////////////////
  2. // PlayerDlg.h : header file
  3. /////////////////////////////////////////////////////////////////////////////////////
  4. #if !defined(AFX_PLAYERDLG_H__BC7E7078_7E67_40B3_85A4_591E51BB1A4A__INCLUDED_)
  5. #define AFX_PLAYERDLG_H__BC7E7078_7E67_40B3_85A4_591E51BB1A4A__INCLUDED_
  6. #if _MSC_VER > 1000
  7. #pragma once
  8. #endif // _MSC_VER > 1000
  9. #include "XColorStatic.h"
  10. #include "XScrollBar.h"
  11. #include "VolumeCtrl.h"
  12. #include "seek.h"
  13. #include "displayRect.h"
  14. #include "VideoCtrlDlg.h"
  15. #include "afxcmn.h"
  16. #include "ListCtrlCl.h"
  17. #include "afxdtctl.h"
  18. #include "afxwin.h"
  19. #include "XPButton.h"
  20. enum _VIDEO_PLAY_STATE
  21. {
  22. State_Close = 0,
  23. State_Play = 1,
  24. State_Pause = 2,
  25. State_Stop = 3
  26. };
  27. /////////////////////////////////////////////////////////////////////////////
  28. // CPlayerDlg dialog
  29. /////////////////////////////////////////////////////////////////////////////
  30. class CPlayerDlg : public CDialog
  31. {
  32. // Construction
  33. public:
  34. CPlayerDlg(CWnd* pParent = NULL); // standard constructor
  35. public:
  36. /************************************************************************/
  37. /* para used to cap pic */
  38. UINT m_nCapPicType; // 0 indicates default bmp, 1 indicates jpeg
  39. UINT m_npic_bmp; // capped bmp pic number
  40. UINT m_npic_jpeg; // capped jpeg pic number
  41. CString m_strCapPicPath; // capped pic path
  42. /************************************************************************/
  43. BOOL m_bStartDraw; // start drawing?
  44. BOOL m_bFileRefCreated; // has file ref created?
  45. BOOL m_bFileEnd; // has file played to end?
  46. BOOL m_bStreamType; // played as stream?
  47. BOOL m_bPicQuality; // use high picture quality?
  48. BOOL m_bDeflash; // set I frame deflashing?
  49. BOOL m_bHighFluid; // hight fluid motion?
  50. BOOL m_bSound; // open the sound or not?
  51. BOOL m_bOpen; // has file opend?
  52. BOOL m_bRepeatPlay; // play the file rewind?
  53. BOOL m_bFullScreen; // full screen or not?
  54. BOOL m_bConvertAVI; // convert to AVI or not?
  55. LONG m_nSpeed; // video play speed
  56. LONG m_nWidth; // image width
  57. LONG m_nHeight; // image height
  58. LONG m_nPrePlayPos; // pre play slider pos
  59. DWORD m_dwScreenHeight; // screem height
  60. DWORD m_dwScreenWidth; // screen width
  61. CRect m_rcScreen; // dlg in which screen now?
  62. DWORD m_dwHeadSize; // Hikvision file header length
  63. DWORD m_dwMaxFileSize; // Hikvision file size
  64. DWORD m_dwTotalFrames; // total frames
  65. DWORD m_dwMaxFileTime; // total file time(s)
  66. DWORD m_dwDisplaySecond; // seconds displayed at the statusbar
  67. DWORD m_dwDisplayMinute; // minutes displayed at the statusbar
  68. DWORD m_dwDisplayHour; // hours displayed at the statusbar
  69. DWORD m_dwDlgTopSize; // dlg top space height
  70. DWORD m_dwDlgEdge; // dlg edge space width
  71. DWORD m_dwOldDeviceNum; // old display device sequence
  72. CRect m_rcWindow; // window rect
  73. CRect m_rcDraw; // draw rect
  74. CRect m_rcDisplay; // mutli display rect
  75. CPoint m_StartPoint; // start point
  76. HANDLE m_hEventKill; // kill inputstream thread event
  77. HANDLE m_hEventInput; // inputstream thread event
  78. HANDLE m_hThread; // inputstream thread handle
  79. HANDLE m_hStreamFile; // input file
  80. CString m_strPlayFileName; // playing h264 file path
  81. CString m_strSaveAVIPath; // saveing avi file path
  82. CBitmap m_HikvisionBmp; // hikvision bmp
  83. CBitmap m_BlackBmp; // black bmp
  84. CBitmap m_OverlayBmp; // overlay bmp
  85. CMenu* m_pMainMenu; // pointer to the menu
  86. CSeek* m_pSeek; // seek dialog
  87. CDisplayRect* m_pDisplayRegion; // display region dialog
  88. CVideoCtrlDlg* m_pVideoControl; // video control dialog
  89. WINDOWPLACEMENT m_OldWndpl; // save dialog window pos
  90. _VIDEO_PLAY_STATE m_enumState; // now the play state
  91. public:
  92. BOOL PreTranslateMessage(MSG* lpmsg); // overload to handle keydown message
  93. /*************************************************************************/
  94. /* button operation begin
  95. /*************************************************************************/
  96. // play / pause / stop
  97. void Play();
  98. void Pause();
  99. void Stop();
  100. // gotostart / slow / fast / gotoend
  101. void GotoStart();
  102. void Slow();
  103. void Fast();
  104. void AdjustSpeed(int nSpeed);
  105. void GotoEnd();
  106. // stepback / stepfore / cap picture
  107. void StepBackward();
  108. void StepForward();
  109. void GetPic(PBYTE pImage, DWORD nBufSize);
  110. void Cappic();
  111. // close or open sound
  112. void Sound();
  113. // adjust sound
  114. void AdjustSound(BOOL bFlag);
  115. /*************************************************************************/
  116. /* button operation over
  117. /*************************************************************************/
  118. /*************************************************************************/
  119. /* menu operation begin
  120. /*************************************************************************/
  121. // file operation:
  122. void Open();
  123. void Close();
  124. void CutFile();
  125. // view operation:
  126. void ViewFullScreen();
  127. void ViewZoom(UINT nID);
  128. void Infomation();
  129. void SetDisplay();
  130. BOOL SetDevice(UINT nID);
  131. // control operation:
  132. void VideoControl();
  133. void Repeat();
  134. void Locate();
  135. // option operation:
  136. void StreamType();
  137. void Deflash();
  138. void Quality();
  139. void ThrowB(UINT nID);
  140. void DisplayType(UINT nID);
  141. void SelectTimer(UINT nID);
  142. void ResetBuf();
  143. void CapPicType(UINT nID);
  144. void CappicPath();
  145. void ConvertToAVI();
  146. // help operation:
  147. void AppAbout();
  148. void AppHelp();
  149. /*************************************************************************/
  150. /* menu operation over
  151. /*************************************************************************/
  152. /*************************************************************************/
  153. /* assistant operation begin
  154. /*************************************************************************/
  155. // open/close file or stream
  156. BOOL BrowseFile(CString *strFileName);
  157. void OpenFile();
  158. void CloseFile();
  159. void OpenStream();
  160. void CloseStream();
  161. // set play state
  162. void DrawStatus();
  163. void SetState();
  164. void SetAVIState();
  165. DWORD GetSpeedModulus();
  166. // sort the dialog control
  167. void SetWindowSize();
  168. void SortControl();
  169. void InitWindowSize(DWORD cx, DWORD cy);
  170. // others
  171. CRect GetOnPicRect(CRect rcWnd, CRect rcOnWnd, LONG nPicWidth, LONG nPicHeight);
  172. void TestCapability(DWORD nDeviceNum);
  173. void SetDisplayRegion(RECT);
  174. /*************************************************************************/
  175. /* assistant operation over
  176. /*************************************************************************/
  177. // Dialog Data
  178. //{{AFX_DATA(CPlayerDlg)
  179. enum { IDD = IDD_PLAYER_DIALOG };
  180. CButtonST m_ctrlBtnCapPic;
  181. CButtonST m_ctrlBtnSound;
  182. CButtonST m_ctrlStepBackward;
  183. CButtonST m_ctrlStepForward;
  184. CButtonST m_ctrlBtnSlow;
  185. CButtonST m_ctrlBtnFast;
  186. CButtonST m_ctrlBtnGStart;
  187. CButtonST m_ctrlBtnGEnd;
  188. CButtonST m_ctrlBtnStop;
  189. CButtonST m_ctrlBtnPlay;
  190. CButtonST m_ctrlBtnPause;
  191. CStatic m_ctrlVideoPic;
  192. CString m_strPlayStateText;
  193. CXColorStatic m_ctrlPlayText;
  194. //}}AFX_DATA
  195. CVolumeCtrl m_SoundSlider;
  196. CXScrollBar m_PlaySlider;
  197. // ClassWizard generated virtual function overrides
  198. //{{AFX_VIRTUAL(CPlayerDlg)
  199. protected:
  200. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  201. //}}AFX_VIRTUAL
  202. // Implementation
  203. protected:
  204. HICON m_hIcon;
  205. // Generated message map functions
  206. //{{AFX_MSG(CPlayerDlg)
  207. virtual BOOL OnInitDialog();
  208. afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
  209. afx_msg void OnPaint();
  210. afx_msg HCURSOR OnQueryDragIcon();
  211. afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
  212. afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
  213. afx_msg void OnLButtonDblClk(UINT nFlags, CPoint point);
  214. afx_msg void OnClose();
  215. afx_msg void OnTimer(UINT nIDEvent);
  216. afx_msg void OnSize(UINT nType, int cx, int cy);
  217. afx_msg void OnDropFiles(HDROP hDropInfo);
  218. afx_msg void OnMove(int x, int y);
  219. afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
  220. afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
  221. afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI);
  222. //}}AFX_MSG
  223. afx_msg void DisplayOk(WPARAM wParam, LPARAM lParam);
  224. afx_msg void SeekOk(WPARAM wParam, LPARAM lParam);
  225. afx_msg void VideoCtrlOK(WPARAM wParam, LPARAM lParam);
  226. afx_msg void PlayMessage(WPARAM wParam, LPARAM lParam);
  227. afx_msg void EncChangeMessage(WPARAM wParam, LPARAM lParam);
  228. afx_msg void OnMenuItem(UINT nID);
  229. afx_msg void OnButtonItem(UINT nID);
  230. DECLARE_MESSAGE_MAP()
  231. public:
  232. bool m_bInit;
  233. void Init();
  234. CListCtrlCl m_List_Vedio;
  235. void InitList( CListCtrlCl *pListCtrlCl );
  236. CDateTimeCtrl m_timeBegin;
  237. CDateTimeCtrl m_timeEnd;
  238. CXPButton m_btnQuery;
  239. afx_msg void OnBnClickedBtnQuery();
  240. afx_msg void OnNMDblclkListVedio(NMHDR *pNMHDR, LRESULT *pResult);
  241. afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
  242. void SetCtrlPos( CRect rect );
  243. void SetVideoCtrlPos( ) ;
  244. };
  245. //{{AFX_INSERT_LOCATION}}
  246. // Microsoft Visual C++ will insert additional declarations immediately before the previous line.
  247. #endif // !defined(AFX_PLAYERDLG_H__BC7E7078_7E67_40B3_85A4_591E51BB1A4A__INCLUDED_)