From b28ee24628f77fced393cacc45500be6761e4497 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 22 Jan 2014 16:18:42 +0100 Subject: New QCameraInfo class. The class allows to get the list of available cameras on the system as well as getting some static information about them such as their unique ID, display name, physical position and sensor orientation. This makes QCamera::availableDevices() and QCamera::deviceDescription() obsolete. This patch contains the API, documentation and auto-tests but not the actual implementation by each backend (except for retrieving the default camera device). [ChangeLog][QtMultimedia] Added new QCameraInfo class [ChangeLog][QtMultimedia] QCamera: availableDevices() and deviceDescription() are deprecated, use QCameraInfo instead Change-Id: I64fd65729ab26a789468979ed5444ee90bb82cd0 Reviewed-by: Christian Stromme --- src/multimedia/qmediaserviceproviderplugin.h | 30 +++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'src/multimedia/qmediaserviceproviderplugin.h') diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h index fa3b88235..2c276beed 100644 --- a/src/multimedia/qmediaserviceproviderplugin.h +++ b/src/multimedia/qmediaserviceproviderplugin.h @@ -46,6 +46,7 @@ #include #include #include +#include #ifdef Q_MOC_RUN # pragma Q_MOC_EXPAND_MACROS @@ -62,7 +63,7 @@ class QMediaServiceProviderHintPrivate; class Q_MULTIMEDIA_EXPORT QMediaServiceProviderHint { public: - enum Type { Null, ContentType, Device, SupportedFeatures }; + enum Type { Null, ContentType, Device, SupportedFeatures, CameraPosition }; enum Feature { LowLatencyPlayback = 0x01, @@ -75,6 +76,7 @@ public: QMediaServiceProviderHint(); QMediaServiceProviderHint(const QString &mimeType, const QStringList& codecs); QMediaServiceProviderHint(const QByteArray &device); + QMediaServiceProviderHint(QCamera::Position position); QMediaServiceProviderHint(Features features); QMediaServiceProviderHint(const QMediaServiceProviderHint &other); ~QMediaServiceProviderHint(); @@ -92,6 +94,7 @@ public: QStringList codecs() const; QByteArray device() const; + QCamera::Position cameraPosition() const; Features features() const; @@ -145,6 +148,31 @@ struct Q_MULTIMEDIA_EXPORT QMediaServiceSupportedDevicesInterface "org.qt-project.qt.mediaservicesupporteddevices/5.0" Q_DECLARE_INTERFACE(QMediaServiceSupportedDevicesInterface, QMediaServiceSupportedDevicesInterface_iid) +// This should be part of QMediaServiceSupportedDevicesInterface but it can't in order +// to preserve binary compatibility with 5.2 and earlier. +// The whole media service plugin API shouldn't even be public in the first place. It should +// be made private in Qt 6.0 and QMediaServiceDefaultDeviceInterface should be merged with +// QMediaServiceSupportedDevicesInterface +struct Q_MULTIMEDIA_EXPORT QMediaServiceDefaultDeviceInterface +{ + virtual ~QMediaServiceDefaultDeviceInterface() {} + virtual QByteArray defaultDevice(const QByteArray &service) const = 0; +}; + +#define QMediaServiceDefaultDeviceInterface_iid \ + "org.qt-project.qt.mediaservicedefaultdevice/5.3" +Q_DECLARE_INTERFACE(QMediaServiceDefaultDeviceInterface, QMediaServiceDefaultDeviceInterface_iid) + +struct Q_MULTIMEDIA_EXPORT QMediaServiceCameraInfoInterface +{ + virtual QCamera::Position cameraPosition(const QByteArray &device) const = 0; + virtual int cameraOrientation(const QByteArray &device) const = 0; +}; + +#define QMediaServiceCameraInfoInterface_iid \ + "org.qt-project.qt.mediaservicecamerainfo/5.3" +Q_DECLARE_INTERFACE(QMediaServiceCameraInfoInterface, QMediaServiceCameraInfoInterface_iid) + // Required for QDoc workaround class QString; -- cgit v1.2.3