diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-03-09 18:54:53 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-03-09 18:54:53 +0100 |
commit | 45ad3695b657b33c332bbfd3b08d6a15a5072587 (patch) | |
tree | 06485df0ba8350c65da4a99f208b597cedacd8e6 /include/capture | |
parent | a3fedae32937f8965c9905e12633fa4de0c3658e (diff) |
Refactor capture base
Diffstat (limited to 'include/capture')
-rw-r--r-- | include/capture/capture.h | 12 | ||||
-rw-r--r-- | include/capture/kms.h | 8 | ||||
-rw-r--r-- | include/capture/xcomposite.h | 2 |
3 files changed, 13 insertions, 9 deletions
diff --git a/include/capture/capture.h b/include/capture/capture.h index f1d0467..148da16 100644 --- a/include/capture/capture.h +++ b/include/capture/capture.h @@ -33,6 +33,8 @@ struct gsr_capture { typedef struct gsr_capture_base gsr_capture_base; struct gsr_capture_base { + gsr_egl *egl; + unsigned int input_texture; unsigned int target_textures[2]; unsigned int cursor_texture; @@ -56,11 +58,11 @@ void gsr_capture_end(gsr_capture *cap, AVFrame *frame); /* Calls |gsr_capture_stop| as well */ void gsr_capture_destroy(gsr_capture *cap, AVCodecContext *video_codec_context); -bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *frame, gsr_egl *egl, VADisplay va_dpy, VADRMPRIMESurfaceDescriptor *prime, gsr_color_range color_range); -bool gsr_capture_base_setup_cuda_textures(gsr_capture_base *base, AVFrame *frame, gsr_cuda_context *cuda_context, gsr_egl *egl, gsr_color_range color_range, gsr_source_color source_color, bool hdr); -void gsr_capture_base_stop(gsr_capture_base *self, gsr_egl *egl); +bool gsr_capture_base_setup_vaapi_textures(gsr_capture_base *self, AVFrame *frame, VADisplay va_dpy, VADRMPRIMESurfaceDescriptor *prime, gsr_color_range color_range); +bool gsr_capture_base_setup_cuda_textures(gsr_capture_base *self, AVFrame *frame, gsr_cuda_context *cuda_context, gsr_color_range color_range, gsr_source_color source_color, bool hdr); +void gsr_capture_base_stop(gsr_capture_base *self); -bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec_context, bool hdr, VADisplay *va_dpy); -bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, CUstream *cuda_stream); +bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec_context, int width, int height, bool hdr, VADisplay *va_dpy); +bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, int width, int height, CUstream *cuda_stream); #endif /* GSR_CAPTURE_CAPTURE_H */ diff --git a/include/capture/kms.h b/include/capture/kms.h index a38b4ff..aa58e93 100644 --- a/include/capture/kms.h +++ b/include/capture/kms.h @@ -1,13 +1,13 @@ #ifndef GSR_CAPTURE_KMS_H #define GSR_CAPTURE_KMS_H +#include "capture.h" #include "../../kms/client/kms_client.h" #include "../color_conversion.h" #include "../vec2.h" #include "../defs.h" #include <stdbool.h> -typedef struct gsr_capture_base gsr_capture_base; typedef struct AVCodecContext AVCodecContext; typedef struct AVMasteringDisplayMetadata AVMasteringDisplayMetadata; typedef struct AVContentLightMetadata AVContentLightMetadata; @@ -23,6 +23,8 @@ typedef struct { } MonitorId; struct gsr_capture_kms { + gsr_capture_base base; + bool should_stop; bool stop_is_error; @@ -40,9 +42,9 @@ struct gsr_capture_kms { }; /* Returns 0 on success */ -int gsr_capture_kms_start(gsr_capture_kms *self, gsr_capture_base *base, const char *display_to_capture, gsr_egl *egl, AVCodecContext *video_codec_context, AVFrame *frame); +int gsr_capture_kms_start(gsr_capture_kms *self, const char *display_to_capture, gsr_egl *egl, AVCodecContext *video_codec_context, AVFrame *frame); void gsr_capture_kms_stop(gsr_capture_kms *self); -bool gsr_capture_kms_capture(gsr_capture_kms *self, gsr_capture_base *base, AVFrame *frame, gsr_egl *egl, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external); +bool gsr_capture_kms_capture(gsr_capture_kms *self, AVFrame *frame, bool hdr, bool screen_plane_use_modifiers, bool cursor_texture_is_external); void gsr_capture_kms_cleanup_kms_fds(gsr_capture_kms *self); #endif /* GSR_CAPTURE_KMS_H */ diff --git a/include/capture/xcomposite.h b/include/capture/xcomposite.h index 2a9f3f7..e311a93 100644 --- a/include/capture/xcomposite.h +++ b/include/capture/xcomposite.h @@ -42,7 +42,7 @@ typedef struct { void gsr_capture_xcomposite_init(gsr_capture_xcomposite *self, const gsr_capture_xcomposite_params *params); int gsr_capture_xcomposite_start(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context, AVFrame *frame); -void gsr_capture_xcomposite_stop(gsr_capture_xcomposite *self, AVCodecContext *video_codec_context); +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_should_stop(gsr_capture_xcomposite *self, bool *err); int gsr_capture_xcomposite_capture(gsr_capture_xcomposite *self, AVFrame *frame); |