Table of Contents

Class D3D11VideoConverterBlock

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

Direct3D 11 video converter block that provides hardware-accelerated video format conversion and color space transformation. This block leverages Direct3D 11 Video API for GPU-based video processing, offering superior performance compared to software-based converters. It supports a wide range of pixel formats including YUV formats (NV12, I420, YUY2, UYVY) and RGB formats, with automatic color space conversion between them.

Key features:

  • Hardware-accelerated format conversion using GPU resources
  • Minimal CPU usage for high-performance video pipelines
  • Support for HDR (High Dynamic Range) video processing
  • Automatic handling of video stride and alignment requirements
  • Zero-copy operations when possible for optimal memory efficiency

Common use cases:

  • Converting camera/capture formats to encoder-friendly formats (e.g., RGB to NV12)
  • Preparing video for Direct3D 11 rendering or processing
  • High-performance video transcoding pipelines
  • Real-time video streaming applications
  • Integration with Windows Media Foundation encoders

Requirements:

  • Windows 7 or later with Direct3D 11 capable GPU
  • DirectX 11 runtime and appropriate GPU drivers
  • Hardware video acceleration support (DXVA2)

Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class D3D11VideoConverterBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

D3D11VideoConverterBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.D3D11VideoConverterBlock class. Creates a hardware-accelerated video converter that utilizes Direct3D 11 for format conversion. The converter automatically selects the best GPU device and configures optimal conversion parameters.

public D3D11VideoConverterBlock()

Properties

Input

Gets the primary input pad for video data. This pad accepts video frames in various formats for GPU-accelerated conversion.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of all input pads (single input for this converter). D3D11VideoConverter operates on a single video stream at a time.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad that provides converted video frames. The output format is optimized for the target use case (encoding, display, or processing).

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the array of all output pads (single output for this converter). The converter produces a single converted video stream.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the block type identifier for the Direct3D 11 video converter. Used by the pipeline system for block identification and capability queries.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the Direct3D 11 video converter block. This method creates the D3D11 device context, initializes the video processor, configures input/output formats, and prepares the GPU pipeline for conversion operations. The build process includes capability detection and optimal configuration selection.

public override bool Build()

Returns

bool

true if the converter was successfully initialized with GPU resources allocated; false if initialization failed due to missing D3D11 support, GPU errors, or resource constraints.

CleanUp()

Performs cleanup of Direct3D 11 resources and resets the converter to uninitialized state. Releases GPU resources, closes device contexts, and frees video memory allocations. This method ensures all Direct3D 11 objects are properly released to prevent resource leaks.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources used by the Direct3D 11 converter. This includes GPU resources, Direct3D 11 device contexts, video processor instances, and any allocated video memory. Proper disposal is critical to prevent GPU memory leaks.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources including Direct3D 11 objects; false to release only unmanaged GPU resources.

GetCore()

Gets the core Direct3D 11 video converter element. Provides access to the underlying GStreamer element wrapper for advanced configuration and Direct3D 11 Video API integration.

public BaseElement GetCore()

Returns

BaseElement

The base element wrapping the Direct3D 11 video converter.

GetElement()

Gets the raw GStreamer element for Direct3D 11 video conversion. This provides direct access to the GStreamer d3d11convert element for advanced users who need to configure specific Direct3D 11 properties or handle special use cases.

public Element GetElement()

Returns

Element

The GStreamer element performing Direct3D 11 conversion.

IsAvailable()

Determines whether Direct3D 11 video conversion is available on the current system. Checks for Direct3D 11 support, compatible GPU hardware, and required runtime components. This method verifies that the system meets all requirements for hardware-accelerated video conversion.

public static bool IsAvailable()

Returns

bool

true if Direct3D 11 video conversion is supported with current hardware and drivers; false if the system lacks D3D11 support, compatible GPU, or required runtime components.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this Direct3D 11 converter block. Establishes the connection to the parent pipeline, enabling access to shared Direct3D 11 resources, synchronization primitives, and pipeline-wide configuration settings.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent media blocks pipeline that manages this converter.

See Also