Class MultiUDPMPEGTSSinkBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sinks
- Assembly
- VisioForge.Core.dll
Provides a media sink for streaming MPEG-TS content over UDP to multiple destinations simultaneously.
public class MultiUDPMPEGTSSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputsInheritance
Implements
Inherited Members
Extension Methods
Examples
var settings = new MultiUDPSinkSettings();
settings.AddClient("192.168.1.100", 5004);
settings.AddClient("192.168.1.101", 5004);
var multiUdpSink = new MultiUDPMPEGTSSinkBlock(settings);
var videoInput = multiUdpSink.CreateNewInput(MediaBlockPadMediaType.Video);
var audioInput = multiUdpSink.CreateNewInput(MediaBlockPadMediaType.Audio);
pipeline.Connect(h264Encoder.Output, videoInput);
pipeline.Connect(aacEncoder.Output, audioInput);
Remarks
The MultiUDPMPEGTSSinkBlock combines MPEG-TS multiplexing with multi-destination UDP streaming. It multiplexes audio and video streams into MPEG-TS format and transmits them to one or more destinations specified as comma-separated host:port pairs.
Key features include:
- Multi-destination MPEG-TS streaming
- Low-latency UDP transport
- Unicast and multicast support
- Dynamic input creation for multiple streams
- Runtime add/remove of destinations
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 to all destinations.
Constructors
MultiUDPMPEGTSSinkBlock(MultiUDPSinkSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.MultiUDPMPEGTSSinkBlock class with the specified settings.
public MultiUDPMPEGTSSinkBlock(MultiUDPSinkSettings settings)Parameters
settingsMultiUDPSinkSettings-
The multi-destination UDP sink configuration settings.
Properties
Input
Gets the first input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the multi-destination UDP MPEG-TS sink block.
public override bool Build()Returns
- bool
-
trueif 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
mediaTypeMediaBlockPadMediaType-
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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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 destination clients list.
public string GetFilenameOrURL()Returns
- string
-
The configured clients as a comma-separated string.
GetInput(MediaBlockPadMediaType)
Retrieves an existing input pad of the specified media type.
public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The media type to search for.
Returns
- MediaBlockPad
-
The first VisioForge.Core.MediaBlocks.MediaBlockPad matching the specified type, or
nullif none exists.
IsAvailable()
Determines whether the multi-destination UDP MPEG-TS sink functionality is available in the current environment.
public static bool IsAvailable()Returns
- bool
-
trueif multi-destination UDP streaming with MPEG-TS is supported; otherwise,false.
SetFilenameOrURL(string)
Sets the destination clients list.
public void SetFilenameOrURL(string value)Parameters
valuestring-
A comma-separated list of host:port pairs.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.