From f3565fdd77fb480575feec5de252466b093daf86 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Sun, 8 Dec 2024 14:32:11 +0100 Subject: Query capture options when opening settings and validate capture options when starting recording --- README.md | 4 +- TODO | 4 +- depends/mglpp | 2 +- include/Config.hpp | 6 +- include/GsrInfo.hpp | 3 +- include/Overlay.hpp | 2 +- include/gui/SettingsPage.hpp | 46 +++++++------- src/Config.cpp | 14 ++--- src/GsrInfo.cpp | 109 ++++++++++++++++++++++----------- src/Overlay.cpp | 55 ++++++++++++++--- src/gui/SettingsPage.cpp | 140 ++++++++++++++++++++++--------------------- src/main.cpp | 11 ++-- 12 files changed, 243 insertions(+), 153 deletions(-) diff --git a/README.md b/README.md index ce0117a..6c5ff1c 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,8 @@ These are the dependencies needed to build GPU Screen Recorder UI: * libxkbcommon ## Runtime dependencies +There are also additional dependencies needed at runtime: + * [GPU Screen Recorder](https://git.dec05eba.com/gpu-screen-recorder/) * [GPU Screen Recorder Notification](https://git.dec05eba.com/gpu-screen-recorder-notification/) @@ -47,4 +49,4 @@ If you want to donate you can donate via bitcoin or monero. # Known issues * Some games receive mouse input while the UI is open -* Global hotkeys on Wayland can clash with keys used by other applications. This is primarly because Wayland compositors are missing support for global hotkey so this software uses a global hotkey system that works on all Wayland compositors. \ No newline at end of file +* Global hotkeys on Wayland can clash with keys used by other applications. This is primarly because Wayland compositors are missing support for global hotkey so this software uses a global hotkey system that works on all Wayland compositors. diff --git a/TODO b/TODO index e70013e..d7bcd58 100644 --- a/TODO +++ b/TODO @@ -66,7 +66,7 @@ Make save-video-in-game-folder.sh and notify-saved-name.sh run ~/.config/gpu-scr if the profile is called 4chan. Create a directory of such example scripts, including 4chan webm one. -On nvidia check if suspend fix is applied. If not, show a popup asking the user to apply it (and apply it automatically). +On nvidia check if suspend fix is applied. If not, show a popup asking the user to apply it (and apply it automatically). This is a requirement before this package is made to a flatpak. Show warning when using steam deck or when trying to capture hevc/av1 on amd (the same warnings as gpu screen recorder gtk). @@ -103,4 +103,4 @@ Dont allow autostart of replay if capture option is window recording (when windo Use global shortcuts desktop portal protocol on wayland when available. -Use `gpu-screen-recorder --list-capture-options` instead of gsr_info.supported_capture_options.monitors and update it everytime when opening setting page and when starting recording. \ No newline at end of file +When support for window capture is enabled on x11 then make sure to not save the window except temporary while the program is open. \ No newline at end of file diff --git a/depends/mglpp b/depends/mglpp index 4dbee5a..0c8ccb8 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 4dbee5ac57c10819ff8d06560be573ad3a3e4e05 +Subproject commit 0c8ccb86a55e9b5b98ab68ca538ad7374308bae8 diff --git a/include/Config.hpp b/include/Config.hpp index 6044ab8..02f1634 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -7,7 +7,7 @@ #include namespace gsr { - struct GsrInfo; + struct SupportedCaptureOptions; struct ConfigHotkey { int64_t keysym = 0; @@ -92,7 +92,7 @@ namespace gsr { }; struct Config { - Config(const GsrInfo &gsr_info); + Config(const SupportedCaptureOptions &capture_options); MainConfig main_config; StreamingConfig streaming_config; @@ -100,6 +100,6 @@ namespace gsr { ReplayConfig replay_config; }; - std::optional read_config(const GsrInfo &gsr_info); + std::optional read_config(const SupportedCaptureOptions &capture_options); void save_config(Config &config); } \ No newline at end of file diff --git a/include/GsrInfo.hpp b/include/GsrInfo.hpp index cd6292c..6ec8e23 100644 --- a/include/GsrInfo.hpp +++ b/include/GsrInfo.hpp @@ -52,13 +52,13 @@ namespace gsr { struct GpuInfo { GpuVendor vendor = GpuVendor::UNKNOWN; + std::string card_path; }; struct GsrInfo { SystemInfo system_info; GpuInfo gpu_info; SupportedVideoCodecs supported_video_codecs; - SupportedCaptureOptions supported_capture_options; }; enum class GsrInfoExitStatus { @@ -78,4 +78,5 @@ namespace gsr { std::vector get_audio_devices(); std::vector get_application_audio(); + SupportedCaptureOptions get_supported_capture_options(const GsrInfo &gsr_info); } \ No newline at end of file diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 0a4a1e9..283f2b1 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -36,7 +36,7 @@ namespace gsr { class Overlay { public: - Overlay(std::string resources_path, GsrInfo gsr_info, egl_functions egl_funcs); + Overlay(std::string resources_path, GsrInfo gsr_info, SupportedCaptureOptions capture_options, egl_functions egl_funcs); Overlay(const Overlay&) = delete; Overlay& operator=(const Overlay&) = delete; ~Overlay(); diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index f18ff65..b115d78 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -25,17 +25,17 @@ namespace gsr { STREAM }; - SettingsPage(Type type, const GsrInfo &gsr_info, Config &config, PageStack *page_stack); + SettingsPage(Type type, const GsrInfo *gsr_info, Config &config, PageStack *page_stack); SettingsPage(const SettingsPage&) = delete; SettingsPage& operator=(const SettingsPage&) = delete; - void load(const GsrInfo &gsr_info); + void load(); void save(); void on_navigate_away_from_page() override; private: std::unique_ptr create_view_radio_button(); - std::unique_ptr create_record_area_box(const GsrInfo &gsr_info); - std::unique_ptr create_record_area(const GsrInfo &gsr_info); + std::unique_ptr create_record_area_box(); + std::unique_ptr create_record_area(); std::unique_ptr create_select_window(); std::unique_ptr create_area_width_entry(); std::unique_ptr create_area_height_entry(); @@ -48,7 +48,7 @@ namespace gsr { std::unique_ptr create_restore_portal_session_checkbox(); std::unique_ptr create_restore_portal_session_section(); std::unique_ptr create_change_video_resolution_section(); - std::unique_ptr create_capture_target(const GsrInfo &gsr_info); + std::unique_ptr create_capture_target(); std::unique_ptr create_audio_device_selection_combobox(); std::unique_ptr