public static extern int H264_DVR_PlayBackByTimeEx(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, fRealDataCallBack fDownLoadDataCallBack, int dwDataUser, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser);
public static extern int H264_DVR_FindFile(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, IntPtr ptr, int lMaxCount, out int findcount, int waittime);
public static extern int H264_DVR_GetFileByTime(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, string sSavedFileDIR, bool bMerge, fDownLoadPosCallBack cbDownLoadPos, int dwDataUser);
public static extern int H264_DVR_PlayBackByTimeEx(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo,fRealDataCallBack fDownLoadDataCallBack, int dwDataUser, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser);
public static extern int H264_DVR_GetFileByTime(int lLoginID, ref H264_DVR_FINDINFO lpFindInfo, string sSavedFileDIR, bool bMerge, fDownLoadPosCallBack cbDownLoadPos , int dwDataUser );
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); }