Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PipeWireHost.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2026 fuddlesworth
2// SPDX-License-Identifier: LGPL-2.1-or-later
3
4#pragma once
5
6#include <PhosphorServicePipeWire/phosphorservicepipewire_export.h>
7// Full definitions, not forward declarations, for both types this header's
8// moc surface exposes: the `connection` Q_PROPERTY carries
9// PipeWireConnection* and the nodeAdded/nodeRemoved relay signals carry
10// PwNode*. Qt6 moc auto-registers property and signal-parameter metatypes,
11// and QMetaType SFINAE-probes completeness — a fwd decl for either would
12// re-fire GCC's -Wsfinae-incomplete the moment the mocs_compilation
13// aggregation order stops shielding this header (same rationale as
14// PwNodeModel.h).
17
18#include <QObject>
19#include <QString>
20
21#include <memory>
22
24
63class PHOSPHORSERVICEPIPEWIRE_EXPORT PipeWireHost : public QObject
64{
65 Q_OBJECT
66 Q_DISABLE_COPY_MOVE(PipeWireHost)
68 Q_PROPERTY(bool connected READ isConnected NOTIFY connectedChanged)
72 Q_PROPERTY(bool daemonAvailable READ isDaemonAvailable NOTIFY daemonAvailableChanged)
73 Q_PROPERTY(QString defaultSinkName READ defaultSinkName NOTIFY defaultSinkNameChanged)
88
89public:
90 explicit PipeWireHost(QObject* parent = nullptr);
91 ~PipeWireHost() override;
92
98 [[nodiscard]] PipeWireConnection* connection() const;
99 [[nodiscard]] bool isConnected() const;
100 [[nodiscard]] bool isDaemonAvailable() const;
101 [[nodiscard]] QString defaultSinkName() const;
102 [[nodiscard]] QString defaultSourceName() const;
103 [[nodiscard]] PwNode* defaultSink() const;
104 [[nodiscard]] PwNode* defaultSource() const;
105
106public Q_SLOTS:
110 void reconnect();
122
123Q_SIGNALS:
135 void error(const QString& message);
148
149private:
157 void resolveDefaults();
158
159 class Private;
160 std::unique_ptr<Private> d;
161};
162
163} // namespace PhosphorServicePipeWire
Owns the PipeWire main loop on a dedicated QThread and exposes connection state to the GUI thread via...
Definition PipeWireConnection.h:59
void connectToDaemon()
Asynchronously connect the underlying PipeWireConnection to the daemon.
PipeWireHost(QObject *parent=nullptr)
Mirror of the underlying connection's daemonAvailable.
void nodeRemoved(PhosphorServicePipeWire::PwNode *node)
Forwarded from PipeWireConnection::nodeRemoved.
void disconnectFromDaemon()
Asynchronously disconnect the underlying PipeWireConnection from the daemon.
PipeWireConnection * connection() const
Constructed eagerly in PipeWireHost ctor; guaranteed non-null for the host's lifetime.
void nodeAdded(PhosphorServicePipeWire::PwNode *node)
Forwarded from PipeWireConnection::nodeAdded.
void error(const QString &message)
Forwarded from PipeWireConnection::error.
void reconnect()
Trigger a re-connect on the underlying connection.
One PipeWire audio node — a sink, source, output stream, or input stream.
Definition PwNode.h:49
Definition PipeWireConnection.h:20