9#include <QAbstractListModel>
10#include <QQmlParserStatus>
11#include <QSharedPointer>
13#include <qqmlregistration.h>
15#include <pipewire/pipewire.h>
67 Q_PROPERTY(MediaRole::Role role READ role WRITE setRole NOTIFY roleChanged)
72 Q_PROPERTY(
bool detectionAvailable READ detectionAvailable NOTIFY detectionAvailableChanged)
77 Q_PROPERTY(
int count READ rowCount NOTIFY countChanged)
82 Q_PROPERTY(
int runningCount READ runningCount NOTIFY runningCountChanged)
87 Q_PROPERTY(
int idleCount READ idleCount NOTIFY idleCountChanged)
97 ~MediaMonitor()
override;
103 MediaRole::Role role()
const;
104 void setRole(MediaRole::Role newRole);
106 bool detectionAvailable()
const;
107 int runningCount()
const;
108 int idleCount()
const;
112 void detectionAvailableChanged();
114 void runningCountChanged();
115 void idleCountChanged();
118 void connectToCore();
122 struct ProxyDeleter {
123 void operator()(pw_proxy *proxy)
const
125 MediaMonitor::onProxyDestroy(pw_proxy_get_user_data(proxy));
126 pw_proxy_destroy(proxy);
130 static void onRegistryEventGlobal(
void *data, uint32_t
id, uint32_t permissions,
const char *type, uint32_t version,
const spa_dict *props);
131 static void onRegistryEventGlobalRemove(
void *data, uint32_t
id);
132 static void onProxyDestroy(
void *data);
133 static void onNodeEventInfo(
void *data,
const pw_node_info *info);
135 static void readProps(
const spa_dict *props, pw_proxy *proxy,
bool emitSignal);
137 void classBegin()
override;
138 void componentComplete()
override;
140 void disconnectFromCore();
141 void reconnectOnIdle();
144 static pw_registry_events s_pwRegistryEvents;
145 static pw_proxy_events s_pwProxyEvents;
146 static pw_node_events s_pwNodeEvents;
148 bool m_componentReady =
false;
149 MediaRole::Role m_role = MediaRole::Unknown;
150 bool m_detectionAvailable =
false;
151 int m_runningCount = 0;
155 pw_registry *m_registry =
nullptr;
156 spa_hook m_registryListener;
157 std::vector<std::unique_ptr<pw_proxy, ProxyDeleter>> m_nodeList;
160 bool m_inDestructor =
false;
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const override
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:05:20 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.