Class SystemVideoSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
System video source block for native camera and video capture device access across platforms. Provides unified video capture from webcams, built-in cameras, and professional capture devices using platform-specific APIs (DirectShow, Media Foundation, V4L2, AVFoundation) for live streaming, video recording, and real-time video processing applications. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class SystemVideoSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
SystemVideoSourceBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.SystemVideoSourceBlock class with the default video capture device. Automatically selects the first available video capture device on the system.
public SystemVideoSourceBlock()SystemVideoSourceBlock(VideoCaptureDeviceSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.SystemVideoSourceBlock class with custom capture settings. Configures the system video source for camera capture with specified device and format parameters.
public SystemVideoSourceBlock(VideoCaptureDeviceSourceSettings settings)Parameters
settingsVideoCaptureDeviceSourceSettings-
The video capture settings controlling device selection, resolution, frame rate, and format parameters.
Properties
Input
Gets the primary input pad (none for source blocks that capture from devices).
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 video output pad for the captured video stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block (single video output for camera).
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the video capture device configuration settings that control device selection and capture parameters.
public VideoCaptureDeviceSourceSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for system video source operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the system video source within the pipeline context. Creates platform-specific video capture source, configures device parameters, and prepares video output for downstream processing.
public override bool Build()Returns
- bool
-
trueif the system video source was successfully built and configured; otherwise,false.
CleanUp()
Cleans up all resources associated with the video capture operations, including device handles and capture buffers.
public void CleanUp()Dispose(bool)
Releases unmanaged and managed resources used by the system video source. Properly closes video device handles and disposes of GStreamer elements and capture 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 advanced configuration and monitoring.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for composite source blocks with multiple internal elements.
GetDevicesAsync()
Gets the list of available video capture devices asynchronously. Enumerates all connected cameras, webcams, and capture devices on the current system with their capabilities.
public static Task<VideoCaptureDeviceInfo[]> GetDevicesAsync()Returns
- Task<VideoCaptureDeviceInfo[]>
-
A task that represents the asynchronous operation returning an array of VideoCaptureDeviceInfo containing device names, IDs, and supported formats.
GetElement()
Gets the native GStreamer element for direct GStreamer pipeline integration.
public Element GetElement()Returns
- Element
-
The system video source GStreamer element.
IsAvailable(VideoCaptureDeviceAPI)
Determines whether video capture support is available for the specified API on the current system. Requires platform-specific capture APIs and drivers to be available and functional.
public static bool IsAvailable(VideoCaptureDeviceAPI api)Parameters
apiVideoCaptureDeviceAPI-
The video capture API to check (DirectShow, Media Foundation, V4L2, AVFoundation, etc.).
Returns
- bool
-
trueif video capture support is available for the specified API; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this system video source, providing access to the parent pipeline and logging context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocks pipeline containing this system video source.