File indexing completed on 2024-05-26 05:33:25

0001 /*
0002     SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "screencastsource.h"
0010 #include "window.h"
0011 
0012 #include <QPointer>
0013 #include <QTimer>
0014 
0015 namespace KWin
0016 {
0017 
0018 class WindowScreenCastSource : public ScreenCastSource
0019 {
0020     Q_OBJECT
0021 
0022 public:
0023     explicit WindowScreenCastSource(Window *window, QObject *parent = nullptr);
0024 
0025     quint32 drmFormat() const override;
0026     bool hasAlphaChannel() const override;
0027     QSize textureSize() const override;
0028     uint refreshRate() const override;
0029 
0030     void render(GLFramebuffer *target) override;
0031     void render(spa_data *spa, spa_video_format format) override;
0032     std::chrono::nanoseconds clock() const override;
0033 
0034 private:
0035     QPointer<Window> m_window;
0036     WindowOffscreenRenderRef m_offscreenRef;
0037 };
0038 
0039 } // namespace KWin