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:
Yoann Lopes
2014-01-22 16:18:42 +01:00
committed by The Qt Project
parent d964388b38
commit b28ee24628
54 changed files with 2218 additions and 154 deletions

View File

@@ -44,6 +44,8 @@
#include "private/qmediaserviceprovider_p.h"
#include "qmediaservice.h"
#include "mockvideodeviceselectorcontrol.h"
#include "mockcamerainfocontrol.h"
// Simple provider that lets you set the service
class MockMediaServiceProvider : public QMediaServiceProvider
@@ -67,6 +69,40 @@ public:
}
}
QByteArray defaultDevice(const QByteArray &serviceType) const
{
if (serviceType == Q_MEDIASERVICE_CAMERA)
return MockVideoDeviceSelectorControl::defaultCamera();
return QByteArray();
}
QList<QByteArray> devices(const QByteArray &serviceType) const
{
if (serviceType == Q_MEDIASERVICE_CAMERA)
return MockVideoDeviceSelectorControl::availableCameras();
return QList<QByteArray>();
}
QString deviceDescription(const QByteArray &serviceType, const QByteArray &device)
{
if (serviceType == Q_MEDIASERVICE_CAMERA)
return MockVideoDeviceSelectorControl::cameraDescription(device);
return QString();
}
QCamera::Position cameraPosition(const QByteArray &device) const
{
return MockCameraInfoControl::position(device);
}
int cameraOrientation(const QByteArray &device) const
{
return MockCameraInfoControl::orientation(device);
}
QMediaService *service;
bool deleteServiceOnRelease;
};