From eef7170d011ea142f77ab919d520ef413c6f9a29 Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Mon, 13 Feb 2023 16:38:18 +0100 Subject: [PATCH] Linux screen cap. compile fixes + mark the original X11 as such (alongside with PipeWire) --- src/lib_common.h | 5 +---- src/video_capture/screen_pw.cpp | 24 +++++++++--------------- src/video_capture/screen_x11.c | 4 ++-- 3 files changed, 12 insertions(+), 21 deletions(-) diff --git a/src/lib_common.h b/src/lib_common.h index 531111491..2ebb11396 100644 --- a/src/lib_common.h +++ b/src/lib_common.h @@ -3,7 +3,7 @@ * @author Martin Pulec */ /* - * Copyright (c) 2011-2022 CESNET, z. s. p. o. + * Copyright (c) 2011-2023 CESNET, z. s. p. o. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,9 +38,6 @@ #ifndef LIB_COMMON_H #define LIB_COMMON_H -#include "config_unix.h" -#include "config_win32.h" - #include "host.h" // UNIQUE_LABEL /** @brief This macro causes that this module will be statically linked with UltraGrid. */ diff --git a/src/video_capture/screen_pw.cpp b/src/video_capture/screen_pw.cpp index 3b75e2682..50fb474f1 100644 --- a/src/video_capture/screen_pw.cpp +++ b/src/video_capture/screen_pw.cpp @@ -856,21 +856,13 @@ static void run_screencast(screen_cast_session *session_ptr) { session.portal->run_loop(); } -static struct vidcap_type * vidcap_screen_pw_probe(bool verbose, void (**deleter)(void *)) +static void vidcap_screen_pw_probe(struct device_info **available_devices, int *count, void (**deleter)(void *)) { - UNUSED(verbose); - - struct vidcap_type* vt; *deleter = free; - - vt = (struct vidcap_type *) calloc(1, sizeof(struct vidcap_type)); - if (vt == nullptr) { - return nullptr; - } - - vt->name = "screen_pw"; - vt->description = "Grabbing screen using PipeWire"; - return vt; + *count = 1; + *available_devices = (struct device_info *) calloc(*count, sizeof(struct device_info)); + // (*available_devices)[0].dev can be "" since screen cap. doesn't require parameters + snprintf((*available_devices)[0].name, sizeof (*available_devices)[0].name, "Screen capture PipeWire"); } static void show_help() { @@ -984,7 +976,9 @@ static const struct video_capture_info vidcap_screen_pw_info = { vidcap_screen_pw_init, vidcap_screen_pw_done, vidcap_screen_pw_grab, - true, + "[screen_pw] ", }; -REGISTER_MODULE(screen_pw, &vidcap_screen_pw_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); \ No newline at end of file +REGISTER_MODULE(screen_pw, &vidcap_screen_pw_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); + +/* vim: set expandtab sw=8: */ diff --git a/src/video_capture/screen_x11.c b/src/video_capture/screen_x11.c index cd204843b..60b4119fa 100644 --- a/src/video_capture/screen_x11.c +++ b/src/video_capture/screen_x11.c @@ -257,7 +257,7 @@ static void vidcap_screen_x11_probe(struct device_info **available_devices, int *count = 1; *available_devices = calloc(*count, sizeof(struct device_info)); // (*available_devices)[0].dev can be "" since screen cap. doesn't require parameters - snprintf((*available_devices)[0].name, sizeof (*available_devices)[0].name, "Screen capture"); + snprintf((*available_devices)[0].name, sizeof (*available_devices)[0].name, "Screen capture X11"); int framerates[] = {24, 30, 60}; @@ -488,5 +488,5 @@ static const struct video_capture_info vidcap_screen_x11_info = { VIDCAP_NO_GENERIC_FPS_INDICATOR, }; -REGISTER_MODULE(screen, &vidcap_screen_x11_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION); +REGISTER_MODULE(screen_x11, &vidcap_screen_x11_info, LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION);