Esempio n. 1
0
        // "Open" menu item click - open AVI file
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                // create video source
                AVIFileVideoSource fileSource = new AVIFileVideoSource(openFileDialog.FileName);

                OpenVideoSource(fileSource);
            }
        }
Esempio n. 2
0
        public override void Start()
        {
            source = new AVIFileVideoSource();
            source.FrameIntervalFromSource = true;
            //source.FrameInterval = 200;
            source.Source    = sourceFile;
            source.NewFrame += source_NewFrame;
            timer            = new Timer(timer_Callback);
            timer.Change(1000, 500);
            source.Start();

            isRunning = true;
        }
Esempio n. 3
0
        private void btnOk_Click(object sender, EventArgs e)
        {
            // I'm making sure that filters actually contains something.
            if (rdoCaptureDevice.Checked && filters.Count > 0)
            // Chose to use a capture videoSource.
            {
                // create video source
                VideoCaptureDevice localSource = new VideoCaptureDevice();
                localSource.Source           = filters[deviceCombo.SelectedIndex].MonikerString;
                localSource.DesiredFrameSize = new Size(int.Parse(txtWidth.Text), int.Parse(txtHeight.Text));
                videoSource = localSource;
            }
            // Make sure that the text box contains a path.
            else if (!txtFileName.Text.Equals(String.Empty))             // Chose to load a movie.
            {
                // create video source
                AVIFileVideoSource fileSource = new AVIFileVideoSource();
                fileSource.Source = txtFileName.Text;
                videoSource       = fileSource;
            }
            else if (!txtMjpegUrl.Text.Equals(String.Empty))               // Chose to load a url.
            {
                MJPEGStream stream = new MJPEGStream(txtMjpegUrl.Text);
                videoSource = stream;
            }
            else if (!txtJpgUrl.Text.Equals(String.Empty))               // Chose to load a url.
            {
                JPEGStream stream = new JPEGStream(txtJpgUrl.Text);
                videoSource = stream;
            }
            else             // Unable to display.
            {
                showErrorMessage("No video source was chosen.");
                return;
            }

            DialogResult = DialogResult.OK;
            Hide();
        }