Table of Contents

Class DecodeBinBlock

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

An intelligent decoding block that automatically detects and decodes various media formats into raw streams. DecodeBin analyzes incoming media data, identifies the format and codecs, and constructs an appropriate decoding pipeline to produce raw video, audio, and subtitle outputs.

Key features:

  • Automatic format detection and codec selection
  • Support for virtually any media format GStreamer can decode
  • Dynamic pad creation for discovered streams
  • Separate outputs for video, audio, and subtitle streams
  • Built-in format conversion for consistent output
  • Configurable stream selection (video/audio/subtitle)

Common use cases:

  • Decoding media files with unknown or variable formats
  • Processing network streams with dynamic content
  • Building flexible media players that handle any format
  • Extracting raw streams from container formats
  • Media analysis and transcoding pipelines
  • Multi-stream processing applications

Technical details:

  • Uses GStreamer's decodebin element for intelligent decoding
  • Automatically constructs decoder chains based on stream caps
  • Includes queue elements for each stream to handle threading
  • Video output includes format conversion to standard formats
  • Audio output can optionally include format conversion
  • Handles dynamic stream addition during playback

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

public class DecodeBinBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

DecodeBinBlock(bool, bool, bool)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.DecodeBinBlock class with specified stream types.

public DecodeBinBlock(bool renderVideo = true, bool renderAudio = true, bool renderSubtitle = false)

Parameters

renderVideo bool

if set to true, decodes and outputs video streams. Default is true.

renderAudio bool

if set to true, decodes and outputs audio streams. Default is true.

renderSubtitle bool

if set to true, decodes and outputs subtitle streams. Default is false.

Properties

AudioOutput

Gets the audio output pad providing decoded raw audio samples.

public MediaBlockPad AudioOutput { get; }

Property Value

MediaBlockPad

DisableAudioConverter

Gets or sets a value indicating whether to disable automatic audio format conversion. When true, audio is passed through without format conversion, preserving the decoded format.

public bool DisableAudioConverter { get; set; }

Property Value

bool

Input

Gets the input pad for receiving encoded media data.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of input pads. This block has a single input for encoded media.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad, prioritizing video, then audio, then subtitle.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all configured output pads based on enabled stream types.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

SubtitleOutput

Gets the subtitle output pad providing decoded subtitle data.

public MediaBlockPad SubtitleOutput { get; }

Property Value

MediaBlockPad

Type

Gets the media block type identifier for this decode bin.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

VideoOutput

Gets the video output pad providing decoded raw video frames.

public MediaBlockPad VideoOutput { get; }

Property Value

MediaBlockPad

Methods

Build()

Builds and initializes the decode bin within the media pipeline. Sets up the decodebin element, creates queues and converters for each stream type, and configures dynamic pad handling for stream discovery.

public override bool Build()

Returns

bool

true if the decode bin was successfully built; false if initialization failed.

CleanUp()

Performs cleanup of all decode bin resources including queues and converters. Releases all GStreamer elements and resets the build state.

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 decode bin.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement instance wrapping the decodebin element.

GetElement()

Gets the underlying GStreamer decodebin element.

public Element GetElement()

Returns

Element

The native GStreamer decodebin element.

IsAvailable()

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

public static bool IsAvailable()

Returns

bool

true if decodebin is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this decode bin 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