CPlayerDlg.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #pragma once
  2. #include "CWMPPlayer4.h"
  3. #include "CWMPMedia.h"
  4. #include "CWMPPlaylist.h"
  5. #include "CWMPSettings.h"
  6. #include "CWMPControls.h"
  7. #include "libwmpplayer.h"
  8. #include "resource.h"
  9. // CPlayerDlg 对话框
  10. #define WM_SETVOLUME_MESSAGE WM_USER+100
  11. enum eplayer_loglevel {
  12. PLAYER_LOG_DEBUG,
  13. PLAYER_LOG_INFO,
  14. PLAYER_LOG_ERROR,
  15. PLAYER_LOG_NO
  16. };
  17. enum eplayer_monitor_error {
  18. PLAYER_NOTFUND_VICE,
  19. PLAYER_VICE_LOCATION_ERROR
  20. };
  21. typedef struct player_callback_s {
  22. void (*debug)(eplayer_loglevel elevel, void* user_data, const char* fmt, va_list arg);
  23. void (*player_event)(void* user_data, eplayer_monitor_error errortype, const char* errmsg);
  24. void (*onmediaplayfinished)(void* user_data, int imediatype);
  25. void* user_data;
  26. }player_callback_t;
  27. class CPlayerDlg : public CDialogEx
  28. {
  29. DECLARE_DYNAMIC(CPlayerDlg)
  30. public:
  31. CPlayerDlg(player_callback_t*pCalback, CWnd* pParent = NULL); // 标准构造函数
  32. CPlayerDlg(CWmpPlayConfig *pConfig, player_callback_t*pCalback, CWnd *pParent = NULL);
  33. virtual ~CPlayerDlg();
  34. // 对话框数据
  35. enum { IDD = IDD_DIALOG1 };
  36. protected:
  37. HICON m_hIcon;
  38. CWMPPlayer4 *m_player;
  39. CWMPSettings m_settings;
  40. CWMPPlaylist m_playlist;
  41. CWMPControls m_control;
  42. bool m_bMax;//窗口最大化标志
  43. CRect m_savedWndRect;//上一次的窗口矩形
  44. bool m_bInit;//OnInitDialog是否执行结束
  45. bool m_bTimer;//计时器是否在执行
  46. HMONITOR m_hMonitor;//音视频播放所在的屏幕的句柄
  47. CRect m_monitorRect;//音视频播放所在的屏幕的矩形
  48. int m_nPlayCnt; // 已重复播放次数(多个文件顺序播完一次算重复播一次)
  49. int m_nMediaInx; // 当前媒体序号
  50. CWmpPlayConfig *m_pConfig;
  51. player_callback_t m_callback;
  52. private:
  53. BOOL EndPlay();
  54. void PlayerLog(eplayer_loglevel elvel, const char* fmt, ...);
  55. void PlayerLogEvent(eplayer_monitor_error errortype, const char* errmsg);
  56. void OnMediaPlayFinished(int iMediaType);
  57. protected:
  58. virtual BOOL OnInitDialog();
  59. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
  60. DECLARE_EVENTSINK_MAP()
  61. public:
  62. void PlayStateChangeOcx1(long NewState);
  63. DECLARE_MESSAGE_MAP()
  64. protected:
  65. afx_msg LRESULT OnSetVolumeMessage(WPARAM wParam, LPARAM lParam);
  66. public:
  67. afx_msg void OnClose();
  68. afx_msg void OnSize(UINT nType, int cx, int cy);
  69. afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  70. afx_msg LRESULT OnNcHitTest(CPoint point);
  71. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  72. afx_msg void OnTimer(UINT_PTR nIDEvent);
  73. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  74. };