summaryrefslogtreecommitdiffstats
path: root/src/plugins/gstreamer/mediacapture
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-01-22 16:18:42 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-02-28 14:10:00 +0100
commitb28ee24628f77fced393cacc45500be6761e4497 (patch)
tree811173f8a2caf84e0fa386010283ccfd32c6ad0d /src/plugins/gstreamer/mediacapture
parentd964388b38ec4762e315d86aacb779604bcdca1b (diff)
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 <christian.stromme@digia.com>
Diffstat (limited to 'src/plugins/gstreamer/mediacapture')
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp16
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h4
2 files changed, 20 insertions, 0 deletions
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp
index dbb7649f4..de07d2707 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.cpp
@@ -95,6 +95,18 @@ QMediaServiceProviderHint::Features QGstreamerCaptureServicePlugin::supportedFea
return QMediaServiceProviderHint::Features();
}
+QByteArray QGstreamerCaptureServicePlugin::defaultDevice(const QByteArray &service) const
+{
+ if (service == Q_MEDIASERVICE_CAMERA) {
+ if (m_cameraDevices.isEmpty())
+ updateDevices();
+
+ return m_defaultCameraDevice;
+ }
+
+ return QByteArray();
+}
+
QList<QByteArray> QGstreamerCaptureServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
@@ -131,6 +143,7 @@ QVariant QGstreamerCaptureServicePlugin::deviceProperty(const QByteArray &servic
void QGstreamerCaptureServicePlugin::updateDevices() const
{
+ m_defaultCameraDevice.clear();
m_cameraDevices.clear();
m_cameraDescriptions.clear();
@@ -174,6 +187,9 @@ void QGstreamerCaptureServicePlugin::updateDevices() const
}
::close(fd);
}
+
+ if (!m_cameraDevices.isEmpty())
+ m_defaultCameraDevice = m_cameraDevices.first();
}
#endif
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
index 3003cbbcc..a1141d324 100644
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
+++ b/src/plugins/gstreamer/mediacapture/qgstreamercaptureserviceplugin.h
@@ -53,6 +53,7 @@ class QGstreamerCaptureServicePlugin
: public QMediaServiceProviderPlugin
#if defined(USE_GSTREAMER_CAMERA)
, public QMediaServiceSupportedDevicesInterface
+ , public QMediaServiceDefaultDeviceInterface
, public QMediaServiceFeaturesInterface
#endif
, public QMediaServiceSupportedFormatsInterface
@@ -60,6 +61,7 @@ class QGstreamerCaptureServicePlugin
Q_OBJECT
#if defined(USE_GSTREAMER_CAMERA)
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
+ Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
Q_INTERFACES(QMediaServiceFeaturesInterface)
#endif
Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
@@ -75,6 +77,7 @@ public:
#if defined(USE_GSTREAMER_CAMERA)
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
+ QByteArray defaultDevice(const QByteArray &service) const;
QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device);
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
@@ -87,6 +90,7 @@ private:
#if defined(USE_GSTREAMER_CAMERA)
void updateDevices() const;
+ mutable QByteArray m_defaultCameraDevice;
mutable QList<QByteArray> m_cameraDevices;
mutable QStringList m_cameraDescriptions;
#endif