57 void updateError(QPlatformSurfaceCapture::Error error,
const QString &description = {});
62 void onCoreEventDone(uint32_t id,
int seq);
63 void onRegistryEventGlobal(uint32_t id, uint32_t permissions,
const char *type, uint32_t version,
const spa_dict *props);
64 void onStateChanged(pw_stream_state old, pw_stream_state state,
const char *error);
66 void onParamChanged(uint32_t id,
const struct spa_pod *param);
68 void updateCoreInitSeq();
70 void recreateStream();
71 void destroyStream(
bool forceDrain);
73 void signalLoop(
bool onProcessDone,
bool err);
75 static QVideoFrameFormat::PixelFormat toQtPixelFormat(spa_video_format spaVideoFormat);
76 static spa_video_format toSpaVideoFormat(QVideoFrameFormat::PixelFormat pixelFormat);
78 QString getRequestToken();
79 int generateRequestToken();
80 void createInterface();
82 void selectSources(
const QString &sessionHandle);
84 void updateStreams(
const QDBusArgument &streamsInfo);
85 void openPipeWireRemote();
92 QPipeWireCapture &m_capture;
94 QVideoFrame m_currentFrame;
95 QVideoFrameFormat m_videoFrameFormat;
96 QVideoFrameFormat::PixelFormat m_pixelFormat{};
98 qreal m_streamFrameRate = 0.f;
100 PwThreadLoopHandle m_threadLoop;
101 PwContextHandle m_context;
103 PwCoreConnectionHandle m_core;
104 spa_hook m_coreListener = {};
106 PwRegistryHandle m_registry =
nullptr;
107 spa_hook m_registryListener = {};
109 PwStreamHandle m_stream =
nullptr;
110 spa_hook m_streamListener = {};
112 spa_video_info m_format{};
115 bool m_hasSource =
false;
116 bool m_initDone =
false;
117 bool m_ignoreStateChange =
false;
118 bool m_streamPaused =
false;
119 bool m_silence =
false;
120 bool m_processed =
false;
122 int m_coreInitSeq = 0;
124 int m_requestToken = -1;
125 QString m_requestTokenPrefix;
126 QString m_sessionHandle;
134 QVector<StreamInfo> m_streams;
136 int m_pipewireFd = -1;
138 std::unique_ptr<QDBusInterface> m_screenCastInterface;
140 enum OperationState { NoOperation, CreateSession, SelectSources, StartStream, OpenPipeWireRemote };
141 OperationState m_operationState = NoOperation;
143 enum State { NoState, Starting, Streaming, Stopping };
144 State m_state = NoState;