Refactor windowing from egl to window_x11/window_wayland, yolo

This commit is contained in:
dec05eba
2024-12-08 02:17:41 +01:00
parent 655fd3756b
commit c259a19b9d
18 changed files with 801 additions and 534 deletions

View File

@@ -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;