Class ScreenSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Screen capture source block for desktop recording and screen sharing applications across multiple platforms. Provides real-time screen capture with hardware acceleration support using platform-specific APIs (D3D11, XDisplay, macOS, iOS) for live streaming, tutorials, remote assistance, and screen recording with high performance and low system impact. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class ScreenSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
ScreenSourceBlock(IScreenCaptureSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.ScreenSourceBlock class with custom capture settings. Configures the screen capture source with specified display, resolution, and capture parameters.
public ScreenSourceBlock(IScreenCaptureSourceSettings settings)Parameters
settingsIScreenCaptureSourceSettings-
The screen capture settings controlling display selection, resolution, frame rate, and capture area parameters.
ScreenSourceBlock()
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.ScreenSourceBlock class with platform-specific default settings. Automatically selects the appropriate screen capture method based on the current platform (D3D11, XDisplay, macOS, iOS).
public ScreenSourceBlock()Properties
Input
Gets the primary input pad (none for source blocks that capture screens).
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 screen.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block (single video output for screen capture).
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the screen capture configuration settings that control capture parameters and display options.
public IScreenCaptureSourceSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for screen capture source operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds this instance.
public override bool Build()Returns
- bool
-
trueif successfull,falseotherwise.
CleanUp()
Cleans up.
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 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 screen capture source GStreamer element.
IsAvailable(ScreenCaptureSourceType)
Determines whether screen capture support is available for the specified source type on the current system. Requires platform-specific screen capture APIs and drivers to be available and functional.
public static bool IsAvailable(ScreenCaptureSourceType sourceType)Parameters
sourceTypeScreenCaptureSourceType-
The type of screen capture source to check (D3D11, XDisplay, macOS, etc.).
Returns
- bool
-
trueif screen capture support is available for the specified type; otherwise,false.
IsMouseHighlightSubscribed()
Returns whether the mouse highlight hook is currently active and capturing mouse events.
public bool IsMouseHighlightSubscribed()Returns
- bool
-
trueif subscribed to mouse events; otherwise,false.
MouseHighlightAddClickEvent(int, int)
Manually adds a click event at the specified screen coordinates for the mouse highlight overlay. Use this method on platforms where global mouse hooks are not available, or to simulate click highlights programmatically. Requires VisioForge.Core.Types.X.Sources.IScreenCaptureSourceSettings.MouseHighlight to be set in settings before building the pipeline.
public void MouseHighlightAddClickEvent(int screenX, int screenY)Parameters
MouseHighlightSubscribe()
Subscribes to global mouse events for the mouse click highlight overlay. On Windows, this installs a global mouse hook that captures all mouse clicks. On other platforms, use VisioForge.Core.MediaBlocks.Sources.ScreenSourceBlock.MouseHighlightAddClickEvent(System.Int32,System.Int32) to feed click events manually. Requires VisioForge.Core.Types.X.Sources.IScreenCaptureSourceSettings.MouseHighlight to be set in settings before building the pipeline.
public void MouseHighlightSubscribe()MouseHighlightUnsubscribe()
Unsubscribes from global mouse events and disposes the mouse hook.
public void MouseHighlightUnsubscribe()MouseHighlightUpdateSettings()
Updates the mouse highlight settings on the underlying filter in real-time. Call this after modifying VisioForge.Core.Types.X.Sources.IScreenCaptureSourceSettings.MouseHighlight while the pipeline is running.
public void MouseHighlightUpdateSettings()UpdateLiveSettings(int, int, bool)
Updates the live settings.
public void UpdateLiveSettings(int x, int y, bool cursor)Parameters
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The pipeline.
OnMouseClick
Occurs when a mouse button is clicked while the mouse highlight is active. Provides screen coordinates of the click. Only fires when VisioForge.Core.MediaBlocks.Sources.ScreenSourceBlock.MouseHighlightSubscribe has been called.
public event EventHandler<MouseClickEventArgs> OnMouseClick