Class CustomMixerSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Custom mixer source block that accepts pushed video and audio frames via API. Has no input pads. Outputs fixed-caps video and audio streams. Input data must match the configured output caps exactly; mismatched data is rejected. Uses do-timestamp=true on both AppSrc elements so the pipeline clock generates live timestamps for A/V synchronization.
public class CustomMixerSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
CustomMixerSourceBlock(CustomMixerSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.CustomMixerSourceBlock class.
public CustomMixerSourceBlock(CustomMixerSourceSettings settings)Parameters
settingsCustomMixerSourceSettings-
The output caps configuration.
Properties
AudioDroppedTotal
Gets the total number of dropped audio buffers from managed queues.
public long AudioDroppedTotal { get; }Property Value
AudioManagedQueueBytes
Gets the current queued audio bytes in the managed queue.
public long AudioManagedQueueBytes { get; }Property Value
AudioManagedQueueCount
Gets the current number of queued audio buffers in the managed queue.
public int AudioManagedQueueCount { get; }Property Value
AudioOutput
Gets the audio output pad.
public MediaBlockPad AudioOutput { get; }Property Value
Input
Gets the input pad (none - data is pushed via API).
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the input pads (none).
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad (video).
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets the settings.
public CustomMixerSourceSettings Settings { get; }Property Value
Type
Gets the block type.
public override MediaBlockType Type { get; }Property Value
VideoDroppedTotal
Gets the total number of dropped video buffers from managed queues.
public long VideoDroppedTotal { get; }Property Value
VideoManagedQueueBytes
Gets the current queued video bytes in the managed queue.
public long VideoManagedQueueBytes { get; }Property Value
VideoManagedQueueCount
Gets the current number of queued video buffers in the managed queue.
public int VideoManagedQueueCount { get; }Property Value
VideoOutput
Gets the video output pad.
public MediaBlockPad VideoOutput { get; }Property Value
Methods
Build()
Builds the internal GStreamer pipeline: two AppSrc elements with queues.
public override bool Build()Returns
CleanUp()
Cleans up all GStreamer resources.
public void CleanUp()Remarks
Tear-down order per element is the canonical GStreamer sequence:
- SetState(NULL) — stop dataflow gracefully so any in-flight push returns and the streaming task exits.
- pipeline.Remove(element) — detach from the parent bin so the bin no longer holds a ref. Without this, Dispose only drops the managed wrapper while the unmanaged GstElement stays alive (parented by the bin) and shows up as a leak when the pipeline itself is reused or disposed later. Wrapped in try/catch — Remove is a no-op + warning if the element is not actually parented (defensive against partial Build()s).
- Dispose() — release the managed wrapper and the final unmanaged ref.
Dispose(bool)
Releases resources.
protected override void Dispose(bool disposing)Parameters
disposingbool
GetCore()
Gets the core BaseElement wrapper (not applicable).
public BaseElement GetCore()Returns
- BaseElement
GetDiagnosticsSummary()
Gets a multi-line diagnostics summary for the managed and internal GStreamer queues.
public string GetDiagnosticsSummary()Returns
GetElement()
Gets the GStreamer element (not applicable for composite blocks).
public Element GetElement()Returns
- Element
IsAvailable()
Determines whether AppSrc is available on this system.
public static bool IsAvailable()Returns
PushAudioFrame(byte[], int)
Pushes raw audio data into the pipeline. The data must be in the configured audio format.
public bool PushAudioFrame(byte[] data, int dataSize)Parameters
Returns
- bool
-
True if the audio data was pushed successfully.
PushAudioFrame(AudioFrame)
Pushes an audio frame into the pipeline. The frame data must be in the configured audio format.
public bool PushAudioFrame(AudioFrame frame)Parameters
frameAudioFrame-
The audio frame to push.
Returns
- bool
-
True if the audio frame was pushed successfully.
PushAudioSample(Sample)
Pushes a GStreamer audio sample into the pipeline without copying raw PCM bytes into a fresh managed buffer. The sample caps must match the configured audio format, sample rate, and channel count.
public bool PushAudioSample(Sample sample)Parameters
sampleSample-
The audio sample to push.
Returns
- bool
-
True if the sample was accepted.
PushVideoFrame(VideoFrameX)
Pushes a video frame into the pipeline. The frame must match the configured video format, width, and height exactly.
public bool PushVideoFrame(VideoFrameX frame)Parameters
frameVideoFrameX-
The video frame to push.
Returns
- bool
-
True if the frame was pushed successfully.
PushVideoSample(Sample)
Pushes a GStreamer video sample into the pipeline without copying the frame pixels. The sample caps must match the configured output format, width, height, and frame rate.
public bool PushVideoSample(Sample sample)Parameters
sampleSample-
The video sample to push.
Returns
- bool
-
True if the sample was accepted.
SendEOS()
Signals end of stream on both video and audio.
public void SendEOS()IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline
QueueDropped
Occurs when managed queues drop buffers.
public event EventHandler<CustomMixerQueueDropEventArgs> QueueDropped