Exemple #1
0
BOOL CVideoOutDlg::OnInitDialog() 
{
	CDialog::OnInitDialog();

	g_SetWndStaticText(this);
	
	// TODO: Add extra initialization here

	while(m_ctlResolution.GetCount() > 0)
	{
		m_ctlResolution.DeleteString(0);
	}


	BOOL bRet = FALSE;
	DWORD retlen = 0;
	memset(&m_stVideoOut, 0, sizeof(DEV_VIDEOOUT_INFO));
	if (m_hCurLoginID != 0)
	{
		bRet = CLIENT_GetDevConfig(m_hCurLoginID, DH_DEV_VIDEOOUT_CFG, 0, &m_stVideoOut, sizeof(DEV_VIDEOOUT_INFO), &retlen, 1000);
		if (!bRet || retlen != sizeof(DEV_VIDEOOUT_INFO)) 
		{
			MessageBox(ConvertString("Fail to get configuration"), ConvertString("Prompt"));
			return 0;
		}

		char *rsName[20] = {"D1", "HD1", "BCIF", "CIF", "QCIF", "VGA", "QVGA", "SVCD","QQVGA", "SVGA", "XVGA",
							"WXGA", "SXGA", "WSXGA", "UXGA", "WUXGA", "LTF", "720P", "1080P", "1.3M"};
		int rsIdx = 0;
		for (int i = 0; i < 20; i++)
		{
			if (m_stVideoOut.dwImageSizeMask & (0x01<<i))
			{
				m_ctlResolution.InsertString(rsIdx, ConvertString(rsName[i]));
				rsIdx++;
			}
		}
		BYTE byrsIdx = 0;
		GetMaskedIndex(&byrsIdx, m_stVideoOut.nImageSize, m_stVideoOut.dwImageSizeMask);		
		m_ctlResolution.SetCurSel(byrsIdx);
	}
		
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
void CConfigChannel::OnSelchangeComboStream() 
{
	if (!m_bInited || m_chnIdx < 0)
	{
		return;
	}

	if (m_strmIdx < 0)
	{
		goto skipsave;
	}
	//store current config
	BYTE rsOIdx, ecOIdx;
	GetOrigIndex(&rsOIdx, m_resolutionsel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwImageSizeMask);
	GetOrigIndex(&ecOIdx, m_encodetypesel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwEncodeModeMask);
	if (m_strmIdx < 3 && m_strmIdx >= 0) //main stream - for record
	{
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byEncodeMode= ecOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byImageSize= rsOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[m_strmIdx].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}
	else if (m_strmIdx < 6) //assistant - for net-transfor
	{
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byEncodeMode= ecOIdx;
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byImageSize= rsOIdx;
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[m_strmIdx-3].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}

	//show new config
skipsave:

	int strmIdx = m_streamsel.GetCurSel();
	if (strmIdx < 0)
	{
		return;
	}
	m_strmIdx = strmIdx;

	//get masked resolution and encodetype indexs
	BYTE rsIdx, ecIdx;
	GetMaskedIndex(&rsIdx, m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageSize, m_sysCFG.stDspEncodeCap.dwImageSizeMask);	
	GetMaskedIndex(&ecIdx, m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byEncodeMode ,m_sysCFG.stDspEncodeCap.dwEncodeModeMask);

	if (strmIdx < 3) //main stream - for record
	{
		m_videochk.SetCheck(m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byVideoEnable);
		m_audiochk.SetCheck(m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byAudioEnable);
		m_bitratectrlsel.SetCurSel(m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byBitRateControl);
		m_framesel.SetCurSel(m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byFramesPerSec);
		m_encodetypesel.SetCurSel(ecIdx);
		m_resolutionsel.SetCurSel(rsIdx);
		m_imgqualitysel.SetCurSel(m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageQlty-1);
	}
	else if (strmIdx < 6) //assistant - for net-transfor
	{
		m_videochk.SetCheck(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byVideoEnable);
		m_audiochk.SetCheck(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byAudioEnable);
		m_bitratectrlsel.SetCurSel(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byBitRateControl);
		m_framesel.SetCurSel(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byFramesPerSec);
		m_encodetypesel.SetCurSel(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byEncodeMode);
		m_resolutionsel.SetCurSel(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageSize);
		m_imgqualitysel.SetCurSel(m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageQlty-1);
	}
}