diff options
author | dec05eba <dec05eba@protonmail.com> | 2024-12-08 02:17:41 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2024-12-08 02:17:41 +0100 |
commit | c259a19b9d8ca646824acad60b599b03252bc1c0 (patch) | |
tree | d3c7f3090735b3ae225868d514a9163c02941489 /src/encoder/video/nvenc.c | |
parent | 655fd3756be4507030aac1d497e579cfc0070f3c (diff) |
Refactor windowing from egl to window_x11/window_wayland, yolo
Diffstat (limited to 'src/encoder/video/nvenc.c')
-rw-r--r-- | src/encoder/video/nvenc.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/encoder/video/nvenc.c b/src/encoder/video/nvenc.c index 718560d..e83d0e8 100644 --- a/src/encoder/video/nvenc.c +++ b/src/encoder/video/nvenc.c @@ -1,6 +1,7 @@ #include "../../../include/encoder/video/nvenc.h" #include "../../../include/egl.h" #include "../../../include/cuda.h" +#include "../../../include/window/window.h" #include <libavcodec/avcodec.h> #include <libavutil/hwcontext_cuda.h> @@ -128,8 +129,10 @@ static void gsr_video_encoder_nvenc_stop(gsr_video_encoder_nvenc *self, AVCodecC static bool gsr_video_encoder_nvenc_start(gsr_video_encoder *encoder, AVCodecContext *video_codec_context, AVFrame *frame) { gsr_video_encoder_nvenc *self = encoder->priv; - const bool overclock = gsr_egl_get_display_server(self->params.egl) == GSR_DISPLAY_SERVER_X11 ? self->params.overclock : false; - if(!gsr_cuda_load(&self->cuda, self->params.egl->x11.dpy, overclock)) { + const bool is_x11 = gsr_window_get_display_server(self->params.egl->window) == GSR_DISPLAY_SERVER_X11; + const bool overclock = is_x11 ? self->params.overclock : false; + Display *display = is_x11 ? gsr_window_get_display(self->params.egl->window) : NULL; + if(!gsr_cuda_load(&self->cuda, display, overclock)) { fprintf(stderr, "gsr error: gsr_video_encoder_nvenc_start: failed to load cuda\n"); gsr_video_encoder_nvenc_stop(self, video_codec_context); return false; |