From 4ba1e814b748d57631f6b7afb7eaa63e8435c24e Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 13 Nov 2024 22:18:30 +0100 Subject: Add application audio option --- README.md | 5 + TODO | 27 ++++++ depends/mglpp | 2 +- include/Config.hpp | 3 + include/GsrInfo.hpp | 1 + include/Overlay.hpp | 3 +- include/gui/Label.hpp | 1 + include/gui/LineSeparator.hpp | 24 +++++ include/gui/SettingsPage.hpp | 31 ++++-- include/gui/Subsection.hpp | 1 + meson.build | 1 + scripts/notify-saved-name.sh | 1 - src/Config.cpp | 9 ++ src/GsrInfo.cpp | 26 +++++ src/Overlay.cpp | 149 ++++++++++++----------------- src/gui/CheckBox.cpp | 12 +-- src/gui/Label.cpp | 4 + src/gui/LineSeparator.cpp | 45 +++++++++ src/gui/SettingsPage.cpp | 215 ++++++++++++++++++++++++++++++++++++------ src/gui/Subsection.cpp | 18 +++- 20 files changed, 441 insertions(+), 137 deletions(-) create mode 100644 include/gui/LineSeparator.hpp create mode 100644 src/gui/LineSeparator.cpp diff --git a/README.md b/README.md index abc6ab1..0c003af 100644 --- a/README.md +++ b/README.md @@ -34,3 +34,8 @@ This software is licensed under GPL3.0-only. Files under `fonts/` directory are # Screenshots ![](https://dec05eba.com/images/gsr-overlay-screenshot-front.webp) ![](https://dec05eba.com/images/gsr-overlay-screenshot-settings.webp) + +# Donations +If you want to donate you can donate via bitcoin or monero. +* Bitcoin: bc1qqvuqnwrdyppf707ge27fqz2n9y9gu7lf5ypyuf +* Monero: 4An9kp2qW1C9Gah7ewv4JzcNFQ5TAX7ineGCqXWK6vQnhsGGcRpNgcn8r9EC3tMcgY7vqCKs3nSRXhejMHBaGvFdN2egYet \ No newline at end of file diff --git a/TODO b/TODO index a9c216c..ac71593 100644 --- a/TODO +++ b/TODO @@ -52,3 +52,30 @@ Add profiles and hotkey to switch between profiles (show notification when switc Fix first frame being black. Add support for systray. + +Add option to take screenshot. + +Move event callbacks to a global list instead of std::function object in each widget. This reduces the size of widgets, + since most widgets wont have the event callback set. + This event callback would pass the widget as an argument. + This could be done transparently by having a function in the widget to set a callback function + and that could add a wrapper that checks if the callback received _this_, and that would call the callback set by the user. + +Make save-video-in-game-folder.sh and notify-saved-name.sh run ~/.config/gpu-screen-recorder/on-save.sh if it exists. + This could for example be used to automatically convert the video to a different format or to upload it to a server. + Before this script is called gsr-ui should define an environment variable GSR_PROFILE that specifies the name of the profile. + This profile name can be used to decide which action the users script should do, for example to convert the video to a 4chan friendly webm file + 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). + +Show warning when using steam deck or when trying to capture hevc/av1 on amd (the same warnings as gpu screen recorder gtk). + +Add option to capture application audio. This should show a popup where you can use one of the available applications or a custom one and choose to record that application or all applications except that one. + +Add profile option. Convert view to profile, add an option at the bottom that says "Edit profiles..." which should show a popup where you can create/remove profiles. New profiles should always be in advanced view. + +Verify monitor/audio when starting recording. Give an error if the options are no longer valid. + +Add option to record focused monitor. This is less error prone when plugging in monitors, etc. \ No newline at end of file diff --git a/depends/mglpp b/depends/mglpp index 23b7590..84a6eb5 160000 --- a/depends/mglpp +++ b/depends/mglpp @@ -1 +1 @@ -Subproject commit 23b75905a53abb2e4d5a44b16e0496e7fa4c7e3d +Subproject commit 84a6eb51b0c54e8f2c5134ff9e3baf39f5da77cb diff --git a/include/Config.hpp b/include/Config.hpp index 785af69..fbfc86f 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -23,8 +23,11 @@ namespace gsr { int32_t fps = 60; int32_t video_bitrate = 15000; bool merge_audio_tracks = true; + bool application_audio_invert = false; bool change_video_resolution = false; + std::string audio_type_view = "audio_devices"; std::vector audio_tracks; + std::vector application_audio; std::string color_range = "limited"; std::string video_quality = "very_high"; std::string video_codec = "auto"; diff --git a/include/GsrInfo.hpp b/include/GsrInfo.hpp index fb12cd4..c3da6d7 100644 --- a/include/GsrInfo.hpp +++ b/include/GsrInfo.hpp @@ -76,4 +76,5 @@ namespace gsr { GsrInfoExitStatus get_gpu_screen_recorder_info(GsrInfo *gsr_info); std::vector get_audio_devices(); + std::vector get_application_audio(); } \ No newline at end of file diff --git a/include/Overlay.hpp b/include/Overlay.hpp index eafb4ab..823e3a6 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -90,14 +90,13 @@ namespace gsr { std::string resources_path; GsrInfo gsr_info; egl_functions egl_funcs; - std::vector audio_devices; mgl::Texture window_texture_texture; mgl::Sprite window_texture_sprite; mgl::Texture screenshot_texture; mgl::Sprite screenshot_sprite; mgl::Rectangle bg_screenshot_overlay; WindowTexture window_texture; - gsr::PageStack page_stack; + PageStack page_stack; mgl::Rectangle top_bar_background; mgl::Text top_bar_text; mgl::Sprite logo_sprite; diff --git a/include/gui/Label.hpp b/include/gui/Label.hpp index a702497..f9045e0 100644 --- a/include/gui/Label.hpp +++ b/include/gui/Label.hpp @@ -19,6 +19,7 @@ namespace gsr { mgl::vec2f get_size() override; void set_text(std::string str); + const std::string& get_text() const; private: mgl::Text text; }; diff --git a/include/gui/LineSeparator.hpp b/include/gui/LineSeparator.hpp new file mode 100644 index 0000000..8c39114 --- /dev/null +++ b/include/gui/LineSeparator.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include "Widget.hpp" + +namespace gsr { + class LineSeparator : public Widget { + public: + enum class Type { + HORIZONTAL + }; + + LineSeparator(Type type, float width); + LineSeparator(const LineSeparator&) = delete; + LineSeparator& operator=(const LineSeparator&) = delete; + + bool on_event(mgl::Event &event, mgl::Window &window, mgl::vec2f offset) override; + void draw(mgl::Window &window, mgl::vec2f offset) override; + + mgl::vec2f get_size() override; + private: + Type type; + float width; + }; +} \ No newline at end of file diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index 467463f..2fba93b 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -24,7 +24,7 @@ namespace gsr { STREAM }; - SettingsPage(Type type, const GsrInfo &gsr_info, std::vector audio_devices, 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; @@ -48,13 +48,23 @@ namespace gsr { 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_audio_track_selection_checkbox(); - std::unique_ptr