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, IMediaBlockInternalsInheritance
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
pairIDstring-
The unique identifier that pairs this sink with its corresponding source.
videoInfoVideoFrameInfoX-
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
Inputs
Gets all input pads. This sink has a single input that accepts any media type.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad. Bridge sinks do not have outputs as they are terminal blocks.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. Bridge sinks have no outputs as they are terminal blocks.
public override MediaBlockPad[] Outputs { get; }Property Value
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
Type
Gets the block type identifier for this bridge buffer sink.
public override MediaBlockType Type { get; }Property Value
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
-
trueif the bridge sink was successfully built;falseif 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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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
-
trueif 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
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline that owns this bridge sink.