diff options
author | dec05eba <dec05eba@protonmail.com> | 2025-05-10 17:10:59 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2025-05-10 17:10:59 +0200 |
commit | e3225bc62835c6accc18787c6038fc1dce2484fc (patch) | |
tree | 56c22deacd2a1101ad82ecc80ad300896e6c872f /dbus/client/dbus_client.h | |
parent | 811a14481dbd75fe2c2a072517e06add336fee4f (diff) |
Move dbus code to a separate process to allow gpu-screen-recorder to use cap_sys_nice for better recording performance on amd
Diffstat (limited to 'dbus/client/dbus_client.h')
-rw-r--r-- | dbus/client/dbus_client.h | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/dbus/client/dbus_client.h b/dbus/client/dbus_client.h new file mode 100644 index 0000000..c9e8182 --- /dev/null +++ b/dbus/client/dbus_client.h @@ -0,0 +1,36 @@ +#ifndef GSR_DBUS_CLIENT_H +#define GSR_DBUS_CLIENT_H + +/* + Using a client-server architecture is needed for dbus because cap_sys_nice doesn't work with desktop portal. + The main binary has cap_sys_nice and we launch a new child-process without it which uses uses desktop portal. +*/ + +#include "../portal.h" +#include <stdbool.h> +#include <stdint.h> +#include <signal.h> + +typedef struct { + int socket_pair[2]; + char *screencast_restore_token; + pid_t pid; +} gsr_dbus_client; + +/* Blocking. TODO: Make non-blocking */ +bool gsr_dbus_client_init(gsr_dbus_client *self, const char *screencast_restore_token); +void gsr_dbus_client_deinit(gsr_dbus_client *self); + +/* The follow functions should be called in order to setup ScreenCast properly */ +/* These functions that return an int return the response status code */ +int gsr_dbus_client_screencast_create_session(gsr_dbus_client *self, char *session_handle, size_t session_handle_size); +/* + |capture_type| is a bitmask of gsr_portal_capture_type values. gsr_portal_capture_type values that are not supported by the desktop portal will be ignored. + |gsr_portal_cursor_mode| is a bitmask of gsr_portal_cursor_mode values. gsr_portal_cursor_mode values that are not supported will be ignored. +*/ +int gsr_dbus_client_screencast_select_sources(gsr_dbus_client *self, const char *session_handle, uint32_t capture_type, uint32_t cursor_mode); +int gsr_dbus_client_screencast_start(gsr_dbus_client *self, const char *session_handle, uint32_t *pipewire_node); +bool gsr_dbus_client_screencast_open_pipewire_remote(gsr_dbus_client *self, const char *session_handle, int *pipewire_fd); +const char* gsr_dbus_client_screencast_get_restore_token(gsr_dbus_client *self); + +#endif /* GSR_DBUS_CLIENT_H */ |