/// <summary> /// 设备初始化 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void DeviceInititalize() { m_SnapRevCallBack = new fSnapRevCallBack(SnapRevCallBack); try { //远程抓取监控回调 NETClient.Init(m_DisConnectCallBack, IntPtr.Zero, null); NETClient.SetAutoReconnect(m_ReConnectCallBack, IntPtr.Zero); NETClient.SetSnapRevCallBack(m_SnapRevCallBack, IntPtr.Zero); //下载视频回调 m_DownloadPosCallBack = new fTimeDownLoadPosCallBack(DownLoadPosCallBack); fDownLoadDataCallBack = new fDataCallBack(DataCallBack); } catch (Exception ex) { throw ex; } }
public static extern IntPtr CLIENT_DownloadByTimeEx(IntPtr lLoginID, int nChannelId, int nRecordFileType, ref NET_TIME tmStart, ref NET_TIME tmEnd, string sSavedFileName, fTimeDownLoadPosCallBack cbTimeDownLoadPos, IntPtr dwUserData, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser, IntPtr pReserved);
private static extern int CLIENT_PlayBackByTimeEx(int lLoginID, int nChannelID, ref NET_TIME lpStartTime, ref NET_TIME lpStopTime, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, int dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
private static extern int CLIENT_PlayBackByRecordFileEx(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser,fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser);
public static int NETPlayBackByTimeEx2(int lLoginID, int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser, int nDirection, int nWaittime) { try { int returnValue = 0; NET_IN_PLAY_BACK_BY_TIME_INFO pbTimeInParam = new NET_IN_PLAY_BACK_BY_TIME_INFO(); pbTimeInParam.stStartTime = ToNetTime(tmStart); pbTimeInParam.stStopTime = ToNetTime(tmEnd); pbTimeInParam.hWnd = hWnd; pbTimeInParam.cbDownLoadPos = cbDownLoadPos; pbTimeInParam.dwPosUser = dwPosUser; pbTimeInParam.fDownLoadDataCallBack = fDownLoadDataCallBack; pbTimeInParam.dwDataUser = dwDataUser; pbTimeInParam.nPlayDirection = nDirection; pbTimeInParam.nWaittime = nWaittime; NET_OUT_PLAY_BACK_BY_TIME_INFO pbTimeOutParam = new NET_OUT_PLAY_BACK_BY_TIME_INFO(); returnValue = CLIENT_PlayBackByTimeEx2(lLoginID, nChannelID, ref pbTimeInParam, ref pbTimeOutParam); NETThrowLastError(returnValue); return returnValue; } catch (Exception e) { NETThrowLastError(e); return 0; } }
/// <summary> /// network by time playback /// </summary> /// <param name="lLoginID">Device handle user login</param> /// <param name="nChannelID">channelID</param> /// <param name="tmStart">The video start time</param> /// <param name="tmEnd">Recording end time</param> /// <param name="hWnd">Playback container handler</param> /// <param name="cbDownLoadPos">Progress callback function</param> /// <param name="dwPosUser">User-defined data[progress]</param> /// <param name="cbData">Data callback function</param> /// <param name="dwDataUser">User-defined data[progress]</param> /// <returns>Successful return network playback ID,Failure return 0</returns> public static int NETPlayBackByTime(int lLoginID, int nChannelID, DateTime tmStart, DateTime tmEnd, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser,fDataCallBack cbData,IntPtr dwDataUser) { try { int returnValue = 0; NET_TIME timeStart = ToNetTime(tmStart); NET_TIME timeEnd = ToNetTime(tmEnd); returnValue = CLIENT_PlayBackByTimeEx(lLoginID, nChannelID, ref timeStart, ref timeEnd, hWnd, cbDownLoadPos, dwPosUser,cbData,dwDataUser); NETThrowLastError(returnValue); return returnValue; } catch (Exception e) { NETThrowLastError(e); return 0; } }
/// <summary> ///Callback with data playback video files by extension interface,Each channel at the same time can only play a video,Can't play the same channel multiple records at the same time。Window parameter(hWnd)Effective correction data return values will be ignored,when window parameter(hWnd)is 0,need to pay attention to the callback function return values,See detail the callback function。 /// </summary> /// <param name="lLoginID">CLIENT_Login return value</param> /// <param name="lpRecordFile">Video file information</param> /// <param name="hWnd">Playback handle container</param> /// <param name="cbDownLoadPos">Progress of the callback function</param> /// <param name="dwPosUser">Progress callback function user data</param> /// <param name="fDownLoadDataCallBack">Data callback function</param> /// <param name="dwDataUser">The callback function data user data</param> /// <returns>Successful return to network playback ID,Failure to return0</returns> public static int NETPlayBackByRecordFile(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser) { int returnValue; //returnValue = CLIENT_PlayBackByRecordFileEx(lLoginID, ref lpRecordFile, hWnd, cbDownLoadPos, dwPosUser,fDownLoadDataCallBack,dwDataUser); returnValue = CLIENT_PlayBackByTimeEx(lLoginID, (int)lpRecordFile.ch, ref lpRecordFile.starttime, ref lpRecordFile.endtime, hWnd, cbDownLoadPos, dwPosUser, fDownLoadDataCallBack, dwDataUser); NETThrowLastError(returnValue); return returnValue; }
/// <summary> /// 带数据回调的按录像文件回放扩展接口,每通道同一时间只能播放一则录像,不能同时播放同一通道的多条记录。窗口参数(hWnd)有效时回调数据的返回值将被忽略,窗口参数 (hWnd)为0时,需要注意回调函数的返回值,具体见回调函数说明。 /// </summary> /// <param name="lLoginID">CLIENT_Login的返回值</param> /// <param name="lpRecordFile">录像文件信息</param> /// <param name="hWnd">回放容器句柄</param> /// <param name="cbDownLoadPos">进度回调函数</param> /// <param name="dwPosUser">进度回调函数用户数据</param> /// <param name="fDownLoadDataCallBack">数据回调函数</param> /// <param name="dwDataUser">数据回调函数用户数据</param> /// <returns>成功返回网络回放ID,失败返回0</returns> public static int DHPlayBackByRecordFile(int lLoginID, ref NET_RECORDFILE_INFO lpRecordFile, IntPtr hWnd, fDownLoadPosCallBack cbDownLoadPos, IntPtr dwPosUser, fDataCallBack fDownLoadDataCallBack, IntPtr dwDataUser) { int returnValue; returnValue = CLIENT_PlayBackByRecordFileEx(lLoginID, ref lpRecordFile, hWnd, cbDownLoadPos, dwPosUser,fDownLoadDataCallBack,dwDataUser); DHThrowLastError(returnValue); return returnValue; }