Blackberry: Add camera support for BB10 platform

Reimplement all camera related controls as they are supported by the
BB10 camera API.

Change-Id: Ie7d2258be22c1c1821489bd7074b80cff4242afa
Reviewed-by: Bernd Weimer <bweimer@rim.com>
Reviewed-by: Thomas McGuire <thomas.mcguire@kdab.com>
This commit is contained in:
Tobias Koenig
2013-01-31 10:48:16 +01:00
committed by The Qt Project
parent 7c1d490d1a
commit 36655ccdfb
47 changed files with 5718 additions and 1 deletions

View File

@@ -39,7 +39,12 @@
**
****************************************************************************/
#include "bbserviceplugin.h"
#include "bbcameraservice.h"
#include "bbmediaplayerservice.h"
#include "bbvideodeviceselectorcontrol.h"
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -49,6 +54,9 @@ BbServicePlugin::BbServicePlugin()
QMediaService *BbServicePlugin::create(const QString &key)
{
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new BbCameraService();
if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
return new BbMediaPlayerService();
@@ -66,4 +74,39 @@ QMediaServiceProviderHint::Features BbServicePlugin::supportedFeatures(const QBy
return QMediaServiceProviderHint::Features();
}
QList<QByteArray> BbServicePlugin::devices(const QByteArray &service) const
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_cameraDevices;
}
return QList<QByteArray>();
}
QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
for (int i = 0; i < m_cameraDevices.count(); i++)
if (m_cameraDevices[i] == device)
return m_cameraDescriptions[i];
}
return QString();
}
void BbServicePlugin::updateDevices() const
{
BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions);
if (m_cameraDevices.isEmpty()) {
qWarning() << "No camera devices found";
}
}
QT_END_NAMESPACE