Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
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
24
QT_BEGIN_NAMESPACE
25
26
class
QFFmpegMediaCaptureSession;
27
28
namespace
QFFmpeg
{
29
30
class
QSckWindowCapture
:
public
QPlatformSurfaceCapture
31
{
32
Q_OBJECT
33
34
public
:
35
explicit
QSckWindowCapture
();
36
~
QSckWindowCapture
()
override
=
default
;
37
38
void
setCaptureSession
(QPlatformMediaCaptureSession *)
override
;
39
40
QVideoFrameFormat
frameFormat
()
const
override
;
41
42
std
::
optional
<
int
>
ffmpegHWPixelFormat
()
const
override
;
43
44
void
onNewFrameFormatReceived
(QMacScreenCaptureKit::StreamId streamId,
const
QVideoFrameFormat &);
45
46
void
onStreamStoppedWithErrorEvent
(QMacScreenCaptureKit::StreamId streamId,
const
QString &);
47
48
protected
:
49
bool
setActiveInternal
(
bool
active)
override
;
50
51
[[nodiscard]]
std
::
optional
<
SourceSwitchResult
>
52
switchActiveSource
(
const
Source &newSource)
override
;
53
54
private
:
55
QFFmpegMediaCaptureSession
*m_session =
nullptr
;
56
57
// Tracks the next ID for establishing stream.
58
// Having stream IDs helps us track whether we should
59
// ignore events from lingering stream callbacks.
60
int64_t m_streamIdAllocator = 0;
61
[[nodiscard]] QMacScreenCaptureKit::StreamId allocateStreamId() {
62
return
QMacScreenCaptureKit::StreamId { m_streamIdAllocator++ };
63
}
64
65
struct
ActiveData {
66
QMacScreenCaptureKit::StreamId streamId = {};
67
AVFScopedPointer<SCWindow> scWindow;
68
std::unique_ptr<QMacScreenCaptureKit> macScreenCaptureKit;
69
};
70
// Is allowed to be null when we have no on-going stream.
71
std::unique_ptr<ActiveData> m_activeData;
72
73
std::optional<QVideoFrameFormat> m_videoFrameFormat;
74
75
[[nodiscard]] std::optional<QMacScreenCaptureKit::StreamId> activeStreamId()
const
noexcept
{
76
if
(m_activeData)
77
return
m_activeData->streamId;
78
return
std::nullopt;
79
}
80
};
81
82
}
// namespace QFFmpeg
83
84
QT_END_NAMESPACE
85
86
#
endif
// QSCKWINDOWCAPTURE_H
QFFmpegMediaCaptureSession
Definition
qffmpegmediacapturesession_p.h:37
QFFmpeg::QSckWindowCapture
Definition
qsckwindowcapture_p.h:31
QFFmpeg::QSckWindowCapture::onStreamStoppedWithErrorEvent
void onStreamStoppedWithErrorEvent(QMacScreenCaptureKit::StreamId streamId, const QString &)
Definition
qsckwindowcapture.mm:247
QFFmpeg::QSckWindowCapture::setCaptureSession
void setCaptureSession(QPlatformMediaCaptureSession *) override
Definition
qsckwindowcapture.mm:124
QFFmpeg::QSckWindowCapture::ffmpegHWPixelFormat
std::optional< int > ffmpegHWPixelFormat() const override
Definition
qsckwindowcapture.mm:281
QFFmpeg::QSckWindowCapture::frameFormat
QVideoFrameFormat frameFormat() const override
Definition
qsckwindowcapture.mm:272
QFFmpeg::QSckWindowCapture::switchActiveSource
std::optional< SourceSwitchResult > switchActiveSource(const Source &newSource) override
Definition
qsckwindowcapture.mm:212
QFFmpeg::QSckWindowCapture::onNewFrameFormatReceived
void onNewFrameFormatReceived(QMacScreenCaptureKit::StreamId streamId, const QVideoFrameFormat &)
Definition
qsckwindowcapture.mm:238
QFFmpeg::QSckWindowCapture::setActiveInternal
bool setActiveInternal(bool active) override
Definition
qsckwindowcapture.mm:136
QFFmpeg::QSckWindowCapture::~QSckWindowCapture
~QSckWindowCapture() override=default
QFFmpeg
Definition
qandroidcacertificates.cpp:26
QFFmpeg::makeQSckWindowCapture
std::unique_ptr< QPlatformSurfaceCapture > makeQSckWindowCapture()
Definition
qsckwindowcapture.mm:287
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtmultimedia
src
plugins
multimedia
ffmpeg
darwin
qsckwindowcapture_p.h
Generated on
for Qt by
1.18.0