Table of Contents

Class BridgeBufferSinkBlock

Namespace
VisioForge.Core.MediaBlocks.Bridge
Assembly
VisioForge.Core.dll

Buffer sink block that bridges raw buffer data between different pipelines using a pair-based communication system. This block acts as an endpoint that receives buffer data and makes it available to a corresponding BridgeBufferSourceBlock through a unique pair identifier. Unlike channel-based bridges, this uses direct buffer passing for lower latency and supports any media type including video, audio, or custom data. The bridge maintains a cache of sink/source pairs for efficient lookup and connection. Common use cases include zero-copy data transfer between pipelines, implementing custom processing chains with raw buffers, and creating high-performance media routing systems. The video information parameter helps optimize buffer handling for video streams but the block can handle any buffer type. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals.

public class BridgeBufferSinkBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

BridgeBufferSinkBlock(string, VideoFrameInfoX)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Bridge.BridgeBufferSinkBlock class with specified pair ID and optional video information. Creates a bridge buffer sink that will send buffer data to the source with matching pair ID. The sink is automatically registered in the global bridge cache for discovery by sources.

public BridgeBufferSinkBlock(string pairID, VideoFrameInfoX videoInfo)

Parameters

pairID string

The unique identifier that pairs this sink with its corresponding source.

videoInfo VideoFrameInfoX

Optional video frame information for optimizing video buffer handling. Can be null for non-video data.

Properties

Input

Gets the single input pad for this sink block.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads. This sink has a single input that accepts any media type.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad. Bridge sinks do not have outputs as they are terminal blocks.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads. Bridge sinks have no outputs as they are terminal blocks.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

PairID

Gets or sets the unique pair identifier that links this sink to its corresponding source. Both sink and source must use the same pair ID for successful connection.

public string PairID { get; set; }

Property Value

string

Type

Gets the block type identifier for this bridge buffer sink.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the bridge buffer sink within the pipeline. Creates the bridge element with the specified pair ID, registers it for discovery, and establishes pad connections. The sink will buffer data until a matching source connects.

public override bool Build()

Returns

bool

true if the bridge sink was successfully built; false if an error occurred.

CleanUp()

Performs cleanup operations for the bridge buffer sink. Note: The actual element disposal is handled in the Dispose method to ensure proper removal from the bridge cache before releasing resources.

public void CleanUp()

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 BaseElement wrapper for the bridge buffer sink.

public BaseElement GetCore()

Returns

BaseElement

The BridgeBufferSink element that manages the buffer passing.

GetElement()

Gets the underlying GStreamer element for this bridge sink.

public Element GetElement()

Returns

Element

The GStreamer element that handles buffer bridging.

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.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context for this bridge sink, providing access to shared resources. This method is called internally during pipeline construction.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline that owns this bridge sink.

See Also