Table of Contents

Class MultiQueueBlock

Namespace
VisioForge.Core.MediaBlocks.Special
Assembly
VisioForge.Core.dll

A specialized buffering block that provides multiple synchronized queues for handling multiple media streams. MultiQueue is designed to manage multiple data streams with intelligent buffering and synchronization, ensuring smooth playback and preventing starvation in multi-stream scenarios.

Key features:

  • Multiple independent queues with shared buffering logic
  • Automatic synchronization between streams
  • Dynamic buffer size management
  • Prevention of pipeline stalls in multi-stream scenarios
  • Thread decoupling for each stream
  • Configurable number of input/output pairs

Common use cases:

  • Handling multiple streams from demuxers (video + audio + subtitle)
  • Synchronizing streams with different data rates
  • Buffering before muxing multiple streams
  • Load balancing in parallel processing pipelines
  • Preventing thread blocking in complex pipelines
  • Managing streams with varying latencies

Technical details:

  • Each queue runs in its own thread for isolation
  • Implements intelligent buffering strategies
  • Shares memory limits across all queues
  • Handles format changes dynamically
  • Provides backpressure when buffers are full
  • More efficient than multiple separate Queue blocks

Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class MultiQueueBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

MultiQueueBlock(int)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.MultiQueueBlock class with specified number of queues.

public MultiQueueBlock(int inputOutputCount = 2)

Parameters

inputOutputCount int

The number of input/output pairs (queues) to create. Default is 2.

Properties

Input

Gets the first input pad of the multi-queue.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads for the multi-queue.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the first output pad of the multi-queue.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads for the multi-queue.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type identifier for this multi-queue.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the multiqueue within the media pipeline. Creates the specified number of queue pairs with synchronized buffering. This method is called automatically during pipeline construction.

public override bool Build()

Returns

bool

true if the multiqueue was successfully built; false if initialization failed.

CleanUp()

Performs cleanup of the multiqueue resources. Releases the GStreamer element and all associated queue structures.

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 GStreamer element wrapper for the multiqueue.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement instance wrapping the multiqueue element.

GetElement()

Gets the underlying GStreamer multiqueue element.

public Element GetElement()

Returns

Element

The native GStreamer multiqueue element.

IsAvailable()

Determines whether the multiqueue functionality is available in the current environment. This checks if the required GStreamer multiqueue element is installed.

public static bool IsAvailable()

Returns

bool

true if multiqueue is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this multiqueue block. This internal method establishes the connection to the parent pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocksPipeline that contains this block.

See Also