aboutsummaryrefslogtreecommitdiff
path: root/src/capture/kms.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-09-14 01:15:01 +0200
committerdec05eba <dec05eba@protonmail.com>2024-09-14 01:15:01 +0200
commit8acb34638212ab8dba0d48a57dd40721203a7a44 (patch)
tree7f1942c56fa2700f2f5fe2d623e9e1c94fb23324 /src/capture/kms.c
parent992792fb1f35546b9d66c3f69aa3d0f5adb94ef6 (diff)
Set update fps to video fps, on x11 sync video to damage tracking
Diffstat (limited to 'src/capture/kms.c')
-rw-r--r--src/capture/kms.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/capture/kms.c b/src/capture/kms.c
index bdf3202..9ba4bd2 100644
--- a/src/capture/kms.c
+++ b/src/capture/kms.c
@@ -4,7 +4,6 @@
#include "../../include/cursor.h"
#include "../../kms/client/kms_client.h"
-#include <X11/Xlib.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@@ -50,7 +49,6 @@ typedef struct {
bool is_x11;
gsr_cursor x11_cursor;
- XEvent xev;
} gsr_capture_kms;
static void gsr_capture_kms_cleanup_kms_fds(gsr_capture_kms *self) {
@@ -199,17 +197,13 @@ static int gsr_capture_kms_start(gsr_capture *cap, AVCodecContext *video_codec_c
return 0;
}
-static void gsr_capture_kms_tick(gsr_capture *cap, AVCodecContext *video_codec_context) {
- (void)video_codec_context;
+static void gsr_capture_kms_on_event(gsr_capture *cap, gsr_egl *egl) {
gsr_capture_kms *self = cap->priv;
-
if(!self->is_x11)
return;
- while(XPending(self->params.egl->x11.dpy)) {
- XNextEvent(self->params.egl->x11.dpy, &self->xev);
- gsr_cursor_update(&self->x11_cursor, &self->xev);
- }
+ XEvent *xev = gsr_egl_get_event_data(egl);
+ gsr_cursor_update(&self->x11_cursor, xev);
}
static float monitor_rotation_to_radians(gsr_monitor_rotation rot) {
@@ -628,7 +622,8 @@ gsr_capture* gsr_capture_kms_create(const gsr_capture_kms_params *params) {
*cap = (gsr_capture) {
.start = gsr_capture_kms_start,
- .tick = gsr_capture_kms_tick,
+ .on_event = gsr_capture_kms_on_event,
+ .tick = NULL,
.should_stop = gsr_capture_kms_should_stop,
.capture = gsr_capture_kms_capture,
.capture_end = gsr_capture_kms_capture_end,