Class H264ParseBlock
- Namespace
- VisioForge.Core.MediaBlocks.Parsers
- Assembly
- VisioForge.Core.dll
Parses H.264/AVC (Advanced Video Coding) bitstreams for NAL unit processing and frame boundary detection.
public class H264ParseBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
The H264ParseBlock processes H.264 encoded video streams, parsing NAL (Network Abstraction Layer) units, extracting SPS/PPS parameters, and ensuring proper access unit boundaries. H.264 is the most widely adopted video codec for streaming, broadcasting, and video storage.
Key features: - NAL unit parsing and validation (start codes and length-prefixed) - SPS (Sequence Parameter Set) and PPS (Picture Parameter Set) extraction - Access unit boundary detection based on H.264 specification - SEI (Supplemental Enhancement Information) message parsing - Slice header analysis for frame type detection - Support for both Annex B (start codes) and AVCC (length-prefixed) formats
Common use cases: - Streaming: Preparing H.264 for HLS, DASH, or RTP transmission - Muxing: Packaging H.264 into MP4, MKV, or TS containers - Analysis: Extracting codec parameters and stream properties - Transcoding: Providing properly parsed NAL units to decoders - Video editing: Frame-accurate cutting and splicing
The parser handles various H.264 profiles (Baseline, Main, High) and levels, automatically adapting to the stream's characteristics and ensuring compliance with the H.264 specification (ITU-T H.264 / ISO/IEC 14496-10).
Constructors
H264ParseBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Parsers.H264ParseBlock class.
public H264ParseBlock()Remarks
Creates input and output pads configured for video media type. The parser will automatically detect the H.264 stream format (Annex B with start codes or AVCC with length prefixes) and handle it appropriately.
Properties
Input
Gets the primary input pad for receiving H.264 bitstream data.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad that provides parsed H.264 access units.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the type of this media block.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the H.264 parser element within the media pipeline.
public override bool Build()Returns
- bool
-
trueif the parser was successfully created and configured;falseif initialization failed or required plugins are missing.
Remarks
This method creates the GStreamer H.264 parser element, initializes it within the pipeline context, and connects the input/output pads. The parser will begin processing NAL units once the pipeline transitions to the playing state.
CleanUp()
Performs cleanup of the parser resources and resets the build state.
public void CleanUp()Remarks
This method disposes of the GStreamer element and resets internal state. It is called during disposal to ensure proper resource 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 GStreamer element wrapper.
public BaseElement GetCore()Returns
- BaseElement
-
The base element wrapper providing access to common GStreamer functionality.
GetElement()
Gets the underlying native GStreamer element.
public Element GetElement()Returns
- Element
-
The native GStreamer element instance used for H.264 NAL unit parsing.
IsAvailable()
Determines whether the H.264 parser is available in the current GStreamer installation.
public static bool IsAvailable()Returns
- bool
-
trueif the H.264 parser plugin is available; otherwise,false. This requires the GStreamer base plugins to be installed.
Remarks
The H.264 parser is provided by the GStreamer base plugins collection. Ensure the appropriate VisioForge SDK redistribution package is included in your project.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The media pipeline that will contain this parser block.