Documentation
¶
Overview ¶
Package dxgi captures a Windows display with DXGI Desktop Duplication. The frame stays on the GPU that owns the output; nothing is copied to memory.
Index ¶
- func Adapters() ([]gpu.Adapter, error)
- func Displays() ([]capture.Display, error)
- func FindAdapter(match string) (gpu.Adapter, error)
- type Device
- type Options
- type Source
- func (s *Source) AccumulatedFrames() int
- func (s *Source) Adapter() gpu.Adapter
- func (s *Source) Close() error
- func (s *Source) Device() *Device
- func (s *Source) Format() capture.Format
- func (s *Source) Next(timeout time.Duration) (capture.Frame, error)
- func (s *Source) Recover(timeout, interval time.Duration) error
- func (s *Source) Refresh() float64
- func (s *Source) Release() error
- func (s *Source) Size() (int, int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Adapters ¶
Adapters lists the hardware adapters in DXGI order: the first is the system's default. An adapter can appear under more than one LUID (one per display path); each is listed.
Types ¶
type Device ¶
Device is a D3D11 device on one adapter. Capture, encode, decode and presentation share it to keep frames on that GPU.
func OpenDevice ¶
OpenDevice makes a hardware D3D11 device (BGRA and video support) on the adapter with this LUID.
type Options ¶
type Options struct {
// HDR asks for 10-bit or FP16 surfaces through
// IDXGIOutput5::DuplicateOutput1 when the desktop is in HDR.
HDR bool
}
Options configure OpenDisplay.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
func Open ¶
Open duplicates output on device, which must be a D3D11 device of the adapter that owns the output. hdr asks for 10-bit or FP16 surfaces through IDXGIOutput5::DuplicateOutput1.
func OpenDisplay ¶
OpenDisplay duplicates the display with this ID (`\\.\DISPLAY1`; empty for the primary display) on a new D3D11 device of the adapter that drives it. The source owns the device; encoders take it from Device.
func (*Source) AccumulatedFrames ¶
AccumulatedFrames is how many desktop presents the last frame folded in.
func (*Source) Next ¶
Next waits up to timeout for the compositor's next desktop image. Updates that move only the cursor are skipped. Presented is the compositor's present time and Acquired the time Next got the frame, both on the QPC clock (internal/clock).
func (*Source) Recover ¶
Recover reopens duplication after Next returned capture.ErrAccessLost: a mode change, a full-screen switch, or the secure desktop (UAC, lock screen), during which duplication fails until the user returns. It retries every interval until it succeeds or timeout passes. Size, Format and Refresh reflect the new mode afterwards.