Table of Contents

Class VirtualVideoSourceBlock

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

A virtual video source block that generates synthetic video frames for testing and development purposes. This block creates a test video stream with customizable dimensions, frame rate, and patterns, useful for pipeline testing without requiring actual video files or capture devices. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class VirtualVideoSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

VirtualVideoSourceBlock(VirtualVideoSourceSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.VirtualVideoSourceBlock class with custom settings.

public VirtualVideoSourceBlock(VirtualVideoSourceSettings settings)

Parameters

settings VirtualVideoSourceSettings

The virtual video source settings specifying resolution, frame rate, and pattern.

VirtualVideoSourceBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.VirtualVideoSourceBlock class with default settings. Creates a virtual video source with standard resolution and frame rate.

public VirtualVideoSourceBlock()

VirtualVideoSourceBlock(int, int, VideoFrameRate)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.VirtualVideoSourceBlock class with specific video parameters.

public VirtualVideoSourceBlock(int width, int height, VideoFrameRate frameRate)

Parameters

width int

The width of the generated video frames in pixels.

height int

The height of the generated video frames in pixels.

frameRate VideoFrameRate

The frame rate at which video frames are generated.

Properties

Input

Gets the input pad. Virtual video sources generate content and have no inputs.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of input pads. Virtual video sources have no inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad through which video frames are sent.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads. This block has a single video output.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the configuration settings for the virtual video generation, including resolution, frame rate, and pattern type.

public VirtualVideoSourceSettings Settings { get; set; }

Property Value

VirtualVideoSourceSettings

Type

Gets the block type identifier for this virtual video source.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the virtual video source and its internal components. Creates the GStreamer elements and establishes the internal pipeline connections.

public override bool Build()

Returns

bool

True if the block was successfully built; false if initialization failed.

CleanUp()

Releases all internal resources and disposes of GStreamer elements. Called during disposal to ensure proper cleanup of native resources.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

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

GetCore()

Gets the core BaseElement wrapper. Not used for this block type.

public BaseElement GetCore()

Returns

BaseElement

Always returns null as this block doesn't use a BaseElement wrapper.

GetElement()

Gets the underlying GStreamer element that generates the virtual video.

public Element GetElement()

Returns

Element

The GStreamer element from the virtual video source.

IsAvailable()

Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.

public static bool IsAvailable()

Returns

bool

true if this media block is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context for this block, providing access to shared resources.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline that owns this block.

See Also