mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-03-31 09:17:04 +09:00
Add high performance encoding option (for amd) in settings page. Requires gsr version >= 5.3.4
This commit is contained in:
5
TODO
5
TODO
@@ -139,4 +139,7 @@ Add a hotkey to record/stream/replay region.
|
||||
|
||||
Do xi grab for keys as well. Otherwise the ui cant be used for keyboard input if a program has grabbed the keyboard, and there could possibly be a game that grabs the keyboard as well.
|
||||
|
||||
Make inactive buttons gray (in dropdown boxes and in the front page with save, etc when replay is not running).
|
||||
Make inactive buttons gray (in dropdown boxes and in the front page with save, etc when replay is not running).
|
||||
|
||||
Implement focused monitor capture. On nvidia x11 just use the x11 monitor name. On wayland get monitor name from drm cursor. We can get x11 monitor by combining all drm monitors together (with either x11 or wayland monitor position info) and then calculating the x11 monitor at that position.
|
||||
To get the drm monitor from x11 cursor we can get the x11 monitor then get the CONNECTOR_ID property and get the monitor that matches that. Then copy the drm monitor name code from gsr and use that in gsr-ui to get the same name to use as monitor.
|
||||
@@ -60,6 +60,7 @@ namespace gsr {
|
||||
std::string joystick_hotkeys_enable_option = "disable_hotkeys";
|
||||
std::string tint_color;
|
||||
ConfigHotkey show_hide_hotkey;
|
||||
bool high_performance_encoding = false;
|
||||
};
|
||||
|
||||
struct YoutubeStreamConfig {
|
||||
|
||||
@@ -116,6 +116,8 @@ namespace gsr {
|
||||
bool update_compositor_texture(const Monitor &monitor);
|
||||
|
||||
void force_window_on_top();
|
||||
|
||||
void add_common_gpu_screen_recorder_args(std::vector<const char*> &args, const RecordOptions &record_options, const std::vector<std::string> &audio_tracks, const std::string &video_bitrate, const char *region, const std::string &audio_devices_merged, char *region_str, int region_str_size, const RegionSelector ®ion_selector);
|
||||
private:
|
||||
using KeyBindingCallback = std::function<void()>;
|
||||
struct KeyBinding {
|
||||
|
||||
@@ -17,6 +17,7 @@ namespace gsr {
|
||||
class Button;
|
||||
class List;
|
||||
class CustomRendererWidget;
|
||||
class CheckBox;
|
||||
|
||||
enum ConfigureHotkeyType {
|
||||
NONE,
|
||||
@@ -63,6 +64,7 @@ namespace gsr {
|
||||
std::unique_ptr<List> create_hotkey_control_buttons();
|
||||
std::unique_ptr<Subsection> create_keyboard_hotkey_subsection(ScrollablePage *parent_page);
|
||||
std::unique_ptr<Subsection> create_controller_hotkey_subsection(ScrollablePage *parent_page);
|
||||
std::unique_ptr<CheckBox> create_high_performance_encoding_option();
|
||||
std::unique_ptr<Button> create_exit_program_button();
|
||||
std::unique_ptr<Button> create_go_back_to_old_ui_button();
|
||||
std::unique_ptr<Subsection> create_application_options_subsection(ScrollablePage *parent_page);
|
||||
@@ -95,6 +97,7 @@ namespace gsr {
|
||||
Button *take_screenshot_button_ptr = nullptr;
|
||||
Button *take_screenshot_region_button_ptr = nullptr;
|
||||
Button *show_hide_button_ptr = nullptr;
|
||||
CheckBox *high_performance_encoding_checkbox_ptr = nullptr;
|
||||
|
||||
ConfigHotkey configure_config_hotkey;
|
||||
ConfigureHotkeyType configure_hotkey_type = ConfigureHotkeyType::NONE;
|
||||
|
||||
@@ -158,6 +158,7 @@ namespace gsr {
|
||||
return {
|
||||
{"main.config_file_version", &config.main_config.config_file_version},
|
||||
{"main.software_encoding_warning_shown", &config.main_config.software_encoding_warning_shown},
|
||||
{"main.high_performance_encoding", &config.main_config.high_performance_encoding},
|
||||
{"main.hotkeys_enable_option", &config.main_config.hotkeys_enable_option},
|
||||
{"main.joystick_hotkeys_enable_option", &config.main_config.joystick_hotkeys_enable_option},
|
||||
{"main.tint_color", &config.main_config.tint_color},
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace gsr {
|
||||
}
|
||||
|
||||
bool GsrVersion::operator>=(const GsrVersion &other) const {
|
||||
return major >= other.major || (major == other.major && minor >= other.minor) || (major == other.major && minor == other.minor && patch >= other.patch);
|
||||
return major > other.major || (major == other.major && minor > other.minor) || (major == other.major && minor == other.minor && patch >= other.patch);
|
||||
}
|
||||
|
||||
bool GsrVersion::operator<(const GsrVersion &other) const {
|
||||
|
||||
@@ -1841,7 +1841,7 @@ namespace gsr {
|
||||
args.push_back(region_str);
|
||||
}
|
||||
|
||||
static void add_common_gpu_screen_recorder_args(std::vector<const char*> &args, const RecordOptions &record_options, const std::vector<std::string> &audio_tracks, const std::string &video_bitrate, const char *region, const std::string &audio_devices_merged, char *region_str, int region_str_size, const RegionSelector ®ion_selector) {
|
||||
void Overlay::add_common_gpu_screen_recorder_args(std::vector<const char*> &args, const RecordOptions &record_options, const std::vector<std::string> &audio_tracks, const std::string &video_bitrate, const char *region, const std::string &audio_devices_merged, char *region_str, int region_str_size, const RegionSelector ®ion_selector) {
|
||||
if(record_options.video_quality == "custom") {
|
||||
args.push_back("-bm");
|
||||
args.push_back("cbr");
|
||||
@@ -1876,6 +1876,11 @@ namespace gsr {
|
||||
|
||||
if(record_options.record_area_option == "region")
|
||||
add_region_command(args, region_str, region_str_size, region_selector);
|
||||
|
||||
if(config.main_config.high_performance_encoding && gsr_info.gpu_info.vendor != GpuVendor::NVIDIA && gsr_info.system_info.gsr_version >= GsrVersion{5, 3, 4}) {
|
||||
args.push_back("-high-performance-encoding");
|
||||
args.push_back("yes");
|
||||
}
|
||||
}
|
||||
|
||||
static bool validate_capture_target(const GsrInfo &gsr_info, const std::string &capture_target) {
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "../../include/gui/RadioButton.hpp"
|
||||
#include "../../include/gui/LineSeparator.hpp"
|
||||
#include "../../include/gui/CustomRendererWidget.hpp"
|
||||
#include "../../include/gui/CheckBox.hpp"
|
||||
|
||||
#include <assert.h>
|
||||
#include <X11/Xlib.h>
|
||||
@@ -398,6 +399,13 @@ namespace gsr {
|
||||
return subsection;
|
||||
}
|
||||
|
||||
std::unique_ptr<CheckBox> GlobalSettingsPage::create_high_performance_encoding_option() {
|
||||
auto checkbox = std::make_unique<CheckBox>(&get_theme().body_font, "High performance encoding mode (Experimental, may cause performance issues)");
|
||||
high_performance_encoding_checkbox_ptr = checkbox.get();
|
||||
checkbox->set_visible(gsr_info->gpu_info.vendor != GpuVendor::NVIDIA && gsr_info->system_info.gsr_version >= GsrVersion{5, 3, 4});
|
||||
return checkbox;
|
||||
}
|
||||
|
||||
std::unique_ptr<Button> GlobalSettingsPage::create_exit_program_button() {
|
||||
auto exit_program_button = std::make_unique<Button>(&get_theme().body_font, "Exit program", mgl::vec2f(0.0f, 0.0f), mgl::Color(0, 0, 0, 120));
|
||||
exit_program_button->on_click = [&]() {
|
||||
@@ -418,10 +426,16 @@ namespace gsr {
|
||||
|
||||
std::unique_ptr<Subsection> GlobalSettingsPage::create_application_options_subsection(ScrollablePage *parent_page) {
|
||||
const bool inside_flatpak = getenv("FLATPAK_ID") != NULL;
|
||||
auto list = std::make_unique<List>(List::Orientation::HORIZONTAL);
|
||||
list->add_widget(create_exit_program_button());
|
||||
|
||||
auto list = std::make_unique<List>(List::Orientation::VERTICAL);
|
||||
list->add_widget(create_high_performance_encoding_option());
|
||||
|
||||
auto buttons_list = std::make_unique<List>(List::Orientation::HORIZONTAL);
|
||||
buttons_list->add_widget(create_exit_program_button());
|
||||
if(inside_flatpak)
|
||||
list->add_widget(create_go_back_to_old_ui_button());
|
||||
buttons_list->add_widget(create_go_back_to_old_ui_button());
|
||||
list->add_widget(std::move(buttons_list));
|
||||
|
||||
return std::make_unique<Subsection>("Application options", std::move(list), mgl::vec2f(parent_page->get_inner_size().x, 0.0f));
|
||||
}
|
||||
|
||||
@@ -483,6 +497,7 @@ namespace gsr {
|
||||
|
||||
enable_keyboard_hotkeys_radio_button_ptr->set_selected_item(config.main_config.hotkeys_enable_option, false, false);
|
||||
enable_joystick_hotkeys_radio_button_ptr->set_selected_item(config.main_config.joystick_hotkeys_enable_option, false, false);
|
||||
high_performance_encoding_checkbox_ptr->set_checked(config.main_config.high_performance_encoding);
|
||||
|
||||
load_hotkeys();
|
||||
}
|
||||
@@ -507,6 +522,7 @@ namespace gsr {
|
||||
config.main_config.tint_color = tint_color_radio_button_ptr->get_selected_id();
|
||||
config.main_config.hotkeys_enable_option = enable_keyboard_hotkeys_radio_button_ptr->get_selected_id();
|
||||
config.main_config.joystick_hotkeys_enable_option = enable_joystick_hotkeys_radio_button_ptr->get_selected_id();
|
||||
config.main_config.high_performance_encoding = high_performance_encoding_checkbox_ptr->is_checked();
|
||||
save_config(config);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,14 +120,13 @@ static void keyboard_event_process_key_state_change(keyboard_event *self, const
|
||||
|
||||
/* Return true if a global hotkey is assigned to the key combination */
|
||||
static bool keyboard_event_on_key_pressed(keyboard_event *self, const struct input_event *event, uint32_t modifiers) {
|
||||
if(event->value != KEYBOARD_BUTTON_PRESSED)
|
||||
return false;
|
||||
|
||||
bool global_hotkey_match = false;
|
||||
for(int i = 0; i < self->num_global_hotkeys; ++i) {
|
||||
if(event->code == self->global_hotkeys[i].key && modifiers == self->global_hotkeys[i].modifiers) {
|
||||
puts(self->global_hotkeys[i].action);
|
||||
fflush(stdout);
|
||||
if(event->value == KEYBOARD_BUTTON_PRESSED) {
|
||||
puts(self->global_hotkeys[i].action);
|
||||
fflush(stdout);
|
||||
}
|
||||
global_hotkey_match = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user