
// LT_UVC_MFCDlg.h : 头文件
//

#pragma once
#include "VideoView.h"
#include "resource.h"
#include "afxwin.h"
// CLT_UVC_MFCDlg 对话框
class CLT_UVC_MFCDlg : public CDialogEx
{
// 构造
public:
	int m_hVideoDSP[MAX_VIDEO_CHANNEL];
	int m_hAudioDSP[MAX_VIDEO_CHANNEL];
	int m_Current;
	BOOL m_bOne;
	CRect	m_r64Vid[8][8];
	CRect	m_r36Vid[6][6];
	CRect	m_rSixteenVid[4][4];
	CRect	m_rNineVid[3][3];
	CRect	m_r4Vid[2][2];
	RECT m_Onerect;
	int m_nViewMode;
	CRect   *m_pCurRectArr;
	CVideoView m_Static_View_CH[MAX_VIDEO_CHANNEL];
	RECT m_rect[MAX_VIDEO_CHANNEL];

	HANDLE  m_hKillEvent;
	HANDLE  m_hExitEvent;
	int     m_hExitCnt;
	HANDLE  m_hEvent[1];
	HANDLE	m_hThread;
	BOOL    m_ExitThread;
	//-----------------
	void InitVideoSys();
	void ExitVideoSys();
	void InitRect();
	void Set9CHPreView() ;
	void Set4CHPreView() ;
	void Set16CHPreView();
	void Set64CHPreView();
	void ShowHideScreen(int nBegin, int nNum);
	void  Set_Default_Config_Setting(void);
	void IniNormalRect();
	void StreamCallback(ULONG i,void *DataBuf,int FrameType,int width,int height);
	void AudioCallback(ULONG i,void *DataBuf,int FrameType,int size);
	void SysVideoStautsCallback(ULONG i,int FrameType);
	int m_CurrSelResIndex[MAX_VIDEO_CHANNEL];
	int  m_InitDone;
	CLT_UVC_MFCDlg(CWnd* pParent = NULL);	// 标准构造函数
	void Show_Result();
	void OpenVideo(int index);
	void CloseVideo(int index);
	void GetVideoDeviceInfo();
	int OpenAudio(int index);
	void CloseAudio(int index);
	void  CreateVideoTestThread();
	void KillVideoTestThread();
	void DealWithTestEvent();
	void ReOpenSys(int index);
// 对话框数据
	enum { IDD = IDD_LT_UVC_MFC_DIALOG };

	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV 支持


// 实现
protected:
	HICON m_hIcon;

	// 生成的消息映射函数
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	DECLARE_MESSAGE_MAP()
public:
	afx_msg void OnBnClickedClosesys();
	afx_msg void OnBnClickedCloseVideo();
	afx_msg LRESULT OnMsgViewDbClick(WPARAM wParam, LPARAM lParam);
	afx_msg LRESULT OnMsgViewClick(WPARAM wParam, LPARAM lParam);
	afx_msg void OnBnClickedAddSrc3();
	CEdit m_CurrInex_Edit;
	afx_msg void OnBnClickedSetColor();
	afx_msg void OnBnClickedSetColorM();
	afx_msg void OnBnClickedAddSrc2();
	CComboBox m_com_res_list;
	afx_msg void OnBnClickedReopen();
	afx_msg void OnCbnSelchangeReslist();
	void OnSet(int index);
	void OpenSys();
	afx_msg void OnBnClickedVideoOpen();
	afx_msg void OnBnClickedAutoOpen();
	CButton m_ThreadTestBu_ST;
	CButton m_ThreadTestBu_Close;
};
