Class H264DecoderBlock
- Assembly
- VisioForge.Core.dll
H.264/AVC video decoder block that converts compressed H.264 bitstreams into raw video frames. This block supports multiple decoder implementations including software (FFmpeg, OpenH264), hardware-accelerated (NVIDIA NVDEC, VAAPI on Linux, DXVA on Windows), and can automatically select the best available decoder for optimal performance. Essential for decoding H.264 content from files, streams, and live sources in media processing pipelines.
Supported profiles: Baseline, Main, High, High 10, High 4:2:2, High 4:4:4
Performance: Hardware decoders can achieve 4K@60fps or higher depending on GPU capabilities
Use cases: Video playback, transcoding, streaming, video editing, surveillance systems
Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.public class H264DecoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
H264DecoderBlock(IH264DecoderSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoDecoders.H264DecoderBlock class with specific decoder settings. This constructor allows you to specify exactly which H.264 decoder implementation to use and configure its parameters according to your application's requirements.
public H264DecoderBlock(IH264DecoderSettings settings)Parameters
settingsIH264DecoderSettings-
The H.264 decoder settings that define which decoder to use and how to configure it.
H264DecoderBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoDecoders.H264DecoderBlock class with automatic decoder selection. This constructor automatically detects and selects the best available H.264 decoder on the system, prioritizing hardware-accelerated decoders when available, then falling back to software decoders. The selection order is: FFmpeg → OpenH264 → NVIDIA NVDEC → VAAPI (Linux) → Error if none available.
public H264DecoderBlock()Properties
Input
Gets the primary input pad for receiving H.264 encoded video data.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this decoder block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad that provides decoded raw video frames.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this decoder block.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the H.264 decoder configuration settings that control decoder selection, performance options, and hardware acceleration preferences. These settings determine which decoder implementation will be used and how it will be configured.
public IH264DecoderSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for this H.264 decoder.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the H.264 decoder element within the pipeline, creating the necessary GStreamer elements and configuring the pads.
public override bool Build()Returns
- bool
-
trueif the decoder was successfully built and initialized;falseif an error occurred.
CleanUp()
Performs cleanup of internal resources, disposing of the decoder element and resetting the build state.
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 underlying GStreamer element for advanced configuration and control.
public BaseElement GetCore()Returns
- BaseElement
-
The core H.264 decoder element instance.
GetElement()
Gets the native GStreamer element for direct manipulation and advanced use cases.
public Element GetElement()Returns
- Element
-
The underlying GStreamer H.264 decoder element.
IsAvailable(H264DecoderType)
Determines whether the specified H.264 decoder implementation is available on the current system. This method checks for the presence of required libraries, drivers, and hardware support for the requested decoder type. Ensure the appropriate NuGet SDK redistribution packages are included in your project for the decoder types you intend to use.
public static bool IsAvailable(H264DecoderType decoder)Parameters
decoderH264DecoderType-
The specific H.264 decoder type to check for availability (FFmpeg, OpenH264, NVDEC, VAAPI, etc.).
Returns
- bool
-
trueif the specified decoder is available and can be used; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this decoder block, establishing the connection to the parent pipeline and enabling access to shared resources.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocksPipeline that contains this decoder.