Exemple #1
0
        public void SetStreamCapture(bool isOpen)
        {
            //发送 "开关实时码流" 命令【主机→采集器】

            DataPackage pkgData = new DataPackage();
            pkgData.CtrlHead.CMD_ID = HCCommand.STREAM_SWITCH;
            pkgData.CtrlHead.CE_ID = ceInfo.CE_ID;

            Struct_Video videoData = new Struct_Video();
            Struct_Audio audioData = new Struct_Audio();

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.Write((byte)(isOpen ? 1 : 0));       //操作码:  0-关闭实时码流,1-打开实时码流
                    bw.Write((byte)0);                      //输出开关量状态,主机->采集器无效
                    bw.Write((byte)0);                      //保留
                    bw.Write((byte)0);                      //更新参数: 0-不更新,1-更新
                    bw.Write(videoData.Buffer);             //视频参数: 在打开且更新参数时才有效,否则设置为 0
                    bw.Write(audioData.Buffer);             //音频参数: 在打开且更新参数时才有效,否则设置为 0
                }

                pkgData.PureData = ms.ToArray();
            }

            pkgData.Pack();
            SendData(pkgData);

            //-----------------------------------

            //建立实时码流定时发送命令线程
            streamContinue = isOpen;
            if (isOpen)
            {
                Thread thread = new Thread(new ThreadStart(ThreadProc));
                thread.IsBackground = true;
                thread.Start();
            }
        }
Exemple #2
0
        public void SetVideoCapture(bool isOpen)
        {
            //发送 "开关录像" 命令 【主机→采集器】

            DataPackage pkgData = new DataPackage();

            pkgData.CtrlHead.CMD_ID = HCCommand.VIDEO_SWITCH;
            pkgData.CtrlHead.CE_ID = ceInfo.CE_ID;

            Struct_Video videoData = new Struct_Video();
            Struct_Audio audioData = new Struct_Audio();

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.Write((byte)(isOpen ? 1 : 0));       //操作码:  0-关闭录象,1-打开录象
                    bw.Write((byte)0);                      //输出开关量状态,主机->采集器无效
                    bw.Write((byte)0);                      //说明:利用原有保留字节,缺省为 0,其它取值已废弃。
                    bw.Write((byte)0);                      //更新参数: 0-不更新,1-更新
                    bw.Write(videoData.Buffer);             //视频参数: 在打开且更新参数时才有效,否则设置为 0
                    bw.Write(audioData.Buffer);             //音频参数: 在打开且更新参数时才有效,否则设置为 0
                }

                pkgData.PureData = ms.ToArray();
            }

            pkgData.Pack();
            SendData(pkgData);
        }
Exemple #3
0
        public void SetStreamCapture(bool isOpen)
        {
            //发送 "开关实时码流" 命令【主机→采集器】
            isStart = isOpen;

            DataPackage pkgData = new DataPackage();
            pkgData.CtrlHead.CMD_ID = HCCommand.STREAM_SWITCH;
            pkgData.CtrlHead.CE_ID = 0;

            Struct_Video videoData = new Struct_Video();
            Struct_Audio audioData = new Struct_Audio();

            using (MemoryStream ms = new MemoryStream())
            {
                using (BinaryWriter bw = new BinaryWriter(ms))
                {
                    bw.Write((byte)(isOpen ? 1 : 0));       //操作码:  0-关闭实时码流,1-打开实时码流
                    bw.Write((byte)0);                      //输出开关量状态,主机->采集器无效
                    bw.Write((byte)0);                      //保留
                    bw.Write((byte)0);                      //更新参数: 0-不更新,1-更新
                    bw.Write(videoData.Buffer);             //视频参数: 在打开且更新参数时才有效,否则设置为 0
                    bw.Write(audioData.Buffer);             //音频参数: 在打开且更新参数时才有效,否则设置为 0
                }

                pkgData.PureData = ms.ToArray();
            }

            pkgData.Pack();
            SendData(pkgData);
        }