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 IMediaBlocksPipelineProperties
State
Gets the current playback state of the pipeline (stopped, playing, paused, etc.).
PlaybackState State { get; }Property Value
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
blockIMediaBlock-
The media block to add to the pipeline (source, effect, encoder, sink, etc.).
Returns
- bool
-
trueif the block was successfully added,falseotherwise.
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
-
trueif the pipeline was successfully built,falseif 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
outputMediaBlockPad-
The output pad from the source media block.
inputMediaBlockPad-
The input pad of the destination media block.
Returns
- bool
-
trueif the connection was established successfully,falseotherwise.
GetBlock(string)
Retrieves a media block from the pipeline by its unique name identifier.
IMediaBlock GetBlock(string name)Parameters
namestring-
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
-
trueif the pipeline was successfully paused,falseotherwise.
Resume()
Resumes pipeline execution from a paused state, continuing media processing from the current position.
bool Resume()Returns
- bool
-
trueif the pipeline was successfully resumed,falseotherwise.
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
onlyPreloadbool-
If set to
true, only preloads the pipeline and sets it to paused state without starting playback.
Returns
- bool
-
trueif the pipeline started successfully,falseotherwise.
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
forcebool-
If set to
true, forces an immediate stop without waiting for graceful shutdown.
Returns
- bool
-
trueif the pipeline stopped successfully,falseotherwise.
OnError
Event raised when an error occurs during pipeline execution. Provides detailed error information for debugging and error handling.
event EventHandler<ErrorsEventArgs> OnError