AVI file video source.

The video source reads AVI files using Video for Windows.

Sample usage:

// create AVI file video source AVIFileVideoSource source = new AVIFileVideoSource( "some file" ); // set event handlers source.NewFrame += new NewFrameEventHandler( video_NewFrame ); // start the video source source.Start( ); // ... // signal to stop source.SignalToStop( ); // New frame event handler, which is invoked on each new available video frame private void video_NewFrame( object sender, NewFrameEventArgs eventArgs ) { // get new frame Bitmap bitmap = eventArgs.Frame; // process the frame }
Inheritance: IVideoSource
Exemplo n.º 1
1
		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();
		}
Exemplo n.º 2
0
        // "Open" menu item clieck - 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 );
            }
        }