C# Class AForge.Video.VFW.AVIFileVideoSource

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
Afficher le fichier Open project: holisticware-admin/MonoVersal.AForgeNET Class Usage Examples

Méthodes publiques

Méthode Description
AVIFileVideoSource ( ) : System

Initializes a new instance of the AVIFileVideoSource class.

AVIFileVideoSource ( string source ) : System

Initializes a new instance of the AVIFileVideoSource class.

SignalToStop ( ) : void

Signal video source to stop its work.

Signals video source to stop its background thread, stop to provide new frames and free resources.

Start ( ) : void

Start video source.

Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of NewFrame event.

Stop ( ) : void

Stop video source.

Stops video source aborting its thread.

Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion.

WaitForStop ( ) : void

Wait for video source has stopped.

Waits for source stopping after it was signalled to stop using SignalToStop method.

Private Methods

Méthode Description
Free ( ) : void

Free resource.

WorkerThread ( ) : void

Worker thread.

Method Details

AVIFileVideoSource() public méthode

Initializes a new instance of the AVIFileVideoSource class.
public AVIFileVideoSource ( ) : System
Résultat System

AVIFileVideoSource() public méthode

Initializes a new instance of the AVIFileVideoSource class.
public AVIFileVideoSource ( string source ) : System
source string Video file name.
Résultat System

SignalToStop() public méthode

Signal video source to stop its work.
Signals video source to stop its background thread, stop to provide new frames and free resources.
public SignalToStop ( ) : void
Résultat void

Start() public méthode

Start video source.
Starts video source and return execution to caller. Video source object creates background thread and notifies about new frames with the help of NewFrame event.
Video source is not specified.
public Start ( ) : void
Résultat void

Stop() public méthode

Stop video source.

Stops video source aborting its thread.

Since the method aborts background thread, its usage is highly not preferred and should be done only if there are no other options. The correct way of stopping camera is signaling it stop and then waiting for background thread's completion.

public Stop ( ) : void
Résultat void

WaitForStop() public méthode

Wait for video source has stopped.
Waits for source stopping after it was signalled to stop using SignalToStop method.
public WaitForStop ( ) : void
Résultat void