Class D3D11H264DecoderBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Direct3D 11/DXVA H.264/AVC hardware-accelerated video decoder block.
public class D3D11H264DecoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
This decoder block provides hardware-accelerated H.264/AVC video decoding using Direct3D 11 and DirectX Video Acceleration (DXVA) 2.0 on Windows platforms. It leverages the GPU for efficient decoding of H.264 video streams, significantly reducing CPU usage compared to software decoders.
Key Features:
- Hardware-accelerated H.264/AVC decoding (Baseline, Main, High profiles)
- Support for resolutions up to 4K and beyond (hardware dependent)
- Low CPU usage through GPU offloading
- Direct3D 11 surface output for efficient rendering
- Zero-copy decoding pipeline when used with D3D11 renderers
Use Cases:
- High-performance video playback applications
- Multi-stream video surveillance systems
- Real-time video processing pipelines
- Low-latency streaming applications
- VR/AR video applications requiring minimal CPU overhead
Requirements:
- Windows 7 or later with Direct3D 11 support
- GPU with H.264 DXVA2 decoding capabilities
- Compatible graphics drivers with DXVA support
Performance Considerations:
The decoder automatically utilizes the GPU for decoding operations. For optimal performance, ensure your graphics drivers are up to date and the GPU supports the H.264 profile and level of your input video. The decoder outputs D3D11 surfaces which can be directly rendered without additional memory copies when used with D3D11-based video renderers.Constructors
D3D11H264DecoderBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.D3D11H264DecoderBlock class.
public D3D11H264DecoderBlock()Remarks
Creates a new H.264 hardware decoder block with default settings. The decoder is configured with one input pad for receiving H.264 encoded data and one output pad for providing decoded video frames as D3D11 surfaces.
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 decoder configuration settings.
public D3D11DecoderSettings Settings { get; set; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the D3D11 H.264 decoder element within the pipeline.
public override bool Build()Returns
- bool
-
trueif the decoder was successfully built and initialized;falseif an error occurred.
Remarks
This method performs the following operations:
- Creates the underlying D3D11H264Decoder element
- Initializes the decoder with the specified DXGI device settings
- Configures the output pad for D3D11 surface output
- Sets up the input pad for H.264 stream reception
CleanUp()
Performs cleanup of the decoder resources and resets the build state.
public void CleanUp()Remarks
This method releases the underlying D3D11 decoder element and associated GPU resources. It is called during disposal to ensure proper cleanup of hardware acceleration resources.
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 GStreamer element wrapper for advanced pipeline integration.
public BaseElement GetCore()Returns
- BaseElement
-
The base element wrapper containing the D3D11 H.264 decoder.
GetElement()
Gets the underlying GStreamer element for direct GStreamer API access.
public Element GetElement()Returns
- Element
-
The native GStreamer d3d11h264dec element.
IsAvailable()
Determines whether hardware-accelerated H.264 decoding is available on the current system.
public static bool IsAvailable()Returns
- bool
-
trueif D3D11 H.264 hardware decoding is supported; otherwise,false. This depends on GPU capabilities, driver support, and proper SDK redistribution.
Remarks
This method checks for:
- Direct3D 11 runtime availability
- H.264 DXVA2 decoder support in the GPU
- Required GStreamer D3D11 plugins
- Proper Windows Media Foundation codecs
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this decoder block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent media pipeline that contains this decoder block.
Remarks
This internal method is called by the pipeline during initialization to establish the connection between the decoder block and its parent pipeline context.