Table of Contents

Class MPEGAudioParseBlock

Namespace
VisioForge.Core.MediaBlocks.Parsers
Assembly
VisioForge.Core.dll

Parses MPEG Audio (MP1/MP2/MP3) bitstreams for frame boundary detection and audio parameter extraction.

public class MPEGAudioParseBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

The MPEGAudioParseBlock processes MPEG-1 Audio Layer I/II/III and MPEG-2 Audio bitstreams, parsing frame headers to ensure proper frame boundaries and extract audio properties. This includes the widely-used MP3 format as well as MP2 (used in broadcasting) and MP1.

Key features: - Frame header parsing for all MPEG audio layers (I, II, III) - Bitrate detection (CBR and VBR with Xing/VBRI headers) - Sample rate and channel configuration extraction - CRC error detection for protected frames - ID3v1 and ID3v2 tag preservation - Gapless playback support via LAME/encoder delay info - Free format bitstream support

Common use cases: - Streaming: Preparing MP3/MP2 for HTTP Live Streaming or Icecast - Muxing: Packaging MPEG audio into containers like MP4, MKV, or TS - Transcoding: Providing properly framed audio to MPEG audio decoders - Broadcasting: Processing MP2 audio in DVB and DAB applications - Audio analysis: Extracting bitrate, duration, and encoding parameters

The parser handles various MPEG audio versions and layers: - MPEG-1 Audio Layer I (MP1): 32-448 kbps - MPEG-1 Audio Layer II (MP2): 32-384 kbps - MPEG-1 Audio Layer III (MP3): 32-320 kbps - MPEG-2 LSF (Lower Sampling Frequencies) extensions - MPEG-2.5 unofficial extension for very low bitrates

Constructors

MPEGAudioParseBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.Parsers.MPEGAudioParseBlock class.

public MPEGAudioParseBlock()

Remarks

Creates input and output pads configured for audio media type. The parser will automatically detect the MPEG audio layer (I, II, or III) and version (MPEG-1, MPEG-2, or MPEG-2.5) from the frame headers.

Properties

Input

Gets the primary input pad for receiving MPEG audio bitstream data.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads available on this block.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad that provides parsed MPEG audio frames.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads available on this block.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the type of this media block.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the MPEG audio parser element within the media pipeline.

public override bool Build()

Returns

bool

true if the parser was successfully created and configured; false if initialization failed or required plugins are missing.

Remarks

This method creates the GStreamer MPEG audio parser element, initializes it within the pipeline context, and connects the input/output pads. The parser will begin processing audio frames 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

disposing bool

true to release both managed and unmanaged resources; false to 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 audio frame parsing.

IsAvailable()

Determines whether the MPEG audio parser is available in the current GStreamer installation.

public static bool IsAvailable()

Returns

bool

true if the MPEG audio parser plugin is available; otherwise, false. This requires the GStreamer good plugins to be installed.

Remarks

The MPEG audio parser is provided by the GStreamer good 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

pipeline MediaBlocksPipeline

The media pipeline that will contain this parser block.

See Also