CPlayerDlg.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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* user_data;
  25. }player_callback_t;
  26. class CPlayerDlg : public CDialogEx
  27. {
  28. DECLARE_DYNAMIC(CPlayerDlg)
  29. public:
  30. CPlayerDlg(player_callback_t*pCalback, CWnd* pParent = NULL); // 标准构造函数
  31. CPlayerDlg(CWmpPlayConfig *pConfig, player_callback_t*pCalback, CWnd *pParent = NULL);
  32. virtual ~CPlayerDlg();
  33. // 对话框数据
  34. enum { IDD = IDD_DIALOG1 };
  35. protected:
  36. HICON m_hIcon;
  37. CWMPPlayer4 *m_player;
  38. CWMPSettings m_settings;
  39. CWMPPlaylist m_playlist;
  40. CWMPControls m_control;
  41. bool m_bMax;//窗口最大化标志
  42. CRect m_savedWndRect;//上一次的窗口矩形
  43. bool m_bInit;//OnInitDialog是否执行结束
  44. bool m_bTimer;//计时器是否在执行
  45. HMONITOR m_hMonitor;//音视频播放所在的屏幕的句柄
  46. CRect m_monitorRect;//音视频播放所在的屏幕的矩形
  47. int m_nPlayCnt; // 已重复播放次数(多个文件顺序播完一次算重复播一次)
  48. int m_nMediaInx; // 当前媒体序号
  49. CWmpPlayConfig *m_pConfig;
  50. player_callback_t m_callback;
  51. private:
  52. BOOL EndPlay();
  53. void PlayerLog(eplayer_loglevel elvel, const char* fmt, ...);
  54. void PlayerLogEvent(eplayer_monitor_error errortype, const char* errmsg);
  55. protected:
  56. virtual BOOL OnInitDialog();
  57. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
  58. DECLARE_EVENTSINK_MAP()
  59. public:
  60. void PlayStateChangeOcx1(long NewState);
  61. DECLARE_MESSAGE_MAP()
  62. protected:
  63. afx_msg LRESULT OnSetVolumeMessage(WPARAM wParam, LPARAM lParam);
  64. public:
  65. afx_msg void OnClose();
  66. afx_msg void OnSize(UINT nType, int cx, int cy);
  67. afx_msg void OnNcLButtonDblClk(UINT nHitTest, CPoint point);
  68. afx_msg LRESULT OnNcHitTest(CPoint point);
  69. afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
  70. afx_msg void OnTimer(UINT_PTR nIDEvent);
  71. afx_msg BOOL OnEraseBkgnd(CDC* pDC);
  72. };