Skip to content

Commit

Permalink
fix: metadata properties for pipewire servers < 0.3.68 (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed Apr 11, 2024
1 parent 904315f commit 1d64e72
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.21)
project(venmic LANGUAGES CXX VERSION 3.3.4)
project(venmic LANGUAGES CXX VERSION 3.3.5)

# --------------------------------------------------------------------------------------------------------
# Library options
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"private": false,
"license": "MPL-2.0",
"author": "Curve (https://github.com/Curve)",
"version": "3.3.4",
"version": "3.3.5",
"main": "./lib/index.js",
"types": "./lib/module.d.ts",
"scripts": {
Expand Down
7 changes: 5 additions & 2 deletions private/patchbay.impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,13 @@ namespace vencord

private:
template <typename T>
void bind(const pw::global &);
void bind(pw::global &);

public:
void add_global(pw::global &);

template <typename T>
void add_global(T &);
void add_global(T &, pw::global &);

private:
void rem_global(std::uint32_t);
Expand Down
19 changes: 9 additions & 10 deletions src/patchbay.impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ namespace vencord
}

template <>
void patchbay::impl::add_global<pw::node>(pw::node &node)
void patchbay::impl::add_global<pw::node>(pw::node &node, pw::global &)
{
auto id = node.id();
auto props = node.info().props;
Expand Down Expand Up @@ -262,7 +262,7 @@ namespace vencord
}

template <>
void patchbay::impl::add_global<pw::link>(pw::link &link)
void patchbay::impl::add_global<pw::link>(pw::link &link, pw::global &)
{
auto id = link.id();
auto info = link.info();
Expand All @@ -277,7 +277,7 @@ namespace vencord
}

template <>
void patchbay::impl::add_global<pw::port>(pw::port &port)
void patchbay::impl::add_global<pw::port>(pw::port &port, pw::global &)
{
auto props = port.info().props;

Expand All @@ -300,10 +300,10 @@ namespace vencord
}

template <>
void patchbay::impl::add_global<pw::metadata>(pw::metadata &data)
void patchbay::impl::add_global<pw::metadata>(pw::metadata &data, pw::global &global)
{
auto props = data.properties();
const auto name = data.props()["metadata.name"];
const auto name = global.props["metadata.name"];

logger::get()->trace(R"([patchbay] (add_global) new metadata: {} (name: "{}"))", data.id(), name);

Expand Down Expand Up @@ -342,7 +342,7 @@ namespace vencord
}

template <typename T>
void patchbay::impl::bind(const pw::global &global)
void patchbay::impl::bind(pw::global &global)
{
auto bound = registry->bind<T>(global.id).get();

Expand All @@ -353,11 +353,10 @@ namespace vencord
return;
}

add_global(bound.value());
add_global(bound.value(), global);
}

template <>
void patchbay::impl::add_global<const pw::global>(const pw::global &global)
void patchbay::impl::add_global(pw::global &global)
{
logger::get()->trace(R"([patchbay] (add_global) new global: {} (type: "{}"))", global.id, global.type);

Expand Down Expand Up @@ -550,7 +549,7 @@ namespace vencord
auto listener = registry->listen();

listener.on<pw::registry_event::global_removed>([this](std::uint32_t id) { rem_global(id); });
listener.on<pw::registry_event::global>([this](const auto &global) { add_global(global); });
listener.on<pw::registry_event::global>([this](auto global) { add_global(global); });

sender.send(ready{});

Expand Down

0 comments on commit 1d64e72

Please sign in to comment.