📄 clientdemodlg.cpp
字号:
}
default:
{
break;
}
}
// MessageBox(ctemp);
}
void CClientdemoDlg::OnDestroy()
{
OnButton12();
if (nn1 >= 0)
{
MP4_ClientStopCapture(nn1);
// ClientStopPlay(nn5);
MP4_ClientStop(nn1);
}
if (nn2 >= 0)
{
MP4_ClientStopCapture(nn2);
// ClientStopPlay(nn5);
MP4_ClientStop(nn2);
}
if (nn3 >= 0)
{
MP4_ClientStopCapture(nn3);
// ClientStopPlay(nn5);
MP4_ClientStop(nn3);
}
if (nn4 >= 0)
{
MP4_ClientStopCapture(nn4);
// ClientStopPlay(nn5);
MP4_ClientStop(nn4);
}
MP4_ClientReleaseDDraw_Card();
MP4_ClientReleaseDevice_Card();
MP4_ClientCleanup();
CDialog::OnDestroy();
}
void CClientdemoDlg::OnButton5()
{
char ctemp[256];
UpdateData(TRUE);
sprintf(ctemp,"%s",m_ipadd);
MP4_ClientShut((LPCTSTR)ctemp,0);
}
//close sound
void CClientdemoDlg::OnButton7()
{
MP4_ClientAudioStop();
if (m_ifusecard[0])
{
if (nn1 >= 0)
{
MP4_ClientAudioStop_Card(nn1);
}
}
if (m_ifusecard[1])
{
if (nn2 >= 0)
{
MP4_ClientAudioStop_Card(nn2);
}
}
if (m_ifusecard[2])
{
if (nn3 >= 0)
{
MP4_ClientAudioStop_Card(nn3);
}
}
if (m_ifusecard[3])
{
if (nn4 >= 0)
{
MP4_ClientAudioStop_Card(nn4);
}
}
}
void CClientdemoDlg::OnDbStatic1()
{
DISPLAY_PARA pPara;
CRect recttemp;
int iresult;
if (blarged)
{
ScreenToClient((LPPOINT)&orirc);
ScreenToClient((LPPOINT)&orirc+1);
m_video5.MoveWindow(orirc,TRUE);
m_video6.ShowWindow(SW_SHOW);
m_video7.ShowWindow(SW_SHOW);
m_video8.ShowWindow(SW_SHOW);
if ((nn1>=0) && (m_ifusecard[0]))
{
pPara.nLeft = orirc.left;
pPara.nTop = orirc.top;
pPara.nWidth = orirc.Width();
pPara.nHeight = orirc.Height();
pPara.bToScreen = 1;
pPara.bToVideoOut = 1;
pPara.nReserved = 0;
MP4_ClientResetPara_Card(nn1,&pPara);
}
if ((nn2>=0) && (m_ifusecard[1]))
{
m_video6.GetWindowRect(&recttemp);
ScreenToClient((LPPOINT)&recttemp);
ScreenToClient((LPPOINT)&recttemp+1);
pPara.nLeft = recttemp.left;
pPara.nTop = recttemp.top;
pPara.nWidth = recttemp.Width();
pPara.nHeight = recttemp.Height();
pPara.bToScreen = 1;
pPara.bToVideoOut = 1;
pPara.nReserved = 0;
iresult = MP4_ClientResetPara_Card(nn2,&pPara);
}
if ((nn3>=0) && (m_ifusecard[2]))
{
m_video7.GetWindowRect(&recttemp);
ScreenToClient((LPPOINT)&recttemp);
ScreenToClient((LPPOINT)&recttemp+1);
pPara.nLeft = recttemp.left;
pPara.nTop = recttemp.top;
pPara.nWidth = recttemp.Width();
pPara.nHeight = recttemp.Height();
pPara.bToScreen = 1;
pPara.bToVideoOut = 1;
pPara.nReserved = 0;
MP4_ClientResetPara_Card(nn3,&pPara);
}
if ((nn4>=0) && (m_ifusecard[3]))
{
m_video8.GetWindowRect(&recttemp);
ScreenToClient((LPPOINT)&recttemp);
ScreenToClient((LPPOINT)&recttemp+1);
pPara.nLeft = recttemp.left;
pPara.nTop = recttemp.top;
pPara.nWidth = recttemp.Width();
pPara.nHeight = recttemp.Height();
pPara.bToScreen = 1;
pPara.bToVideoOut = 1;
pPara.nReserved = 0;
MP4_ClientResetPara_Card(nn4,&pPara);
}
blarged = FALSE;
}
else
{
m_video6.ShowWindow(SW_HIDE);
m_video7.ShowWindow(SW_HIDE);
m_video8.ShowWindow(SW_HIDE);
m_video5.GetWindowRect(&orirc);
m_video5.MoveWindow(10,10,(int)(352*1.6),(int)(288*1.6),TRUE);
if ((nn4>=0) && (m_ifusecard[3]))
{
pPara.bToScreen = 0;
MP4_ClientResetPara_Card(nn4,&pPara);
}
if ((nn3>=0) && (m_ifusecard[2]))
{
pPara.bToScreen = 0;
MP4_ClientResetPara_Card(nn3,&pPara);
}
if ((nn2>=0) && (m_ifusecard[1]))
{
pPara.bToScreen = 0;
MP4_ClientResetPara_Card(nn2,&pPara);
}
if ((nn1>=0) && (m_ifusecard[0]))
{
pPara.nLeft = 10;
pPara.nTop = 10;
pPara.nWidth = (int)(352*1.6);
pPara.nHeight = (int)(288*1.6);
pPara.bToScreen = 1;
pPara.bToVideoOut = 1;
pPara.nReserved = 0;
MP4_ClientResetPara_Card(nn1,&pPara);
}
blarged = TRUE;
}
MP4_ClientClearSurface_Card();
}
void CClientdemoDlg::OnDbStatic2()
{
if (nn2 >=0 )
{
MP4_ClientAudioStart(nn2);
MP4_ClientAudioVolume(0xfff0);
}
}
void CClientdemoDlg::OnDbStatic3()
{
if (nn3 >=0 )
{
MP4_ClientAudioStart(nn3);
MP4_ClientAudioVolume(0xfff0);
}
}
void CClientdemoDlg::OnDbStatic4()
{
if (nn4 >=0 )
{
MP4_ClientAudioStart(nn4);
MP4_ClientAudioVolume(0xfff0);
}
}
BOOL CClientdemoDlg::DestroyWindow()
{
return CDialog::DestroyWindow();
}
void CClientdemoDlg::OnButton8()
{
char filename[256];
CWnd* pButton1;
if (nn1 >= 0)
{
sprintf(filename,"d:\\mp4test1_%d.mp4",capcount);
MP4_ClientStartCaptureFile(nn1,filename);
}
if (nn2 >= 0)
{
sprintf(filename,"d:\\mp4test2_%d.mp4",capcount);
MP4_ClientStartCaptureFile(nn2,filename);
}
if (nn3 >= 0)
{
sprintf(filename,"d:\\mp4test3_%d.mp4",capcount);
MP4_ClientStartCaptureFile(nn3,filename);
}
if (nn4 >= 0)
{
sprintf(filename,"d:\\mp4test4_%d.mp4",capcount);
MP4_ClientStartCaptureFile(nn4,filename);
}
capcount++;
pButton1 = (CButton*)GetDlgItem(IDC_BUTTON4);
pButton1->EnableWindow(TRUE);
pButton1 = (CButton*)GetDlgItem(IDC_BUTTON8);
pButton1->EnableWindow(FALSE);
//
}
void CClientdemoDlg::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
//
// char cpos;
// cpos = (char)(m_playtryl.GetPos());
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
}
HBRUSH CClientdemoDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Return a different brush if the default is not desired
// if (bmode)
{
CWnd*pSubWnd1=GetDlgItem(IDC_STATIC5);
CWnd*pSubWnd2=GetDlgItem(IDC_STATIC6);
CWnd*pSubWnd3=GetDlgItem(IDC_STATIC7);
CWnd*pSubWnd4=GetDlgItem(IDC_STATIC8);
if((pWnd->m_hWnd==pSubWnd1->m_hWnd) && (m_ifusecard[0]))
{
HBRUSH hBrush=::CreateSolidBrush(COLORREF(0xff00ff));
return hBrush;
}
if((pWnd->m_hWnd==pSubWnd2->m_hWnd) && (m_ifusecard[1]))
{
HBRUSH hBrush=::CreateSolidBrush(COLORREF(0xff00ff));
return hBrush;
}
if((pWnd->m_hWnd==pSubWnd3->m_hWnd) && (m_ifusecard[2]))
{
HBRUSH hBrush=::CreateSolidBrush(COLORREF(0xff00ff));
return hBrush;
}
if((pWnd->m_hWnd==pSubWnd4->m_hWnd) && (m_ifusecard[3]))
{
HBRUSH hBrush=::CreateSolidBrush(COLORREF(0xff00ff));
return hBrush;
}
}
return hbr;
}
void CClientdemoDlg::OnButton9()
{
if (nn1>=0)
MP4_ClientAudioStart_Card(nn1);
}
void CClientdemoDlg::OnShowmode2()
{
bmode = TRUE;
GetDlgItem(IDC_STATIC5)->Invalidate(TRUE);
}
void CClientdemoDlg::OnShowmode1()
{
bmode = FALSE;
GetDlgItem(IDC_STATIC5)->Invalidate(TRUE);
}
void CClientdemoDlg::OnButton10()
{
// g_bCapPic = TRUE;
if (m_ifusecard[0])
{
if (nn1 >= 0)
{
MP4_ClientCapPicFile_Card(nn1,"c:\\test1.bmp");
return;
}
}
if (m_ifusecard[1])
{
if (nn2 >= 0)
{
MP4_ClientCapPicFile_Card(nn2,"c:\\test2.bmp");
return;
}
}
if (m_ifusecard[2])
{
if (nn3 >= 0)
{
MP4_ClientCapPicFile_Card(nn3,"c:\\test3.bmp");
return;
}
}
if (m_ifusecard[3])
{
if (nn4 >= 0)
{
MP4_ClientCapPicFile_Card(nn4,"c:\\test4.bmp");
return;
}
}
}
void CClientdemoDlg::OnRadiobfram0()
{
if (nn1>=0)
{
// MP4_ClientThrowBFrame(nn1,0);
}
if (nn2>=0)
{
// MP4_ClientThrowBFrame(nn2,0);
}
if (nn3>=0)
{
// MP4_ClientThrowBFrame(nn3,0);
}
if (nn4>=0)
{
// MP4_ClientThrowBFrame(nn4,0);
}
}
void CClientdemoDlg::OnRadiobfram1()
{
if (nn1>=0)
{
// MP4_ClientThrowBFrame(nn1,1);
}
if (nn2>=0)
{
// MP4_ClientThrowBFrame(nn2,1);
}
if (nn3>=0)
{
// MP4_ClientThrowBFrame(nn3,1);
}
if (nn4>=0)
{
// MP4_ClientThrowBFrame(nn4,1);
}
}
void CClientdemoDlg::OnRadiobfram2()
{
if (nn1>=0)
{
// MP4_ClientThrowBFrame(nn1,2);
}
if (nn2>=0)
{
// MP4_ClientThrowBFrame(nn2,2);
}
if (nn3>=0)
{
// MP4_ClientThrowBFrame(nn3,2);
}
if (nn4>=0)
{
// MP4_ClientThrowBFrame(nn4,2);
}
}
void CClientdemoDlg::OnMove(int x, int y)
{
CDialog::OnMove(x, y);
MP4_ClientRefreshSurface_Card();
}
void CClientdemoDlg::OnButton11()
{
// TODO: Add your control notification handler code here
// TODO: Add your control notification handler code here
REGION_PARAM param[MAX_DISPLAY_REGION];
memset(param,0,sizeof(param));
//每个区域设置不同的背景色
for(int i=0;i<MAX_DISPLAY_REGION;i++)
param[i].color=RGB(i*8+128,i*16,i*24);
/*
得到所有的解码通道.
在此之前,须执行初始化函数。
原H、HC卡SDK中的InitDSPs()和解码卡SDK中的HW_InitDecDevice()都可以初始化系统中所有的板卡,
可任意使用。
*/
int decodeChannelCount=GetDecodeChannelCount();
/*
得到所有的显示通道(视频输出通道).
*/
int displayChannelCount=GetDisplayChannelCount();
TRACE("decodeChannelCount=%d,,displayChannelCount=%d \n ",decodeChannelCount,displayChannelCount);
if(decodeChannelCount<4||displayChannelCount<2)
return;
/*
对视频输出通道划分窗口,这里按PAL制式设置
第1个显示通道,划分为4个CIF窗口。
第2个显示通道,划分为1个4CIF窗口。
*/
param[0].left=0; param[0].top=0; param[0].width=352; param[0].height=288;
param[1].left=352; param[1].top=0; param[1].width=352; param[1].height=288;
param[2].left=0; param[2].top=288; param[2].width=352; param[2].height=288;
param[3].left=352; param[3].top=288; param[3].width=352; param[3].height=288;
SetDisplayRegion(0,4,param,0);
param[0].left=0; param[0].top=0; param[0].width=704; param[0].height=576;
SetDisplayRegion(1,1,param,0);
/*
设置解码器的视频模拟输出。
由于是在1块MD卡内部输出,没有输出到其它MD卡来构成视频矩阵,
所以这里使用SetDecoderVideoOutput和SetDecoderVideoExtOutput都可以。
*/
SetDecoderVideoOutput(0/*解码通道*/,0/*该解码通道的第0路输出*/,
1/*打开*/,0/*输出到第0路视频显示通道*/,0/*输出到该显示通道的第0个区域*/,0/*备用*/);
SetDecoderVideoOutput(1,0,1,0,1,0);
SetDecoderVideoOutput(2,0,1,0,2,0);
/*
将最后一个解码器的图像,同时分两路输出,1路输出到4分割窗口,另一路输出到全屏窗口。
*/
SetDecoderVideoOutput(3,0,1,0,3,0);
SetDecoderVideoOutput(3,1,1,1,0,0);
}
void CClientdemoDlg::OnButton12()
{
// TODO: Add your control notification handler code here
//stop video output
SetDecoderVideoOutput(0,0,0,0,1,0);
SetDecoderVideoOutput(1,0,0,0,1,0);
SetDecoderVideoOutput(2,0,0,0,1,0);
SetDecoderVideoOutput(3,0,0,0,1,0);
SetDecoderVideoOutput(3,1,0,1,0,0);
ClearDisplayRegion(0,255);
ClearDisplayRegion(1,255);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -