We also now correctly report the default camera to be the rear camera.
Change-Id: Ie96b2950344194637c8feace77246f036c9a3757
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
****************************************************************************/
#include "bbserviceplugin.h"
+#include "bbcamerainfocontrol.h"
#include "bbcameraservice.h"
+#include "bbcamerasession.h"
#include "bbvideodeviceselectorcontrol.h"
#include "mmrenderermediaplayerservice.h"
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
: 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:
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;
--- /dev/null
+/****************************************************************************
+**
+** 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
+
--- /dev/null
+/****************************************************************************
+**
+** 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
+
#include "bbcamerafocuscontrol.h"
#include "bbcameraimagecapturecontrol.h"
#include "bbcameraimageprocessingcontrol.h"
+#include "bbcamerainfocontrol.h"
#include "bbcameralockscontrol.h"
#include "bbcameramediarecordercontrol.h"
#include "bbcamerasession.h"
, 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))
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)
class BbCameraFocusControl;
class BbCameraImageCaptureControl;
class BbCameraImageProcessingControl;
+class BbCameraInfoControl;
class BbCameraLocksControl;
class BbCameraMediaRecorderControl;
class BbCameraSession;
BbCameraFocusControl* m_cameraFocusControl;
BbCameraImageCaptureControl* m_cameraImageCaptureControl;
BbCameraImageProcessingControl* m_cameraImageProcessingControl;
+ BbCameraInfoControl* m_cameraInfoControl;
BbCameraLocksControl* m_cameraLocksControl;
BbCameraMediaRecorderControl* m_cameraMediaRecorderControl;
BbCameraVideoEncoderSettingsControl* m_cameraVideoEncoderSettingsControl;
BbVideoDeviceSelectorControl::BbVideoDeviceSelectorControl(BbCameraSession *session, QObject *parent)
: QVideoDeviceSelectorControl(parent)
, m_session(session)
+ , m_default(0)
, m_selected(0)
{
enumerateDevices(&m_devices, &m_descriptions);
// 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
int BbVideoDeviceSelectorControl::defaultDevice() const
{
- return 0;
+ return m_default;
}
int BbVideoDeviceSelectorControl::selectedDevice() const
QList<QByteArray> m_devices;
QStringList m_descriptions;
+ int m_default;
int m_selected;
};
$$PWD/bbcamerafocuscontrol.h \
$$PWD/bbcameraimagecapturecontrol.h \
$$PWD/bbcameraimageprocessingcontrol.h \
+ $$PWD/bbcamerainfocontrol.h \
$$PWD/bbcameralockscontrol.h \
$$PWD/bbcameramediarecordercontrol.h \
$$PWD/bbcameraorientationhandler.h \
$$PWD/bbcamerafocuscontrol.cpp \
$$PWD/bbcameraimagecapturecontrol.cpp \
$$PWD/bbcameraimageprocessingcontrol.cpp \
+ $$PWD/bbcamerainfocontrol.cpp \
$$PWD/bbcameralockscontrol.cpp \
$$PWD/bbcameramediarecordercontrol.cpp \
$$PWD/bbcameraorientationhandler.cpp \