From ab78e5687297ff5c27dc8b33e7d9f93a873af34f Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 21 Jun 2024 22:18:23 +0200 Subject: Add -fm 'content' option to match fps to captured content, only x11 window capture currently supported --- include/capture/capture.h | 1 + include/capture/xcomposite.h | 7 +++++++ include/cursor.h | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/capture/capture.h b/include/capture/capture.h index 2eb8e42..8719c40 100644 --- a/include/capture/capture.h +++ b/include/capture/capture.h @@ -21,6 +21,7 @@ struct gsr_capture { /* These methods should not be called manually. Call gsr_capture_* instead */ int (*start)(gsr_capture *cap, AVCodecContext *video_codec_context, AVFrame *frame); void (*tick)(gsr_capture *cap, AVCodecContext *video_codec_context); /* can be NULL */ + bool (*consume_damage)(gsr_capture *cap); /* can be NULL */ bool (*should_stop)(gsr_capture *cap, bool *err); /* can be NULL */ int (*capture)(gsr_capture *cap, AVFrame *frame); void (*capture_end)(gsr_capture *cap, AVFrame *frame); /* can be NULL */ diff --git a/include/capture/xcomposite.h b/include/capture/xcomposite.h index e933c35..83731fa 100644 --- a/include/capture/xcomposite.h +++ b/include/capture/xcomposite.h @@ -15,6 +15,7 @@ typedef struct { vec2i region_size; /* This is currently only used with |follow_focused| */ gsr_color_range color_range; bool record_cursor; + bool track_damage; } gsr_capture_xcomposite_params; typedef struct { @@ -37,6 +38,11 @@ typedef struct { Atom net_active_window_atom; gsr_cursor cursor; + + int damage_event; + int damage_error; + XID damage; + bool damaged; } gsr_capture_xcomposite; void gsr_capture_xcomposite_init(gsr_capture_xcomposite *self, const gsr_capture_xcomposite_params *params); @@ -44,6 +50,7 @@ void gsr_capture_xcomposite_init(gsr_capture_xcomposite *self, const gsr_capture int gsr_capture_xcomposite_start(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context, AVFrame *frame); void gsr_capture_xcomposite_stop(gsr_capture_xcomposite *self); void gsr_capture_xcomposite_tick(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context); +bool gsr_capture_xcomposite_consume_damage(gsr_capture_xcomposite *self); bool gsr_capture_xcomposite_should_stop(gsr_capture_xcomposite *self, bool *err); int gsr_capture_xcomposite_capture(gsr_capture_xcomposite *self, AVFrame *frame); diff --git a/include/cursor.h b/include/cursor.h index b1ec6bd..2f26dfd 100644 --- a/include/cursor.h +++ b/include/cursor.h @@ -8,6 +8,7 @@ typedef struct { gsr_egl *egl; Display *display; int x_fixes_event_base; + int xi_opcode; unsigned int texture_id; vec2i size; @@ -15,12 +16,15 @@ typedef struct { vec2i position; bool cursor_image_set; + bool visible; + bool cursor_moved; } gsr_cursor; int gsr_cursor_init(gsr_cursor *self, gsr_egl *egl, Display *display); void gsr_cursor_deinit(gsr_cursor *self); -void gsr_cursor_update(gsr_cursor *self, XEvent *xev); +/* Returns true if the cursor image has updated or if the cursor has moved */ +bool gsr_cursor_update(gsr_cursor *self, XEvent *xev); void gsr_cursor_tick(gsr_cursor *self, Window relative_to); #endif /* GSR_CURSOR_H */ -- cgit v1.2.3