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/plugins/directshow/dsserviceplugin.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/plugins/directshow/dsserviceplugin.cpp') diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp index dca7430af..d262febdd 100644 --- a/src/plugins/directshow/dsserviceplugin.cpp +++ b/src/plugins/directshow/dsserviceplugin.cpp @@ -107,6 +107,20 @@ QMediaServiceProviderHint::Features DSServicePlugin::supportedFeatures( return QMediaServiceProviderHint::Features(); } +QByteArray DSServicePlugin::defaultDevice(const QByteArray &service) const +{ +#ifdef QMEDIA_DIRECTSHOW_CAMERA + if (service == Q_MEDIASERVICE_CAMERA) { + if (m_cameraDevices.isEmpty()) + updateDevices(); + + return m_defaultCameraDevice; + } +#endif + + return QByteArray(); +} + QList DSServicePlugin::devices(const QByteArray &service) const { #ifdef QMEDIA_DIRECTSHOW_CAMERA @@ -140,10 +154,13 @@ QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByt void DSServicePlugin::updateDevices() const { + m_defaultCameraDevice.clear(); DSVideoDeviceControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions); if (m_cameraDevices.isEmpty()) { qWarning() << "No camera devices found"; + } else { + m_defaultCameraDevice = m_cameraDevices.first(); } } #endif -- cgit v1.2.3