|
2 | 2 | * @file src/platform/linux/portalgrab.cpp |
3 | 3 | * @brief Definitions for XDG portal grab. |
4 | 4 | */ |
5 | | -// standard includes |
6 | | -#include <array> |
7 | | -#include <fcntl.h> |
8 | | -#include <format> |
9 | | -#include <fstream> |
10 | | -#include <memory> |
11 | | -#include <mutex> |
12 | | -#include <string.h> |
13 | | -#include <string_view> |
14 | | -#include <thread> |
15 | | - |
16 | | -// lib includes |
17 | | -#include <gio/gio.h> |
18 | | -#include <gio/gunixfdlist.h> |
19 | | -#include <libdrm/drm_fourcc.h> |
20 | | -#include <pipewire/pipewire.h> |
21 | | -#include <spa/param/video/format-utils.h> |
22 | | -#include <spa/param/video/type-info.h> |
23 | | -#include <spa/pod/builder.h> |
24 | | - |
25 | 5 | // local includes |
26 | | -#include "cuda.h" |
27 | | -#include "graphics.h" |
28 | 6 | #include "pipewire.cpp" |
29 | | -#include "src/main.h" |
30 | | -#include "src/platform/common.h" |
31 | | -#include "src/video.h" |
32 | | -#include "vaapi.h" |
33 | | -#include "vulkan_encode.h" |
34 | | -#include "wayland.h" |
35 | 7 |
|
36 | 8 | namespace { |
37 | 9 | // Portal configuration constants |
@@ -108,59 +80,12 @@ namespace portal { |
108 | 80 | } |
109 | 81 | }; |
110 | 82 |
|
111 | | - struct format_map_t { |
112 | | - uint64_t fourcc; |
113 | | - int32_t pw_format; |
114 | | - }; |
115 | | - |
116 | | - static constexpr std::array<format_map_t, 3> format_map = {{ |
117 | | - {DRM_FORMAT_ARGB8888, SPA_VIDEO_FORMAT_BGRA}, |
118 | | - {DRM_FORMAT_XRGB8888, SPA_VIDEO_FORMAT_BGRx}, |
119 | | - {0, 0}, |
120 | | - }}; |
121 | | - |
122 | 83 | struct dbus_response_t { |
123 | 84 | GMainLoop *loop; |
124 | 85 | GVariant *response; |
125 | 86 | guint subscription_id; |
126 | 87 | }; |
127 | 88 |
|
128 | | - struct shared_state_t { |
129 | | - std::atomic<int> negotiated_width {0}; |
130 | | - std::atomic<int> negotiated_height {0}; |
131 | | - std::atomic<bool> stream_dead {false}; |
132 | | - }; |
133 | | - |
134 | | - struct stream_data_t { |
135 | | - struct pw_stream *stream; |
136 | | - struct spa_hook stream_listener; |
137 | | - struct spa_video_info format; |
138 | | - struct pw_buffer *current_buffer; |
139 | | - uint64_t drm_format; |
140 | | - std::shared_ptr<shared_state_t> shared; |
141 | | - std::mutex frame_mutex; |
142 | | - std::condition_variable frame_cv; |
143 | | - size_t local_stride = 0; |
144 | | - bool frame_ready = false; |
145 | | - // Two distinct memory pools |
146 | | - std::vector<uint8_t> buffer_a; |
147 | | - std::vector<uint8_t> buffer_b; |
148 | | - // Points to the buffer currently owned by fill_img |
149 | | - std::vector<uint8_t> *front_buffer; |
150 | | - // Points to the buffer currently being written by on_process |
151 | | - std::vector<uint8_t> *back_buffer; |
152 | | - |
153 | | - stream_data_t(): |
154 | | - front_buffer(&buffer_a), |
155 | | - back_buffer(&buffer_b) {} |
156 | | - }; |
157 | | - |
158 | | - struct dmabuf_format_info_t { |
159 | | - int32_t format; |
160 | | - uint64_t *modifiers; |
161 | | - int n_modifiers; |
162 | | - }; |
163 | | - |
164 | 89 | struct pipewire_streaminfo_t { |
165 | 90 | int pipewire_node = -1; |
166 | 91 | int width = 0; |
|
0 commit comments