Table of Contents

Class MPEGPSSinkBlock

Namespace
VisioForge.Core.MediaBlocks.Sinks
Assembly
VisioForge.Core.dll

Implements a sink block for creating MPEG Program Stream (MPEG-PS) files. Generates DVD-compatible video files and supports legacy MPEG-1/2 workflows.

public class MPEGPSSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputs

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

The MPEGPSSinkBlock creates MPEG Program Stream files, a container format primarily used for: - DVD-Video authoring and playback - MPEG-1 and MPEG-2 video storage - Legacy video archiving systems - Standalone media player compatibility

MPEG-PS characteristics: - Designed for reliable storage media (DVDs, hard drives) - Contains timing information for synchronized playback - Supports multiple video and audio streams - Variable bitrate encoding support - System clock reference (SCR) for timing

Typical stream configurations: - Video: MPEG-2 (DVD), MPEG-1 (VCD) - Audio: MPEG-1 Layer II (MP2), AC-3, PCM - Subtitles: DVD subpicture format - Maximum bitrate: 10.08 Mbps for DVD compliance

Common use cases: - DVD authoring and production - Legacy video system compatibility - Archival storage of MPEG content - Set-top box and hardware player support

Constructors

MPEGPSSinkBlock(string)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.MPEGPSSinkBlock class.

public MPEGPSSinkBlock(string filename)

Parameters

filename string

The full path to the output MPEG-PS file.

Remarks

Use .mpg or .mpeg extension for general use, or .vob for DVD-Video files. Ensure the output directory exists and has write permissions.

Exceptions

ArgumentNullException

Thrown when filename is null or empty.

Properties

Filename

Gets or sets the output filename for the MPEG-PS file.

public string Filename { get; set; }

Property Value

string

Remarks

For DVD compliance, ensure the filename follows DVD naming conventions (e.g., VTS_01_1.VOB for DVD-Video).

Input

Gets the first 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[]

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds the MPEG-PS sink and prepares it for multiplexing.

public override bool Build()

Returns

bool

true if the build was successful; otherwise, false.

Remarks

This method creates the MPEG-PS muxer and configures input pads for all connected streams. The muxer will handle proper packet interleaving and timing information generation.

CleanUp()

Performs cleanup of resources used by the MPEG-PS sink.

public void CleanUp()

Remarks

This method finalizes the MPEG-PS file structure, ensures all packets are written, and releases the underlying muxer element.

CreateNewInput(MediaBlockPadMediaType)

Creates a new input pad for adding a stream to the MPEG-PS file.

public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

The type of stream to add (video, audio, or subtitle).

Returns

MediaBlockPad

A new VisioForge.Core.MediaBlocks.MediaBlockPad for connecting the media stream.

Remarks

For DVD compliance:

  • Video: MPEG-2 at 720x480 (NTSC) or 720x576 (PAL)
  • Audio: AC-3, MP2, or PCM
  • Subtitles: DVD subpicture format

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 core.

public BaseElement GetCore()

Returns

BaseElement

VisioForge.Core.GStreamer.Base.BaseElement.

GetElement()

Gets the element.

public Element GetElement()

Returns

Element

Gst.Element.

GetFilenameOrURL()

Gets the output filename for the MPEG-PS file.

public string GetFilenameOrURL()

Returns

string

The full path to the output MPEG-PS file.

GetInput(MediaBlockPadMediaType)

Gets the existing input.

public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

Type of the media.

Returns

MediaBlockPad

MediaBlockPad.

IsAvailable()

Determines whether MPEG-PS muxing functionality is available on the current platform.

public static bool IsAvailable()

Returns

bool

true if MPEG-PS sink is available; otherwise, false. Requires GStreamer's mpegpsmux element.

Remarks

MPEG-PS support is typically available in GStreamer's bad plugins package. DVD-compliant muxing may require additional configuration.

SetFilenameOrURL(string)

Sets the output filename for the MPEG-PS file.

public void SetFilenameOrURL(string value)

Parameters

value string

The full path where the MPEG-PS file should be written.

Remarks

Changing the filename after the pipeline has started requires a pipeline restart. For DVD authoring, follow proper naming conventions.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The pipeline.

See Also