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
@@ -46,6 +46,7 @@
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
QByteArray QAndroidVideoDeviceSelectorControl::m_defaultDevice;
|
||||
QList<QByteArray> QAndroidVideoDeviceSelectorControl::m_names;
|
||||
QStringList QAndroidVideoDeviceSelectorControl::m_descriptions;
|
||||
|
||||
@@ -99,6 +100,7 @@ void QAndroidVideoDeviceSelectorControl::setSelectedDevice(int index)
|
||||
|
||||
void QAndroidVideoDeviceSelectorControl::update()
|
||||
{
|
||||
m_defaultDevice.clear();
|
||||
m_names.clear();
|
||||
m_descriptions.clear();
|
||||
|
||||
@@ -127,6 +129,17 @@ void QAndroidVideoDeviceSelectorControl::update()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!m_names.isEmpty())
|
||||
m_defaultDevice = m_names.first();
|
||||
}
|
||||
|
||||
QByteArray QAndroidVideoDeviceSelectorControl::defaultDeviceName()
|
||||
{
|
||||
if (m_names.isEmpty())
|
||||
update();
|
||||
|
||||
return m_defaultDevice;
|
||||
}
|
||||
|
||||
QList<QByteArray> QAndroidVideoDeviceSelectorControl::availableDevices()
|
||||
|
||||
@@ -66,6 +66,7 @@ public:
|
||||
|
||||
void setSelectedDevice(int index);
|
||||
|
||||
static QByteArray defaultDeviceName();
|
||||
static QList<QByteArray> availableDevices();
|
||||
static QString availableDeviceDescription(const QByteArray &device);
|
||||
|
||||
@@ -73,6 +74,7 @@ private:
|
||||
static void update();
|
||||
|
||||
int m_selectedDevice;
|
||||
static QByteArray m_defaultDevice;
|
||||
static QList<QByteArray> m_names;
|
||||
static QStringList m_descriptions;
|
||||
|
||||
|
||||
@@ -96,6 +96,14 @@ QMediaServiceProviderHint::Features QAndroidMediaServicePlugin::supportedFeature
|
||||
return QMediaServiceProviderHint::Features();
|
||||
}
|
||||
|
||||
QByteArray QAndroidMediaServicePlugin::defaultDevice(const QByteArray &service) const
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA)
|
||||
return QAndroidVideoDeviceSelectorControl::defaultDeviceName();
|
||||
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
QList<QByteArray> QAndroidMediaServicePlugin::devices(const QByteArray &service) const
|
||||
{
|
||||
if (service == Q_MEDIASERVICE_CAMERA)
|
||||
|
||||
@@ -49,10 +49,12 @@ QT_BEGIN_NAMESPACE
|
||||
class QAndroidMediaServicePlugin
|
||||
: 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 "android_mediaservice.json")
|
||||
@@ -66,6 +68,7 @@ public:
|
||||
|
||||
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE;
|
||||
|
||||
QByteArray defaultDevice(const QByteArray &service) const;
|
||||
QList<QByteArray> devices(const QByteArray &service) const;
|
||||
QString deviceDescription(const QByteArray &service, const QByteArray &device);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user