6#include <QtMultimedia/private/qmultimedia_enum_to_string_converter_p.h>
7#include <QtCore/qspan.h>
9#include <pipewire/version.h>
10#include <spa/debug/pod.h>
34 return pw_thread_loop_start(m_loop.get());
39 pw_thread_loop_stop(m_loop.get());
49 return pw_thread_loop_get_loop(m_loop.get());
54 return pw_thread_loop_in_thread(m_loop.get());
59 pw_thread_loop_lock(m_loop.get());
64 pw_thread_loop_unlock(m_loop.get());
69 return pw_thread_loop_timed_wait(m_loop.get(),
int(waitMax.count()));
74 pw_thread_loop_signal(m_loop.get(), waitForAccept);
82 QSpan<
const spa_dict_item> items{ dict.items, dict.n_items };
84 QDebugStateSaver saver(dbg);
87 for (
const spa_dict_item &item : items)
88 dbg << item.key <<
"=" << item.value <<
", ";
92#if PW_CHECK_VERSION
(0
, 3
, 65
)
96struct QtSpaDebugContext : ::spa_debug_context
98 explicit QtSpaDebugContext(QDebug dbg)
99 : ::spa_debug_context{},
104 ::spa_debug_context::log = &doLog;
107 static void doLog(::spa_debug_context *ctx,
const char *fmt, ...)
111 QString logString = QString::vasprintf(fmt, args);
114 auto *self =
static_cast<QtSpaDebugContext *>(ctx);
115 self->dbg << logString;
123QDebug operator<<(QDebug dbg,
const spa_pod &pod)
125 QtSpaDebugContext context{ std::move(dbg) };
127 spa_debugc_pod(&context, 0,
nullptr, &pod);
128 return std::move(context.dbg);
135 dbg <<
"QDebug operator<<(QDebug, const spa_pod &) not implemented: minimum requirement: "
144 (PW_STREAM_STATE_ERROR,
"error")
145 (PW_STREAM_STATE_UNCONNECTED,
"unconnected")
146 (PW_STREAM_STATE_CONNECTING,
"connecting")
147 (PW_STREAM_STATE_PAUSED,
"paused")
148 (PW_STREAM_STATE_STREAMING,
"streaming")
157 dbg << QStringLiteral(u"pw_time{now: %1ns, rate: %2/%3, ticks: %4, delay: %5, queued: %6}")
160 .arg(state.rate.denom)
PWThreadedEventLoop(const char *name)
pw_thread_loop * get() const
int wait_for(std::chrono::seconds waitMax)
void signal(bool waitForAccept)
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)