1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include <QtQml/qqmlextensionplugin.h> |
41 | #include <QtQml/qqml.h> |
42 | #include <QtQml/qqmlengine.h> |
43 | #include <QtQml/qqmlcomponent.h> |
44 | #include "qsoundeffect.h" |
45 | |
46 | #include <private/qdeclarativevideooutput_p.h> |
47 | #include "qabstractvideofilter.h" |
48 | |
49 | #include "qdeclarativemultimediaglobal_p.h" |
50 | #include "qdeclarativemediametadata_p.h" |
51 | #include "qdeclarativeaudio_p.h" |
52 | #include "qdeclarativeradio_p.h" |
53 | #include "qdeclarativeradiodata_p.h" |
54 | #include "qdeclarativeplaylist_p.h" |
55 | #include "qdeclarativecamera_p.h" |
56 | #include "qdeclarativecamerapreviewprovider_p.h" |
57 | #include "qdeclarativecameraexposure_p.h" |
58 | #include "qdeclarativecameraflash_p.h" |
59 | #include "qdeclarativecamerafocus_p.h" |
60 | #include "qdeclarativecameraimageprocessing_p.h" |
61 | #include "qdeclarativecameraviewfinder_p.h" |
62 | #include "qdeclarativetorch_p.h" |
63 | |
64 | QML_DECLARE_TYPE(QSoundEffect) |
65 | |
66 | QT_BEGIN_NAMESPACE |
67 | |
68 | static QObject *multimedia_global_object(QQmlEngine *qmlEngine, QJSEngine *jsEngine) |
69 | { |
70 | Q_UNUSED(qmlEngine) |
71 | return new QDeclarativeMultimediaGlobal(jsEngine); |
72 | } |
73 | |
74 | class QMultimediaDeclarativeModule : public QQmlExtensionPlugin |
75 | { |
76 | Q_OBJECT |
77 | Q_PLUGIN_METADATA(IID QQmlExtensionInterface_iid) |
78 | |
79 | public: |
80 | QMultimediaDeclarativeModule(QObject *parent = 0) : QQmlExtensionPlugin(parent) { } |
81 | void registerTypes(const char *uri) override |
82 | { |
83 | Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia" )); |
84 | |
85 | // 5.0 types |
86 | qmlRegisterType<QSoundEffect>(uri, 5, 0, "SoundEffect" ); |
87 | qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "Audio" ); |
88 | qmlRegisterType<QDeclarativeAudio>(uri, 5, 0, "MediaPlayer" ); |
89 | qmlRegisterType<QDeclarativeVideoOutput>(uri, 5, 0, "VideoOutput" ); |
90 | qmlRegisterType<QDeclarativeRadio>(uri, 5, 0, "Radio" ); |
91 | qmlRegisterType<QDeclarativeRadioData>(uri, 5, 0, "RadioData" ); |
92 | qmlRegisterType<QDeclarativeCamera>(uri, 5, 0, "Camera" ); |
93 | qmlRegisterType<QDeclarativeTorch>(uri, 5, 0, "Torch" ); |
94 | qmlRegisterUncreatableType<QDeclarativeCameraCapture>(uri, 5, 0, "CameraCapture" , |
95 | tr("CameraCapture is provided by Camera" )); |
96 | qmlRegisterUncreatableType<QDeclarativeCameraRecorder>(uri, 5, 0, "CameraRecorder" , |
97 | tr("CameraRecorder is provided by Camera" )); |
98 | qmlRegisterUncreatableType<QDeclarativeCameraExposure>(uri, 5, 0, "CameraExposure" , |
99 | tr("CameraExposure is provided by Camera" )); |
100 | qmlRegisterUncreatableType<QDeclarativeCameraFocus>(uri, 5, 0, "CameraFocus" , |
101 | tr("CameraFocus is provided by Camera" )); |
102 | qmlRegisterUncreatableType<QDeclarativeCameraFlash>(uri, 5, 0, "CameraFlash" , |
103 | tr("CameraFlash is provided by Camera" )); |
104 | qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing>(uri, 5, 0, "CameraImageProcessing" , |
105 | tr("CameraImageProcessing is provided by Camera" )); |
106 | |
107 | // 5.2 types |
108 | qmlRegisterType<QDeclarativeVideoOutput, 2>(uri, 5, 2, "VideoOutput" ); |
109 | |
110 | // 5.3 types |
111 | // Nothing changed, but adding "import QtMultimedia 5.3" in QML will fail unless at |
112 | // least one type is registered for that version. |
113 | qmlRegisterType<QSoundEffect>(uri, 5, 3, "SoundEffect" ); |
114 | |
115 | // 5.4 types |
116 | qmlRegisterSingletonType<QDeclarativeMultimediaGlobal>(uri, 5, 4, "QtMultimedia" , multimedia_global_object); |
117 | qmlRegisterType<QDeclarativeCamera, 1>(uri, 5, 4, "Camera" ); |
118 | qmlRegisterUncreatableType<QDeclarativeCameraViewfinder>(uri, 5, 4, "CameraViewfinder" , |
119 | tr("CameraViewfinder is provided by Camera" )); |
120 | |
121 | // 5.5 types |
122 | qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing, 1>(uri, 5, 5, "CameraImageProcessing" , tr("CameraImageProcessing is provided by Camera" )); |
123 | qmlRegisterType<QDeclarativeCamera, 2>(uri, 5, 5, "Camera" ); |
124 | |
125 | // 5.6 types |
126 | qmlRegisterType<QDeclarativeAudio, 1>(uri, 5, 6, "Audio" ); |
127 | qmlRegisterType<QDeclarativeAudio, 1>(uri, 5, 6, "MediaPlayer" ); |
128 | qmlRegisterType<QDeclarativePlaylist>(uri, 5, 6, "Playlist" ); |
129 | qmlRegisterType<QDeclarativePlaylistItem>(uri, 5, 6, "PlaylistItem" ); |
130 | |
131 | // 5.7 types |
132 | qmlRegisterType<QDeclarativePlaylist, 1>(uri, 5, 7, "Playlist" ); |
133 | qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing, 2>(uri, 5, 7, "CameraImageProcessing" , |
134 | tr("CameraImageProcessing is provided by Camera" )); |
135 | |
136 | // 5.8 types (nothing new, re-register one of the types) |
137 | qmlRegisterType<QSoundEffect>(uri, 5, 8, "SoundEffect" ); |
138 | |
139 | // 5.9 types |
140 | qmlRegisterType<QDeclarativeAudio, 2>(uri, 5, 9, "Audio" ); |
141 | qmlRegisterType<QDeclarativeAudio, 2>(uri, 5, 9, "MediaPlayer" ); |
142 | qmlRegisterUncreatableType<QDeclarativeCameraCapture, 1>(uri, 5, 9, "CameraCapture" , |
143 | tr("CameraCapture is provided by Camera" )); |
144 | qmlRegisterUncreatableType<QDeclarativeCameraFlash, 1>(uri, 5, 9, "CameraFlash" , |
145 | tr("CameraFlash is provided by Camera" )); |
146 | |
147 | // 5.11 types |
148 | qmlRegisterType<QDeclarativeAudio, 3>(uri, 5, 11, "Audio" ); |
149 | qmlRegisterType<QDeclarativeAudio, 3>(uri, 5, 11, "MediaPlayer" ); |
150 | qmlRegisterUncreatableType<QDeclarativeCameraFocus, 1>(uri, 5, 11, "CameraFocus" , |
151 | tr("CameraFocus is provided by Camera" )); |
152 | qmlRegisterUncreatableType<QDeclarativeCameraExposure, 1>(uri, 5, 11, "CameraExposure" , |
153 | tr("CameraExposure is provided by Camera" )); |
154 | qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing, 3>(uri, 5, 11, "CameraImageProcessing" , |
155 | tr("CameraImageProcessing is provided by Camera" )); |
156 | |
157 | qmlRegisterType<QDeclarativeMediaMetaData>(); |
158 | qmlRegisterType<QAbstractVideoFilter>(); |
159 | |
160 | // 5.13 types |
161 | qmlRegisterType<QDeclarativeVideoOutput, 13>(uri, 5, 13, "VideoOutput" ); |
162 | |
163 | // Auto-increment the import to stay in sync with ALL future QtQuick minor versions from 5.11 onward |
164 | qmlRegisterModule(uri, 5, QT_VERSION_MINOR); |
165 | } |
166 | |
167 | void initializeEngine(QQmlEngine *engine, const char *uri) override |
168 | { |
169 | Q_UNUSED(uri); |
170 | engine->addImageProvider("camera" , new QDeclarativeCameraPreviewProvider); |
171 | } |
172 | }; |
173 | |
174 | QT_END_NAMESPACE |
175 | |
176 | #include "multimedia.moc" |
177 | |
178 | |