Table of Contents

Class ASFSinkBlock

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

ASF (Advanced Systems Format) sink block for writing media streams to ASF/WMV/WMA container files.

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

Inheritance

Implements

Inherited Members

Extension Methods

Remarks

The ASF sink block supports writing audio and video streams to the Advanced Systems Format container, commonly used for Windows Media files (.wmv for video, .wma for audio, .asf for generic content). This format is optimized for streaming and supports advanced features like DRM, multiple bitrates, and metadata embedding.

Key Features:

  • Support for multiple audio and video streams
  • Windows Media Video (WMV) and Windows Media Audio (WMA) codec support
  • Metadata and tagging support
  • Suitable for both local file storage and streaming scenarios
  • Compatible with Windows Media Player and other ASF-compliant players

Typical Use Cases:

  • Creating Windows Media files for playback on Windows systems
  • Recording video content for streaming over Windows Media Services
  • Archiving media in a format with good compression and quality balance
  • Creating content for legacy Windows-based media systems

Limitations:

  • Limited codec support (primarily WMV/WMA codecs)
  • Less universal playback support compared to MP4 or MKV
  • Proprietary format with potential licensing considerations

Constructors

ASFSinkBlock(ASFSinkSettings)

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

public ASFSinkBlock(ASFSinkSettings settings)

Parameters

settings ASFSinkSettings

The VisioForge.Core.Types.X.Sinks.ASFSinkSettings object containing configuration for the ASF output, including the target filename, encoding parameters, and metadata options.

Properties

Input

Gets the first input pad from the collection of available inputs.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all available input pads for connecting multiple media streams.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad for this sink block.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads for this sink block.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the ASF sink configuration settings.

public ASFSinkSettings Settings { get; set; }

Property Value

ASFSinkSettings

Type

Gets the media block type identifier for the ASF sink.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the ASF sink pipeline components.

public override bool Build()

Returns

bool

true if the sink was successfully built and all requested input pads were created; false if initialization failed or required pads couldn't be allocated.

Remarks

This method creates the underlying GStreamer ASF muxer element and configures input pads for each media stream that was previously added via VisioForge.Core.MediaBlocks.Sinks.ASFSinkBlock.CreateNewInput(VisioForge.Core.MediaBlocks.MediaBlockPadMediaType). The method is idempotent and will return immediately if already built.

CleanUp()

Cleans up resources and resets the sink block to an unbuilt state.

public void CleanUp()

Remarks

This method disposes of the underlying GStreamer element and resets the build state, allowing the block to be rebuilt with new settings if needed.

CreateNewInput(MediaBlockPadMediaType)

Creates a new input pad for connecting a media stream of the specified type.

public MediaBlockPad CreateNewInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

The type of media stream to accept on this input pad. Supported types include: VisioForge.Core.MediaBlocks.MediaBlockPadMediaType.Video for video streams and VisioForge.Core.MediaBlocks.MediaBlockPadMediaType.Audio for audio streams.

Returns

MediaBlockPad

A new VisioForge.Core.MediaBlocks.MediaBlockPad configured for the specified media type, which can be used to connect upstream media sources or processing blocks.

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 wrapper element for advanced pipeline integration.

public BaseElement GetCore()

Returns

BaseElement

The VisioForge.Core.GStreamer.Base.BaseElement wrapper that provides access to the underlying GStreamer ASF muxer element for advanced configuration and pipeline operations.

GetElement()

Gets the native GStreamer element for direct GStreamer API access.

public Element GetElement()

Returns

Element

The underlying Gst.Element representing the ASF muxer, allowing direct access to GStreamer properties and methods when needed.

GetFilenameOrURL()

Gets the output filename or URL where the ASF file will be written.

public string GetFilenameOrURL()

Returns

string

The file path or URL string specified in the settings. For local files, this should be an absolute or relative file path.

GetInput(MediaBlockPadMediaType)

Gets an existing input pad that matches the specified media type.

public MediaBlockPad GetInput(MediaBlockPadMediaType mediaType)

Parameters

mediaType MediaBlockPadMediaType

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 null if 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

true if this media block is available; otherwise, false.

SetFilenameOrURL(string)

Sets the output filename or URL for the ASF file.

public void SetFilenameOrURL(string value)

Parameters

value string

The file path or URL where the ASF file should be written. For local files, use a standard file path. The directory must exist.

Remarks

This method updates both the settings and the underlying GStreamer element if the sink has already been built. Changing the filename during recording may not be supported and could cause errors.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context for this media block.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

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.

See Also