Class DASHSinkBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sinks
- Assembly
- VisioForge.Core.dll
DASH (Dynamic Adaptive Streaming over HTTP) sink block for creating adaptive streaming content.
public class DASHSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlockDynamicInputsInheritance
Implements
Inherited Members
Extension Methods
Remarks
The DASH sink block generates MPEG-DASH content, an international standard for adaptive bitrate streaming. DASH works by breaking the overall stream into a sequence of small HTTP-based file segments, each representing a short interval of playback time. This enables adaptive streaming, VOD, and live broadcasts.
Key Features:
- Adaptive bitrate streaming support
- Automatic generation of MPD (Media Presentation Description) manifest files
- Configurable segment duration and buffering parameters
- Support for both live and on-demand content
- Compatible with all major browsers and streaming platforms
- Multi-period support for different quality levels
Typical Use Cases:
- Live streaming to browsers and mobile devices
- Creating VOD content for web-based video players
- Building adaptive streaming solutions
- Streaming to smart TVs and set-top boxes
- CDN-friendly content distribution
Technical Specifications:
- Segment format: ISO BMFF (fragmented MP4) files
- Video codecs: H.264/AVC, H.265/HEVC, VP9, AV1
- Audio codecs: AAC, MP3, Opus
- Manifest format: MPD (Media Presentation Description) XML
- Default segment duration: 5 seconds (configurable)
Output Structure: The sink creates a directory structure with an MPD manifest file and segment files. For live streaming, old segments are automatically removed based on time shift buffer settings.
Constructors
DASHSinkBlock(DASHSinkSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sinks.DASHSinkBlock class with the specified settings.
public DASHSinkBlock(DASHSinkSettings settings)Parameters
settingsDASHSinkSettings-
The VisioForge.Core.Types.X.Sinks.DASHSinkSettings object containing configuration for DASH output, including the target directory, segment parameters, and manifest options.
Properties
Input
Gets the first input pad from the collection of available inputs.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all available input pads for connecting multiple media streams.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad for this sink block.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads for this sink block.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the DASH sink configuration settings.
public DASHSinkSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for the DASH sink.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the DASH sink pipeline components.
public override bool Build()Returns
- bool
-
trueif the sink was successfully built and configured;falseif initialization failed or required pads couldn't be allocated.
Remarks
This method creates the underlying GStreamer DASH sink element and configures separate video and audio input pads. The sink will create the output directory structure and begin generating manifest files when the pipeline starts.
CleanUp()
Cleans up resources and resets the sink block to an unbuilt state.
public void CleanUp()Remarks
This method disposes of the underlying GStreamer DASH sink element. Any incomplete segments may be finalized and the manifest updated before cleanup.
CreateNewInput(MediaBlockPadMediaType)
Creates a new input pad for connecting a media stream of the specified type.
public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The type of media stream to accept. DASH supports: VisioForge.Core.MediaBlocks.MediaBlockPadMediaType.Video for video streams (H.264/H.265/VP9/AV1) and VisioForge.Core.MediaBlocks.MediaBlockPadMediaType.Audio for audio streams (AAC/MP3/Opus).
Returns
- MediaBlockPad
-
A new VisioForge.Core.MediaBlocks.MediaBlockPad configured for the specified media type, ready to receive encoded streams for DASH segmentation.
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 wrapper element for advanced pipeline integration.
public BaseElement GetCore()Returns
- BaseElement
-
The VisioForge.Core.GStreamer.Base.BaseElement wrapper providing access to the underlying GStreamer DASH sink element for advanced configuration.
GetElement()
Gets the native GStreamer element for direct GStreamer API access.
public Element GetElement()Returns
- Element
-
The underlying Gst.Element representing the DASH sink, allowing direct access to properties like segment duration and manifest settings.
GetFilenameOrURL()
Gets the output location where DASH segments and manifest will be written.
public string GetFilenameOrURL()Returns
- string
-
The MPD filename path specified in the settings. This location will contain the master manifest and segment files.
GetInput(MediaBlockPadMediaType)
Gets an existing input pad that matches the specified media type.
public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)Parameters
mediaTypeMediaBlockPadMediaType-
The media type to search for among existing input pads.
Returns
- MediaBlockPad
-
The first VisioForge.Core.MediaBlocks.MediaBlockPad that matches the specified media type, or
nullif no matching input pad exists.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
SetFilenameOrURL(string)
Sets the output location for DASH manifest.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The file path where the MPD manifest should be written. The directory will be created if it doesn't exist.
Exceptions
- NotImplementedException
-
This method is not currently implemented. Configure the location through settings instead.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this media block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The VisioForge.Core.MediaBlocks.MediaBlocksPipeline that owns this sink block, providing access to the pipeline context and logging facilities.
Remarks
This method is called internally by the pipeline during initialization and should not be called directly by user code.