// Moonlight 会话(外部进程) // // 以 QProcess 参数数组直启 moonlight-qt(不拼 shell 命令), // 串流期间 moonlight-qt 独占全屏显示;进程退出后回调 MainWindow 返回桌面列表。 // 参数来自 ConnectionTicket,不再读取全局静态配置。 #ifndef KIOSK_SHELL_MOONLIGHT_SESSION_H #define KIOSK_SHELL_MOONLIGHT_SESSION_H #include #include #include #include "desktop_session.h" namespace vdi { class MoonlightSession : public QObject { Q_OBJECT public: struct Options { // 低延迟开关(实测 A/B 后定版) bool vsync = true; bool framePacing = true; bool performanceOverlay = false; bool audioOnHost = true; QString videoCodec = QStringLiteral("H.264"); QString decoder = QStringLiteral("software"); // RK3528 无可用 V4L2 硬解设备 }; using StateCallback = std::function; explicit MoonlightSession(QObject* parent = nullptr); ~MoonlightSession() override; void setOptions(const Options& options); // 启动串流;成功返回 true(不代表串流已建立,仅代表进程已拉起) bool start(const ConnectionTicket& ticket, StateCallback callback); // 终止串流(管理菜单/退出登录时调用) void stop(); bool isRunning() const; private slots: void onProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); void onProcessError(QProcess::ProcessError error); private: QProcess* process_ = nullptr; Options options_; StateCallback callback_; }; } // namespace vdi #endif // KIOSK_SHELL_MOONLIGHT_SESSION_H