From 62d61fda12e3774fee6b671e44fb89bd2ef8da8c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Thu, 4 Jul 2024 01:35:03 +0200 Subject: Add support for software video encoding with '-encoder cpu' option, currently h264 only --- include/capture/capture.h | 3 ++- include/capture/kms_software.h | 19 +++++++++++++++++++ include/capture/nvfbc.h | 1 + include/capture/xcomposite_software.h | 13 +++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 include/capture/kms_software.h create mode 100644 include/capture/xcomposite_software.h (limited to 'include/capture') diff --git a/include/capture/capture.h b/include/capture/capture.h index fbbe767..8c654f4 100644 --- a/include/capture/capture.h +++ b/include/capture/capture.h @@ -62,9 +62,10 @@ void gsr_capture_destroy(gsr_capture *cap, AVCodecContext *video_codec_context); 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); +bool gsr_capture_base_setup_textures(gsr_capture_base *self, AVFrame *frame, gsr_color_range color_range, gsr_source_color source_color, bool hdr, bool cursor_texture_is_external); void gsr_capture_base_stop(gsr_capture_base *self); -bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec_context, int width, int height, bool hdr, VADisplay *va_dpy); +bool vaapi_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, bool hdr, CUstream *cuda_stream); #endif /* GSR_CAPTURE_CAPTURE_H */ diff --git a/include/capture/kms_software.h b/include/capture/kms_software.h new file mode 100644 index 0000000..f9b57f3 --- /dev/null +++ b/include/capture/kms_software.h @@ -0,0 +1,19 @@ +#ifndef GSR_CAPTURE_KMS_SOFTWARE_H +#define GSR_CAPTURE_KMS_SOFTWARE_H + +#include "../vec2.h" +#include "../utils.h" +#include "../color_conversion.h" +#include "capture.h" + +typedef struct { + gsr_egl *egl; + const char *display_to_capture; /* if this is "screen", then the first monitor is captured. A copy is made of this */ + bool hdr; + gsr_color_range color_range; + bool record_cursor; +} gsr_capture_kms_software_params; + +gsr_capture* gsr_capture_kms_software_create(const gsr_capture_kms_software_params *params); + +#endif /* GSR_CAPTURE_KMS_SOFTWARE_H */ diff --git a/include/capture/nvfbc.h b/include/capture/nvfbc.h index 36bc2b6..e24b712 100644 --- a/include/capture/nvfbc.h +++ b/include/capture/nvfbc.h @@ -15,6 +15,7 @@ typedef struct { bool hdr; gsr_color_range color_range; bool record_cursor; + bool use_software_video_encoder; } gsr_capture_nvfbc_params; gsr_capture* gsr_capture_nvfbc_create(const gsr_capture_nvfbc_params *params); diff --git a/include/capture/xcomposite_software.h b/include/capture/xcomposite_software.h new file mode 100644 index 0000000..d41083c --- /dev/null +++ b/include/capture/xcomposite_software.h @@ -0,0 +1,13 @@ +#ifndef GSR_CAPTURE_XCOMPOSITE_SOFTWARE_H +#define GSR_CAPTURE_XCOMPOSITE_SOFTWARE_H + +#include "capture.h" +#include "xcomposite.h" + +typedef struct { + gsr_capture_xcomposite_params base; +} gsr_capture_xcomposite_software_params; + +gsr_capture* gsr_capture_xcomposite_software_create(const gsr_capture_xcomposite_software_params *params); + +#endif /* GSR_CAPTURE_XCOMPOSITE_SOFTWARE_H */ -- cgit v1.2.3