/// <summary> /// 预览 /// </summary> /// <param name="CH">通道</param> /// <param name="Handle">句柄</param> /// <param name="StreamType">码流类型:0-主码流,1-子码流,2-码流3,3-码流4,以此类推</param> /// <param name="Mode">连接方式:0- TCP方式,1- UDP方式,2- 多播方式,3- RTP方式,4-RTP/RTSP,5-RSTP/HTTP </param> /// <param name="Blocked">0- 非阻塞取流,1- 阻塞取流</param> public void RealPlay(int CH, IntPtr Handle, Action <int, int, IntPtr, uint, IntPtr> RealDataCallBack = null, Action <int, int, IntPtr, uint, IntPtr> StdDataEvent = null, Action <int, int, IntPtr, uint, IntPtr> RealDataEvent = null, int StreamType = 0, LinkMode Mode = LinkMode.TCP, bool Blocked = true) { NET_DVR_PREVIEWINFO lpPreviewInfo = new NET_DVR_PREVIEWINFO(); lpPreviewInfo.hPlayWnd = Handle; lpPreviewInfo.lChannel = CH; lpPreviewInfo.dwStreamType = (uint)StreamType; lpPreviewInfo.dwLinkMode = (uint)Mode; lpPreviewInfo.bBlocked = Blocked; lpPreviewInfo.dwDisplayBufNum = (uint)this.BufferFrame; IntPtr pUser = new IntPtr(); REALDATACALLBACK RealData = null; if (RealDataCallBack != null) { RealData = new REALDATACALLBACK(RealDataCallBack); } System.Threading.Thread.Sleep(1000); if (Environment.Is64BitProcess) { m_lRealHandle = HCNetSDKia64.NET_DVR_RealPlay_V40(this.lUserID, ref lpPreviewInfo, RealData, pUser); } else { m_lRealHandle = HCNetSDK.NET_DVR_RealPlay_V40(this.lUserID, ref lpPreviewInfo, RealData, pUser); } if (m_lRealHandle < 0) { Error(); } if (StdDataEvent != null) { if (Environment.Is64BitProcess) { HCNetSDKia64.NET_DVR_SetStandardDataCallBack(this.lUserID, new StdDataCallBack(StdDataEvent), pUser); } else { HCNetSDK.NET_DVR_SetStandardDataCallBack(this.lUserID, new StdDataCallBack(StdDataEvent), pUser); } } if (RealDataEvent != null) { if (Environment.Is64BitProcess) { HCNetSDKia64.NET_DVR_SetRealDataCallBack(this.lUserID, new RealDataCallBack(RealDataEvent), pUser); } else { HCNetSDK.NET_DVR_SetRealDataCallBack(this.lUserID, new RealDataCallBack(RealDataEvent), pUser); } } }