Table of Contents

Class CustomMediaBlock

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

A flexible media block that allows integration of any GStreamer element or bin into the MediaBlocks pipeline. This block serves as a bridge between the MediaBlocks abstraction and raw GStreamer elements, enabling use of specialized or custom GStreamer components not wrapped by standard blocks.

Key features:

  • Support for any GStreamer element by name or bin description
  • Dynamic pad configuration with automatic or manual pad handling
  • Property setting through key-value parameters
  • Support for elements with dynamic pads (pad-added event)
  • Optional caps filtering on output pads
  • Property introspection for debugging

Common use cases:

  • Integrating third-party GStreamer plugins
  • Using experimental or platform-specific elements
  • Creating complex processing chains with bin descriptions
  • Prototyping new functionality before creating dedicated blocks
  • Accessing GStreamer elements not yet wrapped in MediaBlocks

Technical details:

  • Can create elements from factory names or parse bin descriptions
  • Supports multiple input and output pads with configurable media types
  • Handles dynamic pad creation for elements like demuxers
  • Provides property mapping for various data types (int, float, string, enum)
  • Uses identity elements for dynamic pad connection management

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

public class CustomMediaBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

CustomMediaBlock(CustomMediaBlockSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.CustomMediaBlock class with the specified configuration.

public CustomMediaBlock(CustomMediaBlockSettings settings)

Parameters

settings CustomMediaBlockSettings

The settings defining the GStreamer element name, parameters, and pad configuration.

Properties

Input

Gets the primary input pad of the custom block.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads configured for this custom block.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad of the custom block.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads configured for this custom block.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type identifier for custom blocks.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and configures the custom GStreamer element within the media pipeline. Creates the element from name or bin description, sets properties, configures pads, and handles dynamic pad scenarios if enabled.

public override bool Build()

Returns

bool

true if the element was successfully created and configured; false if initialization failed.

CleanUp()

Performs cleanup of the custom element and associated resources. Removes event handlers, disposes of the GStreamer element and identity helpers.

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 element wrapper. Returns null as custom blocks don't use BaseElement wrappers.

public BaseElement GetCore()

Returns

BaseElement

Always returns null for custom blocks.

GetElement()

Gets the underlying GStreamer element created from the configuration.

public Element GetElement()

Returns

Element

The native GStreamer element or bin.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this custom 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.

OnElementAdded

Occurs after the GStreamer element has been created and added to the pipeline. This event allows for additional configuration or property setting on the raw element.

public event EventHandler<Element> OnElementAdded

Event Type

EventHandler<Element>

See Also