Class BridgeBufferSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Bridge
- Assembly
- VisioForge.Core.dll
Buffer source block that bridges raw buffer data from other pipelines using a pair-based communication system. This block acts as a source that receives buffer data from a BridgeBufferSinkBlock with a matching 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 source automatically discovers its corresponding sink through the global bridge cache and establishes the connection during build time. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class BridgeBufferSourceBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
BridgeBufferSourceBlock(string)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Bridge.BridgeBufferSourceBlock class with specified pair ID. Creates a bridge buffer source that will receive buffer data from the sink with matching pair ID. The source is automatically registered in the global bridge cache for discovery by sinks.
public BridgeBufferSourceBlock(string pairID)Parameters
pairIDstring-
The unique identifier that pairs this source with its corresponding sink.
Properties
Input
Gets the input pad. Bridge sources do not have inputs as they generate data from a paired sink.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads. Bridge sources have no inputs as they generate data from a paired sink.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the single output pad for this source block.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. This source has a single output that provides any media type.
public override MediaBlockPad[] Outputs { get; }Property Value
PairID
Gets or sets the unique pair identifier that links this source to its corresponding sink. 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 source.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the bridge buffer source within the pipeline. Discovers the corresponding sink through the bridge cache, creates the bridge element, and establishes pad connections. If no sink is found, creates a placeholder that will connect when the sink becomes available.
public override bool Build()Returns
- bool
-
trueif the bridge source was successfully built;falseif an error occurred.
CleanUp()
Performs cleanup operations for the bridge buffer source. 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 source. Note: This implementation returns null as the buffer source uses a different architecture.
public BaseElement GetCore()Returns
- BaseElement
-
Always returns null for buffer sources.
GetElement()
Gets the underlying GStreamer element for this bridge source.
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 source, 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 source.