aboutsummaryrefslogtreecommitdiff
path: root/src/capture
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-11-08 20:52:08 +0100
committerdec05eba <dec05eba@protonmail.com>2024-11-08 20:52:08 +0100
commit70fced3889b4c15044041b960ab9d6be9b697f5e (patch)
treeecf6c4d2119e1c1d723baff00c5a371271247a3c /src/capture
parent0686b924def291323c94f8d26d96fd0ef9d854c4 (diff)
x11: fix correct monitor capture size when output is scaled
Diffstat (limited to 'src/capture')
-rw-r--r--src/capture/kms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/capture/kms.c b/src/capture/kms.c
index 829fc6a..5292012 100644
--- a/src/capture/kms.c
+++ b/src/capture/kms.c
@@ -582,13 +582,14 @@ static int gsr_capture_kms_capture(gsr_capture *cap, AVFrame *frame, gsr_color_c
" If you are experience performance problems in the video then record a single window on X11 or use portal capture option instead\n");
}
+ self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->src_w, drm_fd->src_h });
+
const bool is_scaled = self->params.output_resolution.x > 0 && self->params.output_resolution.y > 0;
vec2i output_size = is_scaled ? self->params.output_resolution : self->capture_size;
output_size = scale_keep_aspect_ratio(self->capture_size, output_size);
const float texture_rotation = monitor_rotation_to_radians(self->monitor_rotation);
const vec2i target_pos = { max_int(0, frame->width / 2 - output_size.x / 2), max_int(0, frame->height / 2 - output_size.y / 2) };
- self->capture_size = rotate_capture_size_if_rotated(self, (vec2i){ drm_fd->src_w, drm_fd->src_h });
gsr_capture_kms_update_capture_size_change(self, color_conversion, target_pos, drm_fd);
vec2i capture_pos = self->capture_pos;