mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-03-31 09:07:13 +09:00
Only report monitors when /dev/dri/cardN is available (its not available on linux mint for some reason with prime setup)
This commit is contained in:
18
src/main.cpp
18
src/main.cpp
@@ -2053,12 +2053,13 @@ static void output_monitor_info(const gsr_monitor *monitor, void *userdata) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void list_supported_capture_options(gsr_egl *egl, bool wayland) {
|
static void list_supported_capture_options(gsr_egl *egl, bool wayland, bool list_monitors) {
|
||||||
if(!wayland) {
|
if(!wayland) {
|
||||||
puts("window");
|
puts("window");
|
||||||
puts("focused");
|
puts("focused");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(list_monitors) {
|
||||||
capture_options_callback options;
|
capture_options_callback options;
|
||||||
options.wayland = wayland;
|
options.wayland = wayland;
|
||||||
options.egl = egl;
|
options.egl = egl;
|
||||||
@@ -2070,6 +2071,7 @@ static void list_supported_capture_options(gsr_egl *egl, bool wayland) {
|
|||||||
puts("screen"); // All monitors in one, only available on Nvidia X11
|
puts("screen"); // All monitors in one, only available on Nvidia X11
|
||||||
for_each_active_monitor_output(egl, GSR_CONNECTION_X11, output_monitor_info, &options);
|
for_each_active_monitor_output(egl, GSR_CONNECTION_X11, output_monitor_info, &options);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GSR_PORTAL
|
#ifdef GSR_PORTAL
|
||||||
// Desktop portal capture on x11 doesn't seem to be hardware accelerated
|
// Desktop portal capture on x11 doesn't seem to be hardware accelerated
|
||||||
@@ -2117,12 +2119,13 @@ static void info_command() {
|
|||||||
_exit(22);
|
_exit(22);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool list_monitors = true;
|
||||||
egl.card_path[0] = '\0';
|
egl.card_path[0] = '\0';
|
||||||
if(monitor_capture_use_drm(&egl, wayland)) {
|
if(monitor_capture_use_drm(&egl, wayland)) {
|
||||||
// TODO: Allow specifying another card, and in other places
|
// TODO: Allow specifying another card, and in other places
|
||||||
if(!gsr_get_valid_card_path(&egl, egl.card_path, false)) {
|
if(!gsr_get_valid_card_path(&egl, egl.card_path, true)) {
|
||||||
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
|
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
|
||||||
_exit(23);
|
list_monitors = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2139,7 +2142,7 @@ static void info_command() {
|
|||||||
puts("section=video_codecs");
|
puts("section=video_codecs");
|
||||||
list_supported_video_codecs(&egl, wayland);
|
list_supported_video_codecs(&egl, wayland);
|
||||||
puts("section=capture_options");
|
puts("section=capture_options");
|
||||||
list_supported_capture_options(&egl, wayland);
|
list_supported_capture_options(&egl, wayland, list_monitors);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
@@ -2216,17 +2219,18 @@ static void list_capture_options_command() {
|
|||||||
_exit(1);
|
_exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool list_monitors = true;
|
||||||
egl.card_path[0] = '\0';
|
egl.card_path[0] = '\0';
|
||||||
if(monitor_capture_use_drm(&egl, wayland)) {
|
if(monitor_capture_use_drm(&egl, wayland)) {
|
||||||
// TODO: Allow specifying another card, and in other places
|
// TODO: Allow specifying another card, and in other places
|
||||||
if(!gsr_get_valid_card_path(&egl, egl.card_path, false)) {
|
if(!gsr_get_valid_card_path(&egl, egl.card_path, true)) {
|
||||||
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
|
fprintf(stderr, "Error: no /dev/dri/cardX device found. Make sure that you have at least one monitor connected\n");
|
||||||
_exit(23);
|
list_monitors = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
av_log_set_level(AV_LOG_FATAL);
|
av_log_set_level(AV_LOG_FATAL);
|
||||||
list_supported_capture_options(&egl, wayland);
|
list_supported_capture_options(&egl, wayland, list_monitors);
|
||||||
|
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user