Class UniversalSourceBlockV2
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Universal source block that automatically creates the necessary pipeline based on file content.
public class UniversalSourceBlockV2 : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
Pipeline construction algorithm (Build):
- Create a GStreamer source element based on URI scheme (filesrc, souphttpsrc, rtspsrc, etc.).
- For RTSP sources: connect through parsebin which auto-discovers and decodes streams via dynamic pads (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.OnParsebinPadAdded(System.Object,Gst.PadAddedArgs), VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.OnRtspPadAdded(System.Object,Gst.PadAddedArgs)).
- For file/HTTP sources: use typefind to detect container format, then select an explicit demuxer (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.SelectDemuxer(System.String)) and parsers (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.SelectParser(System.String)).
- If the demuxer has static pads, link them immediately via VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.ProcessStaticDemuxerPads; otherwise, wait for dynamic pad-added signals (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.OnDemuxerPadAdded(System.Object,Gst.PadAddedArgs)).
- For each media stream, create an output chain: queue → optional parser → decoder → converter → output pad (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.CreateVideoOutputChain(System.Int32), VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.CreateAudioOutputChain(System.Int32), VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.CreateSubtitleOutputChain(System.Int32)).
- Decoder selection (VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.SelectDecoder(System.String)) considers hardware acceleration availability and falls back to software decoding when hardware is unavailable.
Key responsibilities: source element creation, format detection, demuxer/parser/decoder selection, output chain assembly, dynamic pad negotiation, hardware decoder fallback, and multi-stream output management.
This class delegates to GStreamer elements for the actual media processing. The VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2.StreamChain helper tracks per-stream element references (parser, decoder, converter, queues) for cleanup.
Constructors
UniversalSourceBlockV2(UniversalSourceSettingsV2)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.UniversalSourceBlockV2 class.
public UniversalSourceBlockV2(UniversalSourceSettingsV2 settings)Parameters
settingsUniversalSourceSettingsV2-
The universal source settings.
Properties
AudioOutput
Gets the primary audio output pad.
public MediaBlockPad AudioOutput { get; }Property Value
AudioOutputs
Gets all audio output pads.
public List<MediaBlockPad> AudioOutputs { get; }Property Value
Input
Gets the primary input pad (not used for file sources).
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads (empty for file sources).
public override MediaBlockPad[] Inputs { get; }Property Value
MetadataOutput
Gets the primary metadata output pad.
public MediaBlockPad MetadataOutput { get; }Property Value
MetadataOutputs
Gets all metadata output pads.
public List<MediaBlockPad> MetadataOutputs { get; }Property Value
Output
Gets the primary output pad (first available output).
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets the source settings.
public UniversalSourceSettingsV2 Settings { get; }Property Value
SubtitleOutput
Gets the primary subtitle output pad.
public MediaBlockPad SubtitleOutput { get; }Property Value
SubtitleOutputs
Gets all subtitle output pads.
public List<MediaBlockPad> SubtitleOutputs { get; }Property Value
Type
Gets the type of this media block.
public override MediaBlockType Type { get; }Property Value
VideoOutput
Gets the primary video output pad.
public MediaBlockPad VideoOutput { get; }Property Value
VideoOutputs
Gets all video output pads.
public List<MediaBlockPad> VideoOutputs { get; }Property Value
Methods
Build()
Builds the media block.
public override bool Build()Returns
CleanUp()
Cleans up the block's internal resources.
public virtual void CleanUp()Dispose(bool)
Cleans up the media block.
protected override void Dispose(bool disposing)Parameters
disposingbool
GetCore()
Gets the core BaseElement wrapper.
public BaseElement GetCore()Returns
- BaseElement
-
Not applicable for this block, returns null.
GetElement()
Gets the main GStreamer element for this block.
public Element GetElement()Returns
- Element
-
The source element (as primary element).
SetContext(MediaBlocksPipeline)
Sets the pipeline context for this block.
public void SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance.
IMediaBlockInternals.CleanUp()
IMediaBlockInternals cleanup implementation.
void IMediaBlockInternals.CleanUp()