summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabian Bumberger <fbumberger@rim.com>2013-10-04 01:16:52 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-10-10 17:55:19 +0200
commit2e1d38a3c719cddd4089709820985822309dc477 (patch)
tree4999ff5c091266487eaeefb1a2891ef4fd57ac8b
parent4cd39cc52f52b07650ea3deb9195b309e214e50f (diff)
Enable camera on the Playbook
Change-Id: I61537899bee63150861df57f9140316eca6a6eed Reviewed-by: Bernd Weimer <bweimer@blackberry.com> Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
-rw-r--r--src/plugins/blackberry/bbserviceplugin.cpp6
-rw-r--r--src/plugins/blackberry/blackberry.pro4
-rw-r--r--src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp4
-rw-r--r--src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp13
-rw-r--r--src/plugins/blackberry/camera/bbcameraorientationhandler.cpp2
-rw-r--r--src/plugins/blackberry/camera/bbcamerasession.cpp25
-rw-r--r--src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp2
-rw-r--r--src/plugins/blackberry/camera/camera.pri6
8 files changed, 45 insertions, 17 deletions
diff --git a/src/plugins/blackberry/bbserviceplugin.cpp b/src/plugins/blackberry/bbserviceplugin.cpp
index 0a9abd71d..dab3caf9b 100644
--- a/src/plugins/blackberry/bbserviceplugin.cpp
+++ b/src/plugins/blackberry/bbserviceplugin.cpp
@@ -40,10 +40,8 @@
****************************************************************************/
#include "bbserviceplugin.h"
-#ifndef Q_OS_BLACKBERRY_TABLET
#include "bbcameraservice.h"
#include "bbvideodeviceselectorcontrol.h"
-#endif
#include "bbmediaplayerservice.h"
#include <QDebug>
@@ -56,10 +54,8 @@ BbServicePlugin::BbServicePlugin()
QMediaService *BbServicePlugin::create(const QString &key)
{
-#ifndef Q_OS_BLACKBERRY_TABLET
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new BbCameraService();
-#endif
if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
return new BbMediaPlayerService();
@@ -106,9 +102,7 @@ QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByt
void BbServicePlugin::updateDevices() const
{
-#ifndef Q_OS_BLACKBERRY_TABLET
BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions);
-#endif
if (m_cameraDevices.isEmpty()) {
qWarning() << "No camera devices found";
diff --git a/src/plugins/blackberry/blackberry.pro b/src/plugins/blackberry/blackberry.pro
index 5684645fb..e0a6233ce 100644
--- a/src/plugins/blackberry/blackberry.pro
+++ b/src/plugins/blackberry/blackberry.pro
@@ -12,9 +12,7 @@ SOURCES += bbserviceplugin.cpp
include(common/common.pri)
-!blackberry-playbook {
- include(camera/camera.pri)
-}
+include(camera/camera.pri)
include(mediaplayer/mediaplayer.pri)
diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp
index a24fdbaf1..b1d637cd0 100644
--- a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp
+++ b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp
@@ -139,6 +139,7 @@ QVariant BbCameraExposureControl::requestedValue(ExposureParameter parameter) co
QVariant BbCameraExposureControl::actualValue(ExposureParameter parameter) const
{
+#ifndef Q_OS_BLACKBERRY_TABLET
if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment
return QVariantList();
@@ -170,6 +171,9 @@ QVariant BbCameraExposureControl::actualValue(ExposureParameter parameter) const
default:
return QVariant();
}
+#else
+ return QVariant();
+#endif
}
bool BbCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp
index a4a42abf8..44c19fb46 100644
--- a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp
+++ b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp
@@ -45,11 +45,14 @@
#include <QDebug>
#include <QUrl>
+#ifndef Q_OS_BLACKBERRY_TABLET
#include <audio/audio_manager_device.h>
#include <audio/audio_manager_volume.h>
+#endif
QT_BEGIN_NAMESPACE
+#ifndef Q_OS_BLACKBERRY_TABLET
static audio_manager_device_t currentAudioInputDevice()
{
audio_manager_device_t device = AUDIO_DEVICE_HEADSET;
@@ -62,6 +65,7 @@ static audio_manager_device_t currentAudioInputDevice()
return device;
}
+#endif
BbCameraMediaRecorderControl::BbCameraMediaRecorderControl(BbCameraSession *session, QObject *parent)
: QMediaRecorderControl(parent)
@@ -103,12 +107,13 @@ bool BbCameraMediaRecorderControl::isMuted() const
{
bool muted = false;
+#ifndef Q_OS_BLACKBERRY_TABLET
const int result = audio_manager_get_input_mute(currentAudioInputDevice(), &muted);
if (result != EOK) {
emit const_cast<BbCameraMediaRecorderControl*>(this)->error(QMediaRecorder::ResourceError, tr("Unable to retrieve mute status"));
return false;
}
-
+#endif
return muted;
}
@@ -116,11 +121,13 @@ qreal BbCameraMediaRecorderControl::volume() const
{
double level = 0.0;
+#ifndef Q_OS_BLACKBERRY_TABLET
const int result = audio_manager_get_input_level(currentAudioInputDevice(), &level);
if (result != EOK) {
emit const_cast<BbCameraMediaRecorderControl*>(this)->error(QMediaRecorder::ResourceError, tr("Unable to retrieve audio input volume"));
return 0.0;
}
+#endif
return (level / 100);
}
@@ -137,22 +144,26 @@ void BbCameraMediaRecorderControl::setState(QMediaRecorder::State state)
void BbCameraMediaRecorderControl::setMuted(bool muted)
{
+#ifndef Q_OS_BLACKBERRY_TABLET
const int result = audio_manager_set_input_mute(currentAudioInputDevice(), muted);
if (result != EOK) {
emit error(QMediaRecorder::ResourceError, tr("Unable to set mute status"));
} else {
emit mutedChanged(muted);
}
+#endif
}
void BbCameraMediaRecorderControl::setVolume(qreal volume)
{
+#ifndef Q_OS_BLACKBERRY_TABLET
const int result = audio_manager_set_input_level(currentAudioInputDevice(), (volume * 100));
if (result != EOK) {
emit error(QMediaRecorder::ResourceError, tr("Unable to set audio input volume"));
} else {
emit volumeChanged(volume);
}
+#endif
}
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp b/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp
index 7e89162a8..b715249f9 100644
--- a/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp
+++ b/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp
@@ -70,9 +70,11 @@ BbCameraOrientationHandler::BbCameraOrientationHandler(QObject *parent)
BbCameraOrientationHandler::~BbCameraOrientationHandler()
{
+#ifndef Q_OS_BLACKBERRY_TABLET
const int result = orientation_stop_events(0);
if (result == BPS_FAILURE)
qWarning() << "Unable to unregister for orientation change events";
+#endif
QCoreApplication::eventDispatcher()->removeNativeEventFilter(this);
}
diff --git a/src/plugins/blackberry/camera/bbcamerasession.cpp b/src/plugins/blackberry/camera/bbcamerasession.cpp
index 24e0a3796..707397992 100644
--- a/src/plugins/blackberry/camera/bbcamerasession.cpp
+++ b/src/plugins/blackberry/camera/bbcamerasession.cpp
@@ -85,16 +85,18 @@ static QString errorToString(camera_error_t error)
return QLatin1String("Communication timeout");
case CAMERA_EALREADY:
return QLatin1String("Operation already in progress");
- case CAMERA_ENOSPC:
- return QLatin1String("Disk is full");
case CAMERA_EUNINIT:
return QLatin1String("Camera library not initialized");
case CAMERA_EREGFAULT:
return QLatin1String("Callback registration failed");
case CAMERA_EMICINUSE:
return QLatin1String("Microphone in use already");
+#ifndef Q_OS_BLACKBERRY_TABLET
case CAMERA_EDESKTOPCAMERAINUSE:
return QLatin1String("Desktop camera in use already");
+ case CAMERA_ENOSPC:
+ return QLatin1String("Disk is full");
+#endif
default:
return QLatin1String("Unknown error");
}
@@ -648,6 +650,9 @@ void BbCameraSession::applyVideoSettings()
return;
}
+ const QSize resolution = m_videoEncoderSettings.resolution();
+
+#ifndef Q_OS_BLACKBERRY_TABLET
QString videoCodec = m_videoEncoderSettings.codec();
if (videoCodec.isEmpty())
videoCodec = QLatin1String("h264");
@@ -660,8 +665,6 @@ void BbCameraSession::applyVideoSettings()
else if (videoCodec == QLatin1String("h264"))
cameraVideoCodec = CAMERA_VIDEOCODEC_H264;
- const QSize resolution = m_videoEncoderSettings.resolution();
-
qreal frameRate = m_videoEncoderSettings.frameRate();
if (frameRate == 0) {
const QList<qreal> frameRates = supportedFrameRates(QVideoEncoderSettings(), 0);
@@ -680,12 +683,16 @@ void BbCameraSession::applyVideoSettings()
cameraAudioCodec = CAMERA_AUDIOCODEC_AAC;
else if (audioCodec == QLatin1String("raw"))
cameraAudioCodec = CAMERA_AUDIOCODEC_RAW;
-
result = camera_set_video_property(m_handle,
CAMERA_IMGPROP_WIDTH, resolution.width(),
CAMERA_IMGPROP_HEIGHT, resolution.height(),
CAMERA_IMGPROP_VIDEOCODEC, cameraVideoCodec,
CAMERA_IMGPROP_AUDIOCODEC, cameraAudioCodec);
+#else
+ result = camera_set_video_property(m_handle,
+ CAMERA_IMGPROP_WIDTH, resolution.width(),
+ CAMERA_IMGPROP_HEIGHT, resolution.height());
+#endif
if (result != CAMERA_EOK) {
qWarning() << "Unable to apply video settings:" << result;
@@ -969,10 +976,14 @@ static void viewFinderStatusCallback(camera_handle_t handle, camera_devstatus_t
if (status == CAMERA_STATUS_FOCUS_CHANGE) {
BbCameraSession *session = static_cast<BbCameraSession*>(context);
QMetaObject::invokeMethod(session, "handleFocusStatusChanged", Qt::QueuedConnection, Q_ARG(int, value));
- } else if (status == CAMERA_STATUS_POWERUP) {
+ return;
+ }
+#ifndef Q_OS_BLACKBERRY_TABLET
+ else if (status == CAMERA_STATUS_POWERUP) {
BbCameraSession *session = static_cast<BbCameraSession*>(context);
QMetaObject::invokeMethod(session, "handleCameraPowerUp", Qt::QueuedConnection);
}
+#endif
}
bool BbCameraSession::startViewFinder()
@@ -1149,6 +1160,7 @@ static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatu
Q_UNUSED(handle)
Q_UNUSED(value)
+#ifndef Q_OS_BLACKBERRY_TABLET
if (status == CAMERA_STATUS_VIDEO_PAUSE) {
BbCameraSession *session = static_cast<BbCameraSession*>(context);
QMetaObject::invokeMethod(session, "handleVideoRecordingPaused", Qt::QueuedConnection);
@@ -1156,6 +1168,7 @@ static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatu
BbCameraSession *session = static_cast<BbCameraSession*>(context);
QMetaObject::invokeMethod(session, "handleVideoRecordingResumed", Qt::QueuedConnection);
}
+#endif
}
bool BbCameraSession::startVideoRecording()
diff --git a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp
index a63d7a731..5c7671e80 100644
--- a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp
+++ b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp
@@ -156,10 +156,12 @@ QVariant BbCameraViewfinderSettingsControl::viewfinderParameter(ViewfinderParame
return QVideoFrame::Format_Invalid;
case CAMERA_FRAMETYPE_CBYCRY:
return QVideoFrame::Format_Invalid;
+#ifndef Q_OS_BLACKBERRY_TABLET
case CAMERA_FRAMETYPE_COMPRESSEDVIDEO:
return QVideoFrame::Format_Invalid;
case CAMERA_FRAMETYPE_COMPRESSEDAUDIO:
return QVideoFrame::Format_Invalid;
+#endif
default:
return QVideoFrame::Format_Invalid;
}
diff --git a/src/plugins/blackberry/camera/camera.pri b/src/plugins/blackberry/camera/camera.pri
index 8186cdcc6..6665573b0 100644
--- a/src/plugins/blackberry/camera/camera.pri
+++ b/src/plugins/blackberry/camera/camera.pri
@@ -46,4 +46,8 @@ SOURCES += \
$$PWD/bbvideodeviceselectorcontrol.cpp \
$$PWD/bbvideorenderercontrol.cpp
-LIBS += -lcamapi -laudio_manager
+LIBS += -lcamapi
+
+!blackberry-playbook {
+ LIBS += -laudio_manager
+}