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>
This commit is contained in:
committed by
The Qt Project
parent
d964388b38
commit
b28ee24628
@@ -74,6 +74,18 @@ QMediaServiceProviderHint::Features BbServicePlugin::supportedFeatures(const QBy
|
||||
return QMediaServiceProviderHint::Features();
|
||||
}
|
||||
|
||||
QByteArray BbServicePlugin::defaultDevice(const QByteArray &service) const
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
if (m_cameraDevices.isEmpty())
|
||||
updateDevices();
|
||||
|
||||
return m_defaultCameraDevice;
|
||||
}
|
||||
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QList<QByteArray> BbServicePlugin::devices(const QByteArray &service) const
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA) {
|
||||
@@ -102,10 +114,13 @@ QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByt
|
||||
|
||||
void BbServicePlugin::updateDevices() const
|
||||
{
|
||||
m_defaultCameraDevice.clear();
|
||||
BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions);
|
||||
|
||||
if (m_cameraDevices.isEmpty()) {
|
||||
qWarning() << "No camera devices found";
|
||||
} else {
|
||||
m_defaultCameraDevice = m_cameraDevices.first();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,10 +48,12 @@ QT_BEGIN_NAMESPACE
|
||||
class BbServicePlugin
|
||||
: public QMediaServiceProviderPlugin,
|
||||
public QMediaServiceSupportedDevicesInterface,
|
||||
public QMediaServiceDefaultDeviceInterface,
|
||||
public QMediaServiceFeaturesInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
|
||||
Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
|
||||
Q_INTERFACES(QMediaServiceFeaturesInterface)
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "blackberry_mediaservice.json")
|
||||
public:
|
||||
@@ -61,6 +63,7 @@ public:
|
||||
void release(QMediaService *service) Q_DECL_OVERRIDE;
|
||||
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE;
|
||||
|
||||
QByteArray defaultDevice(const QByteArray &service) const Q_DECL_OVERRIDE;
|
||||
QList<QByteArray> devices(const QByteArray &service) const Q_DECL_OVERRIDE;
|
||||
QString deviceDescription(const QByteArray &service, const QByteArray &device) Q_DECL_OVERRIDE;
|
||||
QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property) Q_DECL_OVERRIDE;
|
||||
@@ -68,6 +71,7 @@ public:
|
||||
private:
|
||||
void updateDevices() const;
|
||||
|
||||
mutable QByteArray m_defaultCameraDevice;
|
||||
mutable QList<QByteArray> m_cameraDevices;
|
||||
mutable QStringList m_cameraDescriptions;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user