Copyright
SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
SPDX-License-Identifier: MIT
protocol for capturing output contents or window contents
This protocol allows authorized application to capture output contents or window
contents(useful for window streaming).
Warning! This protocol is EXPERIMENTAL and under active development.
It may change at any time, including in backward-incompatible ways,
without incrementing the interface major version and without prior
notice. No compatibility guarantees of any kind are provided. Clients
and compositors must track the upstream definition in treeland-protocols
and must not rely on the current interface names, requests, events, or
semantics remaining stable across releases.
Version 1
- cancel_reason
- flags
- destroy — delete this object
- start — start session
- frame_done — Indicates current frame is done.
- frame — supply the client with information about the frame
- object — supply the client with object fd
- ready — indicates frame is available for reading
- cancel — Notifies current frame is no longer valid.
persistent screen capture session
Represents a persistent screen capture session that continuously sends frames.
treeland_capture_session_v1
enum cancel_reason {
temporary = 0,
permanent = 1,
resizing = 2,
}- temporary — temporary error, source will produce more frames
- permanent — fatal error, source will not produce frames
- resizing — temporary error, source will produce more frames
treeland_capture_session_v1
request frame_done(
tv_sec_hi: uint,
tv_sec_lo: uint,
tv_usec: uint,
)- tv_sec_hi — high 32 bits of the ready timestamp seconds
- tv_sec_lo — low 32 bits of the ready timestamp seconds
- tv_usec — ready timestamp microseconds
Indicates current frame is done.
This is the ACK to the current "ready" event. The next "frame" event will be sent only when current
"ready" event is acknowledged. The timestamp should be the same as the one sent in "ready" event.
If the frame has the "transient" flag, all objects sent before become invalid after this event.
treeland_capture_session_v1
event frame(
offset_x: int,
offset_y: int,
width: uint,
height: uint,
buffer_flags: uint,
flags: uint<flags>,
format: uint,
mod_high: uint,
mod_low: uint,
num_objects: uint,
)- offset_x — crop offset x
- offset_y — crop offset y
- width — frame width in pixels
- height — frame height in pixels
- buffer_flags — buffer flags
- format — DRM format code
- mod_high — DRM format modifier high bits
- mod_low — DRM format modifier low bits
- num_objects — number of DMA-BUF objects in the frame
supply the client with information about the frame
Main event supplying the client with information about the frame. If the capture didn't fail, this event is always
emitted first before any other events.
When mask is provided, x and y should be offset relative to mask surface origin. Otherwise offset_x and offset_y should always
be zero.
treeland_capture_session_v1
event object(
index: uint,
fd: fd,
size: uint,
offset: uint,
stride: uint,
plane_index: uint,
)- index — object index
- fd — DMA-BUF file descriptor
- size — size of the DMA-BUF in bytes
- offset — offset into the DMA-BUF
- stride — line stride in bytes
- plane_index — plane index within the buffer
supply the client with object fd
Provides a DMA-BUF object for the current frame.
treeland_capture_session_v1
event ready(
tv_sec_hi: uint,
tv_sec_lo: uint,
tv_nsec: uint,
)- tv_sec_hi — high 32 bits of the presentation timestamp seconds
- tv_sec_lo — low 32 bits of the presentation timestamp seconds
- tv_nsec — presentation timestamp nanoseconds
indicates frame is available for reading
This event is sent as soon as the frame is presented, indicating it is available for reading. This event
includes the time at which presentation happened at.
treeland_capture_session_v1
event cancel(
reason: uint<cancel_reason>,
)Notifies current frame is no longer valid.
If the capture failed or if the frame is no longer valid after the "frame" event has been emitted, this
event will be used to inform the client to scrap the frame.
Version 1
Version 1
treeland_capture_context_v1
enum source_failure {
selector_busy = 1,
user_cancel = 2,
source_destroyed = 3,
other = 4,
}- selector_busy — selector is occupied by other context
- user_cancel — User cancel this context from compositor
- source_destroyed — Source has been destroyed
- other — other failure
treeland_capture_context_v1
request select_source(
source_hint: uint<source_type>,
freeze: uint,
with_cursor: uint,
mask: nullable object<wl_surface>,
)- source_hint — hint for the type of source to select
- freeze — freeze compositing or not
- with_cursor — whether source content contains cursor or not
- mask — this mask is guaranteed to be at the top most
select source interactively
Selector is provided by compositor. Client can provide source hint to hint compositor
to provide certain kinds of source.
treeland_capture_context_v1
event source_ready(
region_x: int,
region_y: int,
region_width: uint,
region_height: uint,
source_type: uint<source_type>,
)- region_x — offset x of capture region relative to mask for capture contents
- region_y — offset y of capture region relative to mask for capture contents
- region_width — width of capture region
- region_height — height of capture region
- source_type — final capture source type
notify client that source is ready
This event supplies the client some information about the capture source, including
the capture region relative to mask and source type.
Version 1
Compositor Support
capture manager
Global factory for creating capture sessions and capture contexts.