Table of Contents

Class D3D11VideoCompositorBlock

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

Direct3D 11 hardware-accelerated video compositor block for multi-stream video mixing. This Windows-specific block provides GPU-accelerated video compositing using Direct3D 11, enabling real-time mixing of multiple video streams with exceptional performance. Features include per-stream positioning and scaling, alpha blending and transparency, chroma key (green screen) support, animated transitions with fade in/out effects, z-order layering, and hardware-accelerated color space conversion. The compositor efficiently handles multiple HD/4K streams using GPU resources, making it ideal for live production systems, video conferencing with multiple participants, virtual sets, picture-in-picture layouts, video walls, and professional broadcast applications. Requires Windows 8+ and Direct3D 11 compatible GPU. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class D3D11VideoCompositorBlock : MediaBlock, IMediaBlock, IDisposable, IVideoMixerControl, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

D3D11VideoCompositorBlock(D3D11VideoCompositorSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.D3D11VideoCompositorBlock class.

public D3D11VideoCompositorBlock(D3D11VideoCompositorSettings settings)

Parameters

settings D3D11VideoCompositorSettings

The settings.

Properties

Input

Gets the input.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the Direct3D 11 video compositor configuration settings. Contains output resolution, background color, stream configurations including position, size, alpha, z-order, and chroma key settings for each input.

public D3D11VideoCompositorSettings Settings { get; set; }

Property Value

D3D11VideoCompositorSettings

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds this instance.

public override bool Build()

Returns

bool

true if successful, false otherwise.

CleanUp()

Releases all resources and performs cleanup operations for this Direct3D 11 video compositor block. This method disposes of the GStreamer elements and releases Direct3D 11 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 that provides additional functionality around the GStreamer Direct3D 11 video compositor element.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement wrapper instance that encapsulates the GStreamer D3D11 compositor.

GetElement()

Gets the underlying GStreamer element that performs Direct3D 11 video compositing.

public Element GetElement()

Returns

Element

The GStreamer Element instance representing the D3D11 video compositor.

Input_Get(Guid)

Gets the video mixer stream configuration for a specific input by its GUID.

public VideoMixerStream Input_Get(Guid id)

Parameters

id Guid

The GUID identifier of the input stream.

Returns

VideoMixerStream

The VideoMixerStream configuration for the specified input, or null if not found.

Input_List()

Gets all configured input video streams in the compositor.

public VideoMixerStream[] Input_List()

Returns

VideoMixerStream[]

An array of VideoMixerStream configurations for all inputs.

Input_Move(Guid, Rect, TimeSpan, double?, double?)

Animates the position and opacity of an input stream over a specified duration. Creates smooth transitions for picture-in-picture effects or layout changes.

public void Input_Move(Guid id, Rect rect, TimeSpan duration, double? startAlpha, double? endAlpha)

Parameters

id Guid

The GUID identifier of the input stream to animate.

rect Rect

The target rectangle defining the new position and size.

duration TimeSpan

The duration of the animation.

startAlpha double?

Optional starting opacity value (0.0-1.0).

endAlpha double?

Optional ending opacity value (0.0-1.0).

Input_SetChromaKeyEnabled(Guid, bool)

Enables or disables chroma key (green screen) processing for a specific input stream. When enabled, pixels matching the key color become transparent.

public void Input_SetChromaKeyEnabled(Guid id, bool enabled)

Parameters

id Guid

The GUID identifier of the input stream.

enabled bool

True to enable chroma key, false to disable.

Input_Update(VideoMixerStream)

Updates the configuration for a specific input stream identified by its GUID. Changes position, size, alpha, z-order, and other properties in real-time.

public void Input_Update(VideoMixerStream stream)

Parameters

stream VideoMixerStream

The updated VideoMixerStream configuration to apply.

Input_UpdateChromaKeySettings(Guid, ChromaKeySettingsX)

Updates the chroma key (green screen) settings for a specific input stream. Allows real-time adjustment of key color, tolerance, and edge softness.

public void Input_UpdateChromaKeySettings(Guid id, ChromaKeySettingsX settings)

Parameters

id Guid

The GUID identifier of the input stream.

settings ChromaKeySettingsX

The new chroma key settings including color and tolerance values.

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.

SetSettings(VideoMixerBaseSettings)

Updates the stream layout and background of the compositor, and keeps them for the next build.

public void SetSettings(VideoMixerBaseSettings settings)

Parameters

settings VideoMixerBaseSettings

The settings.

Remarks

The stream list and the background are written into VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock.Settings, so the next build (a pipeline stopped and started again) applies them too. VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock.Settings stays the same object - the one passed to the constructor - and now holds the list passed in. The output size, frame rate and the other fields read only when the mixer is built stay as they are in VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock.Settings: a settings object made just to move layers does not change the output format.

The input pads are created by the constructor and VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock.AddInputPadLive, and are not changed by this call. Streams apply to the pads in order: the constructor's first, then the live-added ones. A restart keeps an input unless the connection that fed it was dropped (its source removed or disconnected) and nothing connected it since, while another input is connected; such an input leaves the block, and its stream leaves VisioForge.Core.MediaBlocks.VideoProcessing.VideoMixerBlock.Settings, so the inputs after it keep their own streams. Streams beyond the pads are unused, and pads with no stream entry are drawn with the compositor's defaults.

StartFadeIn(Guid, TimeSpan)

Starts a fade-in animation for the specified input stream. Gradually increases opacity from 0.0 to 1.0 over the specified duration.

public void StartFadeIn(Guid id, TimeSpan duration)

Parameters

id Guid

The GUID identifier of the input stream to fade in.

duration TimeSpan

The duration of the fade-in effect.

StartFadeOut(Guid, TimeSpan)

Starts a fade-out animation for the specified input stream. Gradually decreases opacity from 1.0 to 0.0 over the specified duration.

public void StartFadeOut(Guid id, TimeSpan duration)

Parameters

id Guid

The GUID identifier of the input stream to fade out.

duration TimeSpan

The duration of the fade-out effect.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this Direct3D 11 video compositor block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also