mirror of
https://github.com/hyprwm/xdg-desktop-portal-hyprland.git
synced 2024-11-22 06:35:57 +01:00
screencast: rename screencopy_frame to screencopy_frame_info
This commit is contained in:
parent
21d26fe23e
commit
e28f5e06e6
4 changed files with 27 additions and 27 deletions
|
@ -60,7 +60,7 @@ struct xdpw_frame {
|
|||
struct pw_buffer *current_pw_buffer;
|
||||
};
|
||||
|
||||
struct xdpw_screencopy_frame {
|
||||
struct xdpw_screencopy_frame_info {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
uint32_t size;
|
||||
|
@ -113,7 +113,7 @@ struct xdpw_screencast_instance {
|
|||
struct xdpw_wlr_output *target_output;
|
||||
uint32_t max_framerate;
|
||||
struct zwlr_screencopy_frame_v1 *wlr_frame;
|
||||
struct xdpw_screencopy_frame screencopy_frame;
|
||||
struct xdpw_screencopy_frame_info screencopy_frame_info;
|
||||
bool with_cursor;
|
||||
int err;
|
||||
bool quit;
|
||||
|
|
|
@ -87,8 +87,8 @@ static void pwr_handle_stream_param_changed(void *data, uint32_t id,
|
|||
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
|
||||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(XDPW_PWR_BUFFERS, 1, 32),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(cast->screencopy_frame.size),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(cast->screencopy_frame.stride),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_Int(cast->screencopy_frame_info.size),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(cast->screencopy_frame_info.stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(XDPW_PWR_ALIGN),
|
||||
SPA_PARAM_BUFFERS_dataType,SPA_POD_CHOICE_FLAGS_Int(1<<SPA_DATA_MemFd));
|
||||
|
||||
|
@ -120,10 +120,10 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
|
|||
logprint(TRACE, "pipewire: selected buffertype %u", d[0].type);
|
||||
// Prepare buffer for choosen type
|
||||
if (d[0].type == SPA_DATA_MemFd) {
|
||||
d[0].maxsize = cast->screencopy_frame.size;
|
||||
d[0].maxsize = cast->screencopy_frame_info.size;
|
||||
d[0].mapoffset = 0;
|
||||
d[0].chunk->size = cast->screencopy_frame.size;
|
||||
d[0].chunk->stride = cast->screencopy_frame.stride;
|
||||
d[0].chunk->size = cast->screencopy_frame_info.size;
|
||||
d[0].chunk->stride = cast->screencopy_frame_info.stride;
|
||||
d[0].chunk->offset = 0;
|
||||
d[0].flags = 0;
|
||||
d[0].fd = anonymous_shm_open();
|
||||
|
@ -144,8 +144,8 @@ static void pwr_handle_stream_add_buffer(void *data, struct pw_buffer *buffer) {
|
|||
}
|
||||
|
||||
// create wl_buffer
|
||||
buffer->user_data = import_wl_shm_buffer(cast, d[0].fd, cast->screencopy_frame.format,
|
||||
cast->screencopy_frame.width, cast->screencopy_frame.height, cast->screencopy_frame.stride);
|
||||
buffer->user_data = import_wl_shm_buffer(cast, d[0].fd, cast->screencopy_frame_info.format,
|
||||
cast->screencopy_frame_info.width, cast->screencopy_frame_info.height, cast->screencopy_frame_info.stride);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -230,8 +230,8 @@ void xdpw_pwr_enqueue_buffer(struct xdpw_screencast_instance *cast) {
|
|||
logprint(TRACE, "pipewire: fd %u", d[0].fd);
|
||||
logprint(TRACE, "pipewire: size %d", d[0].maxsize);
|
||||
logprint(TRACE, "pipewire: stride %d", d[0].chunk->stride);
|
||||
logprint(TRACE, "pipewire: width %d", cast->screencopy_frame.width);
|
||||
logprint(TRACE, "pipewire: height %d", cast->screencopy_frame.height);
|
||||
logprint(TRACE, "pipewire: width %d", cast->screencopy_frame_info.width);
|
||||
logprint(TRACE, "pipewire: height %d", cast->screencopy_frame_info.height);
|
||||
logprint(TRACE, "pipewire: y_invert %d", cast->current_frame.y_invert);
|
||||
logprint(TRACE, "********************");
|
||||
|
||||
|
@ -249,10 +249,10 @@ void pwr_update_stream_param(struct xdpw_screencast_instance *cast) {
|
|||
SPA_POD_BUILDER_INIT(params_buffer, sizeof(params_buffer));
|
||||
const struct spa_pod *params[1];
|
||||
|
||||
enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast->screencopy_frame.format);
|
||||
enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast->screencopy_frame_info.format);
|
||||
|
||||
params[0] = build_format(&b, format,
|
||||
cast->screencopy_frame.width, cast->screencopy_frame.height, cast->framerate);
|
||||
cast->screencopy_frame_info.width, cast->screencopy_frame_info.height, cast->framerate);
|
||||
|
||||
pw_stream_update_params(stream, params, 1);
|
||||
}
|
||||
|
@ -279,10 +279,10 @@ void xdpw_pwr_stream_create(struct xdpw_screencast_instance *cast) {
|
|||
}
|
||||
cast->pwr_stream_state = false;
|
||||
|
||||
enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast->screencopy_frame.format);
|
||||
enum spa_video_format format = xdpw_format_pw_from_wl_shm(cast->screencopy_frame_info.format);
|
||||
|
||||
const struct spa_pod *param = build_format(&b, format,
|
||||
cast->screencopy_frame.width, cast->screencopy_frame.height, cast->framerate);
|
||||
cast->screencopy_frame_info.width, cast->screencopy_frame_info.height, cast->framerate);
|
||||
|
||||
pw_stream_add_listener(cast->stream, &cast->stream_listener,
|
||||
&pwr_stream_events, cast);
|
||||
|
|
|
@ -449,7 +449,7 @@ static int method_screencast_start(sd_bus_message *msg, void *data,
|
|||
"streams", "a(ua{sv})", 1,
|
||||
cast->node_id, 2,
|
||||
"position", "(ii)", 0, 0,
|
||||
"size", "(ii)", cast->screencopy_frame.width, cast->screencopy_frame.height);
|
||||
"size", "(ii)", cast->screencopy_frame_info.width, cast->screencopy_frame_info.height);
|
||||
|
||||
if (ret < 0) {
|
||||
return ret;
|
||||
|
|
|
@ -95,11 +95,11 @@ static void wlr_frame_buffer(void *data, struct zwlr_screencopy_frame_v1 *frame,
|
|||
logprint(TRACE, "wlroots: buffer event handler");
|
||||
cast->wlr_frame = frame;
|
||||
|
||||
cast->screencopy_frame.width = width;
|
||||
cast->screencopy_frame.height = height;
|
||||
cast->screencopy_frame.stride = stride;
|
||||
cast->screencopy_frame.size = stride * height;
|
||||
cast->screencopy_frame.format = format;
|
||||
cast->screencopy_frame_info.width = width;
|
||||
cast->screencopy_frame_info.height = height;
|
||||
cast->screencopy_frame_info.stride = stride;
|
||||
cast->screencopy_frame_info.size = stride * height;
|
||||
cast->screencopy_frame_info.format = format;
|
||||
|
||||
if (zwlr_screencopy_manager_v1_get_version(cast->ctx->screencopy_manager) < 3) {
|
||||
wlr_frame_buffer_done(cast, frame);
|
||||
|
@ -124,10 +124,10 @@ static void wlr_frame_buffer_done(void *data,
|
|||
}
|
||||
|
||||
// Check if announced screencopy information is compatible with pipewire meta
|
||||
if ((cast->pwr_format.format != xdpw_format_pw_from_wl_shm(cast->screencopy_frame.format) &&
|
||||
cast->pwr_format.format != xdpw_format_pw_strip_alpha(xdpw_format_pw_from_wl_shm(cast->screencopy_frame.format))) ||
|
||||
cast->pwr_format.size.width != cast->screencopy_frame.width ||
|
||||
cast->pwr_format.size.height != cast->screencopy_frame.height) {
|
||||
if ((cast->pwr_format.format != xdpw_format_pw_from_wl_shm(cast->screencopy_frame_info.format) &&
|
||||
cast->pwr_format.format != xdpw_format_pw_strip_alpha(xdpw_format_pw_from_wl_shm(cast->screencopy_frame_info.format))) ||
|
||||
cast->pwr_format.size.width != cast->screencopy_frame_info.width ||
|
||||
cast->pwr_format.size.height != cast->screencopy_frame_info.height) {
|
||||
logprint(DEBUG, "wlroots: pipewire and wlroots metadata are incompatible. Renegotiate stream");
|
||||
cast->frame_state = XDPW_FRAME_STATE_RENEG;
|
||||
xdpw_wlr_frame_finish(cast);
|
||||
|
@ -135,8 +135,8 @@ static void wlr_frame_buffer_done(void *data,
|
|||
}
|
||||
|
||||
// Check if dequeued buffer is compatible with announced buffer
|
||||
if (cast->current_frame.size != cast->screencopy_frame.size ||
|
||||
cast->current_frame.stride != cast->screencopy_frame.stride) {
|
||||
if (cast->current_frame.size != cast->screencopy_frame_info.size ||
|
||||
cast->current_frame.stride != cast->screencopy_frame_info.stride) {
|
||||
logprint(DEBUG, "wlroots: pipewire buffer has wrong dimensions");
|
||||
cast->frame_state = XDPW_FRAME_STATE_FAILED;
|
||||
xdpw_wlr_frame_finish(cast);
|
||||
|
|
Loading…
Reference in a new issue