예제 #1
0
        private void checkIpAddrButton_Click(object sender, EventArgs e)
        {
            //go through each cam and if any haven't loaded, set the other to centre
            int haveLoaded = 0;

            checkIpAddrButton.Text = "Checking...";
            //parse the IP addresses entered and attempt to connect to those cameras
            //For testing Vivotek cams 146.230.195.13-15/video.mjpg for 14 use video4.mjpg
            webCams_CB = new VideoOutputWindow.Video_Device[listOfIps.Items.Count];
            //test each camera's availability
            for (int i = 0; i < listOfIps.Items.Count; i++)
            {
                string currentUrl = "http://" + listOfIps.Items[i].Text + ":8080/video";
                bool   urlIsValid = initIpCamStreams(currentUrl);
                if (urlIsValid)
                {
                    haveLoaded++;
                    listOfIps.Items[i].BackColor = Color.LightGreen;
                    webCams_CB[i] = new VideoOutputWindow.Video_Device(i, currentUrl); //fill web cam array with IP cams
                }
                else
                {
                    listOfIps.Items[i].BackColor = Color.OrangeRed;
                }
            }

            if (haveLoaded /*>= 2*/ > 0)
            {
                ipCamReady = true;
                for (int i = 0; i < listOfIps.Items.Count; i++)
                {
                    //  SetupCapture_CB(i, webCams_CB[i].Device_Name);       //setup one of the ip cams (middle)
                }

                checkIpAddrButton.Text = "Check IP addresses";
            }
            else
            {
                checkIpAddrButton.Text = "Check IP addresses";
                ipCamReady             = false;
            }

            //---------------END ORIGINAL CODE COMMENTED OUT
        }
예제 #2
0
        public void initCamStreams()
        {
            //tries to initialise the default camera and the first adjacent left and right

            try
            {
                for (int i = 0; i < _SystemCameras_CB.Length; i++)
                {
                    webCams_CB[i] = new VideoOutputWindow.Video_Device(i, _SystemCameras_CB[i].Name, _SystemCameras_CB[i].ClassID); //fill web cam array
                }

                //setup the middlemost cam first
                //anything LOWER index is left, HIGHER is right
                SetupCapture_CB(0 /*(int)_SystemCameras_CB.Length / 2*/);
            }
            catch (NullReferenceException nr)
            {
                throw nr;
            }
        }