Class MPEG4ParseBlock
- Namespace
- VisioForge.Core.MediaBlocks.Parsers
- Assembly
- VisioForge.Core.dll
Parses MPEG-4 Part 2 (MPEG-4 Visual) bitstreams for VOP boundary detection and codec parameter extraction.
public class MPEG4ParseBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
The MPEG4ParseBlock processes MPEG-4 Part 2 encoded video streams, parsing Visual Object Sequences (VOS), Visual Object Layer (VOL) headers, and Video Object Planes (VOPs) to ensure proper frame boundaries. MPEG-4 Part 2 includes profiles like Simple Profile, Advanced Simple Profile (ASP), and others used in formats like DivX, Xvid, and early MP4 videos.
Key features: - Visual Object Sequence (VOS) header parsing for profile/level detection - Visual Object Layer (VOL) processing for resolution and timing info - Video Object Plane (VOP) boundary detection and type identification (I, P, B, S) - Support for rectangular and arbitrary shaped video objects - Handles packed bitstream mode and B-frame processing - Interlaced content support with field-based processing - Sprite (S-VOP) and GMC (Global Motion Compensation) support
Common use cases: - Streaming: Processing MPEG-4 content for adaptive streaming - Muxing: Packaging MPEG-4 Visual into MP4, AVI, or MKV containers - Transcoding: Providing properly parsed VOPs to MPEG-4 decoders - Legacy support: Handling DivX/Xvid content in media players - Video analysis: Extracting codec parameters and stream properties
The parser handles various MPEG-4 Visual profiles including Simple Profile (SP), Advanced Simple Profile (ASP), Core Profile, and Main Profile, automatically detecting stream characteristics and ensuring compliance with ISO/IEC 14496-2.
Constructors
MPEG4ParseBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Parsers.MPEG4ParseBlock class.
public MPEG4ParseBlock()Remarks
Creates input and output pads configured for video media type. The parser will automatically detect the MPEG-4 Visual profile and features (packed bitstream, B-frames, GMC, etc.) upon receiving the VOS/VOL headers.
Properties
Input
Gets the primary input pad for receiving MPEG-4 Visual 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 MPEG-4 VOPs.
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 MPEG-4 Visual 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 MPEG-4 parser element, initializes it within the pipeline context, and connects the input/output pads. The parser will begin processing VOPs 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 MPEG-4 Visual VOP parsing.
IsAvailable()
Determines whether the MPEG-4 Visual parser is available in the current GStreamer installation.
public static bool IsAvailable()Returns
- bool
-
trueif the MPEG-4 parser plugin is available; otherwise,false. This requires the GStreamer bad plugins to be installed.
Remarks
The MPEG-4 Visual parser is provided by the GStreamer bad 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.