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#ifndef QMEDIASERVICEPROVIDERPLUGIN_H
41#define QMEDIASERVICEPROVIDERPLUGIN_H
42
43#include <QtCore/qstringlist.h>
44#include <QtCore/qplugin.h>
45#include <QtMultimedia/qmultimedia.h>
46#include <QtMultimedia/qtmultimediaglobal.h>
47#include <QtMultimedia/qcamera.h>
48
49#ifdef Q_MOC_RUN
50# pragma Q_MOC_EXPAND_MACROS
51#endif
52
53QT_BEGIN_NAMESPACE
54
55// Required for QDoc workaround
56class QString;
57
58class QMediaService;
59
60class QMediaServiceProviderHintPrivate;
61class Q_MULTIMEDIA_EXPORT QMediaServiceProviderHint
62{
63public:
64 enum Type { Null, ContentType, Device, SupportedFeatures, CameraPosition };
65
66 enum Feature {
67 LowLatencyPlayback = 0x01,
68 RecordingSupport = 0x02,
69 StreamPlayback = 0x04,
70 VideoSurface = 0x08
71 };
72 Q_DECLARE_FLAGS(Features, Feature)
73
74 QMediaServiceProviderHint();
75 QMediaServiceProviderHint(const QString &mimeType, const QStringList& codecs);
76 QMediaServiceProviderHint(const QByteArray &device);
77 QMediaServiceProviderHint(QCamera::Position position);
78 QMediaServiceProviderHint(Features features);
79 QMediaServiceProviderHint(const QMediaServiceProviderHint &other);
80 ~QMediaServiceProviderHint();
81
82 QMediaServiceProviderHint& operator=(const QMediaServiceProviderHint &other);
83
84 bool operator == (const QMediaServiceProviderHint &other) const;
85 bool operator != (const QMediaServiceProviderHint &other) const;
86
87 bool isNull() const;
88
89 Type type() const;
90
91 QString mimeType() const;
92 QStringList codecs() const;
93
94 QByteArray device() const;
95 QCamera::Position cameraPosition() const;
96
97 Features features() const;
98
99 //to be extended, if necessary
100
101private:
102 QSharedDataPointer<QMediaServiceProviderHintPrivate> d;
103};
104
105Q_DECLARE_OPERATORS_FOR_FLAGS(QMediaServiceProviderHint::Features)
106
107// Required for QDoc workaround
108class QString;
109
110struct Q_MULTIMEDIA_EXPORT QMediaServiceProviderFactoryInterface
111{
112 virtual QMediaService* create(QString const& key) = 0;
113 virtual void release(QMediaService *service) = 0;
114 virtual ~QMediaServiceProviderFactoryInterface();
115};
116
117#define QMediaServiceProviderFactoryInterface_iid \
118 "org.qt-project.qt.mediaserviceproviderfactory/5.0"
119Q_DECLARE_INTERFACE(QMediaServiceProviderFactoryInterface, QMediaServiceProviderFactoryInterface_iid)
120
121// Required for QDoc workaround
122class QString;
123
124struct Q_MULTIMEDIA_EXPORT QMediaServiceSupportedFormatsInterface
125{
126 virtual ~QMediaServiceSupportedFormatsInterface() {}
127 virtual QMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const = 0;
128 virtual QStringList supportedMimeTypes() const = 0;
129};
130
131#define QMediaServiceSupportedFormatsInterface_iid \
132 "org.qt-project.qt.mediaservicesupportedformats/5.0"
133Q_DECLARE_INTERFACE(QMediaServiceSupportedFormatsInterface, QMediaServiceSupportedFormatsInterface_iid)
134
135// Required for QDoc workaround
136class QString;
137
138struct Q_MULTIMEDIA_EXPORT QMediaServiceSupportedDevicesInterface
139{
140 virtual ~QMediaServiceSupportedDevicesInterface() {}
141 virtual QList<QByteArray> devices(const QByteArray &service) const = 0;
142 virtual QString deviceDescription(const QByteArray &service, const QByteArray &device) = 0;
143};
144
145#define QMediaServiceSupportedDevicesInterface_iid \
146 "org.qt-project.qt.mediaservicesupporteddevices/5.0"
147Q_DECLARE_INTERFACE(QMediaServiceSupportedDevicesInterface, QMediaServiceSupportedDevicesInterface_iid)
148
149// This should be part of QMediaServiceSupportedDevicesInterface but it can't in order
150// to preserve binary compatibility with 5.2 and earlier.
151// The whole media service plugin API shouldn't even be public in the first place. It should
152// be made private in Qt 6.0 and QMediaServiceDefaultDeviceInterface should be merged with
153// QMediaServiceSupportedDevicesInterface
154struct Q_MULTIMEDIA_EXPORT QMediaServiceDefaultDeviceInterface
155{
156 virtual ~QMediaServiceDefaultDeviceInterface() {}
157 virtual QByteArray defaultDevice(const QByteArray &service) const = 0;
158};
159
160#define QMediaServiceDefaultDeviceInterface_iid \
161 "org.qt-project.qt.mediaservicedefaultdevice/5.3"
162Q_DECLARE_INTERFACE(QMediaServiceDefaultDeviceInterface, QMediaServiceDefaultDeviceInterface_iid)
163
164struct Q_MULTIMEDIA_EXPORT QMediaServiceCameraInfoInterface
165{
166 virtual ~QMediaServiceCameraInfoInterface() {}
167 virtual QCamera::Position cameraPosition(const QByteArray &device) const = 0;
168 virtual int cameraOrientation(const QByteArray &device) const = 0;
169};
170
171#define QMediaServiceCameraInfoInterface_iid \
172 "org.qt-project.qt.mediaservicecamerainfo/5.3"
173Q_DECLARE_INTERFACE(QMediaServiceCameraInfoInterface, QMediaServiceCameraInfoInterface_iid)
174
175// Required for QDoc workaround
176class QString;
177
178struct Q_MULTIMEDIA_EXPORT QMediaServiceFeaturesInterface
179{
180 virtual ~QMediaServiceFeaturesInterface() {}
181 virtual QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const = 0;
182};
183
184
185#define QMediaServiceFeaturesInterface_iid \
186 "org.qt-project.qt.mediaservicefeatures/5.0"
187Q_DECLARE_INTERFACE(QMediaServiceFeaturesInterface, QMediaServiceFeaturesInterface_iid)
188
189// Required for QDoc workaround
190class QString;
191
192class Q_MULTIMEDIA_EXPORT QMediaServiceProviderPlugin : public QObject, public QMediaServiceProviderFactoryInterface
193{
194 Q_OBJECT
195 Q_INTERFACES(QMediaServiceProviderFactoryInterface)
196
197public:
198 QMediaService* create(const QString& key) override = 0;
199 void release(QMediaService *service) override = 0;
200};
201
202/*!
203 Service with support for media playback
204 Required Controls: QMediaPlayerControl
205 Optional Controls: QMediaPlaylistControl, QAudioDeviceControl
206 Video Output Controls (used by QWideoWidget and QGraphicsVideoItem):
207 Required: QVideoOutputControl
208 Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
209*/
210#define Q_MEDIASERVICE_MEDIAPLAYER "org.qt-project.qt.mediaplayer"
211
212/*!
213 Service with support for recording from audio sources
214 Required Controls: QAudioDeviceControl
215 Recording Controls (QMediaRecorder):
216 Required: QMediaRecorderControl
217 Recommended: QAudioEncoderSettingsControl
218 Optional: QMediaContainerControl
219*/
220#define Q_MEDIASERVICE_AUDIOSOURCE "org.qt-project.qt.audiosource"
221
222/*!
223 Service with support for camera use.
224 Required Controls: QCameraControl
225 Optional Controls: QCameraExposureControl, QCameraFocusControl, QCameraImageProcessingControl
226 Still Capture Controls: QCameraImageCaptureControl
227 Video Capture Controls (QMediaRecorder):
228 Required: QMediaRecorderControl
229 Recommended: QAudioEncoderSettingsControl, QVideoEncoderSettingsControl, QMediaContainerControl
230 Viewfinder Video Output Controls (used by QCameraViewfinder and QGraphicsVideoItem):
231 Required: QVideoOutputControl
232 Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
233*/
234#define Q_MEDIASERVICE_CAMERA "org.qt-project.qt.camera"
235
236/*!
237 Service with support for radio tuning.
238 Required Controls: QRadioTunerControl
239 Recording Controls (Optional, used by QMediaRecorder):
240 Required: QMediaRecorderControl
241 Recommended: QAudioEncoderSettingsControl
242 Optional: QMediaContainerControl
243*/
244#define Q_MEDIASERVICE_RADIO "org.qt-project.qt.radio"
245
246/*!
247 Service with support for decoding audio.
248 Required Controls: QAudioDecoderControl
249 Optional: that streams control
250*/
251#define Q_MEDIASERVICE_AUDIODECODER "org.qt-project.qt.audiodecode"
252
253QT_END_NAMESPACE
254
255#endif // QMEDIASERVICEPROVIDERPLUGIN_H
256

source code of qtmultimedia/src/multimedia/qmediaserviceproviderplugin.h