56 void updateError(QPlatformSurfaceCapture::Error error,
const QString &description = {});
61 void onCoreEventDone(uint32_t id,
int seq);
62 void onRegistryEventGlobal(uint32_t id, uint32_t permissions,
const char *type, uint32_t version,
const spa_dict *props);
63 void onStateChanged(pw_stream_state old, pw_stream_state state,
const char *error);
65 void onParamChanged(uint32_t id,
const struct spa_pod *param);
67 void updateCoreInitSeq();
69 void recreateStream();
70 void destroyStream(
bool forceDrain);
72 void signalLoop(
bool onProcessDone,
bool err);
74 static QVideoFrameFormat::PixelFormat toQtPixelFormat(spa_video_format spaVideoFormat);
75 static spa_video_format toSpaVideoFormat(QVideoFrameFormat::PixelFormat pixelFormat);
77 QString getRequestToken();
78 int generateRequestToken();
79 void createInterface();
81 void selectSources(
const QString &sessionHandle);
83 void updateStreams(
const QDBusArgument &streamsInfo);
84 void openPipeWireRemote();
91 QPipeWireCapture &m_capture;
93 QVideoFrame m_currentFrame;
94 QVideoFrameFormat m_videoFrameFormat;
95 QVideoFrameFormat::PixelFormat m_pixelFormat{};
98 PwThreadLoopHandle m_threadLoop;
99 PwContextHandle m_context;
102 spa_hook m_coreListener = {};
104 PwRegistryHandle m_registry =
nullptr;
105 spa_hook m_registryListener = {};
107 PwStreamHandle m_stream =
nullptr;
108 spa_hook m_streamListener = {};
110 spa_video_info m_format{};
113 bool m_hasSource =
false;
114 bool m_initDone =
false;
115 bool m_ignoreStateChange =
false;
116 bool m_streamPaused =
false;
117 bool m_silence =
false;
118 bool m_processed =
false;
120 int m_coreInitSeq = 0;
122 int m_requestToken = -1;
123 QString m_requestTokenPrefix;
124 QString m_sessionHandle;
132 QVector<StreamInfo> m_streams;
134 int m_pipewireFd = -1;
136 std::unique_ptr<QDBusInterface> m_screenCastInterface;
138 enum OperationState { NoOperation, CreateSession, SelectSources, StartStream, OpenPipeWireRemote };
139 OperationState m_operationState = NoOperation;
141 enum State { NoState, Starting, Streaming, Stopping };
142 State m_state = NoState;