示例#1
0
        private bool m_bSound     = false; //声音
        public bool preview()
        {
            if (this.monitor == null)
            {
                MessageBox.Show("未指定监控器!");
                return(false);
            }
            //if device did not login,login first
            if (this.monitor.nvrDevice.userID <= 0)
            {
                bool loginSuccess = this.login();
                if (!loginSuccess)
                {
                    return(false);
                }
            }
            if (this.monitor.nvrDevice.userID > 0)
            {
                if (m_iPlayhandle != -1)
                {
                    string thead = Thread.CurrentThread.Name;
                    if (0 != XMSDK.H264_DVR_StopRealPlay(m_iPlayhandle, (uint)this.pictureBox.Handle))
                    {
                        //TRACE("H264_DVR_StopRealPlay fail m_iPlayhandle = %d", m_iPlayhandle);
                    }
                    if (m_bSound)
                    {
                        closeSound();
                    }
                }

                H264_DVR_CLIENTINFO playstru = new H264_DVR_CLIENTINFO();

                playstru.nChannel = this.monitor.channel;
                playstru.nStream  = 0;
                playstru.nMode    = 0;
                playstru.hWnd     = this.pictureBox.Handle;
                m_iPlayhandle     = XMSDK.H264_DVR_RealPlay(this.monitor.nvrDevice.userID, ref playstru);
                if (m_iPlayhandle <= 0)
                {
                    Int32         dwErr = XMSDK.H264_DVR_GetLastError();
                    StringBuilder sTemp = new StringBuilder("");
                    sTemp.AppendFormat("登录 {0} 通道{1} 失败, 错误码 = {2}", this.monitor.nvrDevice.IP, this.monitor.channel, dwErr);
                    MessageBox.Show(sTemp.ToString());
                    return(false);
                }
                else
                {
                    XMSDK.H264_DVR_MakeKeyFrame(this.monitor.nvrDevice.userID, this.monitor.channel, 0);
                }
            }
            return(true);
        }
示例#2
0
 public static extern int H264_DVR_RealPlay(int lLoginID, ref H264_DVR_CLIENTINFO lpClientInfo);
示例#3
0
 public static extern int H264_DVR_RealPlay(int lLoginID, ref H264_DVR_CLIENTINFO lpClientInfo);
示例#4
0
        public bool preview()
        {
            if (this.monitor == null)
            {
                MessageBox.Show("未指定监控器!");
                return false;
            }
            //if device did not login,login first
            if (this.monitor.nvrDevice.userID <= 0)
            {
                bool loginSuccess=this.login();
                if (!loginSuccess)
                {
                    return false;
                }
            }
            if (this.monitor.nvrDevice.userID > 0)
            {
                if (m_iPlayhandle != -1)
                {
                    string thead = Thread.CurrentThread.Name;
                    if (0 != XMSDK.H264_DVR_StopRealPlay(m_iPlayhandle, (uint)this.pictureBox.Handle))
                    {
                        //TRACE("H264_DVR_StopRealPlay fail m_iPlayhandle = %d", m_iPlayhandle);
                    }
                    if (m_bSound)
                    {
                        closeSound();
                    }
                }

                H264_DVR_CLIENTINFO playstru = new H264_DVR_CLIENTINFO();

                playstru.nChannel = this.monitor.channel;
                playstru.nStream = 0;
                playstru.nMode = 0;
                playstru.hWnd = this.pictureBox.Handle;
                m_iPlayhandle = XMSDK.H264_DVR_RealPlay(this.monitor.nvrDevice.userID, ref playstru);
                if (m_iPlayhandle <= 0)
                {
                    Int32 dwErr = XMSDK.H264_DVR_GetLastError();
                    StringBuilder sTemp = new StringBuilder("");
                    sTemp.AppendFormat("登录 {0} 通道{1} 失败, 错误码 = {2}", this.monitor.nvrDevice.IP, this.monitor.channel, dwErr);
                    MessageBox.Show(sTemp.ToString());
                    return false;
                }
                else
                {
                    XMSDK.H264_DVR_MakeKeyFrame(this.monitor.nvrDevice.userID, this.monitor.channel, 0);
                }
            }
            return true;
        }