Replay on startup: wait until audio devices are available before turning replay on

This commit is contained in:
dec05eba
2025-02-25 17:33:21 +01:00
parent d9a1e5c2eb
commit f0bbbbe4a9
8 changed files with 108 additions and 39 deletions

View File

@@ -11,6 +11,15 @@
namespace gsr {
struct SupportedCaptureOptions;
enum class ReplayStartupMode {
DONT_TURN_ON_AUTOMATICALLY,
TURN_ON_AT_SYSTEM_STARTUP,
TURN_ON_AT_FULLSCREEN,
TURN_ON_AT_POWER_SUPPLY_CONNECTED
};
ReplayStartupMode replay_startup_string_to_type(const char *startup_mode_str);
struct ConfigHotkey {
int64_t key = 0; // Mgl key
uint32_t modifiers = 0; // HotkeyModifier

View File

@@ -92,6 +92,7 @@ namespace gsr {
void replay_status_update_status();
void update_focused_fullscreen_status();
void update_power_supply_status();
void update_system_startup_status();
void on_stop_recording(int exit_code);
@@ -108,7 +109,7 @@ namespace gsr {
void update_ui_replay_stopped();
void on_press_save_replay();
void on_press_start_replay(bool disable_notification);
bool on_press_start_replay(bool disable_notification);
void on_press_start_record();
void on_press_start_stream();
void on_press_take_screenshot();
@@ -197,6 +198,8 @@ namespace gsr {
mgl::Clock replay_save_clock;
bool replay_save_show_notification = false;
ReplayStartupMode replay_startup_mode = ReplayStartupMode::TURN_ON_AT_SYSTEM_STARTUP;
bool try_replay_startup = true;
AudioPlayer audio_player;
};

View File

@@ -12,14 +12,14 @@ namespace gsr {
};
// Arguments ending with NULL
bool exec_program_daemonized(const char **args);
bool exec_program_daemonized(const char **args, bool debug = true);
// Arguments ending with NULL. |read_fd| can be NULL
pid_t exec_program(const char **args, int *read_fd);
pid_t exec_program(const char **args, int *read_fd, bool debug = true);
// Arguments ending with NULL. Returns the exit status of the program or -1 on error
int exec_program_get_stdout(const char **args, std::string &result);
int exec_program_get_stdout(const char **args, std::string &result, bool debug = true);
// Arguments ending with NULL. Returns the exit status of the program or -1 on error.
// This works the same as |exec_program_get_stdout|, except on flatpak where this runs the program on the
// host machine with flatpak-spawn --host
int exec_program_on_host_get_stdout(const char **args, std::string &result);
int exec_program_on_host_get_stdout(const char **args, std::string &result, bool debug = true);
pid_t pidof(const char *process_name, pid_t ignore_pid);
}