Table of Contents

Class VideoFrameSource

Namespace
VisioForge.Core.MediaBlocks
Assembly
VisioForge.Core.dll

High-level video frame extraction utility that creates a simplified pipeline for processing video frames. This class provides an easy-to-use interface for extracting individual frames from video files or camera sources, with optional resizing and format conversion. Designed for applications that need frame-by-frame video analysis, thumbnail generation, or computer vision processing without complex pipeline management.

public class VideoFrameSource : IDisposable

Inheritance

Implements

Inherited Members

Properties

FramesProcessed

Gets the total number of frames that have been processed and delivered through events. This count excludes frames that were skipped due to the FramesToSkip setting.

public long FramesProcessed { get; }

Property Value

long

FramesReceived

Gets the total number of frames received from the video source. This count includes all frames, regardless of whether they were processed or skipped.

public long FramesReceived { get; }

Property Value

long

FramesToSkip

Gets or sets the number of frames to skip between processed frames. For example, setting this to 2 will process every third frame (skip 2, process 1). Useful for reducing processing load when full frame rate is not needed.

public int FramesToSkip { get; set; }

Property Value

int

Methods

Dispose(bool)

Releases the unmanaged and optionally managed resources used by the VideoFrameSource. Properly disposes of all MediaBlocks pipeline components and cleans up event handlers.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

True to release both managed and unmanaged resources; false to release only unmanaged resources.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. Stops video processing and releases all pipeline resources.

public void Dispose()

~VideoFrameSource()

Finalizes an instance of the VideoFrameSource class. Ensures proper cleanup if Dispose was not called explicitly.

protected ~VideoFrameSource()

StartAsync(string, VideoFormatX, Size?)

Asynchronously starts video frame extraction from a file using the specified format and optional resizing. This method creates a pipeline to decode video frames and deliver them through the OnNewFrame event.

public Task StartAsync(string filename, VideoFormatX format, Size? resizeTo)

Parameters

filename string

The path to the video file to process.

format VideoFormatX

The desired output format for extracted frames (e.g., RGB, RGBA, YUV).

resizeTo Size?

Optional target size for frame resizing. If null, frames are delivered in original resolution.

Returns

Task

A Task representing the asynchronous start operation.

StartAsync(Uri, VideoFormatX, Size?)

Asynchronously starts video frame extraction from a URI source using the specified format and optional resizing. This method creates a pipeline to decode video frames from various URI sources (files, streams, etc.).

public Task StartAsync(Uri uri, VideoFormatX format, Size? resizeTo)

Parameters

uri Uri

The URI of the video source to process (NSUrl on iOS, Uri on other platforms).

format VideoFormatX

The desired output format for extracted frames (e.g., RGB, RGBA, YUV).

resizeTo Size?

Optional target size for frame resizing. If null, frames are delivered in original resolution.

Returns

Task

A Task representing the asynchronous start operation.

StartAsync(IVideoView, VideoCaptureDeviceSourceSettings, VideoFormatX, Size?)

Asynchronously starts video frame extraction from a camera source with optional preview display. This method creates a pipeline to capture frames from a camera device while optionally showing a live preview.

public Task StartAsync(IVideoView videoView, VideoCaptureDeviceSourceSettings sourceSettings, VideoFormatX frameFormat, Size? resizeTo)

Parameters

videoView IVideoView

Optional video view for displaying live camera preview. If null, no preview is shown.

sourceSettings VideoCaptureDeviceSourceSettings

Camera device configuration including device selection and capture parameters.

frameFormat VideoFormatX

The desired output format for extracted frames (e.g., RGB, RGBA, YUV).

resizeTo Size?

Optional target size for frame resizing. If null, frames are delivered in original resolution.

Returns

Task

A Task representing the asynchronous start operation.

StopAsync()

Asynchronously stops video frame extraction and cleans up the pipeline. This method gracefully shuts down the video processing pipeline and releases resources.

public Task StopAsync()

Returns

Task

A Task representing the asynchronous stop operation.

OnNewFrame

Event raised when a new video frame is available for processing. Provides access to the decoded video frame data in the specified format.

public event EventHandler<VideoFrameX> OnNewFrame

Event Type

EventHandler<VideoFrameX>

OnStop

Event raised when video processing stops, either normally or due to an error.

public event EventHandler<EventArgs> OnStop

Event Type

EventHandler<EventArgs>