pub struct SurfaceCaptureHost {
pub width: u32,
pub height: u32,
/* private fields */
}Expand description
A resident smix-capture-host in serve mode for one booted UDID.
Holds the child + its stdin/stdout. Dropping it kills the child
(kill_on_drop), so a dropped SimctlClient leaves
no stray capture host behind.
Fields§
§width: u32Geometry from the startup header (informational; each frame carries its
own w/h, which is authoritative across a rotation/reboot).
height: u32Startup-header height (see SurfaceCaptureHost::width).
Implementations§
Source§impl SurfaceCaptureHost
impl SurfaceCaptureHost
Sourcepub async fn spawn(udid: &str) -> Result<SurfaceCaptureHost, HostError>
pub async fn spawn(udid: &str) -> Result<SurfaceCaptureHost, HostError>
Spawn a resident host for udid and wait (≤5 s) for its WxH
geometry header, which confirms the surface resolved.
Sourcepub async fn grab(
&mut self,
want_png: bool,
) -> Result<Option<CapturedFrame>, HostError>
pub async fn grab( &mut self, want_png: bool, ) -> Result<Option<CapturedFrame>, HostError>
Request one frame. want_png selects an in-host ImageIO PNG encode;
otherwise a raw BGRA frame.
Returns Ok(Some(frame)) on success, Ok(None) when the host reports
the surface is no longer resolvable (caller falls back to simctl),
and Err on a transport failure (caller drops this host + falls back).