Class AudioConverterBlock
- Assembly
- VisioForge.Core.dll
Audio format converter block that transforms audio data between different formats, sample rates, and channel configurations. This block provides automatic audio format conversion capabilities within a media processing pipeline, handling format negotiation and conversion between incompatible audio formats. It supports conversion between various audio formats including different sample rates (8kHz to 192kHz), bit depths (8/16/24/32-bit), channel layouts (mono, stereo, surround), and audio codecs. The converter automatically determines the optimal conversion path and handles format negotiation between connected blocks. Common use cases include matching audio formats between sources and encoders, resampling for output devices, and ensuring compatibility between pipeline elements with different audio requirements. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class AudioConverterBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
AudioConverterBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.AudioProcessing.AudioConverterBlock class. Creates an audio converter that automatically handles format conversion between connected blocks. The converter negotiates the best format based on the capabilities of upstream and downstream elements.
public AudioConverterBlock()Properties
Input
Gets the single audio input pad for this converter block.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads. This block has a single audio input.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the single audio output pad for this converter block.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. This block has a single audio output.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the block type identifier for this audio converter.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the audio converter element within the pipeline. Creates the GStreamer audioconvert element and establishes pad connections. This method is called during pipeline construction to set up the converter.
public override bool Build()Returns
- bool
-
trueif the converter was successfully built and initialized;falseif an error occurred.
CleanUp()
Releases all internal resources and disposes of the audio converter element. Called during disposal to ensure proper cleanup of native GStreamer resources.
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 BaseElement wrapper for the audio converter.
public BaseElement GetCore()Returns
- BaseElement
-
The AudioConverter element that performs the format conversion.
GetElement()
Gets the underlying GStreamer element for this converter block.
public Element GetElement()Returns
- Element
-
The GStreamer audioconvert element that performs the format transformation.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this converter block, providing access to shared resources and pipeline state. This method is called internally during pipeline construction.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline that owns this converter block.