Treeland capture
用于捕获输出内容或窗口内容的协议
此协议允许授权应用程序捕获输出内容或窗口内容(适用于窗口串流)。
指示当前帧已完成
这是对当前 "ready" 事件的确认。只有在当前 "ready" 事件被确认后才会发送下一个 "frame" 事件。时间戳应与 "ready" 事件中发送的时间戳相同。 如果帧具有 "transient" 标志,则此事件之后之前发送的所有对象都将失效。
frame(offset_x: int, offset_y: int, width: uint, height: uint, buffer_flags: uint, flags: uint<treeland_capture_session_v1.flags>, format: uint, mod_high: uint, mod_low: uint, num_objects: uint)
参数 | 类型 | 描述 |
|---|---|---|
| offset_x | int | crop offset x |
| offset_y | int | crop offset y |
| width | uint | |
| height | uint | |
| buffer_flags | uint | |
| flags | uint<treeland_capture_session_v1.flags> | |
| format | uint | |
| mod_high | uint | |
| mod_low | uint | |
| num_objects | uint |
向客户端提供帧信息
向客户端提供帧信息的主要事件。如果捕获未失败,此事件始终在其他事件之前首先发出。 当提供 mask 时,x 和 y 应为相对于 mask surface 原点的偏移量。否则 offset_x 和 offset_y 应始终为零。
向客户端提供对象 fd
指示帧可供读取
帧呈现后立即发送此事件,指示帧可供读取。此事件包含呈现发生的时间。
cancel(reason: uint<treeland_capture_session_v1.cancel_reason>)
参数 | 类型 | 描述 |
|---|---|---|
| reason | uint<treeland_capture_session_v1.cancel_reason> |
通知当前帧不再有效
如果捕获失败或在 "frame" 事件发出后帧不再有效,此事件将通知客户端丢弃该帧。
复制捕获内容
将捕获内容复制到提供的缓冲区。
buffer(format: uint<wl_shm.format>, width: uint, height: uint, stride: uint)
参数 | 类型 | 描述 |
|---|---|---|
| format | uint<wl_shm.format> | |
| width | uint | |
| height | uint | |
| stride | uint |
通知客户端准备缓冲区
通知客户端准备缓冲区。
flags(flags: uint<treeland_capture_frame_v1.flags>)
参数 | 类型 | 描述 |
|---|---|---|
| flags | uint<treeland_capture_frame_v1.flags> | frame flags |
帧标志
提供关于帧的标志。此事件在 "ready" 事件之前发送一次。
select_source(source_hint: uint<treeland_capture_context_v1.source_type>, freeze: uint, with_cursor: uint, mask: object<wl_surface>)
参数 | 类型 | 描述 |
|---|---|---|
| source_hint | uint<treeland_capture_context_v1.source_type> | |
| freeze | uint | freeze compositing or not |
| with_cursor | uint | whether source content contains cursor or not |
| mask | object<wl_surface>允许为空 | this mask is guaranteed to be at the top most |
交互式选择源
选择器由合成器提供。客户端可以提供源提示来引导合成器提供特定类型的源。
capture(frame: new_id<treeland_capture_frame_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| frame | new_id<treeland_capture_frame_v1> |
捕获一帧
此事件只能调用一次。第二次调用可能会导致协议错误,因为我们只提供 transient。
create_session(session: new_id<treeland_capture_session_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| session | new_id<treeland_capture_session_v1> |
创建持久捕获会话
通常由屏幕录制器使用。
source_ready(region_x: int, region_y: int, region_width: uint, region_height: uint, source_type: uint<treeland_capture_context_v1.source_type>)
参数 | 类型 | 描述 |
|---|---|---|
| region_x | int | offset x of capture region relative to mask for capture contents |
| region_y | int | offset y of capture region relative to mask for capture contents |
| region_width | uint | width of capture region |
| region_height | uint | height of capture region |
| source_type | uint<treeland_capture_context_v1.source_type> | final capture source type |
通知客户端源已就绪
此事件向客户端提供有关捕获源的一些信息,包括相对于 mask 的捕获区域和源类型。
source_failed(reason: uint<treeland_capture_context_v1.source_failure>)
参数 | 类型 | 描述 |
|---|---|---|
| reason | uint<treeland_capture_context_v1.source_failure> |
通知客户端源选择失败
可能有很多原因,但最常见的是选择器正忙。
source_failure { selector_busy, user_cancel, source_destroyed, other }
参数 | 值 | 描述 |
|---|---|---|
| selector_busy | 1 | 选择器被其他上下文占用 |
| user_cancel | 2 | 用户从合成器取消此上下文 |
| source_destroyed | 3 | 源已被销毁 |
| other | 4 | 其他失败 |
源失败原因
treeland_capture_manager_v1::destroy
类型: destructor
destroy()
销毁捕获管理器
销毁 treeland_capture_manager_v1 对象。
get_context(context: new_id<treeland_capture_context_v1>)
参数 | 类型 | 描述 |
|---|---|---|
| context | new_id<treeland_capture_context_v1> |
获取捕获上下文
合成器支持
Cage | COSMIC | GameScope | Hyprland | Jay | KWin | Labwc | Louvre | Mir | Muffin | Mutter | niri | phoc | river | Sway | Treeland | Wayfire | Weston | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| treeland_capture_manager_v1 | x | x | x | x | x | x | x | x | x | x | x | x | x | x | x | 1 | x | x |
Copyright
SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd. SPDX-License-Identifier: MIT