private void PlayByName() { if (m_nNetPlayHandle >= 0) { timerNetPlayBack.Enabled = false; XMSDK.H264_DVR_StopPlayBack(m_nNetPlayHandle); m_nNetPlayHandle = 0; trackBarNetPlayPos.Value = 0; m_bOpenAudio = false; m_bPauseNetPlay = false; } m_nFastTypeNet = 0; m_nSlowTypeNet = 0; if (m_nNetPlayHandle == 0) { string csFileName = ""; int nSelected = listFile.SelectedItems.Count; if (nSelected == 0) { MessageBox.Show("SelectFile"); return; } H264_DVR_FILE_DATA FileInfo = (H264_DVR_FILE_DATA)listFile.FocusedItem.Tag; FileInfo.hWnd = (IntPtr)pictureBoxNetVideoWnd.Handle; XMSDK.fDownLoadPosCallBack downloadCallBack = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack_V2 netdatacallbackv2 = new XMSDK.fRealDataCallBack_V2(NetCallBack_V2); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByName_V2(m_lLoginID, ref FileInfo, downloadCallBack, netdatacallbackv2, this.Handle.ToInt32()); if (m_nNetPlayHandle <= 0) { MessageBox.Show("Playback fail"); return; } timerNetPlayBack.Start(); } else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0); //暂停恢复正常 m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); //快慢放恢复正常 m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } }
private void PlayByTime() { m_nFastTypeNet = 0; m_nSlowTypeNet = 0; if (m_nNetPlayHandle == 0) { H264_DVR_FINDINFO info = new H264_DVR_FINDINFO(); info.nChannelN0 = comboChannel.SelectedIndex; //channel No. info.nFileType = comboRecordType.SelectedIndex; //file type info.startTime.dwYear = beginDate.Value.Year; info.startTime.dwMonth = beginDate.Value.Month; info.startTime.dwDay = beginDate.Value.Day; info.startTime.dwHour = beginTime.Value.Hour; info.startTime.dwMinute = beginTime.Value.Minute; info.startTime.dwSecond = beginTime.Value.Second; info.endTime.dwYear = endDate.Value.Year; info.endTime.dwMonth = endDate.Value.Month; info.endTime.dwDay = endDate.Value.Day; info.endTime.dwHour = endTime.Value.Hour; info.endTime.dwMinute = endTime.Value.Minute; info.endTime.dwSecond = endTime.Value.Second; info.hWnd = (uint)pictureBoxNetVideoWnd.Handle; XMSDK.fDownLoadPosCallBack DownloadCallback = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack realDataCallBack = new XMSDK.fRealDataCallBack(RealDataCallBack); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByTimeEx(m_lLoginID, ref info, null, this.Handle.ToInt32(), null, this.Handle.ToInt32()); if (m_nNetPlayHandle <= 0) { MessageBox.Show("Playback fail"); m_nNetPlayHandle = 0; return; } timerNetPlayBack.Start(); } else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0); m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } }
private void PlayByTime() { m_nFastTypeNet = 0; m_nSlowTypeNet = 0; if(m_nNetPlayHandle == 0) { H264_DVR_FINDINFO info = new H264_DVR_FINDINFO(); info.nChannelN0 = comboChannel.SelectedIndex; //channel No. info.nFileType = comboRecordType.SelectedIndex; //file type info.startTime.dwYear = beginDate.Value.Year; info.startTime.dwMonth = beginDate.Value.Month; info.startTime.dwDay = beginDate.Value.Day; info.startTime.dwHour = beginTime.Value.Hour; info.startTime.dwMinute = beginTime.Value.Minute; info.startTime.dwSecond = beginTime.Value.Second; info.endTime.dwYear = endDate.Value.Year; info.endTime.dwMonth = endDate.Value.Month; info.endTime.dwDay = endDate.Value.Day; info.endTime.dwHour = endTime.Value.Hour; info.endTime.dwMinute = endTime.Value.Minute; info.endTime.dwSecond = endTime.Value.Second; info.hWnd = (uint)pictureBoxNetVideoWnd.Handle; XMSDK.fDownLoadPosCallBack DownloadCallback = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack realDataCallBack = new XMSDK.fRealDataCallBack(RealDataCallBack); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByTimeEx(m_lLoginID, ref info, null, this.Handle.ToInt32(), null, this.Handle.ToInt32()); if (m_nNetPlayHandle <= 0) { MessageBox.Show("Playback fail"); m_nNetPlayHandle = 0; return; } timerNetPlayBack.Start(); } else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0 ); m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } }
private void PlayByName() { m_nFastTypeNet = 0; m_nSlowTypeNet = 0; if(m_nNetPlayHandle == 0) { string csFileName = ""; int nSelected = listFile.SelectedItems.Count; if ( nSelected == 0 ) { MessageBox.Show("SelectFile"); return; } H264_DVR_FILE_DATA FileInfo = (H264_DVR_FILE_DATA)listFile.FocusedItem.Tag; FileInfo.hWnd = (uint)pictureBoxNetVideoWnd.Handle; XMSDK.fDownLoadPosCallBack downloadCallBack = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack_V2 netdatacallbackv2 = new XMSDK.fRealDataCallBack_V2(NetCallBack_V2); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByName_V2(m_lLoginID, ref FileInfo, downloadCallBack, netdatacallbackv2, this.Handle.ToInt32()); if(m_nNetPlayHandle <= 0 ) { MessageBox.Show("Playback fail"); return; } timerNetPlayBack.Start(); } else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0 );//暂停恢复正常 m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); //快慢放恢复正常 m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } }
public bool play(GateRecord gateRecord) { //if device did not login,login first if (this.monitor != null && this.monitor.nvrDevice!=null&&this.monitor.nvrDevice.userID <= 0) { bool loginSuccess = this.login(); if (!loginSuccess) { return false; } } if (m_nNetPlayHandle == 0) { H264_DVR_FINDINFO info = new H264_DVR_FINDINFO(); //test by dyl info.nChannelN0 = monitor.channel; //channel No. info.nFileType = 0; //file type DateTime nvr_begintime=gateRecord.nvr_begintime; //DateTime nvr_begintime = DateTime.Parse("2014-12-30 21:30:00"); info.startTime.dwYear = nvr_begintime.Year; info.startTime.dwMonth = nvr_begintime.Month; info.startTime.dwDay = nvr_begintime.Day; info.startTime.dwHour = nvr_begintime.Hour; info.startTime.dwMinute = nvr_begintime.Minute; info.startTime.dwSecond = nvr_begintime.Second; DateTime nvr_endtime = gateRecord.nvr_endtime; //DateTime nvr_endtime = DateTime.Parse("2014-12-30 22:30:00"); info.endTime.dwYear = nvr_endtime.Year; info.endTime.dwMonth = nvr_endtime.Month; info.endTime.dwDay = nvr_endtime.Day; info.endTime.dwHour = nvr_endtime.Hour; info.endTime.dwMinute = nvr_endtime.Minute; info.endTime.dwSecond = nvr_endtime.Second; info.hWnd = (uint)this.pictureBox.Handle; XMSDK.fDownLoadPosCallBack DownloadCallback = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack realDataCallBack = new XMSDK.fRealDataCallBack(RealDataCallBack); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByTimeEx(monitor.nvrDevice.userID, ref info, null, this.pictureBox.Handle.ToInt32(), null, this.pictureBox.Handle.ToInt32()); if (m_nNetPlayHandle <= 0) { int iLastErr = XMSDK.H264_DVR_GetLastError(); string str = "H264_DVR_PlayBackByTimeEx failed, 错误号= " + iLastErr + "!播放失败!"; //播放失败 MessageBox.Show(str); m_nNetPlayHandle = 0; return false; } }else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0); m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } return true; }
public bool play(GateRecord gateRecord) { //if device did not login,login first if (this.monitor != null && this.monitor.nvrDevice != null && this.monitor.nvrDevice.userID <= 0) { bool loginSuccess = this.login(); if (!loginSuccess) { return(false); } } if (m_nNetPlayHandle == 0) { H264_DVR_FINDINFO info = new H264_DVR_FINDINFO(); //test by dyl info.nChannelN0 = monitor.channel; //channel No. info.nFileType = 0; //file type DateTime nvr_begintime = gateRecord.nvr_begintime; //DateTime nvr_begintime = DateTime.Parse("2014-12-30 21:30:00"); info.startTime.dwYear = nvr_begintime.Year; info.startTime.dwMonth = nvr_begintime.Month; info.startTime.dwDay = nvr_begintime.Day; info.startTime.dwHour = nvr_begintime.Hour; info.startTime.dwMinute = nvr_begintime.Minute; info.startTime.dwSecond = nvr_begintime.Second; DateTime nvr_endtime = gateRecord.nvr_endtime; //DateTime nvr_endtime = DateTime.Parse("2014-12-30 22:30:00"); info.endTime.dwYear = nvr_endtime.Year; info.endTime.dwMonth = nvr_endtime.Month; info.endTime.dwDay = nvr_endtime.Day; info.endTime.dwHour = nvr_endtime.Hour; info.endTime.dwMinute = nvr_endtime.Minute; info.endTime.dwSecond = nvr_endtime.Second; info.hWnd = (uint)this.pictureBox.Handle; XMSDK.fDownLoadPosCallBack DownloadCallback = new XMSDK.fDownLoadPosCallBack(DownLoadPosCallback); XMSDK.fRealDataCallBack realDataCallBack = new XMSDK.fRealDataCallBack(RealDataCallBack); m_nNetPlayHandle = XMSDK.H264_DVR_PlayBackByTimeEx(monitor.nvrDevice.userID, ref info, null, this.pictureBox.Handle.ToInt32(), null, this.pictureBox.Handle.ToInt32()); if (m_nNetPlayHandle <= 0) { int iLastErr = XMSDK.H264_DVR_GetLastError(); string str = "H264_DVR_PlayBackByTimeEx failed, 错误号= " + iLastErr + "!播放失败!"; //播放失败 MessageBox.Show(str); m_nNetPlayHandle = 0; return(false); } } else { if (m_bPauseNetPlay) { XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_CONTINUE, 0); m_bPauseNetPlay = !m_bPauseNetPlay; } XMSDK.H264_DVR_PlayBackControl(m_nNetPlayHandle, (int)PlayBackAction.SDK_PLAY_BACK_FAST, 0); m_nFastTypeNet = 0; m_nSlowTypeNet = 0; } return(true); }