/// <summary> /// 打开对话(Dialog) /// </summary> /// <param name="pu"></param> /// <param name="channelNo"></param> /// <param name="panel"></param> public void openBrowse(Pu pu, int channelNo, Panel panel) { try { BVCU_DialogControlParam_Network net = new BVCU_DialogControlParam_Network(0, 5, 1, 3); BVRect dispRect = new BVRect(0, 0, panel.ClientRectangle.Height, panel.ClientRectangle.Width); OneDialog dlg = new OneDialog(); foreach (Channel channel in pu.channelList) { int volume = -1; if (channel.channelNo == channelNo) { if (channel.audioPlayback) { volume = 0; } //打开视屏浏览, 主要参数:sdkHandle、sessionHandle、puID、channelNo、显示区域的大小 int ret = BVCU.ManagedLayer_CuBrowsePu(m_bvsdkHandle, //sdk handle ref dlg.dialogHandle, //dialog handle m_session.Handle, //session handle Encoding.UTF8.GetBytes(pu.id), //pu id channelNo, //channel no panel.Handle, //pannel handle ref dispRect, //上下左右,矩形 volume, //音量 0, //single Rec File Sec Encoding.UTF8.GetBytes(""), //rec File Dir true, //videoTrans ref net, //network 时延 m_bvsdkEventHandler.dialog_OnDialogEvent, m_bvsdkEventHandler.dialog_OnStorageEvent); BVCU.FAILED(ret); LogHelper.LogHelper.RecordLog(4, string.Format("打开[{0}, {1}]的视屏预览通道", pu.puName, channelNo)); break; } } dlg.panel = panel; dlg.pu = pu; dlg.channelNo = channelNo; m_dialogs.Add(dlg); } catch { panel.ContextMenuStrip = null; MessageBox.Show("打开预览失败"); } }
/// <summary> /// 视频预览 /// </summary> /// <example>adf</example> /// <param name="pu">要预览的设备</param> /// <param name="channelNo">通道号</param> /// <param name="control">在哪个控件上预览</param> public void PreviewVideo(Pu pu, int channelNo, Control control) { BVCU_DialogControlParam_Network net = new BVCU_DialogControlParam_Network(0, 5, 1, 3); OneDialog dlg = new OneDialog(); BVRect dispRect = new BVRect(0, 0, control.ClientRectangle.Height, control.ClientRectangle.Width); //打开视屏浏览 int ret = BVCU.ManagedLayer_CuBrowsePu(m_bvsdkHandle, //sdk handle ref dlg.dialogHandle, //dialog handle m_session.Handle, //session handle Encoding.UTF8.GetBytes(pu.id), //pu id channelNo, //channel no control.Handle, //pannel handle ref dispRect, //上下左右,矩形 0, //音量 0, //single Rec File Sec Encoding.UTF8.GetBytes(""), //rec File Dir true, //videoTrans ref net, //network 时延 m_bvsdkEventHandler.dialog_OnDialogEvent, m_bvsdkEventHandler.dialog_OnStorageEvent); }
/* * 打开对话(Dialog) */ public void openBrowse(Session.Pu pu, int channelNo, Panel panel) { try { BVCU_DialogControlParam_Network net = new BVCU_DialogControlParam_Network(0, 5, 1, 3); BVRect dispRect = new BVRect(0, 0, panel.ClientRectangle.Height, panel.ClientRectangle.Width); OneDialog dlg = new OneDialog(); foreach (Session.Channel channel in pu.channelList) { int volume = -1; if (channel.channelNo == channelNo) { if (channel.audioPlayback) { volume = 0; } BVCU.FAILED( BVCU.ManagedLayer_CuBrowsePu(m_bvsdkHandle, ref dlg.dialogHandle, m_session.Handle, Encoding.UTF8.GetBytes(pu.id), channelNo, panel.Handle, ref dispRect, volume, 0, Encoding.UTF8.GetBytes(""), true, ref net, m_bvsdkEventHandler.dialog_OnDialogEvent, m_bvsdkEventHandler.dialog_OnStorageEvent)); break; } } dlg.panel = panel; dlg.pu = pu; dlg.channelNo = channelNo; m_dialogs.Add(dlg); } catch { panel.ContextMenuStrip = null; MessageBox.Show("打开预览失败"); } }