diff options
Diffstat (limited to 'include')
17 files changed, 78 insertions, 19 deletions
diff --git a/include/Config.hpp b/include/Config.hpp index c8c6650..7c2aeda 100644 --- a/include/Config.hpp +++ b/include/Config.hpp @@ -45,7 +45,7 @@ namespace gsr { int32_t video_width = 0; int32_t video_height = 0; int32_t fps = 60; - int32_t video_bitrate = 15000; + int32_t video_bitrate = 8000; bool merge_audio_tracks = true; // TODO: Remove in the future bool application_audio_invert = false; // TODO: Remove in the future bool change_video_resolution = false; @@ -55,7 +55,7 @@ namespace gsr { std::string video_quality = "very_high"; std::string video_codec = "auto"; std::string audio_codec = "opus"; - std::string framerate_mode = "vfr"; + std::string framerate_mode = "auto"; bool advanced_view = false; bool overclock = false; bool record_cursor = true; @@ -79,6 +79,10 @@ namespace gsr { std::string stream_key; }; + struct RumbleStreamConfig { + std::string stream_key; + }; + struct CustomStreamConfig { std::string url; std::string container = "flv"; @@ -91,6 +95,7 @@ namespace gsr { std::string streaming_service = "twitch"; YoutubeStreamConfig youtube; TwitchStreamConfig twitch; + RumbleStreamConfig rumble; CustomStreamConfig custom; ConfigHotkey start_stop_hotkey; }; @@ -100,6 +105,7 @@ namespace gsr { bool save_video_in_game_folder = false; bool show_recording_started_notifications = true; bool show_video_saved_notifications = true; + bool show_video_paused_notifications = true; std::string save_directory; std::string container = "mp4"; ConfigHotkey start_stop_hotkey; @@ -117,6 +123,7 @@ namespace gsr { std::string save_directory; std::string container = "mp4"; int32_t replay_time = 60; + std::string replay_storage = "ram"; ConfigHotkey start_stop_hotkey; ConfigHotkey save_hotkey; ConfigHotkey save_1_min_hotkey; diff --git a/include/CursorTracker.hpp b/include/CursorTracker/CursorTracker.hpp index ff7374f..ff7374f 100644 --- a/include/CursorTracker.hpp +++ b/include/CursorTracker/CursorTracker.hpp diff --git a/include/CursorTrackerWayland.hpp b/include/CursorTracker/CursorTrackerWayland.hpp index 1eeee83..1eeee83 100644 --- a/include/CursorTrackerWayland.hpp +++ b/include/CursorTracker/CursorTrackerWayland.hpp diff --git a/include/CursorTrackerX11.hpp b/include/CursorTracker/CursorTrackerX11.hpp index 66618c4..66618c4 100644 --- a/include/CursorTrackerX11.hpp +++ b/include/CursorTracker/CursorTrackerX11.hpp diff --git a/include/GlobalHotkeys.hpp b/include/GlobalHotkeys/GlobalHotkeys.hpp index 2927fa7..2927fa7 100644 --- a/include/GlobalHotkeys.hpp +++ b/include/GlobalHotkeys/GlobalHotkeys.hpp diff --git a/include/GlobalHotkeysJoystick.hpp b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp index fde5be2..0177d29 100644 --- a/include/GlobalHotkeysJoystick.hpp +++ b/include/GlobalHotkeys/GlobalHotkeysJoystick.hpp @@ -1,7 +1,7 @@ #pragma once #include "GlobalHotkeys.hpp" -#include "Hotplug.hpp" +#include "../Hotplug.hpp" #include <unordered_map> #include <thread> #include <poll.h> @@ -56,6 +56,8 @@ namespace gsr { bool down_pressed = false; bool left_pressed = false; bool right_pressed = false; + bool l3_button_pressed = false; + bool r3_button_pressed = false; bool save_replay = false; bool save_1_min_replay = false; diff --git a/include/GlobalHotkeysLinux.hpp b/include/GlobalHotkeys/GlobalHotkeysLinux.hpp index 959d095..959d095 100644 --- a/include/GlobalHotkeysLinux.hpp +++ b/include/GlobalHotkeys/GlobalHotkeysLinux.hpp diff --git a/include/GlobalHotkeysX11.hpp b/include/GlobalHotkeys/GlobalHotkeysX11.hpp index 610399a..610399a 100644 --- a/include/GlobalHotkeysX11.hpp +++ b/include/GlobalHotkeys/GlobalHotkeysX11.hpp diff --git a/include/Overlay.hpp b/include/Overlay.hpp index 5af839e..3de89c2 100644 --- a/include/Overlay.hpp +++ b/include/Overlay.hpp @@ -6,10 +6,11 @@ #include "Config.hpp" #include "window_texture.h" #include "WindowUtils.hpp" -#include "GlobalHotkeysJoystick.hpp" +#include "GlobalHotkeys/GlobalHotkeysJoystick.hpp" #include "AudioPlayer.hpp" #include "RegionSelector.hpp" -#include "CursorTracker.hpp" +#include "WindowSelector.hpp" +#include "CursorTracker/CursorTracker.hpp" #include <mglpp/window/Window.hpp> #include <mglpp/window/Event.hpp> @@ -90,6 +91,7 @@ namespace gsr { void save_video_in_current_game_directory(const char *video_filepath, NotificationType notification_type); void on_replay_saved(const char *replay_saved_filepath); void process_gsr_output(); + void on_gsr_process_error(int exit_code, NotificationType notification_type); void update_gsr_process_status(); void update_gsr_screenshot_process_status(); @@ -116,10 +118,10 @@ namespace gsr { void on_press_save_replay(); void on_press_save_replay_1_min_replay(); void on_press_save_replay_10_min_replay(); - bool on_press_start_replay(bool disable_notification, bool finished_region_selection); - void on_press_start_record(bool finished_region_selection); - void on_press_start_stream(bool finished_region_selection); - void on_press_take_screenshot(bool finished_region_selection, bool force_region_capture); + bool on_press_start_replay(bool disable_notification, bool finished_selection); + void on_press_start_record(bool finished_selection); + void on_press_start_stream(bool finished_selection); + void on_press_take_screenshot(bool finished_selection, bool force_region_capture); bool update_compositor_texture(const Monitor &monitor); std::string get_capture_target(const std::string &capture_target, const SupportedCaptureOptions &capture_options); @@ -213,10 +215,15 @@ namespace gsr { int replay_save_duration_min = 0; AudioPlayer audio_player; + RegionSelector region_selector; bool start_region_capture = false; std::function<void()> on_region_selected; + WindowSelector window_selector; + bool start_window_capture = false; + std::function<void()> on_window_selected; + std::string recording_capture_target; std::string screenshot_capture_target; diff --git a/include/RegionSelector.hpp b/include/RegionSelector.hpp index 0465302..ef0bc0e 100644 --- a/include/RegionSelector.hpp +++ b/include/RegionSelector.hpp @@ -26,7 +26,6 @@ namespace gsr { bool failed() const; bool poll_events(); - bool is_selected() const; bool take_selection(); bool take_canceled(); Region get_selection() const; diff --git a/include/Theme.hpp b/include/Theme.hpp index 249ad3d..1390182 100644 --- a/include/Theme.hpp +++ b/include/Theme.hpp @@ -28,6 +28,7 @@ namespace gsr { mgl::Texture combobox_arrow_texture; mgl::Texture settings_texture; mgl::Texture settings_small_texture; + mgl::Texture settings_extra_small_texture; mgl::Texture folder_texture; mgl::Texture up_arrow_texture; mgl::Texture replay_button_texture; diff --git a/include/Utils.hpp b/include/Utils.hpp index 1415209..3d3c029 100644 --- a/include/Utils.hpp +++ b/include/Utils.hpp @@ -15,6 +15,8 @@ namespace gsr { void string_split_char(std::string_view str, char delimiter, StringSplitCallback callback_func); bool starts_with(std::string_view str, const char *substr); + bool ends_with(std::string_view str, const char *substr); + std::string strip(const std::string &str); std::string get_home_dir(); std::string get_config_dir(); diff --git a/include/WindowSelector.hpp b/include/WindowSelector.hpp new file mode 100644 index 0000000..ab4a85d --- /dev/null +++ b/include/WindowSelector.hpp @@ -0,0 +1,33 @@ +#pragma once + +#include <X11/Xlib.h> + +#include <mglpp/graphics/Color.hpp> + +namespace gsr { + class WindowSelector { + public: + WindowSelector(); + WindowSelector(const WindowSelector&) = delete; + WindowSelector& operator=(const WindowSelector&) = delete; + ~WindowSelector(); + + bool start(mgl::Color border_color); + void stop(); + bool is_started() const; + + bool failed() const; + bool poll_events(); + bool take_selection(); + bool take_canceled(); + Window get_selection() const; + private: + Display *dpy = nullptr; + Cursor crosshair_cursor = None; + Colormap border_window_colormap = None; + Window border_window = None; + Window selected_window = None; + bool selected = false; + bool canceled = false; + }; +}
\ No newline at end of file diff --git a/include/WindowUtils.hpp b/include/WindowUtils.hpp index 72d2179..5c4d39a 100644 --- a/include/WindowUtils.hpp +++ b/include/WindowUtils.hpp @@ -24,6 +24,7 @@ namespace gsr { std::string get_window_name_at_position(Display *dpy, mgl::vec2i position, Window ignore_window); std::string get_window_name_at_cursor_position(Display *dpy, Window ignore_window); void set_window_size_not_resizable(Display *dpy, Window window, int width, int height); + Window window_get_target_window_child(Display *display, Window window); mgl::vec2i get_cursor_position(Display *dpy, Window *window); mgl::vec2i create_window_get_center_position(Display *display); std::string get_window_manager_name(Display *display); diff --git a/include/gui/RadioButton.hpp b/include/gui/RadioButton.hpp index 16d638e..e319aa0 100644 --- a/include/gui/RadioButton.hpp +++ b/include/gui/RadioButton.hpp @@ -23,7 +23,8 @@ namespace gsr { void add_item(const std::string &text, const std::string &id); void set_selected_item(const std::string &id, bool trigger_event = true, bool trigger_event_even_if_selection_not_changed = true); - const std::string get_selected_id() const; + const std::string& get_selected_id() const; + const std::string& get_selected_text() const; mgl::vec2f get_size() override; diff --git a/include/gui/ScreenshotSettingsPage.hpp b/include/gui/ScreenshotSettingsPage.hpp index 1cfbf00..db66d66 100644 --- a/include/gui/ScreenshotSettingsPage.hpp +++ b/include/gui/ScreenshotSettingsPage.hpp @@ -26,7 +26,6 @@ namespace gsr { private: std::unique_ptr<ComboBox> create_record_area_box(); std::unique_ptr<Widget> create_record_area(); - std::unique_ptr<List> create_select_window(); std::unique_ptr<Entry> create_image_width_entry(); std::unique_ptr<Entry> create_image_height_entry(); std::unique_ptr<List> create_image_resolution(); @@ -56,7 +55,6 @@ namespace gsr { GsrPage *content_page_ptr = nullptr; ScrollablePage *settings_scrollable_page_ptr = nullptr; - List *select_window_list_ptr = nullptr; List *image_resolution_list_ptr = nullptr; List *restore_portal_session_list_ptr = nullptr; List *color_range_list_ptr = nullptr; diff --git a/include/gui/SettingsPage.hpp b/include/gui/SettingsPage.hpp index fb705cc..1810de5 100644 --- a/include/gui/SettingsPage.hpp +++ b/include/gui/SettingsPage.hpp @@ -20,6 +20,11 @@ namespace gsr { class LineSeparator; class Subsection; + enum class AudioDeviceType { + OUTPUT, + INPUT + }; + class SettingsPage : public StaticPage { public: enum class Type { @@ -41,7 +46,6 @@ namespace gsr { std::unique_ptr<RadioButton> create_view_radio_button(); std::unique_ptr<ComboBox> create_record_area_box(); std::unique_ptr<Widget> create_record_area(); - std::unique_ptr<List> create_select_window(); std::unique_ptr<Entry> create_area_width_entry(); std::unique_ptr<Entry> create_area_height_entry(); std::unique_ptr<List> create_area_size(); @@ -54,11 +58,12 @@ namespace gsr { std::unique_ptr<List> create_restore_portal_session_section(); std::unique_ptr<Widget> create_change_video_resolution_section(); std::unique_ptr<Widget> create_capture_target_section(); - std::unique_ptr<ComboBox> create_audio_device_selection_combobox(); + std::unique_ptr<ComboBox> create_audio_device_selection_combobox(AudioDeviceType device_type); std::unique_ptr<Button> create_remove_audio_device_button(List *audio_input_list_ptr, List *audio_device_list_ptr); - std::unique_ptr<List> create_audio_device(List *audio_input_list_ptr); + std::unique_ptr<List> create_audio_device(AudioDeviceType device_type, List *audio_input_list_ptr); std::unique_ptr<Button> create_add_audio_track_button(); - std::unique_ptr<Button> create_add_audio_device_button(List *audio_input_list_ptr); + std::unique_ptr<Button> create_add_audio_output_device_button(List *audio_input_list_ptr); + std::unique_ptr<Button> create_add_audio_input_device_button(List *audio_input_list_ptr); std::unique_ptr<ComboBox> create_application_audio_selection_combobox(List *application_audio_row); std::unique_ptr<List> create_application_audio(List *audio_input_list_ptr); std::unique_ptr<List> create_custom_application_audio(List *audio_input_list_ptr); @@ -97,11 +102,12 @@ namespace gsr { std::unique_ptr<List> create_container_section(); std::unique_ptr<List> create_replay_time_entry(); std::unique_ptr<List> create_replay_time(); + std::unique_ptr<List> create_replay_storage(); std::unique_ptr<RadioButton> create_start_replay_automatically(); std::unique_ptr<CheckBox> create_save_replay_in_game_folder(); std::unique_ptr<CheckBox> create_restart_replay_on_save(); std::unique_ptr<Label> create_estimated_replay_file_size(); - void update_estimated_replay_file_size(); + void update_estimated_replay_file_size(const std::string &replay_storage_type); void update_replay_time_text(); std::unique_ptr<CheckBox> create_save_recording_in_game_folder(); std::unique_ptr<Label> create_estimated_record_file_size(); @@ -140,7 +146,6 @@ namespace gsr { GsrPage *content_page_ptr = nullptr; ScrollablePage *settings_scrollable_page_ptr = nullptr; List *settings_list_ptr = nullptr; - List *select_window_list_ptr = nullptr; List *area_size_list_ptr = nullptr; List *video_resolution_list_ptr = nullptr; List *restore_portal_session_list_ptr = nullptr; @@ -179,13 +184,16 @@ namespace gsr { CheckBox *save_recording_in_game_folder_ptr = nullptr; CheckBox *show_recording_started_notification_checkbox_ptr = nullptr; CheckBox *show_video_saved_notification_checkbox_ptr = nullptr; + CheckBox *show_video_paused_notification_checkbox_ptr = nullptr; CheckBox *show_streaming_started_notification_checkbox_ptr = nullptr; CheckBox *show_streaming_stopped_notification_checkbox_ptr = nullptr; Button *save_directory_button_ptr = nullptr; Entry *twitch_stream_key_entry_ptr = nullptr; Entry *youtube_stream_key_entry_ptr = nullptr; + Entry *rumble_stream_key_entry_ptr = nullptr; Entry *stream_url_entry_ptr = nullptr; Entry *replay_time_entry_ptr = nullptr; + RadioButton *replay_storage_button_ptr = nullptr; Label *replay_time_label_ptr = nullptr; RadioButton *turn_on_replay_automatically_mode_ptr = nullptr; Subsection *audio_section_ptr = nullptr; |