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, IMediaBlockInternalsInheritance
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
settingsVirtualVideoSourceSettings-
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
widthint-
The width of the generated video frames in pixels.
heightint-
The height of the generated video frames in pixels.
frameRateVideoFrameRate-
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
Inputs
Gets the array of input pads. Virtual video sources have no inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad through which video frames are sent.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. This block has a single video output.
public override MediaBlockPad[] Outputs { get; }Property Value
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
Type
Gets the block type identifier for this virtual video source.
public override MediaBlockType Type { get; }Property Value
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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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
-
trueif 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
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline that owns this block.