Class D3D11VideoCompositorBlock
- 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, IMediaBlockInternalsInheritance
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
settingsD3D11VideoCompositorSettings-
The settings.
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 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
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds this instance.
public override bool Build()Returns
- bool
-
trueif successful,falseotherwise.
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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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
idGuid-
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
idGuid-
The GUID identifier of the input stream to animate.
rectRect-
The target rectangle defining the new position and size.
durationTimeSpan-
The duration of the animation.
startAlphadouble?-
Optional starting opacity value (0.0-1.0).
endAlphadouble?-
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
idGuid-
The GUID identifier of the input stream.
enabledbool-
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
streamVideoMixerStream-
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
idGuid-
The GUID identifier of the input stream.
settingsChromaKeySettingsX-
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
-
trueif this media block is available; otherwise,false.
SetSettings(VideoMixerBaseSettings)
Sets the settings.
public void SetSettings(VideoMixerBaseSettings settings)Parameters
settingsVideoMixerBaseSettings-
The settings.
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
idGuid-
The GUID identifier of the input stream to fade in.
durationTimeSpan-
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
idGuid-
The GUID identifier of the input stream to fade out.
durationTimeSpan-
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
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance that will manage this block.