File indexing completed on 2024-06-23 05:24:06

0001 // SPDX-FileCopyrightText: 2023 Arjen Hiemstra <ahiemstra@heimr.nl>
0002 //
0003 // SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0004 
0005 #pragma once
0006 
0007 #include <functional>
0008 #include <memory>
0009 #include <optional>
0010 #include <type_traits>
0011 
0012 #include <QDBusPendingCallWatcher>
0013 #include <QObject>
0014 #include <QPoint>
0015 #include <QPointer>
0016 
0017 #include "AbstractSession.h"
0018 #include "krdp_export.h"
0019 
0020 namespace KRdp
0021 {
0022 
0023 struct VideoFrame;
0024 class Server;
0025 
0026 /**
0027  * A FreeDesktop Remote Desktop Portal session.
0028  *
0029  * This encapsulates all the required setup to start a FreeDesktop Remote
0030  * Desktop Portal session including input sending and video streaming.
0031  */
0032 class KRDP_EXPORT PortalSession : public AbstractSession
0033 {
0034     Q_OBJECT
0035 
0036 public:
0037     explicit PortalSession(Server *server);
0038     ~PortalSession() override;
0039 
0040     /**
0041      * Send a new event to the portal.
0042      *
0043      * \param event The new event to send.
0044      */
0045     void sendEvent(QEvent *event) override;
0046 
0047 private:
0048     void onCreateSession(uint code, const QVariantMap &result);
0049     void onDevicesSelected(uint code, const QVariantMap &result);
0050     void onSourcesSelected(uint code, const QVariantMap &result);
0051     void onSessionStarted(uint code, const QVariantMap &result);
0052     void onPacketReceived(const PipeWireEncodedStream::Packet &data);
0053 
0054     class Private;
0055     const std::unique_ptr<Private> d;
0056 };
0057 
0058 }