summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@digia.com>2014-02-04 14:59:44 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-27 16:43:51 +0100
commit09e3d8a28e3e1d4903043f38553aed9d34bcde09 (patch)
tree980b5096ac1a9afeca5d7791a1c9bba0da6ad527
parent5869d484415168692f6ca9513beacf6f69c92c0a (diff)
downloadqtmultimedia-09e3d8a28e3e1d4903043f38553aed9d34bcde09.tar.gz
Blackberry: implement QCameraInfoControl.
We also now correctly report the default camera to be the rear camera. Change-Id: Ie96b2950344194637c8feace77246f036c9a3757 Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
-rw-r--r--src/plugins/qnx/bbserviceplugin.cpp16
-rw-r--r--src/plugins/qnx/bbserviceplugin.h5
-rw-r--r--src/plugins/qnx/camera/bbcamerainfocontrol.cpp83
-rw-r--r--src/plugins/qnx/camera/bbcamerainfocontrol.h65
-rw-r--r--src/plugins/qnx/camera/bbcameraservice.cpp4
-rw-r--r--src/plugins/qnx/camera/bbcameraservice.h2
-rw-r--r--src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp5
-rw-r--r--src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h1
-rw-r--r--src/plugins/qnx/camera/camera.pri2
9 files changed, 180 insertions, 3 deletions
diff --git a/src/plugins/qnx/bbserviceplugin.cpp b/src/plugins/qnx/bbserviceplugin.cpp
index 2351e5730..a0eade602 100644
--- a/src/plugins/qnx/bbserviceplugin.cpp
+++ b/src/plugins/qnx/bbserviceplugin.cpp
@@ -40,7 +40,9 @@
****************************************************************************/
#include "bbserviceplugin.h"
+#include "bbcamerainfocontrol.h"
#include "bbcameraservice.h"
+#include "bbcamerasession.h"
#include "bbvideodeviceselectorcontrol.h"
#include "mmrenderermediaplayerservice.h"
@@ -120,8 +122,20 @@ void BbServicePlugin::updateDevices() const
if (m_cameraDevices.isEmpty()) {
qWarning() << "No camera devices found";
} else {
- m_defaultCameraDevice = m_cameraDevices.first();
+ m_defaultCameraDevice = m_cameraDevices.contains(BbCameraSession::cameraIdentifierRear())
+ ? BbCameraSession::cameraIdentifierRear()
+ : m_cameraDevices.first();
}
}
+QCamera::Position BbServicePlugin::cameraPosition(const QByteArray &device) const
+{
+ return BbCameraInfoControl::position(device);
+}
+
+int BbServicePlugin::cameraOrientation(const QByteArray &device) const
+{
+ return BbCameraInfoControl::orientation(device);
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/qnx/bbserviceplugin.h b/src/plugins/qnx/bbserviceplugin.h
index 45ea4cc6f..f6a20b8f0 100644
--- a/src/plugins/qnx/bbserviceplugin.h
+++ b/src/plugins/qnx/bbserviceplugin.h
@@ -49,11 +49,13 @@ class BbServicePlugin
: public QMediaServiceProviderPlugin,
public QMediaServiceSupportedDevicesInterface,
public QMediaServiceDefaultDeviceInterface,
+ public QMediaServiceCameraInfoInterface,
public QMediaServiceFeaturesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
Q_INTERFACES(QMediaServiceDefaultDeviceInterface)
+ Q_INTERFACES(QMediaServiceCameraInfoInterface)
Q_INTERFACES(QMediaServiceFeaturesInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "blackberry_mediaservice.json")
public:
@@ -68,6 +70,9 @@ public:
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;
+ QCamera::Position cameraPosition(const QByteArray &device) const Q_DECL_OVERRIDE;
+ int cameraOrientation(const QByteArray &device) const Q_DECL_OVERRIDE;
+
private:
void updateDevices() const;
diff --git a/src/plugins/qnx/camera/bbcamerainfocontrol.cpp b/src/plugins/qnx/camera/bbcamerainfocontrol.cpp
new file mode 100644
index 000000000..366495dd5
--- /dev/null
+++ b/src/plugins/qnx/camera/bbcamerainfocontrol.cpp
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bbcamerainfocontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraInfoControl::BbCameraInfoControl(QObject *parent)
+ : QCameraInfoControl(parent)
+{
+}
+
+QCamera::Position BbCameraInfoControl::position(const QString &deviceName)
+{
+ if (deviceName == QString::fromUtf8(BbCameraSession::cameraIdentifierFront()))
+ return QCamera::FrontFace;
+ else if (deviceName == QString::fromUtf8(BbCameraSession::cameraIdentifierRear()))
+ return QCamera::BackFace;
+ else
+ return QCamera::UnspecifiedPosition;
+}
+
+int BbCameraInfoControl::orientation(const QString &deviceName)
+{
+ // The camera sensor orientation could be retrieved with camera_get_native_orientation()
+ // but since the sensor angular offset is compensated with camera_set_videovf_property() and
+ // camera_set_photovf_property() we should always return 0 here.
+ Q_UNUSED(deviceName);
+ return 0;
+}
+
+QCamera::Position BbCameraInfoControl::cameraPosition(const QString &deviceName) const
+{
+ return position(deviceName);
+}
+
+int BbCameraInfoControl::cameraOrientation(const QString &deviceName) const
+{
+ return orientation(deviceName);
+}
+
+QT_END_NAMESPACE
+
diff --git a/src/plugins/qnx/camera/bbcamerainfocontrol.h b/src/plugins/qnx/camera/bbcamerainfocontrol.h
new file mode 100644
index 000000000..a083bbf35
--- /dev/null
+++ b/src/plugins/qnx/camera/bbcamerainfocontrol.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef BBCAMERAINFOCONTROL_H
+#define BBCAMERAINFOCONTROL_H
+
+#include <qcamerainfocontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraInfoControl : public QCameraInfoControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraInfoControl(QObject *parent = 0);
+
+ QCamera::Position cameraPosition(const QString &deviceName) const;
+ int cameraOrientation(const QString &deviceName) const;
+
+ static QCamera::Position position(const QString &deviceName);
+ static int orientation(const QString &deviceName);
+};
+
+QT_END_NAMESPACE
+
+#endif // BBCAMERAINFOCONTROL_H
+
diff --git a/src/plugins/qnx/camera/bbcameraservice.cpp b/src/plugins/qnx/camera/bbcameraservice.cpp
index d9adc7c9d..98feee5a1 100644
--- a/src/plugins/qnx/camera/bbcameraservice.cpp
+++ b/src/plugins/qnx/camera/bbcameraservice.cpp
@@ -49,6 +49,7 @@
#include "bbcamerafocuscontrol.h"
#include "bbcameraimagecapturecontrol.h"
#include "bbcameraimageprocessingcontrol.h"
+#include "bbcamerainfocontrol.h"
#include "bbcameralockscontrol.h"
#include "bbcameramediarecordercontrol.h"
#include "bbcamerasession.h"
@@ -76,6 +77,7 @@ BbCameraService::BbCameraService(QObject *parent)
, m_cameraFocusControl(new BbCameraFocusControl(m_cameraSession, this))
, m_cameraImageCaptureControl(new BbCameraImageCaptureControl(m_cameraSession, this))
, m_cameraImageProcessingControl(new BbCameraImageProcessingControl(m_cameraSession, this))
+ , m_cameraInfoControl(new BbCameraInfoControl(this))
, m_cameraLocksControl(new BbCameraLocksControl(m_cameraSession, this))
, m_cameraMediaRecorderControl(new BbCameraMediaRecorderControl(m_cameraSession, this))
, m_cameraVideoEncoderSettingsControl(new BbCameraVideoEncoderSettingsControl(m_cameraSession, this))
@@ -101,6 +103,8 @@ QMediaControl* BbCameraService::requestControl(const char *name)
return m_cameraCaptureDestinationControl;
else if (qstrcmp(name, QCameraControl_iid) == 0)
return m_cameraControl;
+ else if (qstrcmp(name, QCameraInfoControl_iid) == 0)
+ return m_cameraInfoControl;
else if (qstrcmp(name, QCameraExposureControl_iid) == 0)
return m_cameraExposureControl;
else if (qstrcmp(name, QCameraFlashControl_iid) == 0)
diff --git a/src/plugins/qnx/camera/bbcameraservice.h b/src/plugins/qnx/camera/bbcameraservice.h
index 374d03c36..f87dd0ab0 100644
--- a/src/plugins/qnx/camera/bbcameraservice.h
+++ b/src/plugins/qnx/camera/bbcameraservice.h
@@ -56,6 +56,7 @@ class BbCameraFlashControl;
class BbCameraFocusControl;
class BbCameraImageCaptureControl;
class BbCameraImageProcessingControl;
+class BbCameraInfoControl;
class BbCameraLocksControl;
class BbCameraMediaRecorderControl;
class BbCameraSession;
@@ -89,6 +90,7 @@ private:
BbCameraFocusControl* m_cameraFocusControl;
BbCameraImageCaptureControl* m_cameraImageCaptureControl;
BbCameraImageProcessingControl* m_cameraImageProcessingControl;
+ BbCameraInfoControl* m_cameraInfoControl;
BbCameraLocksControl* m_cameraLocksControl;
BbCameraMediaRecorderControl* m_cameraMediaRecorderControl;
BbCameraVideoEncoderSettingsControl* m_cameraVideoEncoderSettingsControl;
diff --git a/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp
index 6a6e9d3cd..f0221e10b 100644
--- a/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp
+++ b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp
@@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE
BbVideoDeviceSelectorControl::BbVideoDeviceSelectorControl(BbCameraSession *session, QObject *parent)
: QVideoDeviceSelectorControl(parent)
, m_session(session)
+ , m_default(0)
, m_selected(0)
{
enumerateDevices(&m_devices, &m_descriptions);
@@ -56,7 +57,7 @@ BbVideoDeviceSelectorControl::BbVideoDeviceSelectorControl(BbCameraSession *sess
// pre-select the rear camera
const int index = m_devices.indexOf(BbCameraSession::cameraIdentifierRear());
if (index != -1)
- m_selected = index;
+ m_default = m_selected = index;
}
int BbVideoDeviceSelectorControl::deviceCount() const
@@ -82,7 +83,7 @@ QString BbVideoDeviceSelectorControl::deviceDescription(int index) const
int BbVideoDeviceSelectorControl::defaultDevice() const
{
- return 0;
+ return m_default;
}
int BbVideoDeviceSelectorControl::selectedDevice() const
diff --git a/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h
index 1987f5491..24396154a 100644
--- a/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h
+++ b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h
@@ -71,6 +71,7 @@ private:
QList<QByteArray> m_devices;
QStringList m_descriptions;
+ int m_default;
int m_selected;
};
diff --git a/src/plugins/qnx/camera/camera.pri b/src/plugins/qnx/camera/camera.pri
index 6665573b0..7e5fbeb34 100644
--- a/src/plugins/qnx/camera/camera.pri
+++ b/src/plugins/qnx/camera/camera.pri
@@ -10,6 +10,7 @@ HEADERS += \
$$PWD/bbcamerafocuscontrol.h \
$$PWD/bbcameraimagecapturecontrol.h \
$$PWD/bbcameraimageprocessingcontrol.h \
+ $$PWD/bbcamerainfocontrol.h \
$$PWD/bbcameralockscontrol.h \
$$PWD/bbcameramediarecordercontrol.h \
$$PWD/bbcameraorientationhandler.h \
@@ -33,6 +34,7 @@ SOURCES += \
$$PWD/bbcamerafocuscontrol.cpp \
$$PWD/bbcameraimagecapturecontrol.cpp \
$$PWD/bbcameraimageprocessingcontrol.cpp \
+ $$PWD/bbcamerainfocontrol.cpp \
$$PWD/bbcameralockscontrol.cpp \
$$PWD/bbcameramediarecordercontrol.cpp \
$$PWD/bbcameraorientationhandler.cpp \