Skip to main content

open

Function open 

Source
fn open(settings: &CaptureSettings) -> Option<GpuCapture>
Expand description

Build the zero-copy capture for these settings, or report why it cannot serve them.

Everything fallible happens here, before a single frame is delivered, so the caller can fall back to the XShm path with nothing half-built. The order matters: NVENC is opened first because it owns the CUDA context, and NvFBC is then set up with that context current, which is what makes the device pointer it hands back one NVENC can register in place.

The path is declined, rather than failed, when it cannot be zero-copy: a codec no NVENC engine serves, software encoding requested, a device that is not NVIDIA, a watermark (which is composited into host pixels and would mean reading the frame back), a libX11 bound to another libxcb than the driver’s, an X server the NVIDIA driver does not drive, or a driver that offers no NvFBC on this X server.