mirror of
https://repo.dec05eba.com/gpu-screen-recorder-ui
synced 2026-05-07 15:19:56 +09:00
Live stream: fix codec not applied, focused window area not applied and video resolution change not applied
This commit is contained in:
@@ -3175,10 +3175,10 @@ namespace gsr {
|
|||||||
|
|
||||||
char size[64];
|
char size[64];
|
||||||
size[0] = '\0';
|
size[0] = '\0';
|
||||||
if(config.record_config.record_options.record_area_option == "focused")
|
if(config.streaming_config.record_options.record_area_option == "focused")
|
||||||
snprintf(size, sizeof(size), "%dx%d", (int)config.streaming_config.record_options.record_area_width, (int)config.streaming_config.record_options.record_area_height);
|
snprintf(size, sizeof(size), "%dx%d", (int)config.streaming_config.record_options.record_area_width, (int)config.streaming_config.record_options.record_area_height);
|
||||||
|
|
||||||
if(config.record_config.record_options.record_area_option != "focused" && config.streaming_config.record_options.change_video_resolution)
|
if(config.streaming_config.record_options.record_area_option != "focused" && config.streaming_config.record_options.change_video_resolution)
|
||||||
snprintf(size, sizeof(size), "%dx%d", (int)config.streaming_config.record_options.video_width, (int)config.streaming_config.record_options.video_height);
|
snprintf(size, sizeof(size), "%dx%d", (int)config.streaming_config.record_options.video_width, (int)config.streaming_config.record_options.video_height);
|
||||||
|
|
||||||
std::vector<const char*> args = {
|
std::vector<const char*> args = {
|
||||||
@@ -3188,6 +3188,7 @@ namespace gsr {
|
|||||||
"-cursor", config.streaming_config.record_options.record_cursor ? "yes" : "no",
|
"-cursor", config.streaming_config.record_options.record_cursor ? "yes" : "no",
|
||||||
"-cr", config.streaming_config.record_options.color_range.c_str(),
|
"-cr", config.streaming_config.record_options.color_range.c_str(),
|
||||||
"-fm", framerate_mode.c_str(),
|
"-fm", framerate_mode.c_str(),
|
||||||
|
"-k", video_codec,
|
||||||
"-encoder", encoder,
|
"-encoder", encoder,
|
||||||
"-f", fps.c_str(),
|
"-f", fps.c_str(),
|
||||||
"-v", "no",
|
"-v", "no",
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/XInput2.h>
|
#include <X11/extensions/XInput2.h>
|
||||||
#include <X11/extensions/Xrandr.h>
|
#include <X11/extensions/Xrandr.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
@@ -221,6 +222,9 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
set_window_size_not_resizable(dpy, region_window, XWidthOfScreen(screen), XHeightOfScreen(screen));
|
set_window_size_not_resizable(dpy, region_window, XWidthOfScreen(screen), XHeightOfScreen(screen));
|
||||||
|
|
||||||
|
unsigned char data = 2; // Prefer being composed to allow transparency. Do this to prevent the compositor from getting turned on/off when taking a screenshot
|
||||||
|
XChangeProperty(dpy, region_window, XInternAtom(dpy, "_NET_WM_BYPASS_COMPOSITOR", False), XA_CARDINAL, 32, PropModeReplace, &data, 1);
|
||||||
|
|
||||||
if(!is_wayland) {
|
if(!is_wayland) {
|
||||||
cursor_window = create_cursor_window(dpy, cursor_window_size, cursor_window_size, &vinfo, border_color_x11);
|
cursor_window = create_cursor_window(dpy, cursor_window_size, cursor_window_size, &vinfo, border_color_x11);
|
||||||
if(!cursor_window)
|
if(!cursor_window)
|
||||||
@@ -309,6 +313,9 @@ namespace gsr {
|
|||||||
region_window = 0;
|
region_window = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
XFlush(dpy);
|
||||||
|
XSync(dpy, False);
|
||||||
|
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
dpy = nullptr;
|
dpy = nullptr;
|
||||||
selecting_region = false;
|
selecting_region = false;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
#include <X11/extensions/shape.h>
|
#include <X11/extensions/shape.h>
|
||||||
#include <X11/cursorfont.h>
|
#include <X11/cursorfont.h>
|
||||||
#include <X11/keysym.h>
|
#include <X11/keysym.h>
|
||||||
@@ -122,6 +123,10 @@ namespace gsr {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
set_window_size_not_resizable(dpy, border_window, XWidthOfScreen(screen), XHeightOfScreen(screen));
|
set_window_size_not_resizable(dpy, border_window, XWidthOfScreen(screen), XHeightOfScreen(screen));
|
||||||
|
|
||||||
|
unsigned char data = 2; // Prefer being composed to allow transparency. Do this to prevent the compositor from getting turned on/off when taking a screenshot
|
||||||
|
XChangeProperty(dpy, border_window, XInternAtom(dpy, "_NET_WM_BYPASS_COMPOSITOR", False), XA_CARDINAL, 32, PropModeReplace, &data, 1);
|
||||||
|
|
||||||
if(cursor_window && cursor_window != DefaultRootWindow(dpy))
|
if(cursor_window && cursor_window != DefaultRootWindow(dpy))
|
||||||
set_region_rectangle(dpy, border_window, cursor_window_pos.x, cursor_window_pos.y, cursor_window_size.x, cursor_window_size.y, rectangle_border_size);
|
set_region_rectangle(dpy, border_window, cursor_window_pos.x, cursor_window_pos.y, cursor_window_size.x, cursor_window_size.y, rectangle_border_size);
|
||||||
else
|
else
|
||||||
@@ -163,6 +168,8 @@ namespace gsr {
|
|||||||
}
|
}
|
||||||
|
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
XSync(dpy, False);
|
||||||
|
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
dpy = nullptr;
|
dpy = nullptr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user