Пример #1
0
        public void Capture_video()
        {
            if (firstActive)
            {
                firstActive = true;
                CloseInterfaces();
                //this.Close();
                return;
            }

            firstActive = true;

            if (!DsUtils.IsCorrectDirectXVersion())
            {
                MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            if (!DsDev.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevices))
            {
                MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            SaveFileDialog sd = new SaveFileDialog();

            sd.FileName         = DateTime.Now.ToString("yyMMdd hh-mm-ss");
            sd.Title            = "Save Video Stream as...";
            sd.Filter           = "Video file (*.avi)|*.avi";
            sd.FilterIndex      = 1;
            sd.InitialDirectory = "C:\\temp\\autobot7\\";

            Thread.Sleep(2000);
            System.Windows.Forms.SendKeys.Send("{ENTER}");

            if (sd.ShowDialog() != DialogResult.OK)
            {
                this.Close(); return;
            }

            fileName = sd.FileName;

            DsDevice dev = null;

            if (capDevices.Count == 1)
            {
                dev = capDevices[0] as DsDevice;
            }
            else
            {
                DeviceSelector selector = new DeviceSelector(capDevices);
                selector.ShowDialog(this);
                dev = selector.SelectedDevice;
            }

            if (dev == null)
            {
                this.Close(); return;
            }

            if (!StartupVideo(dev.Mon))
            {
                this.Close();
            }
            this.Text = "save" + fileName + "..........";
        }
Пример #2
0
        public void Capture_video()
        {
            if (firstActive)
            {
                firstActive = true;
                CloseInterfaces();
                //this.Close();
                return;
            }

            firstActive = true;

            if (!DsUtils.IsCorrectDirectXVersion())
            {
                MessageBox.Show(this, "DirectX 8.1 NOT installed!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            if (!DsDev.GetDevicesOfCat(FilterCategory.VideoInputDevice, out capDevices))
            {
                MessageBox.Show(this, "No video capture devices found!", "DirectShow.NET", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                this.Close(); return;
            }

            SaveFileDialog sd = new SaveFileDialog();
            sd.FileName = DateTime.Now.ToString("yyMMdd hh-mm-ss");
            sd.Title = "Save Video Stream as...";
            sd.Filter = "Video file (*.avi)|*.avi";
            sd.FilterIndex = 1;
            sd.InitialDirectory = "C:\\temp\\autobot7\\";

            Thread.Sleep(2000);
            System.Windows.Forms.SendKeys.Send("{ENTER}");

            if (sd.ShowDialog() != DialogResult.OK)
            { this.Close(); return; }

            fileName = sd.FileName;

            DsDevice dev = null;
            if (capDevices.Count == 1)
                dev = capDevices[0] as DsDevice;
            else
            {
                DeviceSelector selector = new DeviceSelector(capDevices);
                selector.ShowDialog(this);
                dev = selector.SelectedDevice;
            }

            if (dev == null)
            {
                this.Close(); return;
            }

            if (!StartupVideo(dev.Mon))
                this.Close();
            this.Text = "save" + fileName + "..........";
        }