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
qsckscreencapture_p.h
Go to the documentation of this file.
1
// Copyright (C) 2022 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
QSCKSCREENCAPTURE_P_H
5
#
define
QSCKSCREENCAPTURE_P_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
QT_BEGIN_NAMESPACE
23
24
class
QFFmpegMediaCaptureSession;
25
26
namespace
QFFmpeg
{
27
28
class
QSckScreenCapture
:
public
QPlatformSurfaceCapture
29
{
30
Q_OBJECT
31
32
public
:
33
explicit
QSckScreenCapture
();
34
~
QSckScreenCapture
()
override
=
default
;
35
36
void
setCaptureSession
(QPlatformMediaCaptureSession *)
override
;
37
38
QVideoFrameFormat
frameFormat
()
const
override
;
39
40
std
::
optional
<
int
>
ffmpegHWPixelFormat
()
const
override
;
41
42
void
onNewFrameFormatReceived
(QMacScreenCaptureKit::StreamId streamId,
const
QVideoFrameFormat &);
43
44
void
onStreamStoppedWithErrorEvent
(QMacScreenCaptureKit::StreamId streamId,
const
QString &);
45
46
protected
:
47
bool
setActiveInternal
(
bool
active)
override
;
48
49
[[nodiscard]]
std
::
optional
<
SourceSwitchResult
>
50
switchActiveSource
(
const
Source &newSource)
override
;
51
52
private
:
53
QFFmpegMediaCaptureSession
*m_session =
nullptr
;
54
55
// Tracks the next ID for establishing stream.
56
// Having stream IDs helps us track whether we should
57
// ignore events from lingering stream callbacks.
58
int64_t m_streamIdAllocator = 0;
59
[[nodiscard]] QMacScreenCaptureKit::StreamId allocateStreamId() {
60
return
QMacScreenCaptureKit::StreamId { m_streamIdAllocator++ };
61
}
62
63
struct
ActiveData {
64
QMacScreenCaptureKit::StreamId streamId = {};
65
AVFScopedPointer<SCDisplay> scDisplay;
66
std::unique_ptr<QMacScreenCaptureKit> macScreenCaptureKit;
67
};
68
// Is allowed to be null when we have no on-going stream.
69
std::unique_ptr<ActiveData> m_activeData;
70
71
std::optional<QVideoFrameFormat> m_videoFrameFormat;
72
73
[[nodiscard]] std::optional<QMacScreenCaptureKit::StreamId> activeStreamId()
const
noexcept
{
74
if
(m_activeData)
75
return
m_activeData->streamId;
76
return
std::nullopt;
77
}
78
79
};
80
81
}
// namespace QFFmpeg
82
83
QT_END_NAMESPACE
84
85
#
endif
// QSCKSCREENCAPTURE_P_H
QFFmpegMediaCaptureSession
Definition
qffmpegmediacapturesession_p.h:37
QFFmpeg::QSckScreenCapture
Definition
qsckscreencapture_p.h:29
QFFmpeg::QSckScreenCapture::ffmpegHWPixelFormat
std::optional< int > ffmpegHWPixelFormat() const override
Definition
qsckscreencapture.mm:305
QFFmpeg::QSckScreenCapture::setCaptureSession
void setCaptureSession(QPlatformMediaCaptureSession *) override
Definition
qsckscreencapture.mm:138
QFFmpeg::QSckScreenCapture::setActiveInternal
bool setActiveInternal(bool active) override
Definition
qsckscreencapture.mm:150
QFFmpeg::QSckScreenCapture::~QSckScreenCapture
~QSckScreenCapture() override=default
QFFmpeg::QSckScreenCapture::onNewFrameFormatReceived
void onNewFrameFormatReceived(QMacScreenCaptureKit::StreamId streamId, const QVideoFrameFormat &)
Definition
qsckscreencapture.mm:262
QFFmpeg::QSckScreenCapture::switchActiveSource
std::optional< SourceSwitchResult > switchActiveSource(const Source &newSource) override
Definition
qsckscreencapture.mm:227
QFFmpeg::QSckScreenCapture::frameFormat
QVideoFrameFormat frameFormat() const override
Definition
qsckscreencapture.mm:296
QFFmpeg::QSckScreenCapture::onStreamStoppedWithErrorEvent
void onStreamStoppedWithErrorEvent(QMacScreenCaptureKit::StreamId streamId, const QString &)
Definition
qsckscreencapture.mm:271
QFFmpeg
Definition
qandroidcacertificates.cpp:26
QFFmpeg::findScDisplay
static q23::expected< AVFScopedPointer< SCDisplay >, QString > findScDisplay(CGDirectDisplayID input)
Definition
qsckscreencapture.mm:44
QFFmpeg::setupQMacScreenCaptureKitConnections
static void setupQMacScreenCaptureKitConnections(QSckScreenCapture &screenCapture, const QMacScreenCaptureKit &macScreenCaptureKit)
Definition
qsckscreencapture.mm:98
QFFmpeg::displayIDForScreen
static CGDirectDisplayID displayIDForScreen(NSScreen *screen)
Definition
qsckscreencapture.mm:33
QFFmpeg::findScDisplayForScreen
static auto findScDisplayForScreen(QScreen &screen) -> q23::expected< AVFScopedPointer< SCDisplay >, QPlatformSurfaceCapture::ErrorDetails >
Definition
qsckscreencapture.mm:68
QFFmpeg::makeQSckScreenCapture
std::unique_ptr< QPlatformSurfaceCapture > makeQSckScreenCapture()
Definition
qsckscreencapture.mm:311
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtmultimedia
src
plugins
multimedia
ffmpeg
darwin
qsckscreencapture_p.h
Generated on
for Qt by
1.18.0