Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qsckwindowcapture_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSCKWINDOWCAPTURE_H
5#define QSCKWINDOWCAPTURE_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtMultimedia/private/qplatformsurfacecapture_p.h>
19
20#include <QtFFmpegMediaPluginImpl/private/qmacscreencapturekit_p.h>
21
22#include <memory>
23
24QT_BEGIN_NAMESPACE
25
26namespace QFFmpeg {
27
29{
31
32public:
33 explicit QSckWindowCapture();
35
36 QVideoFrameFormat frameFormat() const override;
37
38 std::optional<int> ffmpegHWPixelFormat() const override;
39
40 void onNewFrameFormatReceived(int64_t streamId, const QVideoFrameFormat &);
41
42 void onStreamStoppedWithErrorEvent(int64_t streamId, const QString &);
43
44protected:
45 bool setActiveInternal(bool active) override;
46
47private:
48 // Tracks the next ID for establishing stream.
49 // Having stream IDs helps us track whether we should
50 // ignore events from lingering stream callbacks.
51 int64_t m_streamIdTracker = 0;
52
53 struct ActiveData {
54 int64_t streamId = -1;
55 AVFScopedPointer<SCWindow> scWindow;
56 std::unique_ptr<QMacScreenCaptureKit> macScreenCaptureKit;
57 };
58 // Is allowed to be null when we have no on-going stream.
59 std::unique_ptr<ActiveData> m_activeData;
60
61 std::optional<QVideoFrameFormat> m_videoFrameFormat;
62
63 [[nodiscard]] std::optional<int64_t> activeStreamId() const noexcept {
64 if (m_activeData)
65 return m_activeData->streamId;
66 return std::nullopt;
67 }
68};
69
70} // namespace QFFmpeg
71
72QT_END_NAMESPACE
73
74#endif // QSCKWINDOWCAPTURE_H
void onNewFrameFormatReceived(int64_t streamId, const QVideoFrameFormat &)
std::optional< int > ffmpegHWPixelFormat() const override
QVideoFrameFormat frameFormat() const override
void onStreamStoppedWithErrorEvent(int64_t streamId, const QString &)
bool setActiveInternal(bool active) override
~QSckWindowCapture() override=default
QT_MANGLE_NAMESPACE(QMacScreenCaptureStreamDelegate) QMacScreenCaptureStreamDelegate
std::unique_ptr< QPlatformSurfaceCapture > makeQSckWindowCapture()