//! Capture dispatcher. Picks the per-display-server source backend and returns //! the shared [`pipeline::CaptureHandle`]. The handle itself, its teardown, and //! the whole encode/serve tail are display-agnostic and live in //! [`super::pipeline`]; the backends differ only in how they obtain a video //! source element. use anyhow::Result; use crate::cli::HostOpts; use crate::common::display::DisplayServer; use crate::host::health; use crate::host::pipeline::CaptureHandle; use crate::host::quality::EffectiveQuality; use crate::host::{wayland, x11}; pub(super) async fn spawn( display: DisplayServer, opts: &HostOpts, quality: &EffectiveQuality, health: health::Reporter, ) -> Result { match display { DisplayServer::Wayland => wayland::start(opts, quality, health).await, DisplayServer::X11 => x11::start(opts, quality, health).await, DisplayServer::Unknown => unreachable!("caller guarantees display != Unknown"), } }