diff --git a/src/platform/linux/pipewire.cpp b/src/platform/linux/pipewire.cpp index 3f10695e..74b9ac15 100644 --- a/src/platform/linux/pipewire.cpp +++ b/src/platform/linux/pipewire.cpp @@ -3,15 +3,7 @@ * @brief Shared classes for pipewire-based capture methods. */ // standard includes -#include -#include -#include #include -#include -#include -#include -#include -#include // lib includes #include @@ -32,12 +24,6 @@ #include "vulkan_encode.h" #include "wayland.h" -#if !defined(__FreeBSD__) - // platform includes - #include - #include -#endif - namespace { // Buffer and limit constants constexpr int SPA_POD_BUFFER_SIZE = 4096; @@ -60,12 +46,6 @@ namespace pipewire { {0, 0}, }}; - struct dbus_response_t { - GMainLoop *loop; - GVariant *response; - guint subscription_id; - }; - struct shared_state_t { std::atomic negotiated_width {0}; std::atomic negotiated_height {0}; @@ -698,13 +678,13 @@ namespace pipewire { } if (pipewire.init(pipewire_fd, pipewire_node, shared_state) < 0) { - BOOST_LOG(error) << "[pipewire] Failed to init pipewire. portal_t::init() failed."; + BOOST_LOG(error) << "[pipewire] Failed to init pipewire. pipewire_t::init() failed."; return -1; } // Start PipeWire now so format negotiation can proceed before capture start if (pipewire.ensure_stream(mem_type, width, height, framerate, dmabuf_infos.data(), n_dmabuf_infos, display_is_nvidia) < 0) { - BOOST_LOG(error) << "[pipewire] Failed to ensure pipewire stream. portal_t::init() failed."; + BOOST_LOG(error) << "[pipewire] Failed to ensure pipewire stream. pipewire_t::init() failed."; return -1; } diff --git a/src/platform/linux/portalgrab.cpp b/src/platform/linux/portalgrab.cpp index 1f845df7..fb6841a4 100644 --- a/src/platform/linux/portalgrab.cpp +++ b/src/platform/linux/portalgrab.cpp @@ -2,36 +2,8 @@ * @file src/platform/linux/portalgrab.cpp * @brief Definitions for XDG portal grab. */ -// standard includes -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// lib includes -#include -#include -#include -#include -#include -#include -#include - // local includes -#include "cuda.h" -#include "graphics.h" #include "pipewire.cpp" -#include "src/main.h" -#include "src/platform/common.h" -#include "src/video.h" -#include "vaapi.h" -#include "vulkan_encode.h" -#include "wayland.h" namespace { // Portal configuration constants @@ -108,59 +80,12 @@ namespace portal { } }; - struct format_map_t { - uint64_t fourcc; - int32_t pw_format; - }; - - static constexpr std::array format_map = {{ - {DRM_FORMAT_ARGB8888, SPA_VIDEO_FORMAT_BGRA}, - {DRM_FORMAT_XRGB8888, SPA_VIDEO_FORMAT_BGRx}, - {0, 0}, - }}; - struct dbus_response_t { GMainLoop *loop; GVariant *response; guint subscription_id; }; - struct shared_state_t { - std::atomic negotiated_width {0}; - std::atomic negotiated_height {0}; - std::atomic stream_dead {false}; - }; - - struct stream_data_t { - struct pw_stream *stream; - struct spa_hook stream_listener; - struct spa_video_info format; - struct pw_buffer *current_buffer; - uint64_t drm_format; - std::shared_ptr shared; - std::mutex frame_mutex; - std::condition_variable frame_cv; - size_t local_stride = 0; - bool frame_ready = false; - // Two distinct memory pools - std::vector buffer_a; - std::vector buffer_b; - // Points to the buffer currently owned by fill_img - std::vector *front_buffer; - // Points to the buffer currently being written by on_process - std::vector *back_buffer; - - stream_data_t(): - front_buffer(&buffer_a), - back_buffer(&buffer_b) {} - }; - - struct dmabuf_format_info_t { - int32_t format; - uint64_t *modifiers; - int n_modifiers; - }; - struct pipewire_streaminfo_t { int pipewire_node = -1; int width = 0;