4#ifndef QPIPEWIRE_SUPPORT_P_H
5#define QPIPEWIRE_SUPPORT_P_H
18#include <QtCore/qdebug.h>
19#include <QtCore/qglobal.h>
24#include <pipewire/extensions/metadata.h>
25#include <system_error>
27#include <pipewire/pipewire.h>
29#if !PW_CHECK_VERSION
(0
, 3
, 75
)
42 return std::error_code(errnoValue,
std::generic_category());
46template <
typename BaseType,
void(Deleter)(BaseType *),
typename Type = BaseType>
51 BaseType *base =
reinterpret_cast<BaseType *>(handle);
56template <
typename BaseType,
void(Deleter)(BaseType *),
typename Type = BaseType>
77 int status = pw_core_disconnect(handle);
79 qWarning() <<
"Failed to disconnect pw_core:" <<
make_error_code(status
).message();
89 int status = pw_unload_spa_handle(handle);
91 qWarning() <<
"Failed to unload spa_handle:" <<
make_error_code(-status
).message();
110 pw_thread_loop *
get()
const;
111 pw_loop *
loop()
const;
118 int wait_for(std::chrono::seconds waitMax);
119 void signal(
bool waitForAccept);
121 template <
typename Closure>
124 std::lock_guard guard{ *
this };
129 PwThreadLoopHandle m_loop;
134template <
typename T,
typename Tag>
142#ifdef __cpp_impl_three_way_comparison
186#define QT_MM_GUARDED_BY(Mutex)
PWThreadedEventLoop(const char *name)
pw_thread_loop * get() const
int wait_for(std::chrono::seconds waitMax)
void signal(bool waitForAccept)
auto runWithEventLoopLock(Closure &&c)
std::unique_ptr< pw_core, PwCoreConnectionDeleter > PwCoreConnectionHandle
std::unique_ptr< spa_handle, SpaHandleDeleter > SpaHandleHandle
StrongIdType< uint32_t, ObjectIdTag > ObjectId
StrongIdType< uint64_t, ObjectSerialTag > ObjectSerial
std::error_code make_error_code(int errnoValue=errno)
bool pw_check_library_version(int major, int minor, int micro)
QDebug operator<<(QDebug dbg, const pw_time &state)
QT_MM_MAKE_STRING_RESOLVER(pw_stream_state, QtMultimediaPrivate::EnumName,(PW_STREAM_STATE_ERROR, "error")(PW_STREAM_STATE_UNCONNECTED, "unconnected")(PW_STREAM_STATE_CONNECTING, "connecting")(PW_STREAM_STATE_PAUSED, "paused")(PW_STREAM_STATE_STREAMING, "streaming"))
QDebug operator<<(QDebug dbg, const spa_dict &dict)
QDebug operator<<(QDebug dbg, const spa_pod &)
QT_MM_DEFINE_QDEBUG_ENUM(pw_stream_state)
QDebug operator<<(QDebug dbg, enum pw_stream_state)
void operator()(Type *handle) const
void operator()(pw_core *handle) const
void operator()(spa_handle *handle) const
friend QDebug operator<<(QDebug dbg, const StrongIdType &self)
friend bool comparesEqual(const StrongIdType &lhs, const StrongIdType &rhs) noexcept
friend Qt::strong_ordering compareThreeWay(const StrongIdType &lhs, const StrongIdType &rhs) noexcept