mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Add support for desktop portal capture (-w portal)
This commit is contained in:
43
include/dbus.h
Normal file
43
include/dbus.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef GSR_DBUS_H
|
||||
#define GSR_DBUS_H
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <dbus/dbus.h>
|
||||
|
||||
#define DBUS_RANDOM_STR_SIZE 16
|
||||
|
||||
typedef struct {
|
||||
DBusConnection *con;
|
||||
DBusError err;
|
||||
char random_str[DBUS_RANDOM_STR_SIZE + 1];
|
||||
unsigned int handle_counter;
|
||||
bool desktop_portal_rule_added;
|
||||
uint32_t screencast_version;
|
||||
char *screencast_restore_token;
|
||||
} gsr_dbus;
|
||||
|
||||
typedef enum {
|
||||
GSR_PORTAL_CAPTURE_TYPE_MONITOR = 1 << 0,
|
||||
GSR_PORTAL_CAPTURE_TYPE_WINDOW = 1 << 1,
|
||||
GSR_PORTAL_CAPTURE_TYPE_VIRTUAL = 1 << 2,
|
||||
GSR_PORTAL_CAPTURE_TYPE_ALL = GSR_PORTAL_CAPTURE_TYPE_MONITOR | GSR_PORTAL_CAPTURE_TYPE_WINDOW | GSR_PORTAL_CAPTURE_TYPE_VIRTUAL
|
||||
} gsr_portal_capture_type;
|
||||
|
||||
typedef enum {
|
||||
GSR_PORTAL_CURSOR_MODE_HIDDEN = 1 << 0,
|
||||
GSR_PORTAL_CURSOR_MODE_EMBEDDED = 1 << 1,
|
||||
GSR_PORTAL_CURSOR_MODE_METADATA = 1 << 2
|
||||
} gsr_portal_cursor_mode;
|
||||
|
||||
/* Blocking. TODO: Make non-blocking */
|
||||
bool gsr_dbus_init(gsr_dbus *self, const char *screencast_restore_token);
|
||||
void gsr_dbus_deinit(gsr_dbus *self);
|
||||
|
||||
bool gsr_dbus_screencast_create_session(gsr_dbus *self, char **session_handle);
|
||||
bool gsr_dbus_screencast_select_sources(gsr_dbus *self, const char *session_handle, gsr_portal_capture_type capture_type, gsr_portal_cursor_mode cursor_mode);
|
||||
bool gsr_dbus_screencast_start(gsr_dbus *self, const char *session_handle, uint32_t *pipewire_node);
|
||||
bool gsr_dbus_screencast_open_pipewire_remote(gsr_dbus *self, const char *session_handle, int *pipewire_fd);
|
||||
const char* gsr_dbus_screencast_get_restore_token(gsr_dbus *self);
|
||||
|
||||
#endif /* GSR_DBUS_H */
|
||||
Reference in New Issue
Block a user