55 void updateError(QPlatformSurfaceCapture::Error error,
const QString &description = {});
60 void onCoreEventDone(uint32_t id,
int seq);
61 void onRegistryEventGlobal(uint32_t id, uint32_t permissions,
const char *type, uint32_t version,
const spa_dict *props);
62 void onStateChanged(pw_stream_state old, pw_stream_state state,
const char *error);
64 void onParamChanged(uint32_t id,
const struct spa_pod *param);
66 void updateCoreInitSeq();
68 void recreateStream();
69 void destroyStream(
bool forceDrain);
71 void signalLoop(
bool onProcessDone,
bool err);
73 static QVideoFrameFormat::PixelFormat toQtPixelFormat(spa_video_format spaVideoFormat);
74 static spa_video_format toSpaVideoFormat(QVideoFrameFormat::PixelFormat pixelFormat);
76 QString getRequestToken();
77 int generateRequestToken();
78 void createInterface();
80 void selectSources(
const QString &sessionHandle);
82 void updateStreams(
const QDBusArgument &streamsInfo);
83 void openPipeWireRemote();
90 QPipeWireCapture &m_capture;
92 QVideoFrame m_currentFrame;
93 QVideoFrameFormat m_videoFrameFormat;
94 QVideoFrameFormat::PixelFormat m_pixelFormat{};
97 PwThreadLoopHandle m_threadLoop;
98 PwContextHandle m_context;
100 PwCoreConnectionHandle m_core;
101 spa_hook m_coreListener = {};
103 PwRegistryHandle m_registry =
nullptr;
104 spa_hook m_registryListener = {};
106 PwStreamHandle m_stream =
nullptr;
107 spa_hook m_streamListener = {};
109 spa_video_info m_format{};
112 bool m_hasSource =
false;
113 bool m_initDone =
false;
114 bool m_ignoreStateChange =
false;
115 bool m_streamPaused =
false;
116 bool m_silence =
false;
117 bool m_processed =
false;
119 int m_coreInitSeq = 0;
121 int m_requestToken = -1;
122 QString m_requestTokenPrefix;
123 QString m_sessionHandle;
131 QVector<StreamInfo> m_streams;
133 int m_pipewireFd = -1;
135 std::unique_ptr<QDBusInterface> m_screenCastInterface;
137 enum OperationState { NoOperation, CreateSession, SelectSources, StartStream, OpenPipeWireRemote };
138 OperationState m_operationState = NoOperation;
140 enum State { NoState, Starting, Streaming, Stopping };
141 State m_state = NoState;