63 void onCoreEventDone(uint32_t id,
int seq);
64 void onRegistryEventGlobal(uint32_t id, uint32_t permissions,
const char *type, uint32_t version,
const spa_dict *props);
65 void onStateChanged(pw_stream_state old, pw_stream_state state,
const char *error);
67 void onParamChanged(uint32_t id,
const struct spa_pod *param);
69 void updateCoreInitSeq();
71 void recreateStream();
72 void destroyStream(
bool forceDrain);
74 void signalLoop(
bool onProcessDone,
bool err);
76 static QVideoFrameFormat::PixelFormat toQtPixelFormat(spa_video_format spaVideoFormat);
77 static spa_video_format toSpaVideoFormat(QVideoFrameFormat::PixelFormat pixelFormat);
79 QString getRequestToken();
80 void createInterface();
82 void selectSources(
const QString &sessionHandle);
84 void updateStreams(
const QDBusArgument &streamsInfo);
85 void openPipeWireRemote();
93 QVideoFrame m_currentFrame;
94 QVideoFrameFormat m_videoFrameFormat;
95 QVideoFrameFormat::PixelFormat m_pixelFormat{};
98 PwThreadLoopHandle m_threadLoop;
99 PwContextHandle m_context;
101 PwCoreConnectionHandle m_core;
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;