Example #1
0
void CVideoOutDlg::OnOK() 
{
	// TODO: Add extra validation here

	UpdateData(TRUE);

	int nResolutionIndex = m_ctlResolution.GetCurSel();
	if (nResolutionIndex < 0)
	{
		return;
	}

	if (m_hCurLoginID != 0)
	{
		BYTE rsOIdx = 0;
		GetOrigIndex(&rsOIdx, nResolutionIndex, m_stVideoOut.dwImageSizeMask);
		m_stVideoOut.nImageSize = rsOIdx;
		
		BOOL bRet = CLIENT_SetDevConfig(m_hCurLoginID, DH_DEV_VIDEOOUT_CFG, 0, &m_stVideoOut, sizeof(DEV_VIDEOOUT_INFO), 1000);
		if (!bRet ) 
		{
			MessageBox(ConvertString("Fail to set configuration"), ConvertString("Prompt"));		
		}
	}
	
	CDialog::OnOK();
}
Example #2
0
void CConfigChannel::OnApply() 
{
	if (!m_bInited || m_chnIdx < 0)
	{
		return;
	}

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

	int osdIdx = m_osdsel.GetCurSel();
	if (osdIdx < 0)
	{
		return;
	}

	GetDlgItemText(IDC_EDIT_CHANNAME, m_chnCFG[m_chnIdx].szChannelName, CHANNEL_NAME_LEN+1);
	BYTE rsOIdx, ecOIdx;
	GetOrigIndex(&rsOIdx, m_resolutionsel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwImageSizeMask);
	GetOrigIndex(&ecOIdx, m_encodetypesel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwEncodeModeMask);
	if (strmIdx < 3) //main stream - for record
	{
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byEncodeMode= ecOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageSize= rsOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}
	else if (strmIdx < 6) //assistant - for net-transfor
	{
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byEncodeMode= m_encodetypesel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageSize= m_resolutionsel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}
	m_chnCFG[m_chnIdx].stColorCfg[0].byBrightness = GetDlgItemInt(IDC_EDIT_BRIGHTNESS);
	m_chnCFG[m_chnIdx].stColorCfg[0].bySaturation = GetDlgItemInt(IDC_EDIT_SATURATION);
	m_chnCFG[m_chnIdx].stColorCfg[0].byContrast = GetDlgItemInt(IDC_EDIT_CONTRAST);
	m_chnCFG[m_chnIdx].stColorCfg[0].byHue = GetDlgItemInt(IDC_EDIT_HUE);
	m_chnCFG[m_chnIdx].stColorCfg[0].byGainEn = m_gainchk.GetCheck();
	m_chnCFG[m_chnIdx].stColorCfg[0].byGain = GetDlgItemInt(IDC_EDIT_GAIN);

//	m_chnCFG[1].stChannelOSD.bShow = 1;
//	m_chnCFG[1].stChannelOSD.rgbaFrontground = 0xFFFFFFFF;

	BOOL bRet = CLIENT_SetDevConfig(m_pDev->LoginID, DEV_CHANNELCFG, -1/*all channel*/,
								&m_chnCFG, 16*sizeof(DEV_CHANNEL_CFG), CONFIG_WAITTIME);
	if (!bRet)
	{
		((CNetSDKDemoDlg*)AfxGetMainWnd())->LastError();
		return;
	}
	else
	{
		MessageBox(ConvertString(MSG_CONFIG_SUCCESS), "OK");
	}
}
Example #3
0
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);
	}
}
Example #4
0
void CConfigChannel::OnSelchangeComboChanno() 
{
	if (!m_bInited)
	{
		return;
	}

	int strmIdx,osdIdx;
	//store current config
	if (m_chnIdx < 0)
	{
		goto skipsave;
	}

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

	osdIdx = m_osdsel.GetCurSel();
	if (osdIdx < 0)
	{
		return;
	}

	GetDlgItemText(IDC_EDIT_CHANNAME, m_chnCFG[m_chnIdx].szChannelName, CHANNEL_NAME_LEN+1);
	BYTE rsOIdx, ecOIdx;
	GetOrigIndex(&rsOIdx, m_resolutionsel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwImageSizeMask);
	GetOrigIndex(&ecOIdx, m_encodetypesel.GetCurSel(), m_sysCFG.stDspEncodeCap.dwEncodeModeMask);	
	if (strmIdx < 3) //main stream - for record
	{
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byEncodeMode= ecOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageSize= rsOIdx;
		m_chnCFG[m_chnIdx].stMainVideoEncOpt[strmIdx].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}
	else if (strmIdx < 6) //assistant - for net-transfor
	{
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byVideoEnable= m_videochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byAudioEnable= m_audiochk.GetCheck();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byBitRateControl= m_bitratectrlsel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byFramesPerSec= m_framesel.GetCurSel();
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byEncodeMode= ecOIdx;
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageSize= rsOIdx;
		m_chnCFG[m_chnIdx].stAssiVideoEncOpt[strmIdx-3].byImageQlty= m_imgqualitysel.GetCurSel()+1;
	}
	m_chnCFG[m_chnIdx].stColorCfg[0].byBrightness = GetDlgItemInt(IDC_EDIT_BRIGHTNESS);
	m_chnCFG[m_chnIdx].stColorCfg[0].bySaturation = GetDlgItemInt(IDC_EDIT_SATURATION);
	m_chnCFG[m_chnIdx].stColorCfg[0].byContrast = GetDlgItemInt(IDC_EDIT_CONTRAST);
	m_chnCFG[m_chnIdx].stColorCfg[0].byHue = GetDlgItemInt(IDC_EDIT_HUE);
	m_chnCFG[m_chnIdx].stColorCfg[0].byGainEn = m_gainchk.GetCheck();
	m_chnCFG[m_chnIdx].stColorCfg[0].byGain = GetDlgItemInt(IDC_EDIT_GAIN);

	//show new config
skipsave:
	int chnIdx = m_channelsel.GetCurSel();
	if (chnIdx < 0)
	{
		return;
	}
	m_chnIdx = chnIdx;

	char tmpName[CHANNEL_NAME_LEN+1] = {0};
	memcpy(tmpName, m_chnCFG[chnIdx].szChannelName, CHANNEL_NAME_LEN);
	SetDlgItemText(IDC_EDIT_CHANNAME, tmpName);
	
	SetDlgItemInt(IDC_EDIT_BRIGHTNESS, m_chnCFG[chnIdx].stColorCfg[0].byBrightness);
	SetDlgItemInt(IDC_EDIT_SATURATION, m_chnCFG[chnIdx].stColorCfg[0].bySaturation);
	SetDlgItemInt(IDC_EDIT_CONTRAST, m_chnCFG[chnIdx].stColorCfg[0].byContrast);
	SetDlgItemInt(IDC_EDIT_HUE, m_chnCFG[chnIdx].stColorCfg[0].byHue);
	SetDlgItemInt(IDC_EDIT_GAIN, m_chnCFG[chnIdx].stColorCfg[0].byGain);
	m_gainchk.SetCheck(m_chnCFG[chnIdx].stColorCfg[0].byGainEn?1:0);

//	SetDlgItemInt(IDC_EDIT_MONADDR, m_chnCFG[chnIdx].dwMonitorAddr);

	//refresh every area
	if (m_streamsel.GetCount())
	{
		m_streamsel.SetCurSel(0);
	}
	m_strmIdx = -1; //prevent from unwanted saving
	OnSelchangeComboStream();
	
	if (m_osdsel.GetCount() > 0)
	{
		m_osdsel.SetCurSel(0);
	}
	m_osdIdx = -1; //prevent from unwanted saving
	OnSelchangeComboOsd();
}