Class QueueBlock
- Namespace
- VisioForge.Core.MediaBlocks.Special
- Assembly
- VisioForge.Core.dll
A fundamental buffering block that provides thread decoupling and data buffering in media pipelines. The Queue block acts as a buffer between pipeline elements, allowing upstream and downstream components to operate at different rates and in different threads.
Key features:
- Thread boundary creation for pipeline parallelization
- Configurable buffer sizes (bytes, time, buffers)
- Prevents pipeline stalls and deadlocks
- Smooth data flow between elements with different processing speeds
- Automatic format negotiation passthrough
- Low latency buffering with minimal overhead
Common use cases:
- Decoupling slow sources from fast sinks
- Creating thread boundaries in pipelines
- Buffering before computationally intensive operations
- Smoothing bursty data flows
- Preventing blocking in real-time pipelines
- Isolating pipeline segments for stability
Technical details:
- Runs source and sink pads in separate threads
- Implements configurable high/low watermarks
- Provides backpressure when full
- Handles format changes and events properly
- Can operate in push or pull mode
- Memory-efficient ring buffer implementation
Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class QueueBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
QueueBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.QueueBlock class with default buffer settings. The queue will use automatic buffer size management based on available system resources.
public QueueBlock()Properties
Input
Gets the input pad for receiving media data.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the array of input pads. This block has a single input.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad that provides buffered media data.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the array of output pads. This block has a single output.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the media block type identifier for this queue.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the queue within the media pipeline. Creates the buffering element and establishes pad connections. This method is called automatically during pipeline construction.
public override bool Build()Returns
- bool
-
trueif the queue was successfully built;falseif initialization failed.
CleanUp()
Performs cleanup of the queue resources. Releases the GStreamer element and clears buffered data.
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 GStreamer element wrapper for the queue.
public BaseElement GetCore()Returns
- BaseElement
-
The BaseElement instance wrapping the queue element.
GetElement()
Gets the underlying GStreamer queue element.
public Element GetElement()Returns
- Element
-
The native GStreamer queue element.
IsAvailable()
Determines whether the queue functionality is available in the current environment. This is a core GStreamer element and should always be available.
public static bool IsAvailable()Returns
- bool
-
trueif queue element is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this queue block. This internal method establishes the connection to the parent pipeline.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocksPipeline that contains this block.