mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-04-29 15:02:04 +08:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b7a031bb7f | |||
| 15cce07b6e | |||
| a8769dee06 | |||
| 855b15025c |
@@ -9,7 +9,7 @@ ARCHITECTURE="amd64"
|
|||||||
MAINTAINER="Junkun Di <junkun.di@hotmail.com>"
|
MAINTAINER="Junkun Di <junkun.di@hotmail.com>"
|
||||||
DESCRIPTION="A simple cross-platform remote desktop client."
|
DESCRIPTION="A simple cross-platform remote desktop client."
|
||||||
ALSA_RUNTIME_DEP="libasound2 | libasound2t64"
|
ALSA_RUNTIME_DEP="libasound2 | libasound2t64"
|
||||||
PIPEWIRE_RUNTIME_DEP="libpipewire-0.3-0 | libpipewire-0.3-0t64"
|
PORTAL_RUNTIME_RECOMMENDS="xdg-desktop-portal, xdg-desktop-portal-gtk | xdg-desktop-portal-kde | xdg-desktop-portal-wlr"
|
||||||
|
|
||||||
# Remove 'v' prefix from version for Debian package (Debian version must start with digit)
|
# Remove 'v' prefix from version for Debian package (Debian version must start with digit)
|
||||||
DEB_VERSION="${APP_VERSION#v}"
|
DEB_VERSION="${APP_VERSION#v}"
|
||||||
@@ -44,10 +44,8 @@ Description: $DESCRIPTION
|
|||||||
Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1,
|
Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1,
|
||||||
libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0,
|
libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0,
|
||||||
libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP,
|
libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP,
|
||||||
libsndio7.0, libxcb-shm0, libpulse0, libdrm2, libdbus-1-3,
|
libsndio7.0, libxcb-shm0, libpulse0, libdrm2, libdbus-1-3
|
||||||
$PIPEWIRE_RUNTIME_DEP, xdg-desktop-portal,
|
Recommends: $PORTAL_RUNTIME_RECOMMENDS, nvidia-cuda-toolkit
|
||||||
xdg-desktop-portal-gtk | xdg-desktop-portal-kde | xdg-desktop-portal-wlr
|
|
||||||
Recommends: nvidia-cuda-toolkit
|
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: utils
|
Section: utils
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ ARCHITECTURE="arm64"
|
|||||||
MAINTAINER="Junkun Di <junkun.di@hotmail.com>"
|
MAINTAINER="Junkun Di <junkun.di@hotmail.com>"
|
||||||
DESCRIPTION="A simple cross-platform remote desktop client."
|
DESCRIPTION="A simple cross-platform remote desktop client."
|
||||||
ALSA_RUNTIME_DEP="libasound2 | libasound2t64"
|
ALSA_RUNTIME_DEP="libasound2 | libasound2t64"
|
||||||
PIPEWIRE_RUNTIME_DEP="libpipewire-0.3-0 | libpipewire-0.3-0t64"
|
PORTAL_RUNTIME_RECOMMENDS="xdg-desktop-portal, xdg-desktop-portal-gtk | xdg-desktop-portal-kde | xdg-desktop-portal-wlr"
|
||||||
|
|
||||||
# Remove 'v' prefix from version for Debian package (Debian version must start with digit)
|
# Remove 'v' prefix from version for Debian package (Debian version must start with digit)
|
||||||
DEB_VERSION="${APP_VERSION#v}"
|
DEB_VERSION="${APP_VERSION#v}"
|
||||||
@@ -44,9 +44,8 @@ Description: $DESCRIPTION
|
|||||||
Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1,
|
Depends: libc6 (>= 2.29), libstdc++6 (>= 9), libx11-6, libxcb1,
|
||||||
libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0,
|
libxcb-randr0, libxcb-xtest0, libxcb-xinerama0, libxcb-shape0,
|
||||||
libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP,
|
libxcb-xkb1, libxcb-xfixes0, libxv1, libxtst6, $ALSA_RUNTIME_DEP,
|
||||||
libsndio7.0, libxcb-shm0, libpulse0, libdrm2, libdbus-1-3,
|
libsndio7.0, libxcb-shm0, libpulse0, libdrm2, libdbus-1-3
|
||||||
$PIPEWIRE_RUNTIME_DEP, xdg-desktop-portal,
|
Recommends: $PORTAL_RUNTIME_RECOMMENDS
|
||||||
xdg-desktop-portal-gtk | xdg-desktop-portal-kde | xdg-desktop-portal-wlr
|
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Section: utils
|
Section: utils
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class Render {
|
|||||||
std::chrono::steady_clock::time_point file_send_last_update_time_;
|
std::chrono::steady_clock::time_point file_send_last_update_time_;
|
||||||
uint64_t file_send_last_bytes_ = 0;
|
uint64_t file_send_last_bytes_ = 0;
|
||||||
bool file_transfer_window_visible_ = false;
|
bool file_transfer_window_visible_ = false;
|
||||||
|
bool file_transfer_window_hovered_ = false;
|
||||||
std::atomic<uint32_t> current_file_id_{0};
|
std::atomic<uint32_t> current_file_id_{0};
|
||||||
|
|
||||||
struct QueuedFile {
|
struct QueuedFile {
|
||||||
|
|||||||
@@ -474,6 +474,12 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const bool file_transfer_window_hovered =
|
||||||
|
props->file_transfer_.file_transfer_window_hovered_;
|
||||||
|
const bool overlay_hovered = props->control_bar_hovered_ ||
|
||||||
|
props->display_selectable_hovered_ ||
|
||||||
|
file_transfer_window_hovered;
|
||||||
|
|
||||||
const SDL_FRect render_rect = props->stream_render_rect_f_;
|
const SDL_FRect render_rect = props->stream_render_rect_f_;
|
||||||
if (render_rect.w <= 1.0f || render_rect.h <= 1.0f) {
|
if (render_rect.w <= 1.0f || render_rect.h <= 1.0f) {
|
||||||
continue;
|
continue;
|
||||||
@@ -517,7 +523,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
|||||||
remote_action.m.flag = MouseFlag::move;
|
remote_action.m.flag = MouseFlag::move;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (props->control_bar_hovered_ || props->display_selectable_hovered_) {
|
if (overlay_hovered) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (props->peer_) {
|
if (props->peer_) {
|
||||||
@@ -563,7 +569,7 @@ int Render::ProcessMouseEvent(const SDL_Event& event) {
|
|||||||
remote_action.m.x = std::clamp(remote_action.m.x, 0.0f, 1.0f);
|
remote_action.m.x = std::clamp(remote_action.m.x, 0.0f, 1.0f);
|
||||||
remote_action.m.y = std::clamp(remote_action.m.y, 0.0f, 1.0f);
|
remote_action.m.y = std::clamp(remote_action.m.y, 0.0f, 1.0f);
|
||||||
|
|
||||||
if (props->control_bar_hovered_) {
|
if (overlay_hovered) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (props->peer_) {
|
if (props->peer_) {
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ int BitrateDisplay(int bitrate) {
|
|||||||
int Render::FileTransferWindow(
|
int Render::FileTransferWindow(
|
||||||
std::shared_ptr<SubStreamWindowProperties>& props) {
|
std::shared_ptr<SubStreamWindowProperties>& props) {
|
||||||
FileTransferState* state = props ? &props->file_transfer_ : &file_transfer_;
|
FileTransferState* state = props ? &props->file_transfer_ : &file_transfer_;
|
||||||
|
state->file_transfer_window_hovered_ = false;
|
||||||
|
|
||||||
// Only show window if there are files in transfer list or currently
|
// Only show window if there are files in transfer list or currently
|
||||||
// transferring
|
// transferring
|
||||||
@@ -72,8 +73,6 @@ int Render::FileTransferWindow(
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGuiIO& io = ImGui::GetIO();
|
|
||||||
|
|
||||||
// Position window at bottom-left of stream window
|
// Position window at bottom-left of stream window
|
||||||
// Adjust window size based on number of files
|
// Adjust window size based on number of files
|
||||||
float file_transfer_window_width = main_window_width_ * 0.6f;
|
float file_transfer_window_width = main_window_width_ * 0.6f;
|
||||||
@@ -82,15 +81,25 @@ int Render::FileTransferWindow(
|
|||||||
float pos_x = file_transfer_window_width * 0.05f;
|
float pos_x = file_transfer_window_width * 0.05f;
|
||||||
float pos_y = stream_window_height_ - file_transfer_window_height -
|
float pos_y = stream_window_height_ - file_transfer_window_height -
|
||||||
file_transfer_window_width * 0.05;
|
file_transfer_window_width * 0.05;
|
||||||
float same_line_width = file_transfer_window_width * 0.1f;
|
|
||||||
|
const ImVec2 mouse_pos = ImGui::GetMousePos();
|
||||||
|
const bool mouse_in_window_rect =
|
||||||
|
mouse_pos.x >= pos_x &&
|
||||||
|
mouse_pos.x <= pos_x + file_transfer_window_width &&
|
||||||
|
mouse_pos.y >= pos_y &&
|
||||||
|
mouse_pos.y <= pos_y + file_transfer_window_height;
|
||||||
|
|
||||||
ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y), ImGuiCond_Always);
|
ImGui::SetNextWindowPos(ImVec2(pos_x, pos_y), ImGuiCond_Always);
|
||||||
ImGui::SetNextWindowSize(
|
ImGui::SetNextWindowSize(
|
||||||
ImVec2(file_transfer_window_width, file_transfer_window_height),
|
ImVec2(file_transfer_window_width, file_transfer_window_height),
|
||||||
ImGuiCond_Always);
|
ImGuiCond_Always);
|
||||||
|
if (mouse_in_window_rect) {
|
||||||
|
ImGui::SetNextWindowFocus();
|
||||||
|
}
|
||||||
|
|
||||||
// Set Chinese font for proper display
|
// Set Chinese font for proper display
|
||||||
if (stream_windows_system_chinese_font_) {
|
const bool has_chinese_font = stream_windows_system_chinese_font_ != nullptr;
|
||||||
|
if (has_chinese_font) {
|
||||||
ImGui::PushFont(stream_windows_system_chinese_font_);
|
ImGui::PushFont(stream_windows_system_chinese_font_);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -103,24 +112,27 @@ int Render::FileTransferWindow(
|
|||||||
|
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
bool window_opened = true;
|
bool window_opened = true;
|
||||||
if (ImGui::Begin(
|
const bool show_contents = ImGui::Begin(
|
||||||
localization::file_transfer_progress[localization_language_index_]
|
localization::file_transfer_progress[localization_language_index_]
|
||||||
.c_str(),
|
.c_str(),
|
||||||
&window_opened,
|
&window_opened,
|
||||||
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
|
ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize |
|
||||||
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
|
ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings |
|
||||||
ImGuiWindowFlags_NoScrollbar)) {
|
ImGuiWindowFlags_NoScrollbar);
|
||||||
|
ImGui::PopStyleColor(4);
|
||||||
|
ImGui::PopStyleVar(2);
|
||||||
|
|
||||||
|
state->file_transfer_window_hovered_ =
|
||||||
|
mouse_in_window_rect ||
|
||||||
|
ImGui::IsWindowHovered(ImGuiHoveredFlags_RootAndChildWindows);
|
||||||
|
|
||||||
|
if (!window_opened) {
|
||||||
|
state->file_transfer_window_visible_ = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (show_contents && window_opened) {
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
ImGui::PopStyleColor(4);
|
|
||||||
ImGui::PopStyleVar(2);
|
|
||||||
|
|
||||||
// Close button handling
|
|
||||||
if (!window_opened) {
|
|
||||||
state->file_transfer_window_visible_ = false;
|
|
||||||
ImGui::End();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Display file list
|
// Display file list
|
||||||
if (file_list.empty()) {
|
if (file_list.empty()) {
|
||||||
@@ -225,21 +237,16 @@ int Render::FileTransferWindow(
|
|||||||
}
|
}
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
ImGui::SetWindowFontScale(0.5f);
|
ImGui::SetWindowFontScale(0.5f);
|
||||||
ImGui::End();
|
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
|
||||||
|
|
||||||
// Pop Chinese font if it was pushed
|
|
||||||
if (stream_windows_system_chinese_font_) {
|
|
||||||
ImGui::PopFont();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ImGui::PopStyleColor(4);
|
|
||||||
ImGui::PopStyleVar(2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::End();
|
||||||
ImGui::SetWindowFontScale(1.0f);
|
ImGui::SetWindowFontScale(1.0f);
|
||||||
|
|
||||||
|
if (has_chinese_font) {
|
||||||
|
ImGui::PopFont();
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace crossdesk
|
} // namespace crossdesk
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,11 @@ int ScreenCapturerWayland::Init(const int fps, cb_desktop_data cb) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!EnsurePipeWireRuntimeAvailable()) {
|
||||||
|
LOG_ERROR("Wayland screen capturer requires PipeWire 0.3 runtime");
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
fps_ = fps;
|
fps_ = fps;
|
||||||
callback_ = cb;
|
callback_ = cb;
|
||||||
pointer_granted_ = false;
|
pointer_granted_ = false;
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ class ScreenCapturerWayland : public ScreenCapturer {
|
|||||||
bool SelectPortalDevices();
|
bool SelectPortalDevices();
|
||||||
bool SelectPortalSource();
|
bool SelectPortalSource();
|
||||||
bool StartPortalSession();
|
bool StartPortalSession();
|
||||||
|
bool EnsurePipeWireRuntimeAvailable() const;
|
||||||
bool OpenPipeWireRemote();
|
bool OpenPipeWireRemote();
|
||||||
bool SetupPipeWireStream(bool relaxed_connect, PipeWireConnectMode mode);
|
bool SetupPipeWireStream(bool relaxed_connect, PipeWireConnectMode mode);
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#if CROSSDESK_WAYLAND_BUILD_ENABLED
|
#if CROSSDESK_WAYLAND_BUILD_ENABLED
|
||||||
|
|
||||||
|
#include <dlfcn.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -10,6 +11,7 @@
|
|||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <mutex>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
@@ -20,6 +22,143 @@ namespace crossdesk {
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
struct PipeWireDynamicApi {
|
||||||
|
void* library = nullptr;
|
||||||
|
bool available = false;
|
||||||
|
|
||||||
|
decltype(&::pw_init) init = nullptr;
|
||||||
|
decltype(&::pw_deinit) deinit = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_new) thread_loop_new = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_destroy) thread_loop_destroy = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_get_loop) thread_loop_get_loop = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_start) thread_loop_start = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_stop) thread_loop_stop = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_lock) thread_loop_lock = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_unlock) thread_loop_unlock = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_wait) thread_loop_wait = nullptr;
|
||||||
|
decltype(&::pw_thread_loop_signal) thread_loop_signal = nullptr;
|
||||||
|
decltype(&::pw_context_new) context_new = nullptr;
|
||||||
|
decltype(&::pw_context_destroy) context_destroy = nullptr;
|
||||||
|
decltype(&::pw_context_connect_fd) context_connect_fd = nullptr;
|
||||||
|
decltype(&::pw_properties_new) properties_new = nullptr;
|
||||||
|
decltype(&::pw_properties_set) properties_set = nullptr;
|
||||||
|
decltype(&::pw_stream_new) stream_new = nullptr;
|
||||||
|
decltype(&::pw_stream_add_listener) stream_add_listener = nullptr;
|
||||||
|
decltype(&::pw_stream_state_as_string) stream_state_as_string = nullptr;
|
||||||
|
decltype(&::pw_stream_connect) stream_connect = nullptr;
|
||||||
|
decltype(&::pw_stream_update_params) stream_update_params = nullptr;
|
||||||
|
decltype(&::pw_stream_set_active) stream_set_active = nullptr;
|
||||||
|
decltype(&::pw_stream_disconnect) stream_disconnect = nullptr;
|
||||||
|
decltype(&::pw_stream_destroy) stream_destroy = nullptr;
|
||||||
|
decltype(&::pw_stream_dequeue_buffer) stream_dequeue_buffer = nullptr;
|
||||||
|
decltype(&::pw_stream_queue_buffer) stream_queue_buffer = nullptr;
|
||||||
|
decltype(&::pw_core_disconnect) core_disconnect = nullptr;
|
||||||
|
decltype(&::pw_proxy_destroy) proxy_destroy = nullptr;
|
||||||
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool LoadPipeWireSymbol(void* library, T* function, const char* symbol_name) {
|
||||||
|
*function = reinterpret_cast<T>(dlsym(library, symbol_name));
|
||||||
|
if (*function != nullptr) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ERROR("Unable to find PipeWire symbol {}", symbol_name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void UnloadPipeWireApi(PipeWireDynamicApi* api) {
|
||||||
|
if (api->library != nullptr) {
|
||||||
|
dlclose(api->library);
|
||||||
|
}
|
||||||
|
*api = PipeWireDynamicApi{};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool LoadPipeWireApi(PipeWireDynamicApi* api) {
|
||||||
|
static constexpr const char* kPipeWireLibraries[] = {
|
||||||
|
"libpipewire-0.3.so.0",
|
||||||
|
"libpipewire-0.3.so",
|
||||||
|
};
|
||||||
|
|
||||||
|
for (const char* library_name : kPipeWireLibraries) {
|
||||||
|
api->library = dlopen(library_name, RTLD_LAZY | RTLD_LOCAL);
|
||||||
|
if (api->library != nullptr) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (api->library == nullptr) {
|
||||||
|
LOG_WARN("PipeWire 0.3 runtime library is unavailable");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!LoadPipeWireSymbol(api->library, &api->init, "pw_init") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->deinit, "pw_deinit") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_new,
|
||||||
|
"pw_thread_loop_new") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_destroy,
|
||||||
|
"pw_thread_loop_destroy") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_get_loop,
|
||||||
|
"pw_thread_loop_get_loop") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_start,
|
||||||
|
"pw_thread_loop_start") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_stop,
|
||||||
|
"pw_thread_loop_stop") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_lock,
|
||||||
|
"pw_thread_loop_lock") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_unlock,
|
||||||
|
"pw_thread_loop_unlock") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_wait,
|
||||||
|
"pw_thread_loop_wait") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->thread_loop_signal,
|
||||||
|
"pw_thread_loop_signal") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->context_new, "pw_context_new") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->context_destroy,
|
||||||
|
"pw_context_destroy") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->context_connect_fd,
|
||||||
|
"pw_context_connect_fd") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->properties_new,
|
||||||
|
"pw_properties_new") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->properties_set,
|
||||||
|
"pw_properties_set") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_new, "pw_stream_new") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_add_listener,
|
||||||
|
"pw_stream_add_listener") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_state_as_string,
|
||||||
|
"pw_stream_state_as_string") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_connect,
|
||||||
|
"pw_stream_connect") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_update_params,
|
||||||
|
"pw_stream_update_params") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_set_active,
|
||||||
|
"pw_stream_set_active") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_disconnect,
|
||||||
|
"pw_stream_disconnect") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_destroy,
|
||||||
|
"pw_stream_destroy") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_dequeue_buffer,
|
||||||
|
"pw_stream_dequeue_buffer") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->stream_queue_buffer,
|
||||||
|
"pw_stream_queue_buffer") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->core_disconnect,
|
||||||
|
"pw_core_disconnect") ||
|
||||||
|
!LoadPipeWireSymbol(api->library, &api->proxy_destroy,
|
||||||
|
"pw_proxy_destroy")) {
|
||||||
|
UnloadPipeWireApi(api);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
api->available = true;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const PipeWireDynamicApi* GetPipeWireApi() {
|
||||||
|
static PipeWireDynamicApi api;
|
||||||
|
static std::once_flag once;
|
||||||
|
std::call_once(once, []() { LoadPipeWireApi(&api); });
|
||||||
|
return api.available ? &api : nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
const char* PipeWireFormatName(uint32_t spa_format) {
|
const char* PipeWireFormatName(uint32_t spa_format) {
|
||||||
switch (spa_format) {
|
switch (spa_format) {
|
||||||
case SPA_VIDEO_FORMAT_BGRx:
|
case SPA_VIDEO_FORMAT_BGRx:
|
||||||
@@ -76,6 +215,7 @@ double SnapLikelyFractionalScale(double observed_scale) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct PipeWireTargetLookupState {
|
struct PipeWireTargetLookupState {
|
||||||
|
const PipeWireDynamicApi* pipewire = nullptr;
|
||||||
pw_thread_loop* loop = nullptr;
|
pw_thread_loop* loop = nullptr;
|
||||||
uint32_t target_node_id = 0;
|
uint32_t target_node_id = 0;
|
||||||
int sync_seq = -1;
|
int sync_seq = -1;
|
||||||
@@ -87,11 +227,13 @@ struct PipeWireTargetLookupState {
|
|||||||
std::string LookupPipeWireTargetObjectSerial(pw_core* core,
|
std::string LookupPipeWireTargetObjectSerial(pw_core* core,
|
||||||
pw_thread_loop* loop,
|
pw_thread_loop* loop,
|
||||||
uint32_t node_id) {
|
uint32_t node_id) {
|
||||||
if (!core || !loop || node_id == 0) {
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
|
if (!pipewire || !core || !loop || node_id == 0) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
PipeWireTargetLookupState state;
|
PipeWireTargetLookupState state;
|
||||||
|
state.pipewire = pipewire;
|
||||||
state.loop = loop;
|
state.loop = loop;
|
||||||
state.target_node_id = node_id;
|
state.target_node_id = node_id;
|
||||||
|
|
||||||
@@ -138,7 +280,7 @@ std::string LookupPipeWireTargetObjectSerial(pw_core* core,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
state->done = true;
|
state->done = true;
|
||||||
pw_thread_loop_signal(state->loop, false);
|
state->pipewire->thread_loop_signal(state->loop, false);
|
||||||
};
|
};
|
||||||
core_events.error = [](void* userdata, uint32_t id, int seq, int res,
|
core_events.error = [](void* userdata, uint32_t id, int seq, int res,
|
||||||
const char* message) {
|
const char* message) {
|
||||||
@@ -152,7 +294,7 @@ std::string LookupPipeWireTargetObjectSerial(pw_core* core,
|
|||||||
LOG_WARN("PipeWire registry lookup error: {}",
|
LOG_WARN("PipeWire registry lookup error: {}",
|
||||||
message ? message : "unknown");
|
message ? message : "unknown");
|
||||||
state->done = true;
|
state->done = true;
|
||||||
pw_thread_loop_signal(state->loop, false);
|
state->pipewire->thread_loop_signal(state->loop, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
pw_registry_add_listener(registry, ®istry_listener, ®istry_events,
|
pw_registry_add_listener(registry, ®istry_listener, ®istry_events,
|
||||||
@@ -161,12 +303,12 @@ std::string LookupPipeWireTargetObjectSerial(pw_core* core,
|
|||||||
state.sync_seq = pw_core_sync(core, PW_ID_CORE, 0);
|
state.sync_seq = pw_core_sync(core, PW_ID_CORE, 0);
|
||||||
|
|
||||||
while (!state.done) {
|
while (!state.done) {
|
||||||
pw_thread_loop_wait(loop);
|
pipewire->thread_loop_wait(loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
spa_hook_remove(®istry_listener);
|
spa_hook_remove(®istry_listener);
|
||||||
spa_hook_remove(&core_listener);
|
spa_hook_remove(&core_listener);
|
||||||
pw_proxy_destroy(reinterpret_cast<pw_proxy*>(registry));
|
pipewire->proxy_destroy(reinterpret_cast<pw_proxy*>(registry));
|
||||||
return state.found ? state.object_serial : "";
|
return state.found ? state.object_serial : "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,56 +330,68 @@ int BytesPerPixel(uint32_t spa_format) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
bool ScreenCapturerWayland::EnsurePipeWireRuntimeAvailable() const {
|
||||||
|
return GetPipeWireApi() != nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
||||||
PipeWireConnectMode mode) {
|
PipeWireConnectMode mode) {
|
||||||
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
|
if (!pipewire) {
|
||||||
|
LOG_ERROR("PipeWire 0.3 runtime library is unavailable");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (pipewire_fd_ < 0 || pipewire_node_id_ == 0) {
|
if (pipewire_fd_ < 0 || pipewire_node_id_ == 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pipewire_initialized_) {
|
if (!pipewire_initialized_) {
|
||||||
pw_init(nullptr, nullptr);
|
pipewire->init(nullptr, nullptr);
|
||||||
pipewire_initialized_ = true;
|
pipewire_initialized_ = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_thread_loop_ = pw_thread_loop_new("crossdesk-wayland-capture", nullptr);
|
pw_thread_loop_ =
|
||||||
|
pipewire->thread_loop_new("crossdesk-wayland-capture", nullptr);
|
||||||
if (!pw_thread_loop_) {
|
if (!pw_thread_loop_) {
|
||||||
LOG_ERROR("Failed to create PipeWire thread loop");
|
LOG_ERROR("Failed to create PipeWire thread loop");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_thread_loop_start(pw_thread_loop_) < 0) {
|
if (pipewire->thread_loop_start(pw_thread_loop_) < 0) {
|
||||||
LOG_ERROR("Failed to start PipeWire thread loop");
|
LOG_ERROR("Failed to start PipeWire thread loop");
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pipewire_thread_loop_started_ = true;
|
pipewire_thread_loop_started_ = true;
|
||||||
|
|
||||||
pw_thread_loop_lock(pw_thread_loop_);
|
pipewire->thread_loop_lock(pw_thread_loop_);
|
||||||
|
|
||||||
pw_context_ =
|
pw_context_ = pipewire->context_new(
|
||||||
pw_context_new(pw_thread_loop_get_loop(pw_thread_loop_), nullptr, 0);
|
pipewire->thread_loop_get_loop(pw_thread_loop_), nullptr, 0);
|
||||||
if (!pw_context_) {
|
if (!pw_context_) {
|
||||||
LOG_ERROR("Failed to create PipeWire context");
|
LOG_ERROR("Failed to create PipeWire context");
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_core_ = pw_context_connect_fd(pw_context_, pipewire_fd_, nullptr, 0);
|
pw_core_ =
|
||||||
|
pipewire->context_connect_fd(pw_context_, pipewire_fd_, nullptr, 0);
|
||||||
if (!pw_core_) {
|
if (!pw_core_) {
|
||||||
LOG_ERROR("Failed to connect to PipeWire remote");
|
LOG_ERROR("Failed to connect to PipeWire remote");
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
pipewire_fd_ = -1;
|
pipewire_fd_ = -1;
|
||||||
|
|
||||||
pw_properties* stream_props =
|
pw_properties* stream_props = pipewire->properties_new(
|
||||||
pw_properties_new(PW_KEY_MEDIA_TYPE, "Video", PW_KEY_MEDIA_CATEGORY,
|
PW_KEY_MEDIA_TYPE, "Video", PW_KEY_MEDIA_CATEGORY, "Capture",
|
||||||
"Capture", PW_KEY_MEDIA_ROLE, "Screen", nullptr);
|
PW_KEY_MEDIA_ROLE, "Screen", nullptr);
|
||||||
if (!stream_props) {
|
if (!stream_props) {
|
||||||
LOG_ERROR("Failed to allocate PipeWire stream properties");
|
LOG_ERROR("Failed to allocate PipeWire stream properties");
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -247,8 +401,8 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
target_object_serial = LookupPipeWireTargetObjectSerial(
|
target_object_serial = LookupPipeWireTargetObjectSerial(
|
||||||
pw_core_, pw_thread_loop_, pipewire_node_id_);
|
pw_core_, pw_thread_loop_, pipewire_node_id_);
|
||||||
if (!target_object_serial.empty()) {
|
if (!target_object_serial.empty()) {
|
||||||
pw_properties_set(stream_props, PW_KEY_TARGET_OBJECT,
|
pipewire->properties_set(stream_props, PW_KEY_TARGET_OBJECT,
|
||||||
target_object_serial.c_str());
|
target_object_serial.c_str());
|
||||||
LOG_INFO("PipeWire target object serial for node {} is {}",
|
LOG_INFO("PipeWire target object serial for node {} is {}",
|
||||||
pipewire_node_id_, target_object_serial);
|
pipewire_node_id_, target_object_serial);
|
||||||
} else {
|
} else {
|
||||||
@@ -260,10 +414,10 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pw_stream_ =
|
pw_stream_ =
|
||||||
pw_stream_new(pw_core_, "CrossDesk Wayland Capture", stream_props);
|
pipewire->stream_new(pw_core_, "CrossDesk Wayland Capture", stream_props);
|
||||||
if (!pw_stream_) {
|
if (!pw_stream_) {
|
||||||
LOG_ERROR("Failed to create PipeWire stream");
|
LOG_ERROR("Failed to create PipeWire stream");
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -289,9 +443,11 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_INFO("PipeWire stream state: {} -> {}",
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
pw_stream_state_as_string(old_state),
|
LOG_INFO(
|
||||||
pw_stream_state_as_string(state));
|
"PipeWire stream state: {} -> {}",
|
||||||
|
pipewire ? pipewire->stream_state_as_string(old_state) : "unknown",
|
||||||
|
pipewire ? pipewire->stream_state_as_string(state) : "unknown");
|
||||||
};
|
};
|
||||||
events.param_changed = [](void* userdata, uint32_t id,
|
events.param_changed = [](void* userdata, uint32_t id,
|
||||||
const struct spa_pod* param) {
|
const struct spa_pod* param) {
|
||||||
@@ -369,7 +525,10 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
SPA_POD_Int(sizeof(struct spa_meta_header))));
|
SPA_POD_Int(sizeof(struct spa_meta_header))));
|
||||||
|
|
||||||
if (self->pw_stream_) {
|
if (self->pw_stream_) {
|
||||||
pw_stream_update_params(self->pw_stream_, params, param_count);
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
|
if (pipewire) {
|
||||||
|
pipewire->stream_update_params(self->pw_stream_, params, param_count);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
self->pipewire_format_ready_.store(true);
|
self->pipewire_format_ready_.store(true);
|
||||||
|
|
||||||
@@ -457,7 +616,7 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
return events;
|
return events;
|
||||||
}();
|
}();
|
||||||
|
|
||||||
pw_stream_add_listener(pw_stream_, listener, &stream_events, this);
|
pipewire->stream_add_listener(pw_stream_, listener, &stream_events, this);
|
||||||
pipewire_format_ready_.store(false);
|
pipewire_format_ready_.store(false);
|
||||||
pipewire_stream_start_ms_.store(NowMs());
|
pipewire_stream_start_ms_.store(NowMs());
|
||||||
pipewire_last_frame_ms_.store(0);
|
pipewire_last_frame_ms_.store(0);
|
||||||
@@ -501,7 +660,7 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
|
|
||||||
if (param_count == 0) {
|
if (param_count == 0) {
|
||||||
LOG_ERROR("No valid PipeWire format params were built");
|
LOG_ERROR("No valid PipeWire format params were built");
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
CleanupPipeWire();
|
CleanupPipeWire();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -522,12 +681,12 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
PipeWireConnectModeName(mode), pipewire_node_id_, target_id,
|
PipeWireConnectModeName(mode), pipewire_node_id_, target_id,
|
||||||
target_object_serial.empty() ? "none" : target_object_serial.c_str(),
|
target_object_serial.empty() ? "none" : target_object_serial.c_str(),
|
||||||
relaxed_connect, param_count, fixed_size.width, fixed_size.height);
|
relaxed_connect, param_count, fixed_size.width, fixed_size.height);
|
||||||
const int ret = pw_stream_connect(
|
const int ret = pipewire->stream_connect(
|
||||||
pw_stream_, PW_DIRECTION_INPUT, target_id,
|
pw_stream_, PW_DIRECTION_INPUT, target_id,
|
||||||
static_cast<pw_stream_flags>(PW_STREAM_FLAG_AUTOCONNECT |
|
static_cast<pw_stream_flags>(PW_STREAM_FLAG_AUTOCONNECT |
|
||||||
PW_STREAM_FLAG_MAP_BUFFERS),
|
PW_STREAM_FLAG_MAP_BUFFERS),
|
||||||
param_count > 0 ? params : nullptr, static_cast<uint32_t>(param_count));
|
param_count > 0 ? params : nullptr, static_cast<uint32_t>(param_count));
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
|
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
LOG_ERROR("pw_stream_connect failed: {}", spa_strerror(ret));
|
LOG_ERROR("pw_stream_connect failed: {}", spa_strerror(ret));
|
||||||
@@ -539,16 +698,17 @@ bool ScreenCapturerWayland::SetupPipeWireStream(bool relaxed_connect,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCapturerWayland::CleanupPipeWire() {
|
void ScreenCapturerWayland::CleanupPipeWire() {
|
||||||
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
const bool need_lock =
|
const bool need_lock =
|
||||||
pw_thread_loop_ &&
|
pipewire && pw_thread_loop_ &&
|
||||||
(pw_stream_ != nullptr || pw_core_ != nullptr || pw_context_ != nullptr);
|
(pw_stream_ != nullptr || pw_core_ != nullptr || pw_context_ != nullptr);
|
||||||
if (need_lock) {
|
if (need_lock) {
|
||||||
pw_thread_loop_lock(pw_thread_loop_);
|
pipewire->thread_loop_lock(pw_thread_loop_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_stream_) {
|
if (pw_stream_ && pipewire) {
|
||||||
pw_stream_set_active(pw_stream_, false);
|
pipewire->stream_set_active(pw_stream_, false);
|
||||||
pw_stream_disconnect(pw_stream_);
|
pipewire->stream_disconnect(pw_stream_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_listener_) {
|
if (stream_listener_) {
|
||||||
@@ -557,33 +717,34 @@ void ScreenCapturerWayland::CleanupPipeWire() {
|
|||||||
stream_listener_ = nullptr;
|
stream_listener_ = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_stream_) {
|
if (pw_stream_ && pipewire) {
|
||||||
pw_stream_destroy(pw_stream_);
|
pipewire->stream_destroy(pw_stream_);
|
||||||
pw_stream_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
pw_stream_ = nullptr;
|
||||||
|
|
||||||
if (pw_core_) {
|
if (pw_core_ && pipewire) {
|
||||||
pw_core_disconnect(pw_core_);
|
pipewire->core_disconnect(pw_core_);
|
||||||
pw_core_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
pw_core_ = nullptr;
|
||||||
|
|
||||||
if (pw_context_) {
|
if (pw_context_ && pipewire) {
|
||||||
pw_context_destroy(pw_context_);
|
pipewire->context_destroy(pw_context_);
|
||||||
pw_context_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
pw_context_ = nullptr;
|
||||||
|
|
||||||
if (need_lock) {
|
if (need_lock) {
|
||||||
pw_thread_loop_unlock(pw_thread_loop_);
|
pipewire->thread_loop_unlock(pw_thread_loop_);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pw_thread_loop_) {
|
if (pw_thread_loop_ && pipewire) {
|
||||||
if (pipewire_thread_loop_started_) {
|
if (pipewire_thread_loop_started_) {
|
||||||
pw_thread_loop_stop(pw_thread_loop_);
|
pipewire->thread_loop_stop(pw_thread_loop_);
|
||||||
pipewire_thread_loop_started_ = false;
|
pipewire_thread_loop_started_ = false;
|
||||||
}
|
}
|
||||||
pw_thread_loop_destroy(pw_thread_loop_);
|
pipewire->thread_loop_destroy(pw_thread_loop_);
|
||||||
pw_thread_loop_ = nullptr;
|
|
||||||
}
|
}
|
||||||
|
pw_thread_loop_ = nullptr;
|
||||||
|
pipewire_thread_loop_started_ = false;
|
||||||
|
|
||||||
if (pipewire_fd_ >= 0) {
|
if (pipewire_fd_ >= 0) {
|
||||||
close(pipewire_fd_);
|
close(pipewire_fd_);
|
||||||
@@ -594,23 +755,24 @@ void ScreenCapturerWayland::CleanupPipeWire() {
|
|||||||
pipewire_stream_start_ms_.store(0);
|
pipewire_stream_start_ms_.store(0);
|
||||||
pipewire_last_frame_ms_.store(0);
|
pipewire_last_frame_ms_.store(0);
|
||||||
|
|
||||||
if (pipewire_initialized_) {
|
if (pipewire_initialized_ && pipewire) {
|
||||||
pw_deinit();
|
pipewire->deinit();
|
||||||
pipewire_initialized_ = false;
|
|
||||||
}
|
}
|
||||||
|
pipewire_initialized_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScreenCapturerWayland::HandlePipeWireBuffer() {
|
void ScreenCapturerWayland::HandlePipeWireBuffer() {
|
||||||
if (!pw_stream_) {
|
const PipeWireDynamicApi* pipewire = GetPipeWireApi();
|
||||||
|
if (!pw_stream_ || !pipewire) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pw_buffer* buffer = pw_stream_dequeue_buffer(pw_stream_);
|
pw_buffer* buffer = pipewire->stream_dequeue_buffer(pw_stream_);
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto requeue = [&]() { pw_stream_queue_buffer(pw_stream_, buffer); };
|
auto requeue = [&]() { pipewire->stream_queue_buffer(pw_stream_, buffer); };
|
||||||
|
|
||||||
if (paused_) {
|
if (paused_) {
|
||||||
requeue();
|
requeue();
|
||||||
|
|||||||
+1
-1
@@ -49,7 +49,7 @@ function setup_platform_settings()
|
|||||||
end
|
end
|
||||||
|
|
||||||
if is_config("USE_WAYLAND", true) then
|
if is_config("USE_WAYLAND", true) then
|
||||||
add_links("dbus-1", "pipewire-0.3")
|
add_links("dbus-1")
|
||||||
add_defines("CROSSDESK_HAS_WAYLAND_CAPTURER=1")
|
add_defines("CROSSDESK_HAS_WAYLAND_CAPTURER=1")
|
||||||
add_existing_include_dirs({
|
add_existing_include_dirs({
|
||||||
"/usr/include/dbus-1.0",
|
"/usr/include/dbus-1.0",
|
||||||
|
|||||||
Reference in New Issue
Block a user