1// Copyright (C) 2022 The Qt Company
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 QTMULTIMEDIAQUICKTYPES_H
5#define QTMULTIMEDIAQUICKTYPES_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 <QtMultimediaQuick/private/qtmultimediaquickglobal_p.h>
19
20#include <QtMultimedia/qaudiodevice.h>
21#include <QtMultimedia/qaudioinput.h>
22#include <QtMultimedia/qaudiooutput.h>
23#include <QtMultimedia/qcamera.h>
24#include <QtMultimedia/qcameradevice.h>
25#include <QtMultimedia/qcapturablewindow.h>
26#include <QtMultimedia/qimagecapture.h>
27#include <QtMultimedia/qmediacapturesession.h>
28#include <QtMultimedia/qmediadevices.h>
29#include <QtMultimedia/qmediaformat.h>
30#include <QtMultimedia/qmediametadata.h>
31#include <QtMultimedia/qmediarecorder.h>
32#include <QtMultimedia/qplaybackoptions.h>
33#include <QtMultimedia/qscreencapture.h>
34#include <QtMultimedia/qwindowcapture.h>
35
36#include <QtQml/qqmlregistration.h>
37
38QT_BEGIN_NAMESPACE
39
40namespace QtMultimediaPrivate {
41
42struct QMediaCaptureSessionForeign
43{
44 Q_GADGET
45 QML_FOREIGN(QMediaCaptureSession)
46 QML_NAMED_ELEMENT(CaptureSession) // ### MediaCaptureSession?
47};
48
49struct QCameraForeign
50{
51 Q_GADGET
52 QML_FOREIGN(QCamera)
53 QML_NAMED_ELEMENT(Camera)
54};
55
56struct QImageCaptureForeign
57{
58 Q_GADGET
59 QML_ANONYMOUS
60 QML_FOREIGN(QImageCapture)
61};
62
63struct QScreenCaptureForeign
64{
65 Q_GADGET
66 QML_ANONYMOUS
67 QML_FOREIGN(QScreenCapture)
68};
69
70struct QMediaRecorderForeign
71{
72 Q_GADGET
73 QML_FOREIGN(QMediaRecorder)
74 QML_NAMED_ELEMENT(MediaRecorder)
75};
76
77struct QMediaMetaDataForeign
78{
79 Q_GADGET
80 QML_FOREIGN(QMediaMetaData)
81 QML_VALUE_TYPE(mediaMetaData)
82};
83
84// To prevent the same type from being exported twice into qmltypes
85// (for value type and for the enums)
86struct QMediaMetaDataDerived : public QMediaMetaData
87{
88 Q_GADGET
89};
90
91namespace QMediaMetaDataNamespaceForeign
92{
93 Q_NAMESPACE
94 QML_FOREIGN_NAMESPACE(QMediaMetaDataDerived)
95 QML_NAMED_ELEMENT(MediaMetaData)
96} // namespace QMediaMetaDataNamespaceForeign
97
98struct QMediaDevicesForeign
99{
100 Q_GADGET
101 QML_FOREIGN(QMediaDevices)
102 QML_NAMED_ELEMENT(MediaDevices)
103};
104
105struct QAudioInputForeign
106{
107 Q_GADGET
108 QML_FOREIGN(QAudioInput)
109 QML_NAMED_ELEMENT(AudioInput)
110};
111
112struct QAudioOutputForeign
113{
114 Q_GADGET
115 QML_FOREIGN(QAudioOutput)
116 QML_NAMED_ELEMENT(AudioOutput)
117};
118
119struct QAudioDeviceForeign
120{
121 Q_GADGET
122 QML_FOREIGN(QAudioDevice)
123 QML_VALUE_TYPE(audioDevice)
124};
125
126// To prevent the same type from being exported twice into qmltypes
127// (for value type and for the enums)
128struct QAudioDeviceDerived : public QAudioDevice
129{
130 Q_GADGET
131};
132
133namespace QAudioDeviceNamespaceForeign
134{
135 Q_NAMESPACE
136 QML_FOREIGN_NAMESPACE(QAudioDeviceDerived)
137 QML_NAMED_ELEMENT(AudioDevice)
138} // namespace QAudioDeviceNamespaceForeign
139
140struct QCameraDeviceForeign
141{
142 Q_GADGET
143 QML_FOREIGN(QCameraDevice)
144 QML_VALUE_TYPE(cameraDevice)
145};
146
147// To prevent the same type from being exported twice into qmltypes
148// (for value type and for the enums)
149struct QCameraDeviceDerived : public QCameraDevice
150{
151 Q_GADGET
152};
153
154namespace QCameraDeviceNamespaceForeign
155{
156 Q_NAMESPACE
157 QML_FOREIGN_NAMESPACE(QCameraDeviceDerived)
158 QML_NAMED_ELEMENT(CameraDevice)
159} // namespace QCameraDeviceNamespaceForeign
160
161struct QMediaFormatForeign
162{
163 Q_GADGET
164 QML_FOREIGN(QMediaFormat)
165 QML_VALUE_TYPE(mediaFormat)
166};
167
168// To prevent the same type from being exported twice into qmltypes
169// (for value type and for the enums)
170struct QMediaFormatDerived : public QMediaFormat
171{
172 Q_GADGET
173};
174
175namespace QMediaFormatNamespaceForeign
176{
177 Q_NAMESPACE
178 QML_FOREIGN_NAMESPACE(QMediaFormatDerived)
179 QML_NAMED_ELEMENT(MediaFormat)
180} // namespace QMediaFormatNamespaceForeign
181
182struct QCameraFormatForeign
183{
184 Q_GADGET
185 QML_FOREIGN(QCameraFormat)
186 QML_VALUE_TYPE(cameraFormat)
187};
188
189struct QCapturableWindowForeign
190{
191 Q_GADGET
192 QML_FOREIGN(QCapturableWindow)
193 QML_VALUE_TYPE(capturableWindow)
194 QML_CONSTRUCTIBLE_VALUE
195};
196
197struct QWindowCaptureForeign
198{
199 Q_GADGET
200 QML_FOREIGN(QWindowCapture)
201 QML_NAMED_ELEMENT(WindowCapture)
202};
203
204class QPlaybackOptionsDerived : public QPlaybackOptions
205{
206 Q_PROPERTY(qint64 networkTimeoutMs READ networkTimeoutMs WRITE setNetworkTimeoutMs RESET resetNetworkTimeoutMs FINAL)
207
208 Q_GADGET
209 QML_FOREIGN(QPlaybackOptions)
210 QML_VALUE_TYPE(playbackOptions)
211 QML_EXTENDED(QPlaybackOptionsDerived)
212 QML_ADDED_IN_VERSION(6, 10)
213
214public:
215 qint64 networkTimeoutMs() const { return networkTimeout().count(); }
216
217 void setNetworkTimeoutMs(qint64 timeout) { setNetworkTimeout(std::chrono::milliseconds(timeout)); }
218
219 void resetNetworkTimeoutMs() { resetNetworkTimeout(); }
220};
221
222namespace QPlaybackOptionsNamespaceForeign {
223 Q_NAMESPACE
224 QML_NAMED_ELEMENT(PlaybackOptions)
225 QML_FOREIGN_NAMESPACE(QPlaybackOptions)
226 QML_ADDED_IN_VERSION(6, 10)
227} // namespace QPlaybackOptionsNamespaceForeign
228
229
230
231} // namespace QtMultimediaPrivate
232
233QT_END_NAMESPACE
234
235#endif
236

source code of qtmultimedia/src/multimediaquick/qtmultimediaquicktypes_p.h