Class PushAudioSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Push audio source block for programmatic audio data injection into the pipeline. Provides real-time audio streaming from application-generated or externally-sourced audio data for custom audio sources, audio synthesis, live audio processing, and integration with external audio APIs or hardware devices. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class PushAudioSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
PushAudioSourceBlock(PushAudioSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.PushAudioSourceBlock class with custom audio settings. Configures the push audio source for real-time audio data injection with specified format parameters.
public PushAudioSourceBlock(PushAudioSourceSettings settings)Parameters
settingsPushAudioSourceSettings-
The push audio settings controlling audio format, sample rate, and buffering parameters.
Properties
Input
Gets the primary input pad (none for source blocks that receive pushed data).
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block (none for source blocks).
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary audio output pad for the pushed audio stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block (single audio output).
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the push audio configuration settings that control audio format and buffering.
public PushAudioSourceSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for push audio source operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the push audio source within the pipeline context. Creates audio injection pipeline, configures format conversion, and prepares audio output for downstream processing.
public override bool Build()Returns
- bool
-
trueif the push audio source was successfully built and configured; otherwise,false.
CleanUp()
Cleans up all resources associated with the push audio operations, including injection buffers and audio converters.
public void CleanUp()Dispose(bool)
Releases unmanaged and managed resources used by the push audio source. Properly stops audio injection and disposes of GStreamer elements and audio buffers.
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 advanced configuration and monitoring.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for composite source blocks with multiple internal elements.
GetElement()
Gets the native GStreamer element for direct GStreamer pipeline integration.
public Element GetElement()Returns
- Element
-
The push audio source GStreamer element.
IsAvailable()
Determines whether push audio support is available on the current system. Requires GStreamer appsrc plugin to be installed for audio data injection.
public static bool IsAvailable()Returns
- bool
-
trueif push audio support is available; otherwise,false.
PushData(AudioFrame)
Pushes an audio frame into the pipeline for real-time processing.
public void PushData(AudioFrame frame)Parameters
frameAudioFrame-
The AudioFrame containing audio samples with format information to inject into the pipeline.
PushData(byte[], int)
Pushes raw audio data bytes into the pipeline for real-time processing.
public void PushData(byte[] data, int dataSize)Parameters
databyte[]-
The byte array containing raw audio samples in the configured format.
dataSizeint-
The actual size of valid audio data in bytes within the array.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this push audio source, providing access to the parent pipeline and logging context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocks pipeline containing this push audio source.