43 template <
typename Closure>
48 return self->runWithEventLoopLock(std::forward<Closure>(c));
67 template <
typename Closure>
68 auto runWithEventLoopLock(Closure &&c)
70 pw_thread_loop_lock(m_eventLoop.get());
71 auto unlock = qScopeGuard([&] {
72 pw_thread_loop_unlock(m_eventLoop.get());
78 std::shared_ptr<QPipeWireInstance> m_libraryInstance;
81 PwThreadLoopHandle m_eventLoop;
82 void prepareEventLoop();
83 void startEventLoop();
87 PwContextHandle m_context;
88 void prepareContext();
91 PwCoreConnectionHandle m_coreConnection;
92 void connectToPipewireInstance();
95 PwRegistryHandle m_registry;
96 spa_hook m_registryListener{};
97 std::unique_ptr<QAudioDeviceMonitor> m_deviceMonitor;
99 void startDeviceMonitor();
100 void stopDeviceMonitor();
101 static void objectAddedCb(
void *data, uint32_t id, uint32_t permissions,
const char *type,
102 uint32_t version,
const struct spa_dict *props);
103 static void objectRemovedCb(
void *data, uint32_t id);
104 void objectAdded(ObjectId id, uint32_t permissions, PipewireRegistryType, uint32_t version,
105 const spa_dict &props);
106 void objectRemoved(ObjectId id);
109 void startListenDefaultMetadataObject(ObjectId, uint32_t version);
110 void stopListenDefaultMetadataObject();
111 struct MetadataRecord
118 int handleDefaultMetadataObjectEvent(ObjectId subject,
const MetadataRecord &);
120 PwMetadataHandle m_defaultMetadataObject;
121 spa_hook m_defaultMetadataObjectListener{};
123 QMutex m_activeStreamMutex;
125 void stopActiveStreams();
static bool minimumRequirementMet()
PwNodeHandle bindNode(ObjectId)
static QAudioDeviceMonitor & deviceMonitor()
static QAudioContextManager * instance()
void registerStreamReference(std::shared_ptr< QPipewireAudioStream >)
void unregisterStreamReference(const std::shared_ptr< QPipewireAudioStream > &)
PwMetadataHandle bindMetadata(ObjectId)
static auto withEventLoopLock(Closure &&c)
static bool isInPwThreadLoop()
static pw_loop * getEventLoop()
const PwCoreConnectionHandle & coreConnection() const
bool pw_check_library_version(int major, int minor, int micro)