mirror of
https://git.outfoxxed.me/quickshell/quickshell.git
synced 2025-11-06 19:14:57 +11:00
service/pipewire: refactor defaults and metadata handling
This commit is contained in:
parent
7f9762be53
commit
f889f08901
11 changed files with 455 additions and 144 deletions
|
|
@ -3,6 +3,7 @@
|
|||
#include <pipewire/extensions/metadata.h>
|
||||
#include <pipewire/type.h>
|
||||
#include <qobject.h>
|
||||
#include <qstringview.h>
|
||||
#include <qtmetamacros.h>
|
||||
|
||||
#include "core.hpp"
|
||||
|
|
@ -18,45 +19,25 @@ class PwMetadata
|
|||
public:
|
||||
void bindHooks() override;
|
||||
void unbindHooks() override;
|
||||
void initProps(const spa_dict* props) override;
|
||||
|
||||
[[nodiscard]] const QString& name() const;
|
||||
[[nodiscard]] bool hasSetPermission() const;
|
||||
|
||||
// null value clears
|
||||
void setProperty(const char* key, const char* type, const char* value);
|
||||
|
||||
signals:
|
||||
void propertyChanged(const char* key, const char* type, const char* value);
|
||||
|
||||
private:
|
||||
static const pw_metadata_events EVENTS;
|
||||
static int
|
||||
onProperty(void* data, quint32 subject, const char* key, const char* type, const char* value);
|
||||
|
||||
QString mName;
|
||||
|
||||
SpaHook listener;
|
||||
};
|
||||
|
||||
class PwDefaultsMetadata: public QObject {
|
||||
Q_OBJECT;
|
||||
|
||||
public:
|
||||
explicit PwDefaultsMetadata(PwRegistry* registry);
|
||||
|
||||
[[nodiscard]] QString defaultSource() const;
|
||||
[[nodiscard]] QString defaultSink() const;
|
||||
|
||||
signals:
|
||||
void defaultSourceChanged();
|
||||
void defaultSinkChanged();
|
||||
|
||||
private slots:
|
||||
void onMetadataUpdate(
|
||||
PwMetadata* metadata,
|
||||
quint32 subject,
|
||||
const char* key,
|
||||
const char* type,
|
||||
const char* value
|
||||
);
|
||||
|
||||
private:
|
||||
static QString parseNameSpaJson(const char* spaJson);
|
||||
|
||||
PwBindableRef<PwMetadata> defaultSinkHolder;
|
||||
PwBindableRef<PwMetadata> defaultSourceHolder;
|
||||
|
||||
QString mDefaultSink;
|
||||
QString mDefaultSource;
|
||||
};
|
||||
|
||||
} // namespace qs::service::pipewire
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue