wlroots capture backend; portal and wlroots as streamer backends
`capture::wlroots::WlrootsCapture` captures outputs of wlroots compositors (Sway, Hyprland, river, labwc, ...) directly over Wayland, for sessions without a working portal or to skip its dialog. It uses `ext-image-copy-capture-v1` with `ext-output-image-capture-source-v1` where the compositor has them, else `wlr-screencopy-unstable-v1` (`copy_with_damage` from version 2). Both only complete a frame once the screen changed, so a still screen costs nothing. The compositor copies into shared-memory buffers allocated once per size (memfd, mapped once); the sink reads straight from the mapping (y-inverted frames are flipped into a reused buffer first). XRGB/ARGB (BGRx in memory) and XBGR/ABGR are read. Events are dispatched with a poll timeout so stopping is prompt. Feature `wlroots` (default; Linux), using the wayland-client, wayland-protocols and wayland-protocols-wlr versions already in the lock file; `with_display` connects to another socket. Tested against a headless sway 1.9 (wlr-screencopy v3, pixman renderer): outputs, the captured background colour, a colour change through sway's IPC arriving as a new frame, and the queue API (`tests/wlroots_capture.rs`, skipped without VOELIN_WLROOTS_TEST_DISPLAY). The ext-image-copy-capture path is untested: sway 1.9 predates it. `CaptureBackend` gains `Portal` and `Wlroots` (names `auto`, `portal`, `x11`, `wlroots` with `name()` / `FromStr`, as the stream settings spell them); `Auto` stays the session default (the portal on Wayland). `EncodedSource` passes `FrameSource::set_layer_bitrate` to the encoders (`MediaSink::layer_bitrate`). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NJvYyRmTjKcb9i8eyYXK5G
This commit is contained in:
1 parent
40ad426f26
commit
6e6e954685
6 files changed
+854
-3
No files matched your search
Generated
+3
@@ -9175,6 +9175,9 @@ dependencies = [
|
||||
"tokio",
|
||||
"tracing",
|
||||
"wasapi",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
"windows-capture",
|
||||
"x11rb",
|
||||
"yuv",
|
||||
|
||||
Reference in new issue
Block a user