public void GetGUIDTest() { string strGUID = "6157354AA608313136"; string strResult = SDK_SKVideoSDK.GetGUID(strGUID); Assert.AreEqual(strResult, "61-57354AA60831-3136"); }
private void button1_Click(object sender, EventArgs e) { //DateTime timStart = DateTime.Now.AddSeconds(-3000); //DateTime timEnd = DateTime.Now.AddSeconds(-2700); DateTime timStart = DateTime.Parse("2019-09-06 12:33:00"); DateTime timEnd = DateTime.Parse("2019-09-06 12:35:01"); //DateTime timStart = DateTime.Now.AddSeconds(-3000); //DateTime timEnd = DateTime.Now.AddSeconds(-2700); long start_time = ConvertClass.DateTimeToUnixTimestamp(timStart); long stop_time = ConvertClass.DateTimeToUnixTimestamp(timEnd); //long start_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Parse("2019-06-05 17:01:38")); //long stop_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Parse("2019-06-05 17:03:34")); //long start_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Parse("2019-06-05 15:04:13")); //long stop_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Parse("2019-06-05 15:50:03")); //long start_time = 1559802091; //long stop_time = 1559802199; int intCount = 0; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0 && intCount < 10) { Common.Delay_Second(1); intCount++; } //string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest\" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss") + ".H264"; Temp_strName = DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss"); //string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest"; string Temp_strDownPath = Path + "\\" + Temp_strName + "_Temp.h264"; int intResult = SDK_SKVideoSDK.p_sdkc_request_download_video("72-00F51F0150E8-35B7", 0, (int)start_time, (int)stop_time, Temp_strDownPath); intCount = 0; timDownLoadStart = DateTime.Now; }
public void callback(UInt32 msg_id, UInt32 arg1, UInt32 arg2, IntPtr data1, UInt32 data1_len, IntPtr data2, UInt32 data2_len) { st_event st = new st_event(); switch (msg_id) { case 12: { st = (st_event)Marshal.PtrToStructure(data1, typeof(st_event)); string str = Encoding.Default.GetString(st.event_data); string guid = System.Text.Encoding.Default.GetString(st.guid); int i = guid.IndexOf("\0"); if (i > 0) { guid = guid.Substring(0, i); } int Temp_intChannelIndex = str.IndexOf("c:"); if (str.IndexOf("{") < 0 && Temp_intChannelIndex > 0) { //存在 { }代表事件内容 //认为是录像信息进行解析 lRemoteVideoRecord = SDK_SKVideoSDK.SKRemoteVideoRecordDataPrasing(guid, str); } } break; default: break; } }
public void DataPrasingTest() { string strData = "[a:192.168.2.166][g:SuperAdmin_PB][c:08][s(1526886082) e(1526886150)][s(1526886179) e(1526887395)][s(1526887503) e(1526889215)][s(1526889314) e(1526892684)][s(1526892685) e(1526895368)][s(1526895368) e(1526898051)][s(1526898051) e(1526900729)]"; List <RemoteVideoRecordInfo> l = SDK_SKVideoSDK.SKRemoteVideoRecordDataPrasing("61-57354AA60831-3136", strData); Assert.AreEqual(l.Count, 1); }
private void FrmSKVideoSDKTest_Load(object sender, EventArgs e) { CurrentVideoInfo = TestDataSource.TestDataSource.GetSKDVSData3(); p_msg_demo_callback = new CallBack(callback); SDK_SKVideoSDK.p_sdkc_reg_msg_callback(p_msg_demo_callback); SDK_SKVideoSDK.p_sdkc_init_client("Admin", "192.168.2.19", 47624, 47724, 47824, @"d:\"); while (SDK_SKVideoSDK.p_sdkc_get_online() == 0) { Common.Delay_Second(1); } DateTime timStart = DateTime.Now.AddSeconds(-3000); DateTime timEnd = DateTime.Now.AddSeconds(-2700); long intStartTime = ConvertClass.DateTimeToUnixTimestamp(timStart); long intEndTimt = ConvertClass.DateTimeToUnixTimestamp(timEnd); //SDK_SKVideoSDK.p_sdkc_start_playback_av(CurrentVideoInfo.DVSAddress, 0, Convert.ToUInt32(intStartTime), pictureBox1.Handle); p_vsdk_reg_dl_video_data_callback = new p_dl_video_data_callback(callback_download); SDK_SKVideoSDK.p_vsdk_reg_dl_video_data_callback(p_vsdk_reg_dl_video_data_callback); //string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest\" + timStart.ToString("yyyy_MM_dd_HH_mm_ss") + ".H264"; //string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest"; //int intResult = SDK_SKVideoSDK.p_sdkc_request_download_video(CurrentVideoInfo.DVSAddress, 0, (int)intStartTime, (int)intEndTimt, Temp_strDownPath); }
public bool SyncOSDInfo_Download(VideoInfo vInfo) { foreach (CameraInfo cInfo in vInfo.Cameras.Values) { string Temp_strValue = CommonMethod.StringEncrypt.Base64Encode(cInfo.CameraName); SDK_SKVideoSDK.p_sdkc_set_dev_cam_osd(vInfo.DVSAddress, cInfo.Channel - 1, Temp_strValue); } return(true); }
public void CreatePCMFileTest() { string strG711File = @"C:\SHIKE_Video\SKAlarmAudio\9999\20180602142359\61-57354AA60831-3136_20180602142406_09_bfr10.G711"; string strPcmFile = @"C:\SHIKE_Video\SKAlarmAudio\9999\20180602142359\61-57354AA60831-3136_20180602142406_09_bfr10.pcm"; string strWavFile = @"C:\SHIKE_Video\SKAlarmAudio\9999\20180602142359\61-57354AA60831-3136_20180602142406_09_bfr10.wav"; //SDK_SKVideoSDK.CreatePCMFile(strG711File, strPcmFile); SDK_SKVideoSDK.CreateWAVFile(strG711File, strWavFile); Assert.Fail(); }
public SDK_SKVideoSDKTests() { SDK_SKVideoSDK.p_sdkc_init_client("Use1111r", "121.41.87.203", 47624, 47724, 47824, @"d:\"); //SDK_SKVideoSDK.p_sdkc_init_client("admin", "192.168.2.19", 47624, 47724, 47824, @"d:\"); int intValue = 0; //while (!(SDK_SKVideoSDK.p_sdkc_get_online() == 1) && (intValue < 100)) //{ // Thread.Sleep(500); // intValue++; //} string x = "1"; }
/// <summary> /// 时刻对讲设备_结束对讲 /// </summary> /// <returns></returns> public bool StopTalk() { bool bolResult = false; if (CurrentVideoInfo != null && CurrentTalkStatus != Enum_TalkStatus.Null) { SDK_SKVideoSDK.p_sdkc_stop_rt_video(CurrentVideoInfo.DVSAddress, 0, IntPtr.Zero); SDK_SKVideoSDK.p_sdkc_stop_talk(CurrentVideoInfo.DVSAddress); StopTalked(null); CurrentTalkStatus = Enum_TalkStatus.Null; } return(bolResult); }
public void GetRemoteVideoRecordFileNameTest() { string strResult = "VHS_ch09_61-57354AA60831-3136_1526886082.h264"; RemoteVideoRecordInfo V = new RemoteVideoRecordInfo { VideoGUID = "61-57354AA60831-3136", StartTime = DateTime.Parse("2018-05-21 15:01:22"), Channel = 8, }; string Temp_str = SDK_SKVideoSDK.GetRemoteVideoRecordFileName(V); Assert.AreEqual(Temp_str, strResult); }
public void p_sdkc_get_revideo_dataTest() { int intCount = 0; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0 && intCount < 20) { Common.Delay_Second(1); intCount++; } string Temp_strValue = "http://192.168.2.19:8008/SK_VideoRecord/0001/20190703200256/"; SDK_SKVideoSDK.p_sdkc_get_revideo_data("61-543032620F30-3430", 0, Temp_strValue); Common.Delay_Millisecond(20000); Assert.IsTrue(intCount < 10); }
public void p_sdkc_dev_passthroughTest() { int intCount = 0; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0 && intCount < 20) { Common.Delay_Second(1); intCount++; } string s = "VSDK_PS_CMD__DELAY_ALARM__" + 1 + "_" + 20; SDK_SKVideoSDK.p_sdkc_dev_passthrough("71-00F51F0150DC-72C9", "VSDK_PS_CMD__DELAY_ALARM__3_10"); Common.Delay_Second(3); Assert.Fail(); }
public void DownLoadRemoteRecordTest() { string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest"; string strData = "[a:192.168.2.166][g:xhcs1][c:08][s(1526886082) e(1526886150)][s(1526886179) e(1526887395)][s(1526887503) e(1526889215)][s(1526889314) e(1526892684)][s(1526892685) e(1526895368)][s(1526895368) e(1526898051)][s(1526898051) e(1526900729)][s(1526900730) e(1526903405)][s(1526903405) e(1526906087)][s(1526906087) e(1526908768)][s(1526908768) e(1526911452)][s(1526911452) e(1526912030)][s(1526945754) e(1526948443)][s(1526948444) e(1526951130)][s(1526951130) e(1526953814)][s(1526953814) e(1526956492)][s(1526956492) e(1526959175)][s(1526959175) e(1526961854)][s(1526961854) e(1526964531)][s(1526964531) e(1526967215)][s(1526967215) e(4294966)]"; List <RemoteVideoRecordInfo> l = SDK_SKVideoSDK.SKRemoteVideoRecordDataPrasing("61-57354AA60831-3136", strData); string strFileName = ""; RemoteVideoRecordInfo v = l[0]; strFileName = Temp_strDownPath + "/" + v.RemoteVidoRecordName; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0) { Common.Delay_Second(1); } SDK_SKVideoSDK.DownLoadRemoteRecord(v, strFileName); Assert.IsTrue(File.Exists(strFileName)); }
/// <summary> /// 时刻设备视频播放 /// </summary> /// <returns></returns> public bool VideoPlay() { bool bolResult = false; string strRecordPath = ""; int intVideoRecordEnable = 0; if (CurrentVideoPlaySet.VideoRecordEnable) { VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.StartVideoRecord }); strRecordPath = GetServerSavePath(CurrentVideoPlaySet.VideoRecordFilePath_Server, CurrentVideoPlaySet.VideoRecordFileName_Server); intVideoRecordEnable = 1; VideoRecordStatus = true; } int Temp_intStreamValue = GetVideoStreamValue(VideoStream); if (ProgParameter.SKVideoPlayFlag) { //新方法预览 SDK_SKVideoSDK.p_sdkc_start_rt_video_ex( CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1, intptrPlayMain, intVideoRecordEnable, 30, 5, Temp_intStreamValue, strRecordPath); } else { //旧方法预览 SDK_SKVideoSDK.p_sdkc_start_rt_video(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1, intptrPlayMain, intVideoRecordEnable, 15, 5, strRecordPath); } if (CurrentVideoPlaySet.PerVideoRecord) { SDK_SKVideoSDK.p_sdkc_get_revideo_data(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1, CurrentVideoPlaySet.PreVideoRecordFilePath); } VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.VideoPlay }); VideoPlayState = Enum_VideoPlayState.InPlayState; return(bolResult); }
/// <summary> /// 时刻设备视频关闭 /// </summary> /// <returns></returns> public bool VideoClose() { bool bolResult = false; if (VideoRecordStatus) { VideoRecordStatus = false; VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.StopVideoRecord }); } SDK_SKVideoSDK.p_sdkc_stop_rt_video(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1, intptrPlayMain); VideoPlayCallback(new VideoPlayCallbackValue { evType = Enum_VideoPlayEventType.VideoClose }); VideoPlayState = Enum_VideoPlayState.NotInPlayState; return(bolResult); }
public void p_sdkc_get_record_time_mapTest() { //1.注册回调 //2.创建线程 //3.触发回调事件 p_msg_demo_callback = new CallBack(callback); p_sdkc_reg_msg_callback(p_msg_demo_callback); while (SDK_SKVideoSDK.p_sdkc_get_online() == 0) { Common.Delay_Second(1); } long start_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Now.AddDays(-1)); long stop_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Now); SDK_SKVideoSDK.p_sdkc_get_record_time_map("72-00F51F01580D-46E5", (byte)0, (int)start_time, (int)stop_time); Common.Delay_Second(10); Assert.Fail(); }
public void p_set_ccam_osdTest() { //"72-00F51F010E10-2B25" //"" int intCount = 0; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0 && intCount < 10) { Common.Delay_Second(1); intCount++; } string Temp_strValue = StringEncrypt.Base64Encode("测试测试测试测试测试测试22测试测试"); SDK_SKVideoSDK.p_sdkc_set_dev_cam_osd("72-00F51F010E10-2B25", 8, Temp_strValue); Common.Delay_Millisecond(200); Assert.IsTrue(intCount < 10); //Assert.AreEqual(Temp_strValue, "JXU2RDRCJXU4QkQ1JXU2RDRCJXU4QkQ1JXU2RDRCJXU4QkQ1"); }
public bool StartTlak(Enum_TalkModel talkModel) { bool bolResult = false; if (CurrentTalkStatus != Enum_TalkStatus.Null) //处于对讲中 先关闭 { StopTalk(); } StartTalking(null); SDK_SKVideoSDK.st_multi_talk talkChannel = new SDK_SKVideoSDK.st_multi_talk(); int Temp_intChannel = CurrentTalkChannel.VideoTalkChannel - 1; talkChannel = SDK_SKVideoSDK.SetMultiTalkChannel(Temp_intChannel, talkChannel); if (CurrentTalkSetting.TalkRecordEnable) { if (ProgParameter.SKVideoTalkRecordFlag && CurrentTalkChannel.VideoInfo.OnlyIntercom) { //仅作为对讲设备,打开通道1视频,视频录像中将会保存视频 string Temp_strTalkRecordPath = GetTalkRecordPath_Server(CurrentTalkSetting.TalkRecordPath_Server, CurrentTalkSetting.TalkRecordName_Server); SDK_SKVideoSDK.p_sdkc_start_rt_video_ex( CurrentVideoInfo.DVSAddress, 0, IntPtr.Zero, 1, 30, 5, 0, Temp_strTalkRecordPath); } else { CurrentTalkSetting.TalkRecordRealSavePath_Local = GetTalkRecordPath_Local(CurrentTalkSetting.TalkRecordPath_Local, CurrentTalkSetting.TalkRecordName_Local); string Temp_strValue = Path.GetDirectoryName(CurrentTalkSetting.TalkRecordRealSavePath_Local); CommonMethod.Common.CreateFolder(Temp_strValue); } } SDK_SKVideoSDK.p_sdkc_start_multi_talk(CurrentVideoInfo.DVSAddress, ref talkChannel, GetSKTalkModel(talkModel), 1, 15, 10, CurrentTalkSetting.TalkRecordRealSavePath_Local); CurrentTalkStatus = (Enum_TalkStatus)(int)talkModel; return(bolResult); }
public void p_sdkc_request_download_videoTest() { DateTime timStart = DateTime.Now.AddSeconds(-2000); DateTime timEnd = DateTime.Now.AddSeconds(-1700); long start_time = ConvertClass.DateTimeToUnixTimestamp(timStart); long stop_time = ConvertClass.DateTimeToUnixTimestamp(timEnd); int intCount = 0; while (SDK_SKVideoSDK.p_sdkc_get_online() == 0 && intCount < 10) { Common.Delay_Second(1); intCount++; } p_msg_demo_callback = new CallBack(callback); p_sdkc_reg_msg_callback(p_msg_demo_callback); string Temp_strDownPath = @"C:\SHIKE_Video\" + timStart.ToString("yyyy_MM_dd_HH_mm_ss") + ".H264"; //string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest"; int intResult = SDK_SKVideoSDK.p_sdkc_request_download_video("72-00F51F817E16-D210", 0, (int)start_time, (int)stop_time, Temp_strDownPath); intCount = 0; Common.Delay_Second(30); Assert.AreEqual(intResult, 1); }
/// <summary> /// 时刻视频设备初始化 /// </summary> /// <param name="strGUId"></param> /// <param name="strServerIP"></param> /// <param name="uintControlPort"></param> /// <param name="uintVideoPort"></param> /// <param name="uintAudioPort"></param> /// <param name="uintStreamPort"></param> /// <returns></returns> public static Enum_SDKState SKVideoSDKInit(string strGUId, string strServerIP, int uintControlPort, int uintVideoPort, int uintAudioPort, int uintStreamPort, string strRecordDirectory = "") { SDKState.SDKEventCallBack(Enum_VideoType.SKVideo, Enum_SDKStateEventType.SDKInitStart); ProgParameter.strSKVideo_ClientUGID = strGUId; ProgParameter.strSKVideo_ServerIP = strServerIP; ProgParameter.uintSKVideo_ControlPort = Convert.ToUInt16(uintControlPort); ProgParameter.uintSKVideo_VideoPort = Convert.ToUInt16(uintVideoPort); ProgParameter.uintSKVideo_AudioPort = Convert.ToUInt16(uintAudioPort); ProgParameter.uintSKVideo_AVPort = Convert.ToUInt16(uintStreamPort); ProgParameter.strSKVideo_RecordDirectory = strRecordDirectory; SDK_SKVideoSDK.p_sdkc_set_server_av_port(ProgParameter.uintSKVideo_AVPort); //设置码流端口 SDK_SKVideoSDK.p_sdkc_init_client(strGUId, strServerIP , ProgParameter.uintSKVideo_ControlPort , ProgParameter.uintSKVideo_VideoPort , ProgParameter.uintSKVideo_AudioPort , ProgParameter.strSKVideo_RecordDirectory); //初始化 SDK_SKVideoSDK.p_sdkc_disable_hw_render(); //关闭客户端软解码 SKVideoSDKState = Enum_SDKState.SDK_Init; SDKState.SDKEventCallBack(Enum_VideoType.SKVideo, Enum_SDKStateEventType.SDKInitEnd); p_msg_demo_callback = new CallBack(callback); SDK_SKVideoSDK.p_sdkc_reg_msg_callback(p_msg_demo_callback); return(SKVideoSDKState); }
public void DownLoadRemoteRecordDataTest() { string Temp_strDownPath = @"C:\SHIKE_Video\0138\DownloadTest"; p_msg_demo_callback = new CallBack(callback); p_sdkc_reg_msg_callback(p_msg_demo_callback); while (SDK_SKVideoSDK.p_sdkc_get_online() == 0) { Common.Delay_Second(1); } long start_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Now.AddHours(-1)); long stop_time = ConvertClass.DateTimeToUnixTimestamp(DateTime.Now); SDK_SKVideoSDK.p_sdkc_get_record_time_map("61-57354AA60831-3136", (byte)8, (int)start_time, (int)stop_time); Common.Delay_Second(5); if (lRemoteVideoRecord != null && lRemoteVideoRecord.Count > 0) { foreach (RemoteVideoRecordInfo v in lRemoteVideoRecord) { SDK_SKVideoSDK.DownLoadRemoteRecord(v, Temp_strDownPath + "/" + v.RemoteVidoRecordName); } } Assert.Fail(); }
/// <summary> /// 获取客户端SDK网络状态 /// 0,客户端不在线,1,客户端在线 /// </summary> /// <returns></returns> public static int GetSKSDKClientOlineStatus() { return(SDK_SKVideoSDK.p_sdkc_get_online()); }
/// <summary> /// 时刻设备_云台控制 /// </summary> /// <param name="PTZControl"></param> /// <param name="bolStart"></param> /// <returns></returns> public bool VideoPTZControl(Enum_VideoPTZControl PTZControl, bool bolStart) { bool bolResult = false; if (bolStart) { int Temp_iXSpeed = 0; int Temp_iYSpeed = 0; int Temp_iZSpeed = 0; switch (PTZControl) { case Enum_VideoPTZControl.PTZControl_Up: Temp_iYSpeed = CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_Down: Temp_iYSpeed = -CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_Left: Temp_iXSpeed = -CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_Right: Temp_iXSpeed = CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_LeftUp: Temp_iXSpeed = -CurrentVideoPlaySet.PTZSpeed; Temp_iYSpeed = CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_LeftDown: Temp_iXSpeed = -CurrentVideoPlaySet.PTZSpeed; Temp_iYSpeed = -CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_RightUp: Temp_iXSpeed = CurrentVideoPlaySet.PTZSpeed; Temp_iYSpeed = CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_RightDown: Temp_iXSpeed = CurrentVideoPlaySet.PTZSpeed; Temp_iYSpeed = -CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_Zoom_Out: Temp_iZSpeed = -CurrentVideoPlaySet.PTZSpeed; break; case Enum_VideoPTZControl.PTZControl_Zoom_In: Temp_iZSpeed = CurrentVideoPlaySet.PTZSpeed; break; } SDK_SKVideoSDK.p_sdkc_onvif_ptz_continue_move(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1, Temp_iXSpeed, Temp_iYSpeed, Temp_iZSpeed); } else { SDK_SKVideoSDK.p_sdkc_onvif_ptz_stop(CurrentVideoInfo.DVSAddress, CurrentCameraInfo.Channel - 1); } return(bolResult); }