service/pipewire: refactor defaults and metadata handling

This commit is contained in:
outfoxxed 2024-09-23 18:41:38 -07:00
parent 7f9762be53
commit f889f08901
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
11 changed files with 455 additions and 144 deletions

View file

@ -11,6 +11,7 @@
#include <qlogging.h>
#include <qloggingcategory.h>
#include <qobject.h>
#include <qstringview.h>
#include <qtmetamacros.h>
#include <qtypes.h>
@ -143,7 +144,7 @@ void PwRegistry::onGlobal(
meta->initProps(props);
self->metadata.emplace(id, meta);
meta->bind();
emit self->metadataAdded(meta);
} else if (strcmp(type, PW_TYPE_INTERFACE_Link) == 0) {
auto* link = new PwLink();
link->init(self, id, permissions);
@ -199,4 +200,14 @@ void PwRegistry::onLinkGroupDestroyed(QObject* object) {
this->linkGroups.removeOne(group);
}
PwNode* PwRegistry::findNodeByName(QStringView name) const {
if (name.isEmpty()) return nullptr;
for (auto* node: this->nodes.values()) {
if (node->name == name) return node;
}
return nullptr;
}
} // namespace qs::service::pipewire