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, IMediaBlockInternalsInheritance
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
renderVideobool-
if set to
true, decodes and outputs video streams. Default is true. renderAudiobool-
if set to
true, decodes and outputs audio streams. Default is true. renderSubtitlebool-
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
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
Input
Gets the input pad for receiving encoded media data.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the array of input pads. This block has a single input for encoded media.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad, prioritizing video, then audio, then subtitle.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all configured output pads based on enabled stream types.
public override MediaBlockPad[] Outputs { get; }Property Value
SubtitleOutput
Gets the subtitle output pad providing decoded subtitle data.
public MediaBlockPad SubtitleOutput { get; }Property Value
Type
Gets the media block type identifier for this decode bin.
public override MediaBlockType Type { get; }Property Value
VideoOutput
Gets the video output pad providing decoded raw video frames.
public MediaBlockPad VideoOutput { get; }Property Value
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
-
trueif the decode bin was successfully built;falseif 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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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
-
trueif 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
pipelineMediaBlocksPipeline-
The parent MediaBlocksPipeline that contains this block.