aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-07-04 01:35:03 +0200
committerdec05eba <dec05eba@protonmail.com>2024-07-04 01:35:03 +0200
commit62d61fda12e3774fee6b671e44fb89bd2ef8da8c (patch)
treed5050689876d9adbe51bdf137475b3c3bc332c63 /include
parentea7b58d7f92b179a4c2717237422e1200b5be673 (diff)
Add support for software video encoding with '-encoder cpu' option, currently h264 only
Diffstat (limited to 'include')
-rw-r--r--include/capture/capture.h3
-rw-r--r--include/capture/kms_software.h19
-rw-r--r--include/capture/nvfbc.h1
-rw-r--r--include/capture/xcomposite_software.h13
-rw-r--r--include/egl.h3
5 files changed, 37 insertions, 2 deletions
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 */
diff --git a/include/egl.h b/include/egl.h
index 64dd2c6..899c0d0 100644
--- a/include/egl.h
+++ b/include/egl.h
@@ -104,7 +104,7 @@ typedef void(*__GLXextFuncPtr)(void);
#define GL_FRAMEBUFFER 0x8D40
#define GL_COLOR_ATTACHMENT0 0x8CE0
#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_STREAM_DRAW 0x88E0
+#define GL_DYNAMIC_DRAW 0x88E8
#define GL_ARRAY_BUFFER 0x8892
#define GL_BLEND 0x0BE2
#define GL_SRC_ALPHA 0x0302
@@ -238,6 +238,7 @@ struct gsr_egl {
void (*glTexImage2D)(unsigned int target, int level, int internalFormat, int width, int height, int border, unsigned int format, unsigned int type, const void *pixels);
void (*glCopyImageSubData)(unsigned int srcName, unsigned int srcTarget, int srcLevel, int srcX, int srcY, int srcZ, unsigned int dstName, unsigned int dstTarget, int dstLevel, int dstX, int dstY, int dstZ, int srcWidth, int srcHeight, int srcDepth);
void (*glClearTexImage)(unsigned int texture, unsigned int level, unsigned int format, unsigned int type, const void *data);
+ void (*glGetTexImage)(unsigned int target, int level, unsigned int format, unsigned int type, void *pixels);
void (*glGenFramebuffers)(int n, unsigned int *framebuffers);
void (*glBindFramebuffer)(unsigned int target, unsigned int framebuffer);
void (*glDeleteFramebuffers)(int n, const unsigned int *framebuffers);