pub struct ScreenCapture { /* private fields */ }Expand description
Portal-approved screen or window capture producing owned RGBA8 frames.
open may show the desktop picker. poll is nonblocking and never retains
a PipeWire producer slot after returning. Drop releases host resources only;
close explicitly disconnects the stream and reports a disconnect failure.
Implementations§
Source§impl ScreenCapture
impl ScreenCapture
Sourcepub fn is_supported() -> bool
pub fn is_supported() -> bool
Whether this platform has the portal adapter and a session bus.
This does not request permission or guarantee that a portal service or
a selected source is available. Actual admission happens in open.
Sourcepub fn open(runtime: &Runtime, config: &ScreenCaptureConfig) -> Result<Self>
pub fn open(runtime: &Runtime, config: &ScreenCaptureConfig) -> Result<Self>
Request desktop consent and open one selected screen/window stream.
§Errors
Rejects invalid extent, FPS or ring hints, missing platform support, cancelled/denied permission, and portal/PipeWire setup failures.
Sourcepub fn poll(&mut self) -> Result<Option<VideoFrame>>
pub fn poll(&mut self) -> Result<Option<VideoFrame>>
Poll once without waiting; return only a new caller-owned RGBA8 frame.
§Errors
Reports closed/revoked streams, malformed frames or texture allocation.
Sourcepub fn close(&mut self) -> Result<()>
pub fn close(&mut self) -> Result<()>
Explicitly disconnect and release the portal grant. Idempotent.
§Errors
Reports a PipeWire disconnect failure after releasing the session.
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Whether PipeWire currently reports a streaming source.