pub trait CaptureBackend: Send + Sync {
// Required methods
fn start_stream<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PipeWireStream>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn stop_stream<'life0, 'async_trait>(
&'life0 self,
stream: PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn pipewire_socket(&self) -> PathBuf;
// Provided methods
fn grab_screenshot<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn start_recording<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
output_path: &'life2 Path,
bitrate: u32,
fps: u32,
) -> Pin<Box<dyn Future<Output = Result<VideoRecorder>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn stop_recording<'life0, 'async_trait>(
&'life0 self,
recorder: VideoRecorder,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Screen capture. Backends either return a PipeWire node id (the common path
on mutter/KWin) that the default take_screenshot pipes through GStreamer,
or override take_screenshot directly if they can produce a PNG without
PipeWire (e.g. a future wlr-screencopy backend).
Required Methods§
Sourcefn start_stream<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PipeWireStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn start_stream<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<PipeWireStream>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Start a PipeWire capture stream. The returned PipeWireStream stays
alive until explicitly stopped.
Sourcefn stop_stream<'life0, 'async_trait>(
&'life0 self,
stream: PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_stream<'life0, 'async_trait>(
&'life0 self,
stream: PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop a previously started stream and release backend-side resources.
Sourcefn pipewire_socket(&self) -> PathBuf
fn pipewire_socket(&self) -> PathBuf
Path to the PipeWire socket the shared GStreamer helper should talk
to (usually <runtime_dir>/pipewire-0).
Provided Methods§
Sourcefn grab_screenshot<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn grab_screenshot<'life0, 'life1, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Capture a PNG from an already-running stream.
Sourcefn start_recording<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
output_path: &'life2 Path,
bitrate: u32,
fps: u32,
) -> Pin<Box<dyn Future<Output = Result<VideoRecorder>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn start_recording<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
stream: &'life1 PipeWireStream,
output_path: &'life2 Path,
bitrate: u32,
fps: u32,
) -> Pin<Box<dyn Future<Output = Result<VideoRecorder>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Start a continuous WebM recording of stream written to
output_path at the given bitrate (bits/sec) and fps. Returns a
handle whose stop() must be awaited to finalize the file cleanly.
Sourcefn stop_recording<'life0, 'async_trait>(
&'life0 self,
recorder: VideoRecorder,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn stop_recording<'life0, 'async_trait>(
&'life0 self,
recorder: VideoRecorder,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Stop a previously-started recording, flushing the WebM seekhead/cues before returning.