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
/
qdarwinintegrationfactory_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
)
41
VTRegisterSupplementalVideoDecoderIfAvailable(kCMVideoCodecType_VP9);
42
#
endif
43
}
44
45
QPlatformMediaFormatInfo *QDarwinIntegration::createFormatInfo()
46
{
47
return
new
QDarwinFormatInfo
(
)
;
48
}
49
50
QPlatformVideoDevices *QDarwinIntegration::createVideoDevices()
51
{
52
#
if
defined
(
Q_OS_VISIONOS
)
53
return
nullptr
;
54
#
else
55
return
makeQAvfVideoDevices(*
this
).release();
56
#
endif
57
}
58
59
q23::expected<QPlatformAudioDecoder *, QString> QDarwinIntegration::createAudioDecoder(QAudioDecoder *decoder)
60
{
61
return
new
AVFAudioDecoder(decoder);
62
}
63
64
q23::expected<QPlatformMediaCaptureSession *, QString> QDarwinIntegration::createCaptureSession()
65
{
66
#
if
defined
(
Q_OS_VISIONOS
)
67
return
q23::unexpected{ notAvailable };
68
#
else
69
return
new
AVFCameraService
;
70
#
endif
71
}
72
73
q23::expected<QPlatformMediaPlayer *, QString> QDarwinIntegration::createPlayer(QMediaPlayer *player)
74
{
75
return
new
AVFMediaPlayer
(player);
76
}
77
78
q23::expected<QPlatformCamera *, QString> QDarwinIntegration::createCamera(QCamera *camera)
79
{
80
#
if
defined
(
Q_OS_VISIONOS
)
81
Q_UNUSED(camera);
82
return
q23::unexpected{ notAvailable };
83
#
else
84
return
new
AVFCamera
(camera);
85
#
endif
86
}
87
88
q23::expected<QPlatformMediaRecorder *, QString> QDarwinIntegration::createRecorder(QMediaRecorder *recorder)
89
{
90
#
if
defined
(
Q_OS_VISIONOS
)
91
Q_UNUSED(recorder);
92
return
q23::unexpected{ notAvailable };
93
#
else
94
return
new
AVFMediaEncoder
(recorder);
95
#
endif
96
}
97
98
q23::expected<QPlatformImageCapture *, QString> QDarwinIntegration::createImageCapture(QImageCapture *imageCapture)
99
{
100
#
if
defined
(
Q_OS_VISIONOS
)
101
Q_UNUSED(imageCapture);
102
return
q23::unexpected{ notAvailable };
103
#
else
104
return
new
AVFImageCapture
(imageCapture);
105
#
endif
106
}
107
108
q23::expected<QPlatformVideoSink *, QString> QDarwinIntegration::createVideoSink(QVideoSink *sink)
109
{
110
return
new
AVFVideoSink(sink);
111
}
112
113
QT_END_NAMESPACE
114
115
#
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:40
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
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qrandomaccessasyncfile_darwin.mm:17
qtmultimedia
src
plugins
multimedia
darwin
qdarwinintegration.mm
Generated on
for Qt by
1.16.1