From e26f5093c6d99c5b9632c3a0375c202bf4dbe627 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 10 Dec 2013 17:38:45 +0100 Subject: GStreamer: add missing breaks in QGstreamerRecorderControl. Task-number: QTBUG-34914 Change-Id: I8237201cb656a3cde23e3d750939fe11e35519cd Reviewed-by: Robin Burchell --- src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp index f08ba3286..257442156 100644 --- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp +++ b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp @@ -98,11 +98,14 @@ QMediaRecorder::Status QGstreamerRecorderControl::status() const switch ( m_session->state() ) { case QGstreamerCaptureSession::RecordingState: sessionState = QMediaRecorder::RecordingState; + break; case QGstreamerCaptureSession::PausedState: sessionState = QMediaRecorder::PausedState; + break; case QGstreamerCaptureSession::PreviewState: case QGstreamerCaptureSession::StoppedState: sessionState = QMediaRecorder::StoppedState; + break; } return statusTable[m_state][sessionState]; -- cgit v1.2.3 From 34f253e19d5687ccc383c52b5baa6d37ac9d4571 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Fri, 13 Dec 2013 15:37:50 +0100 Subject: PulseAudio: fix crash when failing to create a context. Don't try to call a function on a null PulseAudio context. If pa_context_new() fails, we now try again to connect to the pulse audio daemon later. Task-number: QTBUG-35456 Change-Id: I0b848d3f25f57651ab31b9eca7ceb1bc9df2f682 Reviewed-by: Christian Stromme --- src/multimedia/audio/qsoundeffect_pulse_p.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp index 8bac6c998..23e8d727f 100644 --- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp +++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp @@ -183,16 +183,17 @@ private Q_SLOTS: lock(); m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toLatin1().constData()); - pa_context_set_state_callback(m_context, context_state_callback, this); - if (m_context == 0) { qWarning("PulseAudioService: Unable to create new pulseaudio context"); pa_threaded_mainloop_unlock(m_mainLoop); pa_threaded_mainloop_free(m_mainLoop); m_mainLoop = 0; + onContextFailed(); return; } + pa_context_set_state_callback(m_context, context_state_callback, this); + if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) { qWarning("PulseAudioService: pa_context_connect() failed"); pa_context_unref(m_context); -- cgit v1.2.3 From eb84c34c2bb45a9864299288c81b95edcd339db1 Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Mon, 16 Dec 2013 20:00:24 +0100 Subject: Fixed some documentation for VideoOutput qml type. mapPointToSource() and mapPointToSourceNormalized() were documented with the wrong name. Change-Id: Ia128f698a02f1c865bc27443ef2c6cef8fc7a720 Reviewed-by: Christian Stromme --- src/imports/multimedia/qdeclarativevideooutput.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/imports/multimedia/qdeclarativevideooutput.cpp b/src/imports/multimedia/qdeclarativevideooutput.cpp index 240dc4699..6d6107e51 100644 --- a/src/imports/multimedia/qdeclarativevideooutput.cpp +++ b/src/imports/multimedia/qdeclarativevideooutput.cpp @@ -574,7 +574,7 @@ QRectF QDeclarativeVideoOutput::mapNormalizedRectToItem(const QRectF &rectangle) } /*! - \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToItem(const QPointF &point) const + \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToSource(const QPointF &point) const Given a point \a point in item coordinates, return the corresponding point in source coordinates. This mapping is @@ -612,7 +612,7 @@ QRectF QDeclarativeVideoOutput::mapRectToSource(const QRectF &rectangle) const } /*! - \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToItemNormalized(const QPointF &point) const + \qmlmethod QPointF QtMultimedia::VideoOutput::mapPointToSourceNormalized(const QPointF &point) const Given a point \a point in item coordinates, return the corresponding point in normalized source coordinates. This mapping is -- cgit v1.2.3 From a0d39a2ab6c94cdb59a8009611669304372915e6 Mon Sep 17 00:00:00 2001 From: Jeff Tranter Date: Thu, 2 Jan 2014 13:36:12 -0500 Subject: Fix some typos in documentation. Fix some spelling and grammatical errors in comments that show up in Qt documentation. No changes to code. Change-Id: Ieb7be17bd1d50751f00620f7ac28d09355856ac0 Reviewed-by: Yoann Lopes Reviewed-by: Sze Howe Koh --- src/multimedia/audio/qaudiodeviceinfo.cpp | 2 +- src/multimedia/controls/qcameraimageprocessingcontrol.cpp | 6 +++--- src/multimedia/doc/src/blackberry.qdoc | 2 +- src/multimedia/doc/src/changes.qdoc | 2 +- src/multimedia/playback/qmediaplaylist.cpp | 2 +- src/multimedia/video/qabstractvideobuffer.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp index 88d30899b..ff31f3534 100644 --- a/src/multimedia/audio/qaudiodeviceinfo.cpp +++ b/src/multimedia/audio/qaudiodeviceinfo.cpp @@ -127,7 +127,7 @@ public: order, channel, codec, frequency, sample rate, and sample type. A format is represented by the QAudioFormat class. - The values supported by the the device for each of these + The values supported by the device for each of these parameters can be fetched with supportedByteOrders(), supportedChannelCounts(), supportedCodecs(), supportedSampleRates(), supportedSampleSizes(), and diff --git a/src/multimedia/controls/qcameraimageprocessingcontrol.cpp b/src/multimedia/controls/qcameraimageprocessingcontrol.cpp index 7b2e3bbac..f9cb8c86f 100644 --- a/src/multimedia/controls/qcameraimageprocessingcontrol.cpp +++ b/src/multimedia/controls/qcameraimageprocessingcontrol.cpp @@ -120,8 +120,8 @@ QCameraImageProcessingControl::~QCameraImageProcessingControl() Returns true if the camera supports adjusting image processing \a parameter. - Usually the the supported settings is static, - but some parameter may not be available depending on other + Usually the supported setting is static, + but some parameters may not be available depending on other camera settings, like presets. In such case the currently supported parameters should be returned. */ @@ -129,7 +129,7 @@ QCameraImageProcessingControl::~QCameraImageProcessingControl() /*! \fn bool QCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const - Returns true if the camera supports settings the the image processing \a parameter \a value. + Returns true if the camera supports setting the image processing \a parameter \a value. It's used only for parameters with a limited set of values, like WhiteBalancePreset. */ diff --git a/src/multimedia/doc/src/blackberry.qdoc b/src/multimedia/doc/src/blackberry.qdoc index 4b494cb65..5af063651 100644 --- a/src/multimedia/doc/src/blackberry.qdoc +++ b/src/multimedia/doc/src/blackberry.qdoc @@ -59,7 +59,7 @@ supported in QMediaPlayer as well. Playlists as sources are also supported. mmrenderer does not allow access to the pixel data of video frames, hence Qt Multimedia classes like QVideoFrame and QAbstractVideoSurface will not work since they require access to the image data. QVideoWidget and the VideoOutput QML element are implemented with an overlay window; -mmrenderer creates a seperate window displaying a video and puts that on top of the Qt application. +mmrenderer creates a separate window displaying a video and puts that on top of the Qt application. As a consequence, no other widget or QML element can be put on top of the video, and QML shaders have no effect. diff --git a/src/multimedia/doc/src/changes.qdoc b/src/multimedia/doc/src/changes.qdoc index 10e9d92b8..d517ef41c 100644 --- a/src/multimedia/doc/src/changes.qdoc +++ b/src/multimedia/doc/src/changes.qdoc @@ -125,7 +125,7 @@ changed in ways that may affect previously written code. This table highlights s you will probably need to remove them. \row \li QSoundEffect availability - \li The SoundEffect QML type was publically accessible in Qt Multimeda Kit, + \li The SoundEffect QML type was publicly accessible in Qt Multimeda Kit, and now the C++ version is officially public too. If your code contains the previously undocumented QSoundEffect, you may need to update it. \row diff --git a/src/multimedia/playback/qmediaplaylist.cpp b/src/multimedia/playback/qmediaplaylist.cpp index 78f345032..68a8917f5 100644 --- a/src/multimedia/playback/qmediaplaylist.cpp +++ b/src/multimedia/playback/qmediaplaylist.cpp @@ -88,7 +88,7 @@ namespace like QMediaPlayer. QMediaPlaylist allows to access the service intrinsic playlist functionality - if available, otherwise it provides the the local memory playlist implementation. + if available, otherwise it provides the local memory playlist implementation. \snippet multimedia-snippets/media.cpp Movie playlist diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp index e20c42159..5f69382e3 100644 --- a/src/multimedia/video/qabstractvideobuffer.cpp +++ b/src/multimedia/video/qabstractvideobuffer.cpp @@ -78,7 +78,7 @@ namespace a new hardware accelerated video system, for example. The contents of a buffer can be accessed by mapping the buffer to memory using the map() - function, which returns a pointer to memory containing the contents of the the video buffer. + function, which returns a pointer to memory containing the contents of the video buffer. The memory returned by map() is released by calling the unmap() function. The handle() of a buffer may also be used to manipulate its contents using type specific APIs. -- cgit v1.2.3 From 0ebcf43f2235017a6844948ef6d26c74865083aa Mon Sep 17 00:00:00 2001 From: Denis Kormalev Date: Wed, 8 Jan 2014 17:06:59 +0400 Subject: Android: QVideoProbe support for camera QMediaVideoProbeControl sublclass added to capture service to make QVideoProbe work with Android camera. [ChangeLog][QtMultimedia][Android] QVideoProbe support for camera Task-number: QTBUG-35416 Change-Id: I14d0a0e8abd14ee8f577e2901b976b8ed46eb320 Reviewed-by: Yoann Lopes --- .../qtproject/qt5/android/multimedia/QtCamera.java | 11 ++++ .../android/src/mediacapture/mediacapture.pri | 6 ++- .../src/mediacapture/qandroidcamerasession.cpp | 52 +++++++++++++++++-- .../src/mediacapture/qandroidcamerasession.h | 11 ++++ .../src/mediacapture/qandroidcaptureservice.cpp | 30 +++++++++-- .../qandroidmediavideoprobecontrol.cpp | 59 ++++++++++++++++++++++ .../mediacapture/qandroidmediavideoprobecontrol.h | 59 ++++++++++++++++++++++ src/plugins/android/src/wrappers/jcamera.cpp | 29 ++++++++++- src/plugins/android/src/wrappers/jcamera.h | 2 + 9 files changed, 248 insertions(+), 11 deletions(-) create mode 100644 src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.cpp create mode 100644 src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.h diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtCamera.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtCamera.java index 4aa07b713..f03053f17 100644 --- a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtCamera.java +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtCamera.java @@ -60,6 +60,7 @@ public class QtCamera implements Camera.ShutterCallback, private int m_actualPreviewBuffer = 0; private final ReentrantLock m_buffersLock = new ReentrantLock(); private boolean m_isReleased = false; + private boolean m_fetchEachFrame = false; private static final String TAG = "Qt Camera"; @@ -141,6 +142,11 @@ public class QtCamera implements Camera.ShutterCallback, } } + public void fetchEachFrame(boolean fetch) + { + m_fetchEachFrame = fetch; + } + public void startPreview() { Camera.Size previewSize = m_camera.getParameters().getPreviewSize(); @@ -233,6 +239,10 @@ public class QtCamera implements Camera.ShutterCallback, public void onPreviewFrame(byte[] data, Camera camera) { m_buffersLock.lock(); + + if (data != null && m_fetchEachFrame) + notifyFrameFetched(m_cameraId, data); + if (data == m_cameraPreviewFirstBuffer) m_actualPreviewBuffer = 1; else if (data == m_cameraPreviewSecondBuffer) @@ -252,4 +262,5 @@ public class QtCamera implements Camera.ShutterCallback, private static native void notifyAutoFocusComplete(int id, boolean success); private static native void notifyPictureExposed(int id); private static native void notifyPictureCaptured(int id, byte[] data); + private static native void notifyFrameFetched(int id, byte[] data); } diff --git a/src/plugins/android/src/mediacapture/mediacapture.pri b/src/plugins/android/src/mediacapture/mediacapture.pri index d994bebfd..242afe657 100644 --- a/src/plugins/android/src/mediacapture/mediacapture.pri +++ b/src/plugins/android/src/mediacapture/mediacapture.pri @@ -21,7 +21,8 @@ SOURCES += \ $$PWD/qandroidaudioencodersettingscontrol.cpp \ $$PWD/qandroidmediacontainercontrol.cpp \ $$PWD/qandroidvideoencodersettingscontrol.cpp \ - $$PWD/qandroidaudioinputselectorcontrol.cpp + $$PWD/qandroidaudioinputselectorcontrol.cpp \ + $$PWD/qandroidmediavideoprobecontrol.cpp HEADERS += \ $$PWD/qandroidcaptureservice.h \ @@ -44,4 +45,5 @@ HEADERS += \ $$PWD/qandroidaudioencodersettingscontrol.h \ $$PWD/qandroidmediacontainercontrol.h \ $$PWD/qandroidvideoencodersettingscontrol.h \ - $$PWD/qandroidaudioinputselectorcontrol.h + $$PWD/qandroidaudioinputselectorcontrol.h \ + $$PWD/qandroidmediavideoprobecontrol.h diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp index cb5282394..86c5e3120 100644 --- a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp @@ -44,11 +44,13 @@ #include "jcamera.h" #include "jmultimediautils.h" #include "qandroidvideooutput.h" +#include "qandroidmediavideoprobecontrol.h" #include "qandroidmultimediautils.h" #include #include #include #include +#include QT_BEGIN_NAMESPACE @@ -183,6 +185,9 @@ bool QAndroidCameraSession::open() if (m_camera) { connect(m_camera, SIGNAL(pictureExposed()), this, SLOT(onCameraPictureExposed())); connect(m_camera, SIGNAL(previewFetched(QByteArray)), this, SLOT(onCameraPreviewFetched(QByteArray))); + connect(m_camera, SIGNAL(frameFetched(QByteArray)), + this, SLOT(onCameraFrameFetched(QByteArray)), + Qt::DirectConnection); connect(m_camera, SIGNAL(pictureCaptured(QByteArray)), this, SLOT(onCameraPictureCaptured(QByteArray))); connect(m_camera, SIGNAL(previewStarted()), this, SLOT(onCameraPreviewStarted())); connect(m_camera, SIGNAL(previewStopped()), this, SLOT(onCameraPreviewStopped())); @@ -200,6 +205,8 @@ bool QAndroidCameraSession::open() if (m_camera->getPreviewFormat() != JCamera::NV21) m_camera->setPreviewFormat(JCamera::NV21); + m_camera->fetchEachFrame(m_videoProbes.count()); + emit opened(); } else { m_status = QCamera::UnavailableStatus; @@ -364,6 +371,25 @@ int QAndroidCameraSession::currentCameraRotation() const return rotation; } +void QAndroidCameraSession::addProbe(QAndroidMediaVideoProbeControl *probe) +{ + m_videoProbesMutex.lock(); + if (probe) + m_videoProbes << probe; + if (m_camera) + m_camera->fetchEachFrame(m_videoProbes.count()); + m_videoProbesMutex.unlock(); +} + +void QAndroidCameraSession::removeProbe(QAndroidMediaVideoProbeControl *probe) +{ + m_videoProbesMutex.lock(); + m_videoProbes.remove(probe); + if (m_camera) + m_camera->fetchEachFrame(m_videoProbes.count()); + m_videoProbesMutex.unlock(); +} + void QAndroidCameraSession::applyImageSettings() { if (!m_camera || !m_imageSettingsDirty) @@ -513,6 +539,19 @@ void QAndroidCameraSession::onCameraPreviewFetched(const QByteArray &preview) } } +void QAndroidCameraSession::onCameraFrameFetched(const QByteArray &frame) +{ + m_videoProbesMutex.lock(); + if (frame.size() && m_videoProbes.count()) { + QVideoFrame videoFrame(new DataVideoBuffer(frame), + m_camera->previewSize(), + QVideoFrame::Format_NV21); + foreach (QAndroidMediaVideoProbeControl *probe, m_videoProbes) + probe->newFrameProbed(videoFrame); + } + m_videoProbesMutex.unlock(); +} + void QAndroidCameraSession::onCameraPictureCaptured(const QByteArray &data) { if (!m_captureCanceled) { @@ -592,11 +631,16 @@ void QAndroidCameraSession::processCapturedImage(int id, } void QAndroidCameraSession::processPreviewImage(int id, const QByteArray &data, int rotation) +{ + emit imageCaptured(id, prepareImageFromPreviewData(data, rotation)); +} + +QImage QAndroidCameraSession::prepareImageFromPreviewData(const QByteArray &data, int rotation) { QSize frameSize = m_camera->previewSize(); - QImage preview(frameSize, QImage::Format_ARGB32); + QImage result(frameSize, QImage::Format_ARGB32); qt_convert_NV21_to_ARGB32((const uchar *)data.constData(), - (quint32 *)preview.bits(), + (quint32 *)result.bits(), frameSize.width(), frameSize.height()); @@ -610,9 +654,9 @@ void QAndroidCameraSession::processPreviewImage(int id, const QByteArray &data, transform.rotate(rotation); - preview = preview.transformed(transform); + result = result.transformed(transform); - emit imageCaptured(id, preview); + return result; } void QAndroidCameraSession::onVideoOutputReady(bool ready) diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.h b/src/plugins/android/src/mediacapture/qandroidcamerasession.h index a621404a3..e0fd93cdb 100644 --- a/src/plugins/android/src/mediacapture/qandroidcamerasession.h +++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.h @@ -45,12 +45,15 @@ #include #include #include +#include +#include #include "qandroidmediastoragelocation.h" QT_BEGIN_NAMESPACE class JCamera; class QAndroidVideoOutput; +class QAndroidMediaVideoProbeControl; class QAndroidCameraSession : public QObject { @@ -90,6 +93,9 @@ public: int currentCameraRotation() const; + void addProbe(QAndroidMediaVideoProbeControl *probe); + void removeProbe(QAndroidMediaVideoProbeControl *probe); + Q_SIGNALS: void statusChanged(QCamera::Status status); void stateChanged(QCamera::State); @@ -114,6 +120,7 @@ private Q_SLOTS: void onCameraPictureExposed(); void onCameraPreviewFetched(const QByteArray &preview); + void onCameraFrameFetched(const QByteArray &frame); void onCameraPictureCaptured(const QByteArray &data); void onCameraPreviewStarted(); void onCameraPreviewStopped(); @@ -127,6 +134,7 @@ private: void applyImageSettings(); void processPreviewImage(int id, const QByteArray &data, int rotation); + QImage prepareImageFromPreviewData(const QByteArray &data, int rotation); void processCapturedImage(int id, const QByteArray &data, const QSize &resolution, @@ -156,6 +164,9 @@ private: QString m_currentImageCaptureFileName; QAndroidMediaStorageLocation m_mediaStorageLocation; + + QSet m_videoProbes; + QMutex m_videoProbesMutex; }; QT_END_NAMESPACE diff --git a/src/plugins/android/src/mediacapture/qandroidcaptureservice.cpp b/src/plugins/android/src/mediacapture/qandroidcaptureservice.cpp index 3468c64e5..4a38ff5e9 100644 --- a/src/plugins/android/src/mediacapture/qandroidcaptureservice.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcaptureservice.cpp @@ -61,6 +61,7 @@ #include "qandroidaudioencodersettingscontrol.h" #include "qandroidvideoencodersettingscontrol.h" #include "qandroidmediacontainercontrol.h" +#include "qandroidmediavideoprobecontrol.h" #include @@ -201,16 +202,37 @@ QMediaControl *QAndroidCaptureService::requestControl(const char *name) return m_videoRendererControl; } + if (qstrcmp(name,QMediaVideoProbeControl_iid) == 0) { + QAndroidMediaVideoProbeControl *videoProbe = 0; + if (m_cameraSession) { + videoProbe = new QAndroidMediaVideoProbeControl(this); + m_cameraSession->addProbe(videoProbe); + } + return videoProbe; + } + return 0; } void QAndroidCaptureService::releaseControl(QMediaControl *control) { - if (control && control == m_videoRendererControl) { - m_cameraSession->setVideoPreview(0); - delete m_videoRendererControl; - m_videoRendererControl = 0; + if (control) { + if (control == m_videoRendererControl) { + m_cameraSession->setVideoPreview(0); + delete m_videoRendererControl; + m_videoRendererControl = 0; + return; + } + + QAndroidMediaVideoProbeControl *videoProbe = qobject_cast(control); + if (videoProbe) { + if (m_cameraSession) + m_cameraSession->removeProbe(videoProbe); + delete videoProbe; + return; + } } + } QT_END_NAMESPACE diff --git a/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.cpp b/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.cpp new file mode 100644 index 000000000..a4ebc8fe4 --- /dev/null +++ b/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.cpp @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Integrated Computer Solutions, Inc +** 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 "qandroidmediavideoprobecontrol.h" +#include + +QAndroidMediaVideoProbeControl::QAndroidMediaVideoProbeControl(QObject *parent) : + QMediaVideoProbeControl(parent) +{ +} + +QAndroidMediaVideoProbeControl::~QAndroidMediaVideoProbeControl() +{ + +} + +void QAndroidMediaVideoProbeControl::newFrameProbed(const QVideoFrame &frame) +{ + emit videoFrameProbed(frame); +} diff --git a/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.h b/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.h new file mode 100644 index 000000000..7bb34d883 --- /dev/null +++ b/src/plugins/android/src/mediacapture/qandroidmediavideoprobecontrol.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2013 Integrated Computer Solutions, Inc +** 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 QANDROIDMEDIAVIDEOPROBECONTROL_H +#define QANDROIDMEDIAVIDEOPROBECONTROL_H + +#include + +class QAndroidMediaVideoProbeControl : public QMediaVideoProbeControl +{ + Q_OBJECT +public: + explicit QAndroidMediaVideoProbeControl(QObject *parent = 0); + virtual ~QAndroidMediaVideoProbeControl(); + + void newFrameProbed(const QVideoFrame& frame); + +}; + +#endif // QANDROIDMEDIAVIDEOPROBECONTROL_H diff --git a/src/plugins/android/src/wrappers/jcamera.cpp b/src/plugins/android/src/wrappers/jcamera.cpp index 0c7455fae..d24a59a38 100644 --- a/src/plugins/android/src/wrappers/jcamera.cpp +++ b/src/plugins/android/src/wrappers/jcamera.cpp @@ -111,6 +111,21 @@ static void notifyPictureCaptured(JNIEnv *env, jobject, int id, jbyteArray data) } } +static void notifyFrameFetched(JNIEnv *env, jobject, int id, jbyteArray data) +{ + g_objectMapMutex.lock(); + JCamera *obj = g_objectMap.value(id, 0); + g_objectMapMutex.unlock(); + if (obj) { + QByteArray bytes; + int arrayLength = env->GetArrayLength(data); + bytes.resize(arrayLength); + env->GetByteArrayRegion(data, 0, arrayLength, (jbyte*)bytes.data()); + + Q_EMIT obj->frameFetched(bytes); + } +} + class JCameraInstantiator : public QObject { Q_OBJECT @@ -201,6 +216,7 @@ class JCameraWorker : public QObject, public QJNIObjectPrivate Q_INVOKABLE void startPreview(); Q_INVOKABLE void stopPreview(); + Q_INVOKABLE void fetchEachFrame(bool fetch); Q_INVOKABLE void fetchLastPreviewFrame(); Q_INVOKABLE void applyParameters(); @@ -571,6 +587,11 @@ void JCamera::takePicture() QMetaObject::invokeMethod(d, "callVoidMethod", Q_ARG(QByteArray, "takePicture")); } +void JCamera::fetchEachFrame(bool fetch) +{ + QMetaObject::invokeMethod(d, "fetchEachFrame", Q_ARG(bool, fetch)); +} + void JCamera::fetchLastPreviewFrame() { QMetaObject::invokeMethod(d, "fetchLastPreviewFrame"); @@ -1165,6 +1186,11 @@ void JCameraWorker::stopPreview() emit previewStopped(); } +void JCameraWorker::fetchEachFrame(bool fetch) +{ + callMethod("fetchEachFrame", "(Z)V", fetch); +} + void JCameraWorker::fetchLastPreviewFrame() { QJNIEnvironmentPrivate env; @@ -1224,7 +1250,8 @@ void JCameraWorker::callVoidMethod(const QByteArray &methodName) static JNINativeMethod methods[] = { {"notifyAutoFocusComplete", "(IZ)V", (void *)notifyAutoFocusComplete}, {"notifyPictureExposed", "(I)V", (void *)notifyPictureExposed}, - {"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured} + {"notifyPictureCaptured", "(I[B)V", (void *)notifyPictureCaptured}, + {"notifyFrameFetched", "(I[B)V", (void *)notifyFrameFetched} }; bool JCamera::initJNI(JNIEnv *env) diff --git a/src/plugins/android/src/wrappers/jcamera.h b/src/plugins/android/src/wrappers/jcamera.h index 9b2f5b177..535efe214 100644 --- a/src/plugins/android/src/wrappers/jcamera.h +++ b/src/plugins/android/src/wrappers/jcamera.h @@ -155,6 +155,7 @@ public: void takePicture(); + void fetchEachFrame(bool fetch); void fetchLastPreviewFrame(); QJNIObjectPrivate getCameraObject(); @@ -173,6 +174,7 @@ Q_SIGNALS: void pictureExposed(); void pictureCaptured(const QByteArray &data); void previewFetched(const QByteArray &preview); + void frameFetched(const QByteArray &frame); private: JCamera(int cameraId, jobject cam, QThread *workerThread); -- cgit v1.2.3 From f74d7393b88b89933b286b61e4e67ef46809448b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 8 Jan 2014 17:59:46 +0100 Subject: Mark tst_qcamerabackend test as insignificant on Mac OS X It has failed 6 times during qt5.git stable integrations since September 2013 See also QTBUG-36040 Change-Id: I6abd5b2723d2346a4831ab28fa040c14615148b0 Reviewed-by: Yoann Lopes --- tests/auto/integration/qcamerabackend/qcamerabackend.pro | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/auto/integration/qcamerabackend/qcamerabackend.pro b/tests/auto/integration/qcamerabackend/qcamerabackend.pro index 1a0c44ea8..c39ce9c41 100644 --- a/tests/auto/integration/qcamerabackend/qcamerabackend.pro +++ b/tests/auto/integration/qcamerabackend/qcamerabackend.pro @@ -8,3 +8,5 @@ CONFIG += testcase SOURCES += tst_qcamerabackend.cpp DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + +mac: CONFIG += insignificant_test # QTBUG-36040 -- cgit v1.2.3 From da89319f3859b30cf4cf03a53b50677092138921 Mon Sep 17 00:00:00 2001 From: Bernd Weimer Date: Wed, 8 Jan 2014 16:09:13 +0100 Subject: BlackBerry: Fixed volume setting Mute status is taken into account when setting the volume. Change-Id: Id2b9c7f6a1e5b6e4f5d4c82830544394c714b48f Reviewed-by: Thomas McGuire --- src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp index 2a376198b..e80001793 100644 --- a/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp @@ -530,7 +530,7 @@ void MmRendererMediaPlayerControl::play() } setPositionInternal(m_position); - setVolumeInternal(m_volume); + setVolumeInternal(m_muted ? 0 : m_volume); setPlaybackRateInternal(m_rate); if (mmr_play(m_context) != 0) { -- cgit v1.2.3