Class ScreenCaptureD3D11SourceSettings
- Namespace
- VisioForge.Core.Types.X.Sources
- Assembly
- VisioForge.Core.dll
Direct3D 11 screen capture source settings.
public class ScreenCaptureD3D11SourceSettings : IScreenCaptureSourceSettings, IVideoCaptureBaseVideoSourceSettings, IVideoSourceSettings, IMediaBlockSettingsInheritance
Implements
Inherited Members
Constructors
ScreenCaptureD3D11SourceSettings()
Initializes a new instance of the VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings class.
public ScreenCaptureD3D11SourceSettings()Properties
API
Gets or sets the API. The default is VisioForge.Core.Types.X.Sources.D3D11ScreenCaptureAPI.DXGI (Desktop Duplication).
public D3D11ScreenCaptureAPI API { get; set; }Property Value
Remarks
Both APIs repeat the last frame while the captured content does not change, so the capture starts at once, even on a still screen or window. A minimized window gives no frame: VideoCaptureCoreX refuses to start on a window minimized when the start is called, and a Media Blocks pipeline gets its first frame when the window is restored. A window capture (VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.WindowHandle) always uses WGC, and DXGI falls back to WGC where Desktop Duplication is not supported. Desktop Duplication allows a limited number of sessions per monitor across all applications: past it the start fails with "Failed to prepare capture object with given configuration" (the GStreamer debug log says "Hit the max allowed number of Desktop Duplication session"), and WGC is the API to use. VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.ShowBorderLines and VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.DXGIAdapter apply to WGC only.
CaptureCursor
Gets or sets a value indicating whether mouse cursor capture is enabled.
public bool CaptureCursor { get; set; }Property Value
DXGIAdapter
Gets or sets the DXGI adapter index for creating device when WGC mode is selected. -1 for default adapter.
public int DXGIAdapter { get; set; }Property Value
FrameRate
Gets or sets the frame rate.
public VideoFrameRate FrameRate { get; set; }Property Value
MonitorHandle
Gets or sets the HMONITOR handle of monitor to capture.
public nint MonitorHandle { get; set; }Property Value
MonitorIndex
Gets or sets the monitor ID. Enumeration started from 0. -1 for primary monitor.
public int MonitorIndex { get; set; }Property Value
MouseHighlight
Gets or sets the mouse click highlight settings. When not null, mouse click positions are drawn as animated expanding circles on the captured screen video. Set to null to disable mouse click highlighting.
public MouseHighlightSettings MouseHighlight { get; set; }Property Value
Rectangle
Gets or sets the rectangle to capture.
public Rect Rectangle { get; set; }Property Value
Remarks
An empty rectangle, or null, captures the whole monitor at its native resolution, or the whole captured area of VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.WindowHandle; the start replaces null with an empty rectangle for a monitor, and for a window with the size it measures, or the last measured one, or empty when no measurement succeeded (a minimized window). The default is empty. A rectangle is in physical pixels, relative to the captured monitor or window. VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.UpdateLiveSettings(System.Int32,System.Int32,System.Boolean) moves only a rectangle that is not empty; a window rectangle moved away from (0, 0) is the application's own area, and the start no longer measures the window again.
ShowBorderLines
Gets or sets a value indicating whether to show border lines to capture area when WGC mode is selected (Windows 11 or newer is required).
public bool ShowBorderLines { get; set; }Property Value
WindowCaptureMode
Gets or sets the window capture mode.
public D3D11WindowCaptureMode WindowCaptureMode { get; set; }Property Value
Remarks
This property determines how window capture is performed when using Windows Graphics Capture (WGC) API. Only applicable when WindowHandle is specified; a window capture always uses WGC.
WindowHandle
Gets or sets the window handle to capture (optional).
public nint WindowHandle { get; set; }Property Value
Remarks
Setting it sets VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.Rectangle to the size of the captured area in the current VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.WindowCaptureMode: the whole window, or its client area with VisioForge.Core.Types.X.Sources.D3D11WindowCaptureMode.ClientOnly. While VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.Rectangle keeps that measured size, building the capture source measures the window again, so a window resized, or a mode set after the handle, is captured at its size when the capture starts; read VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.Rectangle after the start for that size. A window minimized when it is measured keeps the last size, or the whole window when there is none. A VisioForge.Core.Types.X.Sources.ScreenCaptureD3D11SourceSettings.Rectangle of any other size or position is the application's own area and is kept.
Methods
CreateBlock()
Creates the block.
public MediaBlock CreateBlock()Returns
- MediaBlock
-
MediaBlock.
GetSourceType()
Gets the type of the source.
public ScreenCaptureSourceType GetSourceType()Returns
- ScreenCaptureSourceType
-
ScreenCaptureSourceType.
IsWGCAvailable()
Determines whether is WGC available.
public static bool IsWGCAvailable()Returns
- bool
-
trueif is WGC available; otherwise,false.
UpdateLiveSettings(int, int, bool)
Updates the live settings.
public void UpdateLiveSettings(int x, int y, bool cursor)Parameters
OnUpdated
Occurs when on updated.
public event EventHandler<EventArgs> OnUpdated