Class VideoMixerBlock
- Assembly
- VisioForge.Core.dll
MediaBlock that combines multiple video inputs into a single output with advanced compositing features. The video mixer provides professional broadcast-quality mixing capabilities including multi-layer compositing, real-time positioning, scaling, transparency control, chroma key effects, and transition animations. Supports hardware acceleration through Direct3D11 and OpenGL backends for optimal performance. Essential for live streaming, broadcast production, video conferencing, and any application requiring multiple video source composition with professional-grade features like picture-in-picture, overlays, and dynamic layer management with smooth transitions and effects. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class VideoMixerBlock : MediaBlock, IMediaBlock, IDisposable, IVideoMixerControl, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
VideoMixerBlock(VideoMixerBaseSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock class with the specified mixing settings. Creates input pads for each configured video stream and sets up the mixing environment.
public VideoMixerBlock(VideoMixerBaseSettings settings)Parameters
settingsVideoMixerBaseSettings-
The VideoMixerBaseSettings defining the number of inputs, layout, and mixing behavior.
Properties
Input
Gets the input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the video mixer settings that define composition layout, stream properties, and mixing behavior. These settings control how multiple video inputs are combined, including layer ordering, positioning, transparency, chroma key effects, and hardware acceleration options.
public VideoMixerBaseSettings Settings { get; set; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
AddInputPadLive()
Dynamically adds a new input pad for live video mixing operations. This allows adding video sources to the mixer while the pipeline is running, enabling dynamic composition changes without stopping the stream.
public MediaBlockPad AddInputPadLive()Returns
- MediaBlockPad
-
A new MediaBlockPad that can be connected to a video source, or null if the operation failed.
Build()
Builds this instance.
public override bool Build()Returns
- bool
-
trueif successful,falseotherwise.
CleanUp()
Releases all resources and performs cleanup operations for this video mixer block. This method disposes of the mixer elements and resets the build state.
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 core.
public BaseElement GetCore()Returns
- BaseElement
-
VisioForge.Core.GStreamer.Base.BaseElement.
GetElement()
Gets the element.
public Element GetElement()Returns
- Element
-
Gst.Element.
Input_Get(Guid)
Retrieves a specific video input stream configuration by its unique identifier. This allows access to individual layer properties within the video composition.
public VideoMixerStream Input_Get(Guid id)Parameters
idGuid-
The unique GUID identifier for the input stream.
Returns
- VideoMixerStream
-
The VideoMixerStream configuration for the specified input, or null if not found.
Input_List()
Retrieves all active input stream configurations currently being mixed. Provides access to the complete list of video layers and their properties.
public VideoMixerStream[] Input_List()Returns
- VideoMixerStream[]
-
An array of VideoMixerStream objects representing all active input streams.
Input_Move(Guid, Rect, TimeSpan, double?, double?)
Animates an input stream from its current position and transparency to new values over a specified duration. Creates smooth transitions for professional video production effects like slides and cross-fades.
public void Input_Move(Guid id, Rect rect, TimeSpan duration, double? startAlpha, double? endAlpha)Parameters
idGuid-
The unique GUID identifier for the input stream to animate.
rectRect-
The target position and size rectangle for the animation endpoint.
durationTimeSpan-
The duration of the animation transition.
startAlphadouble?-
Optional starting transparency value (0.0 = transparent, 1.0 = opaque).
endAlphadouble?-
Optional ending transparency value (0.0 = transparent, 1.0 = opaque).
Input_SetChromaKeyEnabled(Guid, bool)
Enables or disables chroma key processing for a specific input stream. When enabled, the configured key color becomes transparent, allowing background replacement for green screen and blue screen compositing effects.
public void Input_SetChromaKeyEnabled(Guid id, bool enabled)Parameters
idGuid-
The unique GUID identifier for the input stream.
enabledbool-
True to enable chroma key processing, false to disable and show the original video.
Input_Update(VideoMixerStream)
Updates the configuration of a specific input stream in real-time. Changes to position, size, transparency, and other properties take effect immediately.
public void Input_Update(VideoMixerStream stream)Parameters
streamVideoMixerStream-
The VideoMixerStream with updated configuration parameters.
Input_UpdateChromaKeySettings(Guid, ChromaKeySettingsX)
Updates the chroma key (green screen) settings for a specific input stream in real-time. Allows dynamic adjustment of color keying parameters including key color, tolerance, and edge softness for professional compositing effects commonly used in broadcast and film production.
public void Input_UpdateChromaKeySettings(Guid id, ChromaKeySettingsX settings)Parameters
idGuid-
The unique GUID identifier for the input stream.
settingsChromaKeySettingsX-
The ChromaKeySettingsX containing key color, tolerance, and edge processing parameters.
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.
SetSettings(VideoMixerBaseSettings)
Updates the video mixer settings in real-time while the pipeline is running. Changes to stream configurations, layout, and mixing parameters take effect immediately.
public void SetSettings(VideoMixerBaseSettings settings)Parameters
settingsVideoMixerBaseSettings-
The VideoMixerBaseSettings containing updated configuration parameters.
StartFadeIn(Guid, TimeSpan)
Initiates a smooth fade-in transition for the specified input stream. Gradually increases opacity from transparent to opaque over the specified duration.
public void StartFadeIn(Guid id, TimeSpan duration)Parameters
idGuid-
The unique GUID identifier for the input stream to fade in.
durationTimeSpan-
The duration of the fade-in transition.
StartFadeOut(Guid, TimeSpan)
Initiates a smooth fade-out transition for the specified input stream. Gradually decreases opacity from opaque to transparent over the specified duration.
public void StartFadeOut(Guid id, TimeSpan duration)Parameters
idGuid-
The unique GUID identifier for the input stream to fade out.
durationTimeSpan-
The duration of the fade-out transition.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.