Table of Contents

Class D3D11MPEG2DecoderBlock

Namespace
VisioForge.Core.MediaBlocks.Sources
Assembly
VisioForge.Core.dll

Direct3D 11/DXVA MPEG-2 hardware-accelerated video decoder block.

public class D3D11MPEG2DecoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

This decoder block provides hardware-accelerated MPEG-2 video decoding using Direct3D 11 and DirectX Video Acceleration (DXVA) 2.0 on Windows platforms. It leverages the GPU for efficient decoding of MPEG-2 video streams commonly found in DVD, broadcast television, and legacy video content.

Key Features:

  • Hardware-accelerated MPEG-2 Main Profile decoding
  • Support for standard definition (SD) and high definition (HD) resolutions
  • Interlaced and progressive video support
  • Low CPU usage through GPU offloading
  • Direct3D 11 surface output for efficient rendering
  • DVD-Video and ATSC/DVB broadcast compatibility

Use Cases:

  • DVD playback applications
  • Digital TV and broadcast video decoding
  • Legacy video archive systems
  • Video surveillance systems using MPEG-2 encoding
  • Professional video editing with MPEG-2 footage
  • Set-top box and media center applications

Requirements:

  • Windows 7 or later with Direct3D 11 support
  • GPU with MPEG-2 DXVA2 decoding capabilities
  • Compatible graphics drivers with DXVA support
  • MPEG-2 Video Decoder may require separate licensing on some Windows versions

Performance Considerations:

MPEG-2 is a mature codec with excellent hardware support across all modern GPUs. The decoder handles both interlaced and progressive content, automatically deinterlacing when necessary. For optimal performance with interlaced content, ensure your rendering pipeline supports proper field handling.

Constructors

D3D11MPEG2DecoderBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.D3D11MPEG2DecoderBlock class.

public D3D11MPEG2DecoderBlock()

Remarks

Creates a new MPEG-2 hardware decoder block with default settings. The decoder is configured with one input pad for receiving MPEG-2 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

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 decoder configuration settings.

public D3D11DecoderSettings Settings { get; set; }

Property Value

D3D11DecoderSettings

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the D3D11 MPEG-2 decoder element within the pipeline.

public override bool Build()

Returns

bool

true if the decoder was successfully built and initialized; false if an error occurred.

Remarks

This method performs the following operations:

  1. Creates the underlying D3D11MPEG2Decoder element
  2. Initializes the decoder with the specified DXGI device settings
  3. Configures the output pad for D3D11 surface output
  4. Sets up the input pad for MPEG-2 stream reception
The method is idempotent and will return immediately if already built.

CleanUp()

Performs cleanup of the decoder resources and resets the build state.

public void CleanUp()

Remarks

This method releases the underlying D3D11 MPEG-2 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

disposing bool

true to release both managed and unmanaged resources; false to 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 MPEG-2 decoder.

GetElement()

Gets the underlying GStreamer element for direct GStreamer API access.

public Element GetElement()

Returns

Element

The native GStreamer d3d11mpeg2dec element.

IsAvailable()

Determines whether hardware-accelerated MPEG-2 decoding is available on the current system.

public static bool IsAvailable()

Returns

bool

true if D3D11 MPEG-2 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
  • MPEG-2 DXVA2 decoder support in the GPU
  • Required GStreamer D3D11 plugins
  • MPEG-2 codec licensing (may require Windows DVD Player app)
Note: MPEG-2 support is standard on most GPUs but may require additional licensing on some Windows versions.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this decoder block.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

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.

See Also