示例#1
0
        /// <summary>
        /// 关闭视频通道
        /// </summary>
        /// <param name="channel">视频通道号</param>
        public void CloseChannel(int channel)
        {
            if (!this.channelHandle.ContainsKey(channel))
            {
                return;
            }
            switch (this.VideoType)
            {
            case VideoType.MvAPI:
                try
                {
                    MvAPI.MV_CloseDevice(this.channelHandle[channel]);
                }
                catch (Exception ex)
                {
                    return;
                }
                break;

            case VideoType.Sa7134Capture:
                try
                {
                    Sa7134Capture.VCAStopVideoPreview(this.channelHandle[channel]);
                    Sa7134Capture.VCACloseDevice(this.channelHandle[channel]);
                }
                catch (Exception ex)
                {
                    return;
                }
                break;
            }
            this.channelHandle.Remove(channel);
        }
示例#2
0
        /// <summary>
        /// 停止视频,,已经打开则关闭
        /// </summary>
        /// <param name="channel">视频通道号</param>
        /// <param name="hdlpreview">预览控件句柄</param>
        /// <returns>成功返回true,失败返回false</returns>
        public bool StopChannel(int channel, IntPtr hdlpreview)
        {
            bool success = true;
            int  hdl     = channel;

            if (!this.channelHandle.ContainsKey(channel))
            {
                return(false);
            }
            switch (this.VideoType)
            {
            case VideoType.MvAPI:
                this.CloseChannel(channel);
                return(success == true);

            case VideoType.Sa7134Capture:
                try
                {
                    success = Sa7134Capture.VCAStopVideoPreview(this.channelHandle[channel]);
                }
                catch (Exception ex)
                {
                    success = false;
                }
                break;
            }
            return(success);
        }