diff options
-rwxr-xr-x | build.sh | 2 | ||||
-rw-r--r-- | com.dec05eba.gpu_screen_recorder.appdata.xml | 11 | ||||
-rw-r--r-- | src/main.cpp | 56 |
3 files changed, 65 insertions, 4 deletions
@@ -6,7 +6,7 @@ cd "$script_dir" CC=${CC:-gcc} CXX=${CXX:-g++} -opts="-O2 -g0 -DNDEBUG -Wall -Wextra -Werror -s" +opts="-O2 -g0 -DNDEBUG -Wall -Wextra -Werror" [ -n "$DEBUG" ] && opts="-O0 -g3 -Wall -Wextra -Werror"; build_gsr_gtk() { diff --git a/com.dec05eba.gpu_screen_recorder.appdata.xml b/com.dec05eba.gpu_screen_recorder.appdata.xml index a44c2c6..4cde850 100644 --- a/com.dec05eba.gpu_screen_recorder.appdata.xml +++ b/com.dec05eba.gpu_screen_recorder.appdata.xml @@ -35,6 +35,7 @@ <li>AAC</li> <li>FLAC</li> </ul> + <p>Note: Opus and FLAC audio codecs are disabled at the moment because of temporary issues.</p> <p> Recording a monitor requires (restricted) root access which means that you have to install GPU Screen Recorder system-wide: flatpak install flathub --system com.dec05eba.gpu_screen_recorder and pkexec needs to be installed on the system and a polkit agent needs to be running. @@ -80,6 +81,16 @@ </screenshots> <releases> + <release version="3.7.2" date="2024-04-20"> + <description> + <ul> + <li>Improve nvidia video encoding performance a lot on certain GPUs</li> + <li>Improve audio/video sync</li> + <li>Increase audio bitrate</li> + <li>Hide notifications after a few seconds</li> + </ul> + </description> + </release> <release version="3.7.1" date="2024-04-12"> <description> <p>Fix audio sync regression when using mixed audio</p> diff --git a/src/main.cpp b/src/main.cpp index 23d6f78..16470b3 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -121,6 +121,10 @@ static bool wayland = false; static bool flatpak = false; static gsr_egl egl; +static bool showing_notification = false; +static double notification_timeout_seconds = 0.0; +static double notification_start_seconds = 0.0; + struct AudioInput { std::string name; std::string description; @@ -893,6 +897,14 @@ static void show_notification(GtkApplication *app, const char *title, const char g_notification_set_body(notification, body); g_notification_set_priority(notification, priority); g_application_send_notification(&app->parent, "gpu-screen-recorder", notification); + + showing_notification = true; + if(priority < G_NOTIFICATION_PRIORITY_URGENT) { + notification_timeout_seconds = 2.0; + } else { + notification_timeout_seconds = 5.0; + } + notification_start_seconds = clock_get_monotonic_seconds(); } static bool window_has_atom(Display *display, Window window, Atom atom) { @@ -2542,14 +2554,26 @@ static GtkWidget* create_common_settings_page(GtkStack *stack, GtkApplication *a gtk_grid_set_column_spacing(start_button_grid, 10); stream_button = GTK_BUTTON(gtk_button_new_with_label("Stream")); + GtkWidget *go_next_stream = gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(stream_button, go_next_stream); + gtk_button_set_always_show_image(stream_button, true); + gtk_button_set_image_position(stream_button, GTK_POS_RIGHT); gtk_widget_set_hexpand(GTK_WIDGET(stream_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(stream_button), 0, 0, 1, 1); record_button = GTK_BUTTON(gtk_button_new_with_label("Record")); + GtkWidget *go_next_record = gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(record_button, go_next_record); + gtk_button_set_always_show_image(record_button, true); + gtk_button_set_image_position(record_button, GTK_POS_RIGHT); gtk_widget_set_hexpand(GTK_WIDGET(record_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(record_button), 1, 0, 1, 1); replay_button = GTK_BUTTON(gtk_button_new_with_label("Replay")); + GtkWidget *go_next_replay = gtk_image_new_from_icon_name("go-next", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(replay_button, go_next_replay); + gtk_button_set_always_show_image(replay_button, true); + gtk_button_set_image_position(replay_button, GTK_POS_RIGHT); gtk_widget_set_hexpand(GTK_WIDGET(replay_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(replay_button), 2, 0, 1, 1); @@ -2561,7 +2585,7 @@ static GtkWidget* create_common_settings_page(GtkStack *stack, GtkApplication *a } static void add_wayland_global_hotkeys_ui(GtkGrid *grid, int &row, int width) { - GtkWidget *label = gtk_label_new("Wayland don't support global hotkeys, use X11"); + GtkWidget *label = gtk_label_new("Hotkeys not supported because Wayland doesn't support global hotkeys"); gtk_widget_set_hexpand(label, true); gtk_grid_attach(grid, label, 0, row, width - 1, 1); @@ -2575,7 +2599,7 @@ static void add_wayland_global_hotkeys_ui(GtkGrid *grid, int &row, int width) { (void)userdata; GtkWidget *dialog = gtk_message_dialog_new_with_markup(GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, "Wayland (desktop portal) doesn't support global hotkeys in any meaningful manner to most applications, including GPU Screen Recorder.\n" - "If you want to use global hotkeys in GPU Screen Recorder then either use X11 or bind the following commands in your desktop environment settings to keys:\n" + "If you want to use global hotkeys in GPU Screen Recorder then either use X11 or bind the following commands in your Wayland desktop environment hotkey settings to keys:\n" "Stop recording (saves video as well when not in replay mode):\n" " killall -SIGINT gpu-screen-recorder\n" "Save a replay:\n" @@ -2683,10 +2707,14 @@ static GtkWidget* create_replay_page(GtkApplication *app, GtkStack *stack) { gtk_grid_attach(replay_time_grid, GTK_WIDGET(replay_time_entry), 1, 0, 1, 1); GtkGrid *start_button_grid = GTK_GRID(gtk_grid_new()); - gtk_grid_attach(grid, GTK_WIDGET(start_button_grid), 0, row++, 5, 1); gtk_grid_set_column_spacing(start_button_grid, 10); + replay_back_button = GTK_BUTTON(gtk_button_new_with_label("Back")); + GtkWidget *go_previous = gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(replay_back_button, go_previous); + gtk_button_set_always_show_image(replay_back_button, true); + gtk_button_set_image_position(replay_back_button, GTK_POS_LEFT); gtk_widget_set_hexpand(GTK_WIDGET(replay_back_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(replay_back_button), 0, 0, 1, 1); @@ -2808,6 +2836,10 @@ static GtkWidget* create_recording_page(GtkApplication *app, GtkStack *stack) { gtk_grid_set_column_spacing(start_button_grid, 10); record_back_button = GTK_BUTTON(gtk_button_new_with_label("Back")); + GtkWidget *go_previous = gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(record_back_button, go_previous); + gtk_button_set_always_show_image(record_back_button, true); + gtk_button_set_image_position(record_back_button, GTK_POS_LEFT); gtk_widget_set_hexpand(GTK_WIDGET(record_back_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(record_back_button), 0, 0, 1, 1); @@ -2908,7 +2940,12 @@ static GtkWidget* create_streaming_page(GtkApplication *app, GtkStack *stack) { GtkGrid *start_button_grid = GTK_GRID(gtk_grid_new()); gtk_grid_attach(grid, GTK_WIDGET(start_button_grid), 0, row++, 3, 1); gtk_grid_set_column_spacing(start_button_grid, 10); + stream_back_button = GTK_BUTTON(gtk_button_new_with_label("Back")); + GtkWidget *go_previous = gtk_image_new_from_icon_name("go-previous", GTK_ICON_SIZE_BUTTON); + gtk_button_set_image(stream_back_button, go_previous); + gtk_button_set_always_show_image(stream_back_button, true); + gtk_button_set_image_position(stream_back_button, GTK_POS_LEFT); gtk_widget_set_hexpand(GTK_WIDGET(stream_back_button), true); gtk_grid_attach(start_button_grid, GTK_WIDGET(stream_back_button), 0, 0, 1, 1); start_streaming_button = GTK_BUTTON(gtk_button_new_with_label("Start streaming")); @@ -3002,7 +3039,20 @@ static void handle_record_timer() { } } +static void handle_notification_timer(GtkApplication *app) { + if(!showing_notification) + return; + + const double now = clock_get_monotonic_seconds(); + if(now - notification_start_seconds >= notification_timeout_seconds) { + g_application_withdraw_notification(&app->parent, "gpu-screen-recorder"); + showing_notification = false; + } +} + static gboolean timer_timeout_handler(gpointer userdata) { + GtkApplication *app = (GtkApplication*)userdata; + handle_notification_timer(app); handle_child_process_death(userdata); handle_record_timer(); return G_SOURCE_CONTINUE; |