Table of Contents

Class UDPMPEGTSSinkBlock

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

Provides a media sink for streaming MPEG-TS content over UDP to a single destination.

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

Inheritance

Implements

Inherited Members

Extension Methods

Examples

var settings = new UDPSinkSettings
{
    Host = "192.168.1.100",
    Port = 5004,
    TTL = 64
};

var udpSink = new UDPMPEGTSSinkBlock(settings);

var videoInput = udpSink.CreateNewInput(MediaBlockPadMediaType.Video);
var audioInput = udpSink.CreateNewInput(MediaBlockPadMediaType.Audio);

pipeline.Connect(h264Encoder.Output, videoInput);
pipeline.Connect(aacEncoder.Output, audioInput);

Remarks

The UDPMPEGTSSinkBlock combines MPEG-TS multiplexing with UDP streaming to enable low-latency media transport. It multiplexes audio and video streams into MPEG-TS format and transmits them using the UDP protocol.

Key features include:

  • Low-latency UDP streaming
  • MPEG-TS multiplexing for multiple audio/video streams
  • Unicast and multicast support
  • Dynamic input creation for multiple streams
  • Configurable TTL, QoS, and buffer sizes

The block expects pre-encoded streams compatible with MPEG-TS format (H.264/H.265 video, AAC/MP3 audio). It first multiplexes streams into MPEG-TS, then transmits via UDP.

Constructors

UDPMPEGTSSinkBlock(UDPSinkSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.UDPMPEGTSSinkBlock class with the specified settings.

public UDPMPEGTSSinkBlock(UDPSinkSettings settings)

Parameters

settings UDPSinkSettings

The UDP sink configuration settings.

Properties

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 UDP MPEG-TS sink block.

public override bool Build()

Returns

bool

true if the block was successfully built; otherwise, false.

CleanUp()

Cleans up.

public void CleanUp()

CreateNewInput(MediaBlockPadMediaType)

Creates a new input pad for the specified media type.

public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

The type of media stream (video, audio, or subtitle) for the new input.

Returns

MediaBlockPad

A new VisioForge.Core.MediaBlocks.MediaBlockPad configured for the specified media type.

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 UDP streaming URL.

public string GetFilenameOrURL()

Returns

string

The configured UDP URL as a string.

GetInput(MediaBlockPadMediaType)

Retrieves an existing input pad of the specified media type.

public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

The media type to search for.

Returns

MediaBlockPad

The first VisioForge.Core.MediaBlocks.MediaBlockPad matching the specified type, or null if none exists.

InsertSpliceIn(uint, TimeSpan?)

Writes a SCTE-35 splice_insert "splice in" (back to the network feed) into the stream.

public bool InsertSpliceIn(uint eventId, TimeSpan? spliceTime)

Parameters

eventId uint

The splice_event_id of the break being ended.

spliceTime TimeSpan?

The splice point as pipeline running time, or null to splice immediately.

Returns

bool

true when the section was handed to the muxer; false when VisioForge.Core.Types.X.Sinks.UDPSinkSettingsBase.SCTE35PID was not set before the build, the sink is not built or a time is out of range.

Remarks

Send it near the end of the break, not right after the splice out, which it would replace.

InsertSpliceOut(uint, TimeSpan?, TimeSpan)

Writes a SCTE-35 splice_insert "splice out" (an ad break starts) into the stream.

public bool InsertSpliceOut(uint eventId, TimeSpan? spliceTime, TimeSpan duration)

Parameters

eventId uint

The splice_event_id; the matching VisioForge.Core.MediaBlocks.Sinks.UDPMPEGTSSinkBlock.InsertSpliceIn(System.UInt32,System.Nullable{System.TimeSpan}) uses the same one.

spliceTime TimeSpan?

The splice point as pipeline running time, or null to splice immediately.

duration TimeSpan

The break duration, up to about 26.5 hours, or Zero to leave it unset.

Returns

bool

true when the section was handed to the muxer; false when VisioForge.Core.Types.X.Sinks.UDPSinkSettingsBase.SCTE35PID was not set before the build, the sink is not built or a time is out of range.

Remarks

Call it while the pipeline runs, ahead of the splice point (SCTE 67 recommends 4 seconds or more). The timing rules and the single pending section described for VisioForge.Core.MediaBlocks.Sinks.MPEGTSSinkBlock.InsertSpliceOut(System.UInt32,System.Nullable{System.TimeSpan},System.TimeSpan) apply. Not available on Android, whose GStreamer build does not export the MPEG-TS section library.

IsAvailable()

Determines whether the UDP MPEG-TS sink functionality is available in the current environment.

public static bool IsAvailable()

Returns

bool

true if UDP streaming with MPEG-TS is supported; otherwise, false.

SetFilenameOrURL(string)

Sets the UDP streaming URL.

public void SetFilenameOrURL(string value)

Parameters

value string

The new UDP URL string.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The pipeline.

See Also