Table of Contents

Interface IMediaBlocksPipeline

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

Core interface for the MediaBlocks pipeline system that manages the lifecycle and coordination of media processing blocks. This interface defines the contract for building complex media processing workflows by adding, connecting, and controlling multiple media blocks (sources, effects, encoders, sinks). The pipeline handles the underlying GStreamer implementation and provides a high-level API for media processing operations including playback control, block management, and error handling.

public interface IMediaBlocksPipeline

Properties

State

Gets the current playback state of the pipeline (stopped, playing, paused, etc.).

PlaybackState State { get; }

Property Value

PlaybackState

Methods

AddBlock(IMediaBlock)

Adds a media block to the pipeline for processing. The block will be automatically integrated into the pipeline's lifecycle management and can be connected to other blocks.

bool AddBlock(IMediaBlock block)

Parameters

block IMediaBlock

The media block to add to the pipeline (source, effect, encoder, sink, etc.).

Returns

bool

true if the block was successfully added, false otherwise.

Build()

Builds the complete pipeline by creating and configuring all underlying GStreamer elements and establishing the connections between media blocks. This must be called before starting playback.

bool Build()

Returns

bool

true if the pipeline was successfully built, false if an error occurred.

Connect(MediaBlockPad, MediaBlockPad)

Connects two media blocks by linking an output pad from one block to an input pad of another block. This establishes the data flow path in the media processing pipeline.

bool Connect(MediaBlockPad output, MediaBlockPad input)

Parameters

output MediaBlockPad

The output pad from the source media block.

input MediaBlockPad

The input pad of the destination media block.

Returns

bool

true if the connection was established successfully, false otherwise.

GetBlock(string)

Retrieves a media block from the pipeline by its unique name identifier.

IMediaBlock GetBlock(string name)

Parameters

name string

The unique name of the block to retrieve.

Returns

IMediaBlock

The media block with the specified name, or null if not found.

GetBlock(MediaBlockType)

Retrieves the first media block of the specified type from the pipeline. Useful for finding blocks by their functional category (source, sink, effect, etc.).

IMediaBlock GetBlock(MediaBlockType type_)

Parameters

type_ MediaBlockType

The type of media block to search for.

Returns

IMediaBlock

The first media block of the specified type, or null if not found.

GetContext()

Gets the GStreamer context that provides access to the underlying pipeline infrastructure, including the GStreamer pipeline object, bus, and other low-level components.

ContextX GetContext()

Returns

ContextX

The ContextX instance containing GStreamer pipeline infrastructure.

Pause()

Pauses the pipeline execution, temporarily halting media processing while maintaining the current state. The pipeline can be resumed from the current position using Resume().

bool Pause()

Returns

bool

true if the pipeline was successfully paused, false otherwise.

Resume()

Resumes pipeline execution from a paused state, continuing media processing from the current position.

bool Resume()

Returns

bool

true if the pipeline was successfully resumed, false otherwise.

Start(bool)

Starts the pipeline execution, beginning media processing and playback. The pipeline must be built before calling this method.

bool Start(bool onlyPreload = false)

Parameters

onlyPreload bool

If set to true, only preloads the pipeline and sets it to paused state without starting playback.

Returns

bool

true if the pipeline started successfully, false otherwise.

Stop(bool)

Stops the pipeline execution and halts all media processing. This will bring the pipeline to a complete stop and free up resources.

bool Stop(bool force = false)

Parameters

force bool

If set to true, forces an immediate stop without waiting for graceful shutdown.

Returns

bool

true if the pipeline stopped successfully, false otherwise.

OnError

Event raised when an error occurs during pipeline execution. Provides detailed error information for debugging and error handling.

event EventHandler<ErrorsEventArgs> OnError

Event Type

EventHandler<ErrorsEventArgs>