aboutsummaryrefslogtreecommitdiff
path: root/src/capture/capture.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2024-03-10 20:59:17 +0100
committerdec05eba <dec05eba@protonmail.com>2024-03-10 20:59:17 +0100
commitf3c32a880a426d8365f01ba7d61d81b75c04d9bc (patch)
treed4cfa97f27bd56b9b0aa39ac849d2be8f1bc1fb4 /src/capture/capture.c
parentfc5ddc97cf0293a2aff74e47a28d4d49a8b63f17 (diff)
Fix cursor capture in nvidia wayland, hdr, clear background immediately in window capture
Diffstat (limited to 'src/capture/capture.c')
-rw-r--r--src/capture/capture.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/capture/capture.c b/src/capture/capture.c
index 0917356..a1d2913 100644
--- a/src/capture/capture.c
+++ b/src/capture/capture.c
@@ -276,6 +276,7 @@ bool gsr_capture_base_setup_cuda_textures(gsr_capture_base *self, AVFrame *frame
color_conversion_params.destination_textures[0] = self->target_textures[0];
color_conversion_params.destination_textures[1] = self->target_textures[1];
color_conversion_params.num_destination_textures = 2;
+ color_conversion_params.load_external_image_shader = true;
if(gsr_color_conversion_init(&self->color_conversion, &color_conversion_params) != 0) {
fprintf(stderr, "gsr error: gsr_capture_kms_setup_cuda_textures: failed to create color conversion\n");
@@ -357,7 +358,7 @@ bool drm_create_codec_context(const char *card_path, AVCodecContext *video_codec
return true;
}
-bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, int width, int height, CUstream *cuda_stream) {
+bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_context, int width, int height, bool hdr, CUstream *cuda_stream) {
AVBufferRef *device_ctx = av_hwdevice_ctx_alloc(AV_HWDEVICE_TYPE_CUDA);
if(!device_ctx) {
fprintf(stderr, "gsr error: cuda_create_codec_context failed: failed to create hardware device context\n");
@@ -383,7 +384,7 @@ bool cuda_create_codec_context(CUcontext cu_ctx, AVCodecContext *video_codec_con
AVHWFramesContext *hw_frame_context = (AVHWFramesContext*)frame_context->data;
hw_frame_context->width = width;
hw_frame_context->height = height;
- hw_frame_context->sw_format = AV_PIX_FMT_NV12;
+ hw_frame_context->sw_format = hdr ? AV_PIX_FMT_P010LE : AV_PIX_FMT_NV12;
hw_frame_context->format = video_codec_context->pix_fmt;
hw_frame_context->device_ref = device_ctx;
hw_frame_context->device_ctx = (AVHWDeviceContext*)device_ctx->data;