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
qdarwinintegration.mm
Go to the documentation of this file.
1
// Copyright (C) 2021 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
#
include
"qdarwinintegration_p.h"
5
#
include
<
avfmediaplayer_p
.
h
>
6
#
if
!
defined
(
Q_OS_VISIONOS
)
7
#
include
<
avfcameraservice_p
.
h
>
8
#
include
<
avfcamera_p
.
h
>
9
#
include
<
QtMultimedia
/
private
/
qavfvideodevices_p
.
h
>
10
#
include
<
avfimagecapture_p
.
h
>
11
#
include
<
avfmediaencoder_p
.
h
>
12
#
endif
13
#
include
<
qdarwinformatsinfo_p
.
h
>
14
#
include
<
avfvideosink_p
.
h
>
15
#
include
<
avfaudiodecoder_p
.
h
>
16
#
include
<
VideoToolbox
/
VideoToolbox
.
h
>
17
#
include
<
qdebug
.
h
>
18
#
include
<
private
/
qplatformmediaplugin_p
.
h
>
19
20
QT_BEGIN_NAMESPACE
21
22
class
QDarwinMediaPlugin
:
public
QPlatformMediaPlugin
23
{
24
Q_OBJECT
25
Q_PLUGIN_METADATA(IID QPlatformMediaPlugin_iid FILE
"darwin.json"
)
26
27
public
:
28
QDarwinMediaPlugin
() =
default
;
29
30
QPlatformMediaIntegration
*
create
(
const
QString &name)
override
31
{
32
if
(name == u"darwin")
33
return
new
QDarwinIntegration;
34
return
nullptr
;
35
}
36
};
37
38
QDarwinIntegration::QDarwinIntegration() : QPlatformMediaIntegration(QLatin1String(
"darwin"
))
39
{
40
#
if
defined
(
Q_OS_MACOS
)
&&
QT_MACOS_PLATFORM_SDK_EQUAL_OR_ABOVE
(
__MAC_11_0
)
41
if
(
__builtin_available
(macOS 11.0, *))
42
VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9);
43
#
endif
44
}
45
46
QPlatformMediaFormatInfo *QDarwinIntegration::createFormatInfo()
47
{
48
return
new
QDarwinFormatInfo
(
)
;
49
}
50
51
QPlatformVideoDevices *QDarwinIntegration::createVideoDevices()
52
{
53
#
if
defined
(
Q_OS_VISIONOS
)
54
return
nullptr
;
55
#
else
56
return
new
QAVFVideoDevices(
this
);
57
#
endif
58
}
59
60
q23::expected<QPlatformAudioDecoder *, QString> QDarwinIntegration::createAudioDecoder(QAudioDecoder *decoder)
61
{
62
return
new
AVFAudioDecoder(decoder);
63
}
64
65
q23::expected<QPlatformMediaCaptureSession *, QString> QDarwinIntegration::createCaptureSession()
66
{
67
#
if
defined
(
Q_OS_VISIONOS
)
68
return
q23::unexpected{ notAvailable };
69
#
else
70
return
new
AVFCameraService
;
71
#
endif
72
}
73
74
q23::expected<QPlatformMediaPlayer *, QString> QDarwinIntegration::createPlayer(QMediaPlayer *player)
75
{
76
return
new
AVFMediaPlayer
(player);
77
}
78
79
q23::expected<QPlatformCamera *, QString> QDarwinIntegration::createCamera(QCamera *camera)
80
{
81
#
if
defined
(
Q_OS_VISIONOS
)
82
Q_UNUSED(camera);
83
return
q23::unexpected{ notAvailable };
84
#
else
85
return
new
AVFCamera
(camera);
86
#
endif
87
}
88
89
q23::expected<QPlatformMediaRecorder *, QString> QDarwinIntegration::createRecorder(QMediaRecorder *recorder)
90
{
91
#
if
defined
(
Q_OS_VISIONOS
)
92
Q_UNUSED(recorder);
93
return
q23::unexpected{ notAvailable };
94
#
else
95
return
new
AVFMediaEncoder
(recorder);
96
#
endif
97
}
98
99
q23::expected<QPlatformImageCapture *, QString> QDarwinIntegration::createImageCapture(QImageCapture *imageCapture)
100
{
101
#
if
defined
(
Q_OS_VISIONOS
)
102
Q_UNUSED(imageCapture);
103
return
q23::unexpected{ notAvailable };
104
#
else
105
return
new
AVFImageCapture
(imageCapture);
106
#
endif
107
}
108
109
q23::expected<QPlatformVideoSink *, QString> QDarwinIntegration::createVideoSink(QVideoSink *sink)
110
{
111
return
new
AVFVideoSink(sink);
112
}
113
114
QT_END_NAMESPACE
115
116
#
include
"qdarwinintegration.moc"
AVFCameraService
Definition
avfcameraservice_p.h:33
AVFCamera
Definition
avfcamera_p.h:27
AVFImageCapture
Definition
avfimagecapture_p.h:29
AVFMediaEncoder
Definition
avfmediaencoder_p.h:38
AVFMediaPlayer
Definition
avfmediaplayer_p.h:41
QDarwinFormatInfo
Definition
qdarwinformatsinfo_p.h:26
QDarwinFormatInfo::QDarwinFormatInfo
QDarwinFormatInfo()
Definition
qdarwinformatsinfo.mm:58
QDarwinMediaPlugin
Definition
qdarwinintegration.mm:23
QDarwinMediaPlugin::create
QPlatformMediaIntegration * create(const QString &name) override
Definition
qdarwinintegration.mm:30
QPlatformGraphicsBufferHelper
\inmodule QtGui
qtmultimedia
src
plugins
multimedia
darwin
qdarwinintegration.mm
Generated on
for Qt by
1.14.0