diff options
-rw-r--r-- | config.tests/opensles/main.cpp | 47 | ||||
-rw-r--r-- | config.tests/opensles/opensles.pro | 2 | ||||
-rw-r--r-- | qtmultimedia.pro | 1 | ||||
-rw-r--r-- | src/gsttools/gsttools.pro | 16 | ||||
-rw-r--r-- | src/imports/audioengine/qmldir | 1 | ||||
-rw-r--r-- | src/imports/multimedia/qmldir | 2 | ||||
-rw-r--r-- | src/multimedia/audio/audio.pri | 4 | ||||
-rw-r--r-- | src/multimedia/audio/qsoundeffect_qaudio_p.cpp | 3 | ||||
-rw-r--r-- | src/multimedia/doc/qtmultimedia.qdocconf | 2 | ||||
-rw-r--r-- | src/multimedia/multimedia.pro | 7 | ||||
-rw-r--r-- | src/multimediawidgets/doc/qtmultimediawidgets.qdocconf | 2 | ||||
-rw-r--r-- | src/multimediawidgets/multimediawidgets.pro | 2 | ||||
-rw-r--r-- | src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java | 3 | ||||
-rw-r--r-- | src/plugins/android/src/mediacapture/qandroidcamerafocuscontrol.cpp | 4 | ||||
-rw-r--r-- | src/plugins/android/src/mediacapture/qandroidcamerasession.cpp | 55 | ||||
-rw-r--r-- | src/plugins/android/src/mediacapture/qandroidcamerasession.h | 1 | ||||
-rw-r--r-- | src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp | 2 | ||||
-rw-r--r-- | src/plugins/android/src/wrappers/jcamera.cpp | 6 | ||||
-rw-r--r-- | src/plugins/blackberry/blackberry.pro | 19 | ||||
-rw-r--r-- | src/plugins/blackberry/camera/bbcameralockscontrol.cpp | 75 | ||||
-rw-r--r-- | src/plugins/blackberry/mediaplayer/mediaplayer.pri | 21 | ||||
-rw-r--r-- | src/plugins/directshow/player/directshowmetadatacontrol.cpp | 70 | ||||
-rw-r--r-- | src/plugins/plugins.pro | 14 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/audio.pro (renamed from src/plugins/qnx/audio/audio.pro) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnx_audio.json (renamed from src/plugins/qnx/audio/qnx_audio.json) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.cpp (renamed from src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.h (renamed from src/plugins/qnx/audio/qnxaudiodeviceinfo.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioinput.cpp (renamed from src/plugins/qnx/audio/qnxaudioinput.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioinput.h (renamed from src/plugins/qnx/audio/qnxaudioinput.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudiooutput.cpp (renamed from src/plugins/qnx/audio/qnxaudiooutput.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudiooutput.h (renamed from src/plugins/qnx/audio/qnxaudiooutput.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioplugin.cpp (renamed from src/plugins/qnx/audio/qnxaudioplugin.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioplugin.h (renamed from src/plugins/qnx/audio/qnxaudioplugin.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioutils.cpp (renamed from src/plugins/qnx/audio/qnxaudioutils.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/audio/qnxaudioutils.h (renamed from src/plugins/qnx/audio/qnxaudioutils.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx-audio/qnx-audio.pro | 3 | ||||
-rw-r--r-- | src/plugins/qnx/bbserviceplugin.cpp (renamed from src/plugins/blackberry/bbserviceplugin.cpp) | 4 | ||||
-rw-r--r-- | src/plugins/qnx/bbserviceplugin.h (renamed from src/plugins/blackberry/bbserviceplugin.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/blackberry_mediaservice.json (renamed from src/plugins/blackberry/blackberry_mediaservice.json) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.h (renamed from src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.h (renamed from src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracapturedestinationcontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracapturedestinationcontrol.h (renamed from src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameracontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameracontrol.h (renamed from src/plugins/blackberry/camera/bbcameracontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraexposurecontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraexposurecontrol.h (renamed from src/plugins/blackberry/camera/bbcameraexposurecontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraflashcontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraflashcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraflashcontrol.h (renamed from src/plugins/blackberry/camera/bbcameraflashcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerafocuscontrol.cpp (renamed from src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerafocuscontrol.h (renamed from src/plugins/blackberry/camera/bbcamerafocuscontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraimagecapturecontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraimagecapturecontrol.h (renamed from src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraimageprocessingcontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraimageprocessingcontrol.h (renamed from src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameralockscontrol.cpp | 258 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameralockscontrol.h (renamed from src/plugins/blackberry/camera/bbcameralockscontrol.h) | 19 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameramediarecordercontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameramediarecordercontrol.h (renamed from src/plugins/blackberry/camera/bbcameramediarecordercontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraorientationhandler.cpp (renamed from src/plugins/blackberry/camera/bbcameraorientationhandler.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraorientationhandler.h (renamed from src/plugins/blackberry/camera/bbcameraorientationhandler.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraservice.cpp (renamed from src/plugins/blackberry/camera/bbcameraservice.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraservice.h (renamed from src/plugins/blackberry/camera/bbcameraservice.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerasession.cpp (renamed from src/plugins/blackberry/camera/bbcamerasession.cpp) | 168 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerasession.h (renamed from src/plugins/blackberry/camera/bbcamerasession.h) | 27 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.h (renamed from src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.cpp (renamed from src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.h (renamed from src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerazoomcontrol.cpp (renamed from src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbcamerazoomcontrol.h (renamed from src/plugins/blackberry/camera/bbcamerazoomcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbimageencodercontrol.cpp (renamed from src/plugins/blackberry/camera/bbimageencodercontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbimageencodercontrol.h (renamed from src/plugins/blackberry/camera/bbimageencodercontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbmediastoragelocation.cpp (renamed from src/plugins/blackberry/camera/bbmediastoragelocation.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbmediastoragelocation.h (renamed from src/plugins/blackberry/camera/bbmediastoragelocation.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp (renamed from src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h (renamed from src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbvideorenderercontrol.cpp (renamed from src/plugins/blackberry/camera/bbvideorenderercontrol.cpp) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/bbvideorenderercontrol.h (renamed from src/plugins/blackberry/camera/bbvideorenderercontrol.h) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/camera/camera.pri (renamed from src/plugins/blackberry/camera/camera.pri) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/common/common.pri (renamed from src/plugins/blackberry/common/common.pri) | 0 | ||||
-rw-r--r-- | src/plugins/qnx/common/windowgrabber.cpp (renamed from src/plugins/blackberry/common/windowgrabber.cpp) | 70 | ||||
-rw-r--r-- | src/plugins/qnx/common/windowgrabber.h (renamed from src/plugins/blackberry/common/windowgrabber.h) | 2 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.cpp | 117 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.h | 66 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mediaplayer.pri | 31 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp (renamed from src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp) | 230 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h (renamed from src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h) | 57 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp (renamed from src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp) | 38 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h (renamed from src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h) | 26 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermetadata.cpp (renamed from src/plugins/blackberry/mediaplayer/bbmetadata.cpp) | 46 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermetadata.h (renamed from src/plugins/blackberry/mediaplayer/bbmetadata.h) | 8 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.cpp (renamed from src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp) | 14 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.h (renamed from src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h) | 14 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp (renamed from src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp) | 28 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.h (renamed from src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h) | 11 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrendererutil.cpp (renamed from src/plugins/blackberry/mediaplayer/bbutil.cpp) | 2 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrendererutil.h (renamed from src/plugins/blackberry/mediaplayer/bbutil.h) | 4 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp (renamed from src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp) | 137 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.h (renamed from src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h) | 19 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp | 199 | ||||
-rw-r--r-- | src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.h | 75 | ||||
-rw-r--r-- | src/plugins/qnx/neutrino_mediaservice.json | 4 | ||||
-rw-r--r-- | src/plugins/qnx/neutrinoserviceplugin.cpp | 70 | ||||
-rw-r--r-- | src/plugins/qnx/neutrinoserviceplugin.h | 65 | ||||
-rw-r--r-- | src/plugins/qnx/qnx.pro | 23 | ||||
-rw-r--r-- | src/plugins/wmf/player/mfplayersession.cpp | 4 |
109 files changed, 1434 insertions, 764 deletions
diff --git a/config.tests/opensles/main.cpp b/config.tests/opensles/main.cpp deleted file mode 100644 index 45fd2f05d..000000000 --- a/config.tests/opensles/main.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 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 <SLES/OpenSLES.h> - -int main() -{ - return 0; -} diff --git a/config.tests/opensles/opensles.pro b/config.tests/opensles/opensles.pro deleted file mode 100644 index def49c7ac..000000000 --- a/config.tests/opensles/opensles.pro +++ /dev/null @@ -1,2 +0,0 @@ -LIBS += -lOpenSLES -SOURCES += main.cpp diff --git a/qtmultimedia.pro b/qtmultimedia.pro index f3ede6cac..489f81fa7 100644 --- a/qtmultimedia.pro +++ b/qtmultimedia.pro @@ -2,7 +2,6 @@ requires(qtHaveModule(gui)) load(configure) qtCompileTest(openal) -qtCompileTest(opensles) win32 { qtCompileTest(directshow) { qtCompileTest(wshellitem) diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro index d24d89390..46184965c 100644 --- a/src/gsttools/gsttools.pro +++ b/src/gsttools/gsttools.pro @@ -8,13 +8,13 @@ QT = core multimedia-private gui-private unix:!maemo*:contains(QT_CONFIG, alsa) { DEFINES += HAVE_ALSA -LIBS += \ +LIBS_PRIVATE += \ -lasound } CONFIG += link_pkgconfig -PKGCONFIG += \ +PKGCONFIG_PRIVATE += \ gstreamer-0.10 \ gstreamer-base-0.10 \ gstreamer-interfaces-0.10 \ @@ -22,11 +22,11 @@ PKGCONFIG += \ gstreamer-video-0.10 \ gstreamer-pbutils-0.10 -maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10 +maemo*: PKGCONFIG_PRIVATE +=gstreamer-plugins-bad-0.10 config_resourcepolicy { DEFINES += HAVE_RESOURCE_POLICY - PKGCONFIG += libresourceqt5 + PKGCONFIG_PRIVATE += libresourceqt5 } # Header files must go inside source directory of a module @@ -79,24 +79,24 @@ qtHaveModule(widgets) { } maemo6 { - PKGCONFIG += qmsystem2 + PKGCONFIG_PRIVATE += qmsystem2 contains(QT_CONFIG, opengles2):qtHaveModule(widgets) { PRIVATE_HEADERS += qgstreamergltexturerenderer_p.h SOURCES += qgstreamergltexturerenderer.cpp QT += opengl - LIBS += -lEGL -lgstmeegointerfaces-0.10 + LIBS_PRIVATE += -lEGL -lgstmeegointerfaces-0.10 } } config_gstreamer_appsrc { - PKGCONFIG += gstreamer-app-0.10 + PKGCONFIG_PRIVATE += gstreamer-app-0.10 PRIVATE_HEADERS += qgstappsrc_p.h SOURCES += qgstappsrc.cpp DEFINES += HAVE_GST_APPSRC - LIBS += -lgstapp-0.10 + LIBS_PRIVATE += -lgstapp-0.10 } HEADERS += $$PRIVATE_HEADERS diff --git a/src/imports/audioengine/qmldir b/src/imports/audioengine/qmldir index d853c8022..ed54ce0a1 100644 --- a/src/imports/audioengine/qmldir +++ b/src/imports/audioengine/qmldir @@ -1,3 +1,4 @@ module QtAudioEngine plugin declarative_audioengine typeinfo plugins.qmltypes +classname QAudioEngineDeclarativeModule
\ No newline at end of file diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir index 673f7ffd2..428bfc8d5 100644 --- a/src/imports/multimedia/qmldir +++ b/src/imports/multimedia/qmldir @@ -1,4 +1,6 @@ module QtMultimedia plugin declarative_multimedia +classname QMultimediaDeclarativeModule typeinfo plugins.qmltypes Video 5.0 Video.qml +classname QMultimediaDeclarativeModule diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri index f76d13264..6fad6604c 100644 --- a/src/multimedia/audio/audio.pri +++ b/src/multimedia/audio/audio.pri @@ -44,14 +44,14 @@ win32 { SOURCES += audio/qaudiodeviceinfo_win32_p.cpp \ audio/qaudiooutput_win32_p.cpp \ audio/qaudioinput_win32_p.cpp - LIBS += -lwinmm -lstrmiids -lole32 -loleaut32 + LIBS_PRIVATE += -lwinmm -lstrmiids -lole32 -loleaut32 } unix:!mac { config_pulseaudio { DEFINES += QT_NO_AUDIO_BACKEND CONFIG += link_pkgconfig - PKGCONFIG += libpulse + PKGCONFIG_PRIVATE += libpulse DEFINES += QT_MULTIMEDIA_PULSEAUDIO PRIVATE_HEADERS += audio/qsoundeffect_pulse_p.h diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp index 524c856a2..2de1b0067 100644 --- a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp +++ b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp @@ -236,10 +236,9 @@ void QSoundEffectPrivate::play() setStatus(QSoundEffect::Null); return; } + setPlaying(true); if (d->m_audioOutput && d->m_audioOutput->state() == QAudio::StoppedState && d->m_sampleReady) d->m_audioOutput->start(d); - - setPlaying(true); } void QSoundEffectPrivate::stop() diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf index 5f82a330b..83abf5b49 100644 --- a/src/multimedia/doc/qtmultimedia.qdocconf +++ b/src/multimedia/doc/qtmultimedia.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtMultimedia description = Qt Multimedia Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtmultimedia +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION # The following parameters are for creating a qhp file, the qhelpgenerator diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro index ef6633b95..63c3f19bb 100644 --- a/src/multimedia/multimedia.pro +++ b/src/multimedia/multimedia.pro @@ -60,11 +60,16 @@ ANDROID_LIB_DEPENDENCIES = \ lib/libQt5MultimediaQuick_p.so:Qt5Quick ANDROID_BUNDLED_FILES += \ lib/libQt5MultimediaQuick_p.so +ANDROID_PERMISSIONS += \ + android.permission.CAMERA \ + android.permission.RECORD_AUDIO +ANDROID_FEATURES += \ + android.hardware.camera MODULE_PLUGIN_TYPES = \ mediaservice \ audio \ video/videonode -win32:LIBS += -luuid +win32: LIBS_PRIVATE += -luuid HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS diff --git a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf index 5648041ad..92d4dc099 100644 --- a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf +++ b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf @@ -2,7 +2,7 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtMultimediaWidgets description = Qt Multimedia Widgets Documentation -url = http://qt-project.org/doc/qt-$QT_VER/qtmultimediawidgets +url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION # The following parameters are for creating a qhp file, the qhelpgenerator diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro index d47742028..1cf35986f 100644 --- a/src/multimediawidgets/multimediawidgets.pro +++ b/src/multimediawidgets/multimediawidgets.pro @@ -35,7 +35,7 @@ maemo6 { SOURCES += qgraphicsvideoitem_maemo6.cpp - LIBS += -lX11 + LIBS_PRIVATE += -lX11 } else { SOURCES += qgraphicsvideoitem.cpp } diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java index 2ca07a63e..cd79c979c 100644 --- a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java +++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java @@ -159,7 +159,6 @@ public class QtAndroidMediaPlayer extends MediaPlayer public void onCompletion(final MediaPlayer mp) { onMediaPlayerInfoNative(MEDIA_PLAYER_FINISHED, 0, mID); - reset(); } } @@ -191,9 +190,9 @@ public class QtAndroidMediaPlayer extends MediaPlayer @Override public void onPrepared(final MediaPlayer mp) { + mPreparing = false; onMediaPlayerInfoNative(MEDIA_PLAYER_READY, 0, mID); onMediaPlayerInfoNative(MEDIA_PLAYER_DURATION, getDuration(), mID); - mPreparing = false; } } diff --git a/src/plugins/android/src/mediacapture/qandroidcamerafocuscontrol.cpp b/src/plugins/android/src/mediacapture/qandroidcamerafocuscontrol.cpp index 899a3a499..345a29174 100644 --- a/src/plugins/android/src/mediacapture/qandroidcamerafocuscontrol.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcamerafocuscontrol.cpp @@ -238,6 +238,10 @@ void QAndroidCameraFocusControl::updateFocusZones(QCameraFocusZone::FocusZoneSta return; QSize viewportSize = m_session->camera()->previewSize(); + + if (!viewportSize.isValid()) + return; + QSizeF focusSize(50.f / viewportSize.width(), 50.f / viewportSize.height()); float x = qBound(qreal(0), m_actualFocusPoint.x() - (focusSize.width() / 2), diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp index 75b0c5e9b..3a50139c3 100644 --- a/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp +++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.cpp @@ -52,6 +52,41 @@ QT_BEGIN_NAMESPACE +class DataVideoBuffer : public QAbstractVideoBuffer +{ +public: + DataVideoBuffer(const QByteArray &d) + : QAbstractVideoBuffer(NoHandle) + , data(d) + , mode(NotMapped) + { } + + MapMode mapMode() const { return mode; } + + uchar *map(MapMode m, int *numBytes, int *bytesPerLine) + { + if (mode != NotMapped || m == NotMapped) + return 0; + + mode = m; + + if (numBytes) + *numBytes = data.size(); + + if (bytesPerLine) + *bytesPerLine = -1; + + return reinterpret_cast<uchar *>(data.data()); + } + + void unmap() { mode = NotMapped; } + +private: + QByteArray data; + MapMode mode; +}; + + QAndroidCameraSession::QAndroidCameraSession(QObject *parent) : QObject(parent) , m_selectedCamera(0) @@ -205,8 +240,11 @@ void QAndroidCameraSession::adjustViewfinderSize(const QSize &captureSize, bool QSize viewfinderResolution = m_camera->previewSize(); const qreal aspectRatio = qreal(captureSize.width()) / qreal(captureSize.height()); - if (qFuzzyCompare(aspectRatio, qreal(viewfinderResolution.width()) / qreal(viewfinderResolution.height()))) + if (viewfinderResolution.isValid() && + qFuzzyCompare(aspectRatio, + qreal(viewfinderResolution.width()) / viewfinderResolution.height())) { return; + } QList<QSize> previewSizes = m_camera->getSupportedPreviewSizes(); for (int i = previewSizes.count() - 1; i >= 0; --i) { @@ -270,6 +308,7 @@ void QAndroidCameraSession::stopPreview() JMultimediaUtils::enableOrientationListener(false); m_camera->stopPreview(); + m_camera->setPreviewSize(QSize()); if (m_videoOutput) m_videoOutput->stop(); m_previewStarted = false; @@ -459,6 +498,7 @@ void QAndroidCameraSession::onCameraPictureCaptured(const QByteArray &data) QtConcurrent::run(this, &QAndroidCameraSession::processCapturedImage, m_currentImageCaptureId, data, + m_imageSettings.resolution(), m_captureDestination, m_currentImageCaptureFileName); } @@ -473,6 +513,7 @@ void QAndroidCameraSession::onCameraPictureCaptured(const QByteArray &data) void QAndroidCameraSession::processCapturedImage(int id, const QByteArray &data, + const QSize &resolution, QCameraImageCapture::CaptureDestinations dest, const QString &fileName) { @@ -505,16 +546,8 @@ void QAndroidCameraSession::processCapturedImage(int id, } if (dest & QCameraImageCapture::CaptureToBuffer) { - QImage image; - const bool ok = image.loadFromData(data, "JPG"); - - if (ok) { - QVideoFrame frame(image); - emit imageAvailable(id, frame); - } else { - emit imageCaptureError(id, QCameraImageCapture::FormatError, - tr("Could not load JPEG data from captured image")); - } + QVideoFrame frame(new DataVideoBuffer(data), resolution, QVideoFrame::Format_Jpeg); + emit imageAvailable(id, frame); } } diff --git a/src/plugins/android/src/mediacapture/qandroidcamerasession.h b/src/plugins/android/src/mediacapture/qandroidcamerasession.h index de891522b..897cf52d1 100644 --- a/src/plugins/android/src/mediacapture/qandroidcamerasession.h +++ b/src/plugins/android/src/mediacapture/qandroidcamerasession.h @@ -127,6 +127,7 @@ private: void processPreviewImage(int id, const QByteArray &data); void processCapturedImage(int id, const QByteArray &data, + const QSize &resolution, QCameraImageCapture::CaptureDestinations dest, const QString &fileName); diff --git a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp index 3f3b599ac..54c04e5c9 100644 --- a/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp +++ b/src/plugins/android/src/mediaplayer/qandroidmediaplayercontrol.cpp @@ -344,7 +344,7 @@ void QAndroidMediaPlayerControl::onMediaPlayerInfo(qint32 what, qint32 extra) Q_EMIT positionChanged(extra); break; case JMediaPlayer::MEDIA_PLAYER_FINISHED: - setState(QMediaPlayer::StoppedState); + stop(); setMediaStatus(QMediaPlayer::EndOfMedia); break; } diff --git a/src/plugins/android/src/wrappers/jcamera.cpp b/src/plugins/android/src/wrappers/jcamera.cpp index f858f4702..fc9b18068 100644 --- a/src/plugins/android/src/wrappers/jcamera.cpp +++ b/src/plugins/android/src/wrappers/jcamera.cpp @@ -261,8 +261,10 @@ void JCamera::setPreviewSize(const QSize &size) m_previewSize = size; - m_parameters.callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height()); - applyParameters(); + if (m_previewSize.isValid()) { + m_parameters.callMethod<void>("setPreviewSize", "(II)V", size.width(), size.height()); + applyParameters(); + } emit previewSizeChanged(); } diff --git a/src/plugins/blackberry/blackberry.pro b/src/plugins/blackberry/blackberry.pro deleted file mode 100644 index e0a6233ce..000000000 --- a/src/plugins/blackberry/blackberry.pro +++ /dev/null @@ -1,19 +0,0 @@ -TARGET = qtmedia_blackberry -QT += multimedia-private gui-private - -PLUGIN_TYPE=mediaservice -PLUGIN_CLASS_NAME = BbServicePlugin -load(qt_plugin) - -LIBS += -lscreen - -HEADERS += bbserviceplugin.h -SOURCES += bbserviceplugin.cpp - -include(common/common.pri) - -include(camera/camera.pri) - -include(mediaplayer/mediaplayer.pri) - -OTHER_FILES += blackberry_mediaservice.json diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.cpp b/src/plugins/blackberry/camera/bbcameralockscontrol.cpp deleted file mode 100644 index 471940549..000000000 --- a/src/plugins/blackberry/camera/bbcameralockscontrol.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Research In Motion -** 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 "bbcameralockscontrol.h" - -#include "bbcamerasession.h" - -QT_BEGIN_NAMESPACE - -BbCameraLocksControl::BbCameraLocksControl(BbCameraSession *session, QObject *parent) - : QCameraLocksControl(parent) - , m_session(session) -{ - connect(m_session, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)), - this, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason))); -} - -QCamera::LockTypes BbCameraLocksControl::supportedLocks() const -{ - return m_session->supportedLocks(); -} - -QCamera::LockStatus BbCameraLocksControl::lockStatus(QCamera::LockType lock) const -{ - return m_session->lockStatus(lock); -} - -void BbCameraLocksControl::searchAndLock(QCamera::LockTypes locks) -{ - m_session->searchAndLock(locks); -} - -void BbCameraLocksControl::unlock(QCamera::LockTypes locks) -{ - m_session->unlock(locks); -} - -QT_END_NAMESPACE diff --git a/src/plugins/blackberry/mediaplayer/mediaplayer.pri b/src/plugins/blackberry/mediaplayer/mediaplayer.pri deleted file mode 100644 index 065c799a6..000000000 --- a/src/plugins/blackberry/mediaplayer/mediaplayer.pri +++ /dev/null @@ -1,21 +0,0 @@ -INCLUDEPATH += $$PWD - -HEADERS += \ - $$PWD/bbmediaplayercontrol.h \ - $$PWD/bbmediaplayerservice.h \ - $$PWD/bbmetadata.h \ - $$PWD/bbmetadatareadercontrol.h \ - $$PWD/bbplayervideorenderercontrol.h \ - $$PWD/bbutil.h \ - $$PWD/bbvideowindowcontrol.h - -SOURCES += \ - $$PWD/bbmediaplayercontrol.cpp \ - $$PWD/bbmediaplayerservice.cpp \ - $$PWD/bbmetadata.cpp \ - $$PWD/bbmetadatareadercontrol.cpp \ - $$PWD/bbplayervideorenderercontrol.cpp \ - $$PWD/bbutil.cpp \ - $$PWD/bbvideowindowcontrol.cpp - -LIBS += -lmmrndclient -lstrm diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp index 3c81ae180..d60bce31a 100644 --- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp +++ b/src/plugins/directshow/player/directshowmetadatacontrol.cpp @@ -389,86 +389,86 @@ void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *s if (FAILED(pStore->GetValue(key, &var))) continue; - if (key == PKEY_Author) { + if (IsEqualPropertyKey(key, PKEY_Author)) { m_metadata.insert(QMediaMetaData::Author, convertValue(var)); - } else if (key == PKEY_Title) { + } else if (IsEqualPropertyKey(key, PKEY_Title)) { m_metadata.insert(QMediaMetaData::Title, convertValue(var)); - } else if (key == PKEY_Media_SubTitle) { + } else if (IsEqualPropertyKey(key, PKEY_Media_SubTitle)) { m_metadata.insert(QMediaMetaData::SubTitle, convertValue(var)); - } else if (key == PKEY_ParentalRating) { + } else if (IsEqualPropertyKey(key, PKEY_ParentalRating)) { m_metadata.insert(QMediaMetaData::ParentalRating, convertValue(var)); - } else if (key == PKEY_Comment) { + } else if (IsEqualPropertyKey(key, PKEY_Comment)) { m_metadata.insert(QMediaMetaData::Description, convertValue(var)); - } else if (key == PKEY_Copyright) { + } else if (IsEqualPropertyKey(key, PKEY_Copyright)) { m_metadata.insert(QMediaMetaData::Copyright, convertValue(var)); - } else if (key == PKEY_Media_ProviderStyle) { + } else if (IsEqualPropertyKey(key, PKEY_Media_ProviderStyle)) { m_metadata.insert(QMediaMetaData::Genre, convertValue(var)); - } else if (key == PKEY_Media_Year) { + } else if (IsEqualPropertyKey(key, PKEY_Media_Year)) { m_metadata.insert(QMediaMetaData::Year, convertValue(var)); - } else if (key == PKEY_Media_DateEncoded) { + } else if (IsEqualPropertyKey(key, PKEY_Media_DateEncoded)) { m_metadata.insert(QMediaMetaData::Date, convertValue(var)); - } else if (key == PKEY_Rating) { + } else if (IsEqualPropertyKey(key, PKEY_Rating)) { m_metadata.insert(QMediaMetaData::UserRating, int((convertValue(var).toUInt() - 1) / qreal(98) * 100)); - } else if (key == PKEY_Keywords) { + } else if (IsEqualPropertyKey(key, PKEY_Keywords)) { m_metadata.insert(QMediaMetaData::Keywords, convertValue(var)); - } else if (key == PKEY_Language) { + } else if (IsEqualPropertyKey(key, PKEY_Language)) { m_metadata.insert(QMediaMetaData::Language, convertValue(var)); - } else if (key == PKEY_Media_Publisher) { + } else if (IsEqualPropertyKey(key, PKEY_Media_Publisher)) { m_metadata.insert(QMediaMetaData::Publisher, convertValue(var)); - } else if (key == PKEY_Media_Duration) { + } else if (IsEqualPropertyKey(key, PKEY_Media_Duration)) { m_metadata.insert(QMediaMetaData::Duration, (convertValue(var).toLongLong() + 10000) / 10000); - } else if (key == PKEY_Audio_EncodingBitrate) { + } else if (IsEqualPropertyKey(key, PKEY_Audio_EncodingBitrate)) { m_metadata.insert(QMediaMetaData::AudioBitRate, convertValue(var)); - } else if (key == PKEY_Media_AverageLevel) { + } else if (IsEqualPropertyKey(key, PKEY_Media_AverageLevel)) { m_metadata.insert(QMediaMetaData::AverageLevel, convertValue(var)); - } else if (key == PKEY_Audio_ChannelCount) { + } else if (IsEqualPropertyKey(key, PKEY_Audio_ChannelCount)) { m_metadata.insert(QMediaMetaData::ChannelCount, convertValue(var)); - } else if (key == PKEY_Audio_PeakValue) { + } else if (IsEqualPropertyKey(key, PKEY_Audio_PeakValue)) { m_metadata.insert(QMediaMetaData::PeakValue, convertValue(var)); - } else if (key == PKEY_Audio_SampleRate) { + } else if (IsEqualPropertyKey(key, PKEY_Audio_SampleRate)) { m_metadata.insert(QMediaMetaData::SampleRate, convertValue(var)); - } else if (key == PKEY_Music_AlbumTitle) { + } else if (IsEqualPropertyKey(key, PKEY_Music_AlbumTitle)) { m_metadata.insert(QMediaMetaData::AlbumTitle, convertValue(var)); - } else if (key == PKEY_Music_AlbumArtist) { + } else if (IsEqualPropertyKey(key, PKEY_Music_AlbumArtist)) { m_metadata.insert(QMediaMetaData::AlbumArtist, convertValue(var)); - } else if (key == PKEY_Music_Artist) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Artist)) { m_metadata.insert(QMediaMetaData::ContributingArtist, convertValue(var)); - } else if (key == PKEY_Music_Composer) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Composer)) { m_metadata.insert(QMediaMetaData::Composer, convertValue(var)); - } else if (key == PKEY_Music_Conductor) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Conductor)) { m_metadata.insert(QMediaMetaData::Conductor, convertValue(var)); - } else if (key == PKEY_Music_Lyrics) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Lyrics)) { m_metadata.insert(QMediaMetaData::Lyrics, convertValue(var)); - } else if (key == PKEY_Music_Mood) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Mood)) { m_metadata.insert(QMediaMetaData::Mood, convertValue(var)); - } else if (key == PKEY_Music_TrackNumber) { + } else if (IsEqualPropertyKey(key, PKEY_Music_TrackNumber)) { m_metadata.insert(QMediaMetaData::TrackNumber, convertValue(var)); - } else if (key == PKEY_Music_Genre) { + } else if (IsEqualPropertyKey(key, PKEY_Music_Genre)) { m_metadata.insert(QMediaMetaData::Genre, convertValue(var)); - } else if (key == PKEY_ThumbnailStream) { + } else if (IsEqualPropertyKey(key, PKEY_ThumbnailStream)) { m_metadata.insert(QMediaMetaData::ThumbnailImage, convertValue(var)); - } else if (key == PKEY_Video_FrameHeight) { + } else if (IsEqualPropertyKey(key, PKEY_Video_FrameHeight)) { QSize res; res.setHeight(convertValue(var).toUInt()); if (SUCCEEDED(pStore->GetValue(PKEY_Video_FrameWidth, &var))) res.setWidth(convertValue(var).toUInt()); m_metadata.insert(QMediaMetaData::Resolution, res); - } else if (key == PKEY_Video_HorizontalAspectRatio) { + } else if (IsEqualPropertyKey(key, PKEY_Video_HorizontalAspectRatio)) { QSize aspectRatio; aspectRatio.setWidth(convertValue(var).toUInt()); if (SUCCEEDED(pStore->GetValue(PKEY_Video_VerticalAspectRatio, &var))) aspectRatio.setHeight(convertValue(var).toUInt()); m_metadata.insert(QMediaMetaData::PixelAspectRatio, aspectRatio); - } else if (key == PKEY_Video_FrameRate) { + } else if (IsEqualPropertyKey(key, PKEY_Video_FrameRate)) { m_metadata.insert(QMediaMetaData::VideoFrameRate, convertValue(var).toReal() / 1000); - } else if (key == PKEY_Video_EncodingBitrate) { + } else if (IsEqualPropertyKey(key, PKEY_Video_EncodingBitrate)) { m_metadata.insert(QMediaMetaData::VideoBitRate, convertValue(var)); - } else if (key == PKEY_Video_Director) { + } else if (IsEqualPropertyKey(key, PKEY_Video_Director)) { m_metadata.insert(QMediaMetaData::Director, convertValue(var)); - } else if (key == PKEY_Media_Writer) { + } else if (IsEqualPropertyKey(key, PKEY_Media_Writer)) { m_metadata.insert(QMediaMetaData::Writer, convertValue(var)); } diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro index 15d5a0b9b..4c70e3d11 100644 --- a/src/plugins/plugins.pro +++ b/src/plugins/plugins.pro @@ -9,15 +9,15 @@ TEMPLATE = subdirs SUBDIRS += m3u android { - SUBDIRS += android + SUBDIRS += android opensles } -blackberry { - SUBDIRS += blackberry +qnx { + SUBDIRS += qnx audiocapture } -qnx { - SUBDIRS += audiocapture qnx +qnx:!blackberry { + SUBDIRS += qnx-audio } win32 { @@ -52,10 +52,6 @@ mac:!simulator { !ios: SUBDIRS += qt7 } -config_opensles { - SUBDIRS += opensles -} - config_resourcepolicy { SUBDIRS += resourcepolicy } diff --git a/src/plugins/qnx/audio/audio.pro b/src/plugins/qnx-audio/audio/audio.pro index 35ddf73de..35ddf73de 100644 --- a/src/plugins/qnx/audio/audio.pro +++ b/src/plugins/qnx-audio/audio/audio.pro diff --git a/src/plugins/qnx/audio/qnx_audio.json b/src/plugins/qnx-audio/audio/qnx_audio.json index a31d52107..a31d52107 100644 --- a/src/plugins/qnx/audio/qnx_audio.json +++ b/src/plugins/qnx-audio/audio/qnx_audio.json diff --git a/src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp b/src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.cpp index ce8083573..ce8083573 100644 --- a/src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.cpp diff --git a/src/plugins/qnx/audio/qnxaudiodeviceinfo.h b/src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.h index 72c10cc75..72c10cc75 100644 --- a/src/plugins/qnx/audio/qnxaudiodeviceinfo.h +++ b/src/plugins/qnx-audio/audio/qnxaudiodeviceinfo.h diff --git a/src/plugins/qnx/audio/qnxaudioinput.cpp b/src/plugins/qnx-audio/audio/qnxaudioinput.cpp index eb8064598..eb8064598 100644 --- a/src/plugins/qnx/audio/qnxaudioinput.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudioinput.cpp diff --git a/src/plugins/qnx/audio/qnxaudioinput.h b/src/plugins/qnx-audio/audio/qnxaudioinput.h index 3084b1de3..3084b1de3 100644 --- a/src/plugins/qnx/audio/qnxaudioinput.h +++ b/src/plugins/qnx-audio/audio/qnxaudioinput.h diff --git a/src/plugins/qnx/audio/qnxaudiooutput.cpp b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp index 4a82e93bb..4a82e93bb 100644 --- a/src/plugins/qnx/audio/qnxaudiooutput.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudiooutput.cpp diff --git a/src/plugins/qnx/audio/qnxaudiooutput.h b/src/plugins/qnx-audio/audio/qnxaudiooutput.h index 77c15e47a..77c15e47a 100644 --- a/src/plugins/qnx/audio/qnxaudiooutput.h +++ b/src/plugins/qnx-audio/audio/qnxaudiooutput.h diff --git a/src/plugins/qnx/audio/qnxaudioplugin.cpp b/src/plugins/qnx-audio/audio/qnxaudioplugin.cpp index f63474f90..f63474f90 100644 --- a/src/plugins/qnx/audio/qnxaudioplugin.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudioplugin.cpp diff --git a/src/plugins/qnx/audio/qnxaudioplugin.h b/src/plugins/qnx-audio/audio/qnxaudioplugin.h index 1886057b4..1886057b4 100644 --- a/src/plugins/qnx/audio/qnxaudioplugin.h +++ b/src/plugins/qnx-audio/audio/qnxaudioplugin.h diff --git a/src/plugins/qnx/audio/qnxaudioutils.cpp b/src/plugins/qnx-audio/audio/qnxaudioutils.cpp index d6400c2b1..d6400c2b1 100644 --- a/src/plugins/qnx/audio/qnxaudioutils.cpp +++ b/src/plugins/qnx-audio/audio/qnxaudioutils.cpp diff --git a/src/plugins/qnx/audio/qnxaudioutils.h b/src/plugins/qnx-audio/audio/qnxaudioutils.h index ddd30b191..ddd30b191 100644 --- a/src/plugins/qnx/audio/qnxaudioutils.h +++ b/src/plugins/qnx-audio/audio/qnxaudioutils.h diff --git a/src/plugins/qnx-audio/qnx-audio.pro b/src/plugins/qnx-audio/qnx-audio.pro new file mode 100644 index 000000000..3049729b8 --- /dev/null +++ b/src/plugins/qnx-audio/qnx-audio.pro @@ -0,0 +1,3 @@ +TEMPLATE = subdirs + +SUBDIRS = audio diff --git a/src/plugins/blackberry/bbserviceplugin.cpp b/src/plugins/qnx/bbserviceplugin.cpp index dab3caf9b..59be46453 100644 --- a/src/plugins/blackberry/bbserviceplugin.cpp +++ b/src/plugins/qnx/bbserviceplugin.cpp @@ -42,7 +42,7 @@ #include "bbcameraservice.h" #include "bbvideodeviceselectorcontrol.h" -#include "bbmediaplayerservice.h" +#include "mmrenderermediaplayerservice.h" #include <QDebug> @@ -58,7 +58,7 @@ QMediaService *BbServicePlugin::create(const QString &key) return new BbCameraService(); if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) - return new BbMediaPlayerService(); + return new MmRendererMediaPlayerService(); return 0; } diff --git a/src/plugins/blackberry/bbserviceplugin.h b/src/plugins/qnx/bbserviceplugin.h index 62fc4a0df..62fc4a0df 100644 --- a/src/plugins/blackberry/bbserviceplugin.h +++ b/src/plugins/qnx/bbserviceplugin.h diff --git a/src/plugins/blackberry/blackberry_mediaservice.json b/src/plugins/qnx/blackberry_mediaservice.json index 2a59cc770..2a59cc770 100644 --- a/src/plugins/blackberry/blackberry_mediaservice.json +++ b/src/plugins/qnx/blackberry_mediaservice.json diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp b/src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.cpp index 2ff800a0f..2ff800a0f 100644 --- a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h b/src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.h index 21fb520e7..21fb520e7 100644 --- a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h +++ b/src/plugins/qnx/camera/bbcameraaudioencodersettingscontrol.h diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp b/src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.cpp index 57f3c9fb1..57f3c9fb1 100644 --- a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp +++ b/src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h b/src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.h index 2897cb2fd..2897cb2fd 100644 --- a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h +++ b/src/plugins/qnx/camera/bbcameracapturebufferformatcontrol.h diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp b/src/plugins/qnx/camera/bbcameracapturedestinationcontrol.cpp index 6b6bcfcb9..6b6bcfcb9 100644 --- a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp +++ b/src/plugins/qnx/camera/bbcameracapturedestinationcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h b/src/plugins/qnx/camera/bbcameracapturedestinationcontrol.h index 93a7d2d14..93a7d2d14 100644 --- a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h +++ b/src/plugins/qnx/camera/bbcameracapturedestinationcontrol.h diff --git a/src/plugins/blackberry/camera/bbcameracontrol.cpp b/src/plugins/qnx/camera/bbcameracontrol.cpp index bc3c78264..bc3c78264 100644 --- a/src/plugins/blackberry/camera/bbcameracontrol.cpp +++ b/src/plugins/qnx/camera/bbcameracontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameracontrol.h b/src/plugins/qnx/camera/bbcameracontrol.h index a5792c5df..a5792c5df 100644 --- a/src/plugins/blackberry/camera/bbcameracontrol.h +++ b/src/plugins/qnx/camera/bbcameracontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp b/src/plugins/qnx/camera/bbcameraexposurecontrol.cpp index b1d637cd0..b1d637cd0 100644 --- a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraexposurecontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.h b/src/plugins/qnx/camera/bbcameraexposurecontrol.h index f4659b624..f4659b624 100644 --- a/src/plugins/blackberry/camera/bbcameraexposurecontrol.h +++ b/src/plugins/qnx/camera/bbcameraexposurecontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp b/src/plugins/qnx/camera/bbcameraflashcontrol.cpp index 06ebe01f6..06ebe01f6 100644 --- a/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraflashcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.h b/src/plugins/qnx/camera/bbcameraflashcontrol.h index d46dc8c12..d46dc8c12 100644 --- a/src/plugins/blackberry/camera/bbcameraflashcontrol.h +++ b/src/plugins/qnx/camera/bbcameraflashcontrol.h diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp b/src/plugins/qnx/camera/bbcamerafocuscontrol.cpp index e0b57d6c6..e0b57d6c6 100644 --- a/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp +++ b/src/plugins/qnx/camera/bbcamerafocuscontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.h b/src/plugins/qnx/camera/bbcamerafocuscontrol.h index 052c29b4b..052c29b4b 100644 --- a/src/plugins/blackberry/camera/bbcamerafocuscontrol.h +++ b/src/plugins/qnx/camera/bbcamerafocuscontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp b/src/plugins/qnx/camera/bbcameraimagecapturecontrol.cpp index a2f61f73d..a2f61f73d 100644 --- a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraimagecapturecontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h b/src/plugins/qnx/camera/bbcameraimagecapturecontrol.h index a73a4f1d5..a73a4f1d5 100644 --- a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h +++ b/src/plugins/qnx/camera/bbcameraimagecapturecontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp b/src/plugins/qnx/camera/bbcameraimageprocessingcontrol.cpp index 54ae48c6b..54ae48c6b 100644 --- a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraimageprocessingcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h b/src/plugins/qnx/camera/bbcameraimageprocessingcontrol.h index ec16d66d7..ec16d66d7 100644 --- a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h +++ b/src/plugins/qnx/camera/bbcameraimageprocessingcontrol.h diff --git a/src/plugins/qnx/camera/bbcameralockscontrol.cpp b/src/plugins/qnx/camera/bbcameralockscontrol.cpp new file mode 100644 index 000000000..d2537361c --- /dev/null +++ b/src/plugins/qnx/camera/bbcameralockscontrol.cpp @@ -0,0 +1,258 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** 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 "bbcameralockscontrol.h" + +#include "bbcamerasession.h" + +QT_BEGIN_NAMESPACE + +BbCameraLocksControl::BbCameraLocksControl(BbCameraSession *session, QObject *parent) + : QCameraLocksControl(parent) + , m_session(session) + , m_locksApplyMode(IndependentMode) + , m_focusLockStatus(QCamera::Unlocked) + , m_exposureLockStatus(QCamera::Unlocked) + , m_whiteBalanceLockStatus(QCamera::Unlocked) + , m_currentLockTypes(QCamera::NoLock) + , m_supportedLockTypes(QCamera::NoLock) +{ + connect(m_session, SIGNAL(cameraOpened()), SLOT(cameraOpened())); + connect(m_session, SIGNAL(focusStatusChanged(int)), SLOT(focusStatusChanged(int))); +} + +QCamera::LockTypes BbCameraLocksControl::supportedLocks() const +{ + return (QCamera::LockFocus | QCamera::LockExposure | QCamera::LockWhiteBalance); +} + +QCamera::LockStatus BbCameraLocksControl::lockStatus(QCamera::LockType lock) const +{ + if (!m_supportedLockTypes.testFlag(lock) || (m_session->handle() == CAMERA_HANDLE_INVALID)) + return QCamera::Locked; + + switch (lock) { + case QCamera::LockExposure: + return m_exposureLockStatus; + case QCamera::LockWhiteBalance: + return m_whiteBalanceLockStatus; + case QCamera::LockFocus: + return m_focusLockStatus; + default: + return QCamera::Locked; + } +} + +void BbCameraLocksControl::searchAndLock(QCamera::LockTypes locks) +{ + if (m_session->handle() == CAMERA_HANDLE_INVALID) + return; + + // filter out unsupported locks + locks &= m_supportedLockTypes; + + m_currentLockTypes |= locks; + + uint32_t lockModes = CAMERA_3A_NONE; + + switch (m_locksApplyMode) { + case IndependentMode: + if (m_currentLockTypes & QCamera::LockExposure) + lockModes |= CAMERA_3A_AUTOEXPOSURE; + if (m_currentLockTypes & QCamera::LockWhiteBalance) + lockModes |= CAMERA_3A_AUTOWHITEBALANCE; + if (m_currentLockTypes & QCamera::LockFocus) + lockModes |= CAMERA_3A_AUTOFOCUS; + break; + case FocusExposureBoundMode: + if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus)) + lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS); + break; + case AllBoundMode: + lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE); + break; + case FocusOnlyMode: + lockModes = CAMERA_3A_AUTOFOCUS; + break; + } + + const camera_error_t result = camera_set_3a_lock(m_session->handle(), lockModes); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to set lock modes:" << result; + } else { + if (lockModes & CAMERA_3A_AUTOFOCUS) { + // handled by focusStatusChanged() + } + + if (lockModes & CAMERA_3A_AUTOEXPOSURE) { + m_exposureLockStatus = QCamera::Locked; + emit lockStatusChanged(QCamera::LockExposure, QCamera::Locked, QCamera::LockAcquired); + } + + if (lockModes & CAMERA_3A_AUTOWHITEBALANCE) { + m_whiteBalanceLockStatus = QCamera::Locked; + emit lockStatusChanged(QCamera::LockWhiteBalance, QCamera::Locked, QCamera::LockAcquired); + } + } +} + +void BbCameraLocksControl::unlock(QCamera::LockTypes locks) +{ + // filter out unsupported locks + locks &= m_supportedLockTypes; + + m_currentLockTypes &= ~locks; + + uint32_t lockModes = CAMERA_3A_NONE; + + switch (m_locksApplyMode) { + case IndependentMode: + if (m_currentLockTypes & QCamera::LockExposure) + lockModes |= CAMERA_3A_AUTOEXPOSURE; + if (m_currentLockTypes & QCamera::LockWhiteBalance) + lockModes |= CAMERA_3A_AUTOWHITEBALANCE; + if (m_currentLockTypes & QCamera::LockFocus) + lockModes |= CAMERA_3A_AUTOFOCUS; + break; + case FocusExposureBoundMode: + if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus)) + lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS); + break; + case AllBoundMode: + lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE); + break; + case FocusOnlyMode: + lockModes = CAMERA_3A_AUTOFOCUS; + break; + } + + const camera_error_t result = camera_set_3a_lock(m_session->handle(), lockModes); + + if (result != CAMERA_EOK) { + qWarning() << "Unable to set lock modes:" << result; + } else { + if (locks.testFlag(QCamera::LockFocus)) { + // handled by focusStatusChanged() + } + + if (locks.testFlag(QCamera::LockExposure)) { + m_exposureLockStatus = QCamera::Unlocked; + emit lockStatusChanged(QCamera::LockExposure, QCamera::Unlocked, QCamera::UserRequest); + } + + if (locks.testFlag(QCamera::LockWhiteBalance)) { + m_whiteBalanceLockStatus = QCamera::Unlocked; + emit lockStatusChanged(QCamera::LockWhiteBalance, QCamera::Unlocked, QCamera::UserRequest); + } + } +} + +void BbCameraLocksControl::cameraOpened() +{ + // retrieve information about lock apply modes + int supported = 0; + uint32_t modes[20]; + + const camera_error_t result = camera_get_3a_lock_modes(m_session->handle(), 20, &supported, modes); + + if (result == CAMERA_EOK) { + // see API documentation of camera_get_3a_lock_modes for explanation of case discrimination below + if (supported == 4) { + m_locksApplyMode = IndependentMode; + } else if (supported == 3) { + m_locksApplyMode = FocusExposureBoundMode; + } else if (supported == 2) { + if (modes[0] == (CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOWHITEBALANCE)) + m_locksApplyMode = AllBoundMode; + else + m_locksApplyMode = FocusOnlyMode; + } + } + + // retrieve information about supported lock types + m_supportedLockTypes = QCamera::NoLock; + + if (camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS)) + m_supportedLockTypes |= QCamera::LockFocus; + + if (camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOEXPOSURE)) + m_supportedLockTypes |= QCamera::LockExposure; + + if (camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOWHITEBALANCE)) + m_supportedLockTypes |= QCamera::LockWhiteBalance; + + m_focusLockStatus = QCamera::Unlocked; + m_exposureLockStatus = QCamera::Unlocked; + m_whiteBalanceLockStatus = QCamera::Unlocked; +} + +void BbCameraLocksControl::focusStatusChanged(int value) +{ + const camera_focusstate_t focusState = static_cast<camera_focusstate_t>(value); + + switch (focusState) { + case CAMERA_FOCUSSTATE_NONE: + m_focusLockStatus = QCamera::Unlocked; + emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::UserRequest); + break; + case CAMERA_FOCUSSTATE_WAITING: + case CAMERA_FOCUSSTATE_SEARCHING: + m_focusLockStatus = QCamera::Searching; + emit lockStatusChanged(QCamera::LockFocus, QCamera::Searching, QCamera::UserRequest); + break; + case CAMERA_FOCUSSTATE_FAILED: + m_focusLockStatus = QCamera::Unlocked; + emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed); + break; + case CAMERA_FOCUSSTATE_LOCKED: + m_focusLockStatus = QCamera::Locked; + emit lockStatusChanged(QCamera::LockFocus, QCamera::Locked, QCamera::LockAcquired); + break; + case CAMERA_FOCUSSTATE_SCENECHANGE: + m_focusLockStatus = QCamera::Unlocked; + emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockTemporaryLost); + break; + default: + break; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.h b/src/plugins/qnx/camera/bbcameralockscontrol.h index 6c4b2da6b..8257abdbc 100644 --- a/src/plugins/blackberry/camera/bbcameralockscontrol.h +++ b/src/plugins/qnx/camera/bbcameralockscontrol.h @@ -51,6 +51,14 @@ class BbCameraLocksControl : public QCameraLocksControl { Q_OBJECT public: + enum LocksApplyMode + { + IndependentMode, + FocusExposureBoundMode, + AllBoundMode, + FocusOnlyMode + }; + explicit BbCameraLocksControl(BbCameraSession *session, QObject *parent = 0); QCamera::LockTypes supportedLocks() const Q_DECL_OVERRIDE; @@ -58,8 +66,19 @@ public: void searchAndLock(QCamera::LockTypes locks) Q_DECL_OVERRIDE; void unlock(QCamera::LockTypes locks) Q_DECL_OVERRIDE; +private Q_SLOTS: + void cameraOpened(); + void focusStatusChanged(int value); + private: BbCameraSession *m_session; + + LocksApplyMode m_locksApplyMode; + QCamera::LockStatus m_focusLockStatus; + QCamera::LockStatus m_exposureLockStatus; + QCamera::LockStatus m_whiteBalanceLockStatus; + QCamera::LockTypes m_currentLockTypes; + QCamera::LockTypes m_supportedLockTypes; }; QT_END_NAMESPACE diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp b/src/plugins/qnx/camera/bbcameramediarecordercontrol.cpp index 44c19fb46..44c19fb46 100644 --- a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp +++ b/src/plugins/qnx/camera/bbcameramediarecordercontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.h b/src/plugins/qnx/camera/bbcameramediarecordercontrol.h index dffd18be5..dffd18be5 100644 --- a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.h +++ b/src/plugins/qnx/camera/bbcameramediarecordercontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp b/src/plugins/qnx/camera/bbcameraorientationhandler.cpp index b715249f9..b715249f9 100644 --- a/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp +++ b/src/plugins/qnx/camera/bbcameraorientationhandler.cpp diff --git a/src/plugins/blackberry/camera/bbcameraorientationhandler.h b/src/plugins/qnx/camera/bbcameraorientationhandler.h index 3d236b884..3d236b884 100644 --- a/src/plugins/blackberry/camera/bbcameraorientationhandler.h +++ b/src/plugins/qnx/camera/bbcameraorientationhandler.h diff --git a/src/plugins/blackberry/camera/bbcameraservice.cpp b/src/plugins/qnx/camera/bbcameraservice.cpp index d9adc7c9d..d9adc7c9d 100644 --- a/src/plugins/blackberry/camera/bbcameraservice.cpp +++ b/src/plugins/qnx/camera/bbcameraservice.cpp diff --git a/src/plugins/blackberry/camera/bbcameraservice.h b/src/plugins/qnx/camera/bbcameraservice.h index 374d03c36..374d03c36 100644 --- a/src/plugins/blackberry/camera/bbcameraservice.h +++ b/src/plugins/qnx/camera/bbcameraservice.h diff --git a/src/plugins/blackberry/camera/bbcamerasession.cpp b/src/plugins/qnx/camera/bbcamerasession.cpp index ca77138bc..59db66f4a 100644 --- a/src/plugins/blackberry/camera/bbcamerasession.cpp +++ b/src/plugins/qnx/camera/bbcamerasession.cpp @@ -131,8 +131,6 @@ BbCameraSession::BbCameraSession(QObject *parent) , m_captureImageDriveMode(QCameraImageCapture::SingleImageCapture) , m_lastImageCaptureId(0) , m_captureDestination(QCameraImageCapture::CaptureToFile) - , m_locksApplyMode(IndependentMode) - , m_focusLockStatus(QCamera::Unlocked) , m_videoState(QMediaRecorder::StoppedState) , m_videoStatus(QMediaRecorder::LoadedStatus) , m_handle(CAMERA_HANDLE_INVALID) @@ -175,10 +173,8 @@ void BbCameraSession::setState(QCamera::State state) } } else if (state == QCamera::ActiveState) { if (openCamera()) { - applyConfiguration(); - if (startViewFinder()) { - m_state = state; - } + QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection); + m_state = state; } } } else if (previousState == QCamera::LoadedState) { @@ -186,10 +182,8 @@ void BbCameraSession::setState(QCamera::State state) closeCamera(); m_state = state; } else if (state == QCamera::ActiveState) { - applyConfiguration(); - if (startViewFinder()) { - m_state = state; - } + QMetaObject::invokeMethod(this, "applyConfiguration", Qt::QueuedConnection); + m_state = state; } } else if (previousState == QCamera::ActiveState) { if (state == QCamera::LoadedState) { @@ -458,95 +452,6 @@ void BbCameraSession::setImageSettings(const QImageEncoderSettings &settings) m_imageEncoderSettings.setCodec(QLatin1String("jpeg")); } -QCamera::LockTypes BbCameraSession::supportedLocks() const -{ - if (m_locksApplyMode == FocusOnlyMode) - return QCamera::LockFocus; - else - return (QCamera::LockExposure | QCamera::LockWhiteBalance | QCamera::LockFocus); -} - -QCamera::LockStatus BbCameraSession::lockStatus(QCamera::LockType lock) const -{ - switch (lock) { - case QCamera::LockExposure: - return QCamera::Unlocked; - case QCamera::LockWhiteBalance: - return QCamera::Unlocked; - case QCamera::LockFocus: - return m_focusLockStatus; - default: - return QCamera::Unlocked; - } -} - -void BbCameraSession::searchAndLock(QCamera::LockTypes locks) -{ - m_currentLockTypes |= locks; - - uint32_t lockModes = CAMERA_3A_NONE; - - switch (m_locksApplyMode) { - case IndependentMode: - if (m_currentLockTypes & QCamera::LockExposure) - lockModes |= CAMERA_3A_AUTOEXPOSURE; - if (m_currentLockTypes & QCamera::LockWhiteBalance) - lockModes |= CAMERA_3A_AUTOWHITEBALANCE; - if (m_currentLockTypes & QCamera::LockFocus) - lockModes |= CAMERA_3A_AUTOFOCUS; - break; - case FocusExposureBoundMode: - if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus)) - lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS); - break; - case AllBoundMode: - lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE); - break; - case FocusOnlyMode: - lockModes = CAMERA_3A_AUTOFOCUS; - break; - } - - const camera_error_t result = camera_set_3a_lock(m_handle, lockModes); - - if (result != CAMERA_EOK) { - qWarning() << "Unable to set lock modes:" << result; - } -} - -void BbCameraSession::unlock(QCamera::LockTypes locks) -{ - m_currentLockTypes &= ~locks; - - uint32_t lockModes = CAMERA_3A_NONE; - - switch (m_locksApplyMode) { - case IndependentMode: - if (m_currentLockTypes & QCamera::LockExposure) - lockModes |= CAMERA_3A_AUTOEXPOSURE; - if (m_currentLockTypes & QCamera::LockWhiteBalance) - lockModes |= CAMERA_3A_AUTOWHITEBALANCE; - if (m_currentLockTypes & QCamera::LockFocus) - lockModes |= CAMERA_3A_AUTOFOCUS; - break; - case FocusExposureBoundMode: - if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus)) - lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS); - break; - case AllBoundMode: - lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE); - break; - case FocusOnlyMode: - lockModes = CAMERA_3A_AUTOFOCUS; - break; - } - - const camera_error_t result = camera_set_3a_lock(m_handle, lockModes); - - if (result != CAMERA_EOK) - qWarning() << "Unable to set lock modes:" << result; -} - QUrl BbCameraSession::outputLocation() const { return QUrl::fromLocalFile(m_videoOutputLocation); @@ -647,13 +552,15 @@ void BbCameraSession::applyVideoSettings() const QByteArray windowGroupId = m_windowGrabber->windowGroupId(); + const int rotationAngle = (360 - m_nativeCameraOrientation); + camera_error_t result = CAMERA_EOK; result = camera_set_videovf_property(m_handle, CAMERA_IMGPROP_WIN_GROUPID, windowGroupId.data(), CAMERA_IMGPROP_WIN_ID, windowId.data(), CAMERA_IMGPROP_WIDTH, viewfinderResolution.width(), CAMERA_IMGPROP_HEIGHT, viewfinderResolution.height(), - CAMERA_IMGPROP_ROTATION, 360 - m_nativeCameraOrientation); + CAMERA_IMGPROP_ROTATION, rotationAngle); if (result != CAMERA_EOK) { qWarning() << "Unable to apply video viewfinder settings:" << result; @@ -693,9 +600,11 @@ 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_ROTATION, rotationAngle, CAMERA_IMGPROP_VIDEOCODEC, cameraVideoCodec, CAMERA_IMGPROP_AUDIOCODEC, cameraAudioCodec); #else @@ -832,37 +741,6 @@ void BbCameraSession::imageCaptured(int requestId, const QImage &rawImage, const } } -void BbCameraSession::handleFocusStatusChanged(int value) -{ - const camera_focusstate_t focusState = static_cast<camera_focusstate_t>(value); - - switch (focusState) { - case CAMERA_FOCUSSTATE_NONE: - case CAMERA_FOCUSSTATE_WAITING: - m_focusLockStatus = QCamera::Unlocked; - emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::UserRequest); - break; - case CAMERA_FOCUSSTATE_SEARCHING: - m_focusLockStatus = QCamera::Searching; - emit lockStatusChanged(QCamera::LockFocus, QCamera::Searching, QCamera::UserRequest); - break; - case CAMERA_FOCUSSTATE_FAILED: - m_focusLockStatus = QCamera::Unlocked; - emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed); - break; - case CAMERA_FOCUSSTATE_LOCKED: - m_focusLockStatus = QCamera::Locked; - emit lockStatusChanged(QCamera::LockFocus, QCamera::Locked, QCamera::LockAcquired); - break; - case CAMERA_FOCUSSTATE_SCENECHANGE: - m_focusLockStatus = QCamera::Unlocked; - emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockTemporaryLost); - break; - default: - break; - } -} - void BbCameraSession::handleVideoRecordingPaused() { //TODO: implement once BB10 API supports pausing a video @@ -952,6 +830,8 @@ bool BbCameraSession::openCamera() m_status = QCamera::LoadedStatus; emit statusChanged(m_status); + emit cameraOpened(); + return true; } @@ -985,7 +865,7 @@ 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)); + QMetaObject::invokeMethod(session, "focusStatusChanged", Qt::QueuedConnection, Q_ARG(int, value)); return; } #ifndef Q_OS_BLACKBERRY_TABLET @@ -1016,28 +896,6 @@ bool BbCameraSession::startViewFinder() return false; } - // retrieve information about lock apply modes - { - int supported = 0; - uint32_t modes[20]; - - const camera_error_t result = camera_get_3a_lock_modes(m_handle, 20, &supported, modes); - - if (result == CAMERA_EOK) { - // see API documentation of camera_get_3a_lock_modes for explanation of case discrimination below - if (supported == 4) { - m_locksApplyMode = IndependentMode; - } else if (supported == 3) { - m_locksApplyMode = FocusExposureBoundMode; - } else if (supported == 2) { - if (modes[0] == (CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOWHITEBALANCE)) - m_locksApplyMode = AllBoundMode; - else - m_locksApplyMode = FocusOnlyMode; - } - } - } - const int angle = m_orientationHandler->orientation(); const QSize rotatedSize = ((angle == 0 || angle == 180) ? viewfinderResolution @@ -1163,6 +1021,8 @@ void BbCameraSession::applyConfiguration() } else if (m_captureMode & QCamera::CaptureVideo) { applyVideoSettings(); } + + startViewFinder(); } static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context) diff --git a/src/plugins/blackberry/camera/bbcamerasession.h b/src/plugins/qnx/camera/bbcamerasession.h index f57c7dabf..e757a83c3 100644 --- a/src/plugins/blackberry/camera/bbcamerasession.h +++ b/src/plugins/qnx/camera/bbcamerasession.h @@ -105,20 +105,6 @@ public: QImageEncoderSettings imageSettings() const; void setImageSettings(const QImageEncoderSettings &settings); - // locks control - enum LocksApplyMode - { - IndependentMode, - FocusExposureBoundMode, - AllBoundMode, - FocusOnlyMode - }; - - QCamera::LockTypes supportedLocks() const; - QCamera::LockStatus lockStatus(QCamera::LockType lock) const; - void searchAndLock(QCamera::LockTypes locks); - void unlock(QCamera::LockTypes locks); - // media recorder control QUrl outputLocation() const; bool setOutputLocation(const QUrl &location); @@ -157,9 +143,6 @@ Q_SIGNALS: // capture destination control void captureDestinationChanged(QCameraImageCapture::CaptureDestinations destination); - // locks control - void lockStatusChanged(QCamera::LockType type, QCamera::LockStatus status, QCamera::LockChangeReason reason); - // media recorder control void videoStateChanged(QMediaRecorder::State state); void videoStatusChanged(QMediaRecorder::Status status); @@ -167,22 +150,24 @@ Q_SIGNALS: void actualLocationChanged(const QUrl &location); void videoError(int error, const QString &errorString); + void cameraOpened(); + void focusStatusChanged(int status); + private slots: void updateReadyForCapture(); void imageCaptured(int, const QImage&, const QString&); - void handleFocusStatusChanged(int); void handleVideoRecordingPaused(); void handleVideoRecordingResumed(); void deviceOrientationChanged(int); void handleCameraPowerUp(); void viewfinderFrameGrabbed(const QImage &image); + void applyConfiguration(); private: bool openCamera(); void closeCamera(); bool startViewFinder(); void stopViewFinder(); - void applyConfiguration(); bool startVideoRecording(); void stopVideoRecording(); @@ -210,10 +195,6 @@ private: QImageEncoderSettings m_imageEncoderSettings; - LocksApplyMode m_locksApplyMode; - QCamera::LockStatus m_focusLockStatus; - QCamera::LockTypes m_currentLockTypes; - QString m_videoOutputLocation; QMediaRecorder::State m_videoState; QMediaRecorder::Status m_videoStatus; diff --git a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp b/src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.cpp index eae448e5b..eae448e5b 100644 --- a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp +++ b/src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h b/src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.h index 8ecf49c85..8ecf49c85 100644 --- a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h +++ b/src/plugins/qnx/camera/bbcameravideoencodersettingscontrol.h diff --git a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp b/src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.cpp index 5c7671e80..5c7671e80 100644 --- a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp +++ b/src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h b/src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.h index f1434c31c..f1434c31c 100644 --- a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h +++ b/src/plugins/qnx/camera/bbcameraviewfindersettingscontrol.h diff --git a/src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp b/src/plugins/qnx/camera/bbcamerazoomcontrol.cpp index f73cf000a..f73cf000a 100644 --- a/src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp +++ b/src/plugins/qnx/camera/bbcamerazoomcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbcamerazoomcontrol.h b/src/plugins/qnx/camera/bbcamerazoomcontrol.h index a1fecab89..a1fecab89 100644 --- a/src/plugins/blackberry/camera/bbcamerazoomcontrol.h +++ b/src/plugins/qnx/camera/bbcamerazoomcontrol.h diff --git a/src/plugins/blackberry/camera/bbimageencodercontrol.cpp b/src/plugins/qnx/camera/bbimageencodercontrol.cpp index 1265b9ca4..1265b9ca4 100644 --- a/src/plugins/blackberry/camera/bbimageencodercontrol.cpp +++ b/src/plugins/qnx/camera/bbimageencodercontrol.cpp diff --git a/src/plugins/blackberry/camera/bbimageencodercontrol.h b/src/plugins/qnx/camera/bbimageencodercontrol.h index 4db2e7def..4db2e7def 100644 --- a/src/plugins/blackberry/camera/bbimageencodercontrol.h +++ b/src/plugins/qnx/camera/bbimageencodercontrol.h diff --git a/src/plugins/blackberry/camera/bbmediastoragelocation.cpp b/src/plugins/qnx/camera/bbmediastoragelocation.cpp index 3d939ce4f..3d939ce4f 100644 --- a/src/plugins/blackberry/camera/bbmediastoragelocation.cpp +++ b/src/plugins/qnx/camera/bbmediastoragelocation.cpp diff --git a/src/plugins/blackberry/camera/bbmediastoragelocation.h b/src/plugins/qnx/camera/bbmediastoragelocation.h index efa89c8ed..efa89c8ed 100644 --- a/src/plugins/blackberry/camera/bbmediastoragelocation.h +++ b/src/plugins/qnx/camera/bbmediastoragelocation.h diff --git a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp index 6a6e9d3cd..6a6e9d3cd 100644 --- a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp +++ b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.cpp diff --git a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h index 1987f5491..1987f5491 100644 --- a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h +++ b/src/plugins/qnx/camera/bbvideodeviceselectorcontrol.h diff --git a/src/plugins/blackberry/camera/bbvideorenderercontrol.cpp b/src/plugins/qnx/camera/bbvideorenderercontrol.cpp index 4fadf9afb..4fadf9afb 100644 --- a/src/plugins/blackberry/camera/bbvideorenderercontrol.cpp +++ b/src/plugins/qnx/camera/bbvideorenderercontrol.cpp diff --git a/src/plugins/blackberry/camera/bbvideorenderercontrol.h b/src/plugins/qnx/camera/bbvideorenderercontrol.h index 93b2b6475..93b2b6475 100644 --- a/src/plugins/blackberry/camera/bbvideorenderercontrol.h +++ b/src/plugins/qnx/camera/bbvideorenderercontrol.h diff --git a/src/plugins/blackberry/camera/camera.pri b/src/plugins/qnx/camera/camera.pri index 6665573b0..6665573b0 100644 --- a/src/plugins/blackberry/camera/camera.pri +++ b/src/plugins/qnx/camera/camera.pri diff --git a/src/plugins/blackberry/common/common.pri b/src/plugins/qnx/common/common.pri index 1a6693474..1a6693474 100644 --- a/src/plugins/blackberry/common/common.pri +++ b/src/plugins/qnx/common/common.pri diff --git a/src/plugins/blackberry/common/windowgrabber.cpp b/src/plugins/qnx/common/windowgrabber.cpp index 144b5a693..5ed54b87e 100644 --- a/src/plugins/blackberry/common/windowgrabber.cpp +++ b/src/plugins/qnx/common/windowgrabber.cpp @@ -47,7 +47,10 @@ #include <QImage> #include <qpa/qplatformnativeinterface.h> +#ifdef Q_OS_BLACKBERRY +#include <bps/event.h> #include <bps/screen.h> +#endif #include <errno.h> QT_BEGIN_NAMESPACE @@ -232,40 +235,55 @@ void WindowGrabber::resume() m_timer.start(); } -bool WindowGrabber::nativeEventFilter(const QByteArray&, void *message, long*) +bool WindowGrabber::handleScreenEvent(screen_event_t screen_event) { - bps_event_t * const event = static_cast<bps_event_t *>(message); - if (event && bps_event_get_domain(event) == screen_get_domain()) { - const screen_event_t screen_event = screen_event_get_event(event); + int eventType; + if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) { + qWarning() << "WindowGrabber: Failed to query screen event type"; + return false; + } - int eventType; - if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) { - qWarning() << "WindowGrabber: Failed to query screen event type"; - return false; - } + if (eventType != SCREEN_EVENT_CREATE) + return false; - if (eventType != SCREEN_EVENT_CREATE) - return false; + screen_window_t window = 0; + if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) { + qWarning() << "WindowGrabber: Failed to query window property"; + return false; + } - screen_window_t window = 0; - if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) { - qWarning() << "WindowGrabber: Failed to query window property"; - return false; - } + const int maxIdStrLength = 128; + char idString[maxIdStrLength]; + if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) { + qWarning() << "WindowGrabber: Failed to query window ID string"; + return false; + } - const int maxIdStrLength = 128; - char idString[maxIdStrLength]; - if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) { - qWarning() << "WindowGrabber: Failed to query window ID string"; - return false; - } + if (m_windowId == idString) { + m_window = window; + start(); + } - if (m_windowId == idString) { - m_window = window; - start(); - } + return false; +} + +bool WindowGrabber::nativeEventFilter(const QByteArray &eventType, void *message, long*) +{ +#ifdef Q_OS_BLACKBERRY + Q_UNUSED(eventType) + bps_event_t * const event = static_cast<bps_event_t *>(message); + + if (event && bps_event_get_domain(event) == screen_get_domain()) { + const screen_event_t screen_event = screen_event_get_event(event); + return handleScreenEvent(screen_event); } +#else + if (eventType == "screen_event_t") { + const screen_event_t event = static_cast<screen_event_t>(message); + return handleScreenEvent(event); + } +#endif return false; } diff --git a/src/plugins/blackberry/common/windowgrabber.h b/src/plugins/qnx/common/windowgrabber.h index f8e3686a2..7ec4202a2 100644 --- a/src/plugins/blackberry/common/windowgrabber.h +++ b/src/plugins/qnx/common/windowgrabber.h @@ -69,6 +69,8 @@ public: bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; + bool handleScreenEvent(screen_event_t event); + QByteArray windowGroupId() const; signals: diff --git a/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.cpp new file mode 100644 index 000000000..dde03ad59 --- /dev/null +++ b/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** 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 "bpsmediaplayercontrol.h" +#include "mmrenderervideowindowcontrol.h" + +#include <bps/mmrenderer.h> +#include <bps/screen.h> + +QT_BEGIN_NAMESPACE + +BpsMediaPlayerControl::BpsMediaPlayerControl(QObject *parent) + : MmRendererMediaPlayerControl(parent), + m_eventMonitor(0) +{ + openConnection(); +} + +BpsMediaPlayerControl::~BpsMediaPlayerControl() +{ + destroy(); +} + +void BpsMediaPlayerControl::startMonitoring(int contextId, const QString &contextName) +{ + m_eventMonitor = mmrenderer_request_events(contextName.toLatin1().constData(), 0, contextId); + if (!m_eventMonitor) { + qDebug() << "Unable to request multimedia events"; + emit error(0, "Unable to request multimedia events"); + } +} + +void BpsMediaPlayerControl::stopMonitoring() +{ + if (m_eventMonitor) { + mmrenderer_stop_events(m_eventMonitor); + m_eventMonitor = 0; + } +} + +bool BpsMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +{ + Q_UNUSED(result) + Q_UNUSED(eventType) + + bps_event_t * const event = static_cast<bps_event_t *>(message); + if (!event || + (bps_event_get_domain(event) != mmrenderer_get_domain() && + bps_event_get_domain(event) != screen_get_domain())) + return false; + + if (event && bps_event_get_domain(event) == screen_get_domain()) { + const screen_event_t screen_event = screen_event_get_event(event); + if (MmRendererVideoWindowControl *control = videoWindowControl()) + control->screenEventHandler(screen_event); + } + + if (bps_event_get_domain(event) == mmrenderer_get_domain()) { + if (bps_event_get_code(event) == MMRENDERER_STATE_CHANGE) { + const mmrenderer_state_t newState = mmrenderer_event_get_state(event); + if (newState == MMR_STOPPED) { + handleMmStopped(); + return false; + } + } + + if (bps_event_get_code(event) == MMRENDERER_STATUS_UPDATE) { + const qint64 newPosition = QString::fromLatin1(mmrenderer_event_get_position(event)).toLongLong(); + handleMmStatusUpdate(newPosition); + + const QString bufferStatus = QString::fromLatin1(mmrenderer_event_get_bufferlevel(event)); + setMmBufferStatus(bufferStatus); + } + } + + return false; +} + +QT_END_NAMESPACE diff --git a/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.h b/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.h new file mode 100644 index 000000000..f0c132346 --- /dev/null +++ b/src/plugins/qnx/mediaplayer/bpsmediaplayercontrol.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** 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 BPSMEDIAPLAYERCONTROL_H +#define BPSMEDIAPLAYERCONTROL_H + +#include "mmrenderermediaplayercontrol.h" + +QT_BEGIN_NAMESPACE + +class BpsMediaPlayerControl Q_DECL_FINAL : public MmRendererMediaPlayerControl +{ + Q_OBJECT +public: + explicit BpsMediaPlayerControl(QObject *parent = 0); + ~BpsMediaPlayerControl(); + + void startMonitoring(int contextId, const QString &contextName) Q_DECL_OVERRIDE; + void stopMonitoring() Q_DECL_OVERRIDE; + + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; + +private: + mmrenderer_monitor_t *m_eventMonitor; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/qnx/mediaplayer/mediaplayer.pri b/src/plugins/qnx/mediaplayer/mediaplayer.pri new file mode 100644 index 000000000..9dedab0fd --- /dev/null +++ b/src/plugins/qnx/mediaplayer/mediaplayer.pri @@ -0,0 +1,31 @@ +INCLUDEPATH += $$PWD + +HEADERS += \ + $$PWD/mmrenderermediaplayercontrol.h \ + $$PWD/mmrenderermediaplayerservice.h \ + $$PWD/mmrenderermetadata.h \ + $$PWD/mmrenderermetadatareadercontrol.h \ + $$PWD/mmrendererplayervideorenderercontrol.h \ + $$PWD/mmrendererutil.h \ + $$PWD/mmrenderervideowindowcontrol.h + +SOURCES += \ + $$PWD/mmrenderermediaplayercontrol.cpp \ + $$PWD/mmrenderermediaplayerservice.cpp \ + $$PWD/mmrenderermetadata.cpp \ + $$PWD/mmrenderermetadatareadercontrol.cpp \ + $$PWD/mmrendererplayervideorenderercontrol.cpp \ + $$PWD/mmrendererutil.cpp \ + $$PWD/mmrenderervideowindowcontrol.cpp + +LIBS += -lmmrndclient -lstrm + +blackberry { + HEADERS += $$PWD/bpsmediaplayercontrol.h + SOURCES += $$PWD/bpsmediaplayercontrol.cpp +} else { + HEADERS += $$PWD/ppsmediaplayercontrol.h + SOURCES += $$PWD/ppsmediaplayercontrol.cpp + QT += core-private + LIBS += -lpps +} diff --git a/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp index c7a0fdd02..2a376198b 100644 --- a/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.cpp @@ -38,19 +38,18 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbmediaplayercontrol.h" -#include "bbmetadatareadercontrol.h" -#include "bbplayervideorenderercontrol.h" -#include "bbutil.h" -#include "bbvideowindowcontrol.h" +#include "mmrenderermediaplayercontrol.h" +#include "mmrenderermetadatareadercontrol.h" +#include "mmrendererplayervideorenderercontrol.h" +#include "mmrendererutil.h" +#include "mmrenderervideowindowcontrol.h" #include <QtCore/qabstracteventdispatcher.h> #include <QtCore/qcoreapplication.h> #include <QtCore/qdir.h> #include <QtCore/qfileinfo.h> #include <QtCore/quuid.h> #include <mm/renderer.h> -#include <bps/mmrenderer.h> -#include <bps/screen.h> + #include <errno.h> #include <sys/strm.h> #include <sys/stat.h> @@ -59,7 +58,7 @@ QT_BEGIN_NAMESPACE static int idCounter = 0; -BbMediaPlayerControl::BbMediaPlayerControl(QObject *parent) +MmRendererMediaPlayerControl::MmRendererMediaPlayerControl(QObject *parent) : QMediaPlayerControl(parent), m_connection(0), m_context(0), @@ -69,7 +68,6 @@ BbMediaPlayerControl::BbMediaPlayerControl(QObject *parent) m_muted(false), m_rate(1), m_id(-1), - m_eventMonitor(0), m_position(0), m_mediaStatus(QMediaPlayer::NoMedia), m_playAfterMediaLoaded(false), @@ -81,10 +79,9 @@ BbMediaPlayerControl::BbMediaPlayerControl(QObject *parent) m_loadingTimer.setInterval(0); connect(&m_loadingTimer, SIGNAL(timeout()), this, SLOT(continueLoadMedia())); QCoreApplication::eventDispatcher()->installNativeEventFilter(this); - openConnection(); } -BbMediaPlayerControl::~BbMediaPlayerControl() +void MmRendererMediaPlayerControl::destroy() { stop(); detach(); @@ -92,7 +89,7 @@ BbMediaPlayerControl::~BbMediaPlayerControl() QCoreApplication::eventDispatcher()->removeNativeEventFilter(this); } -void BbMediaPlayerControl::openConnection() +void MmRendererMediaPlayerControl::openConnection() { m_connection = mmr_connect(NULL); if (!m_connection) { @@ -101,7 +98,7 @@ void BbMediaPlayerControl::openConnection() } m_id = idCounter++; - m_contextName = QString("BbMediaPlayerControl_%1_%2").arg(m_id) + m_contextName = QString("MmRendererMediaPlayerControl_%1_%2").arg(m_id) .arg(QCoreApplication::applicationPid()); m_context = mmr_context_create(m_connection, m_contextName.toLatin1(), 0, S_IRWXU|S_IRWXG|S_IRWXO); @@ -111,19 +108,41 @@ void BbMediaPlayerControl::openConnection() return; } - m_eventMonitor = mmrenderer_request_events(m_contextName.toLatin1(), 0, m_id); - if (!m_eventMonitor) { - qDebug() << "Unable to request multimedia events"; - emit error(0, "Unable to request multimedia events"); - } + startMonitoring(m_id, m_contextName); } -void BbMediaPlayerControl::closeConnection() +void MmRendererMediaPlayerControl::handleMmStatusUpdate(qint64 newPosition) { - if (m_eventMonitor) { - mmrenderer_stop_events(m_eventMonitor); - m_eventMonitor = 0; + // Prevent spurious position change events from overriding our own position, for example + // when setting the position to 0 in stop(). + // Also, don't change the position while we're loading the media, as then play() would + // set a wrong initial position. + if (m_state != QMediaPlayer::PlayingState || + m_mediaStatus == QMediaPlayer::LoadingMedia || + m_mediaStatus == QMediaPlayer::NoMedia || + m_mediaStatus == QMediaPlayer::InvalidMedia) + return; + + setMmPosition(newPosition); +} + +void MmRendererMediaPlayerControl::handleMmStopped() +{ + // Only react to stop events that happen when the end of the stream is reached and + // playback is stopped because of this. + // Ignore other stop event sources, souch as calling mmr_stop() ourselves and + // mmr_input_attach(). + if (m_stopEventsToIgnore > 0) { + --m_stopEventsToIgnore; + } else { + setMediaStatus(QMediaPlayer::EndOfMedia); + stopInternal(IgnoreMmRenderer); } +} + +void MmRendererMediaPlayerControl::closeConnection() +{ + stopMonitoring(); if (m_context) { mmr_context_destroy(m_context); @@ -137,7 +156,7 @@ void BbMediaPlayerControl::closeConnection() } } -QByteArray BbMediaPlayerControl::resourcePathForUrl(const QUrl &url) +QByteArray MmRendererMediaPlayerControl::resourcePathForUrl(const QUrl &url) { // If this is a local file, mmrenderer expects the file:// prefix and an absolute path. // We treat URLs without scheme as local files, most likely someone just forgot to set the @@ -173,7 +192,7 @@ QByteArray BbMediaPlayerControl::resourcePathForUrl(const QUrl &url) } } -void BbMediaPlayerControl::attach() +void MmRendererMediaPlayerControl::attach() { // Should only be called in detached state Q_ASSERT(m_audioId == -1 && !m_inputAttached && m_tempMediaFileName.isEmpty()); @@ -219,7 +238,7 @@ void BbMediaPlayerControl::attach() emit bufferStatusChanged(m_bufferStatus); } -void BbMediaPlayerControl::detach() +void MmRendererMediaPlayerControl::detach() { if (m_context) { if (m_inputAttached) { @@ -243,27 +262,27 @@ void BbMediaPlayerControl::detach() m_loadingTimer.stop(); } -QMediaPlayer::State BbMediaPlayerControl::state() const +QMediaPlayer::State MmRendererMediaPlayerControl::state() const { return m_state; } -QMediaPlayer::MediaStatus BbMediaPlayerControl::mediaStatus() const +QMediaPlayer::MediaStatus MmRendererMediaPlayerControl::mediaStatus() const { return m_mediaStatus; } -qint64 BbMediaPlayerControl::duration() const +qint64 MmRendererMediaPlayerControl::duration() const { return m_metaData.duration(); } -qint64 BbMediaPlayerControl::position() const +qint64 MmRendererMediaPlayerControl::position() const { return m_position; } -void BbMediaPlayerControl::setPosition(qint64 position) +void MmRendererMediaPlayerControl::setPosition(qint64 position) { if (m_position != position) { m_position = position; @@ -277,12 +296,12 @@ void BbMediaPlayerControl::setPosition(qint64 position) } } -int BbMediaPlayerControl::volume() const +int MmRendererMediaPlayerControl::volume() const { return m_volume; } -void BbMediaPlayerControl::setVolumeInternal(int newVolume) +void MmRendererMediaPlayerControl::setVolumeInternal(int newVolume) { if (!m_context) return; @@ -296,7 +315,7 @@ void BbMediaPlayerControl::setVolumeInternal(int newVolume) } } -void BbMediaPlayerControl::setPlaybackRateInternal(qreal rate) +void MmRendererMediaPlayerControl::setPlaybackRateInternal(qreal rate) { if (!m_context) return; @@ -306,7 +325,7 @@ void BbMediaPlayerControl::setPlaybackRateInternal(qreal rate) emitMmError("mmr_speed_set failed"); } -void BbMediaPlayerControl::setPositionInternal(qint64 position) +void MmRendererMediaPlayerControl::setPositionInternal(qint64 position) { if (!m_context) return; @@ -317,7 +336,7 @@ void BbMediaPlayerControl::setPositionInternal(qint64 position) } } -void BbMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status) +void MmRendererMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status) { if (m_mediaStatus != status) { m_mediaStatus = status; @@ -325,7 +344,7 @@ void BbMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status) } } -void BbMediaPlayerControl::setState(QMediaPlayer::State state) +void MmRendererMediaPlayerControl::setState(QMediaPlayer::State state) { if (m_state != state) { if (m_videoRendererControl) { @@ -342,7 +361,7 @@ void BbMediaPlayerControl::setState(QMediaPlayer::State state) } } -void BbMediaPlayerControl::stopInternal(StopCommand stopCommand) +void MmRendererMediaPlayerControl::stopInternal(StopCommand stopCommand) { if (m_state != QMediaPlayer::StoppedState) { @@ -360,7 +379,7 @@ void BbMediaPlayerControl::stopInternal(StopCommand stopCommand) } } -void BbMediaPlayerControl::setVolume(int volume) +void MmRendererMediaPlayerControl::setVolume(int volume) { const int newVolume = qBound(0, volume, 100); if (m_volume != newVolume) { @@ -371,12 +390,12 @@ void BbMediaPlayerControl::setVolume(int volume) } } -bool BbMediaPlayerControl::isMuted() const +bool MmRendererMediaPlayerControl::isMuted() const { return m_muted; } -void BbMediaPlayerControl::setMuted(bool muted) +void MmRendererMediaPlayerControl::setMuted(bool muted) { if (m_muted != muted) { m_muted = muted; @@ -385,38 +404,38 @@ void BbMediaPlayerControl::setMuted(bool muted) } } -int BbMediaPlayerControl::bufferStatus() const +int MmRendererMediaPlayerControl::bufferStatus() const { return m_bufferStatus; } -bool BbMediaPlayerControl::isAudioAvailable() const +bool MmRendererMediaPlayerControl::isAudioAvailable() const { return m_metaData.hasAudio(); } -bool BbMediaPlayerControl::isVideoAvailable() const +bool MmRendererMediaPlayerControl::isVideoAvailable() const { return m_metaData.hasVideo(); } -bool BbMediaPlayerControl::isSeekable() const +bool MmRendererMediaPlayerControl::isSeekable() const { return m_metaData.isSeekable(); } -QMediaTimeRange BbMediaPlayerControl::availablePlaybackRanges() const +QMediaTimeRange MmRendererMediaPlayerControl::availablePlaybackRanges() const { // We can't get this information from the mmrenderer API yet, so pretend we can seek everywhere return QMediaTimeRange(0, m_metaData.duration()); } -qreal BbMediaPlayerControl::playbackRate() const +qreal MmRendererMediaPlayerControl::playbackRate() const { return m_rate; } -void BbMediaPlayerControl::setPlaybackRate(qreal rate) +void MmRendererMediaPlayerControl::setPlaybackRate(qreal rate) { if (m_rate != rate) { m_rate = rate; @@ -425,18 +444,18 @@ void BbMediaPlayerControl::setPlaybackRate(qreal rate) } } -QMediaContent BbMediaPlayerControl::media() const +QMediaContent MmRendererMediaPlayerControl::media() const { return m_media; } -const QIODevice *BbMediaPlayerControl::mediaStream() const +const QIODevice *MmRendererMediaPlayerControl::mediaStream() const { // Always 0, we don't support QIODevice streams return 0; } -void BbMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream) +void MmRendererMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream) { Q_UNUSED(stream); // not supported @@ -460,7 +479,7 @@ void BbMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *strea } } -void BbMediaPlayerControl::continueLoadMedia() +void MmRendererMediaPlayerControl::continueLoadMedia() { attach(); updateMetaData(); @@ -468,7 +487,17 @@ void BbMediaPlayerControl::continueLoadMedia() play(); } -void BbMediaPlayerControl::play() +QString MmRendererMediaPlayerControl::contextName() const +{ + return m_contextName; +} + +MmRendererVideoWindowControl *MmRendererMediaPlayerControl::videoWindowControl() const +{ + return m_videoWindowControl; +} + +void MmRendererMediaPlayerControl::play() { if (m_playAfterMediaLoaded) m_playAfterMediaLoaded = false; @@ -513,7 +542,7 @@ void BbMediaPlayerControl::play() setState( QMediaPlayer::PlayingState); } -void BbMediaPlayerControl::pause() +void MmRendererMediaPlayerControl::pause() { if (m_state == QMediaPlayer::PlayingState) { setPlaybackRateInternal(0); @@ -521,94 +550,53 @@ void BbMediaPlayerControl::pause() } } -void BbMediaPlayerControl::stop() +void MmRendererMediaPlayerControl::stop() { stopInternal(StopMmRenderer); } -void BbMediaPlayerControl::setVideoRendererControl(BbPlayerVideoRendererControl *videoControl) +MmRendererPlayerVideoRendererControl *MmRendererMediaPlayerControl::videoRendererControl() const +{ + return m_videoRendererControl; +} + +void MmRendererMediaPlayerControl::setVideoRendererControl(MmRendererPlayerVideoRendererControl *videoControl) { m_videoRendererControl = videoControl; } -void BbMediaPlayerControl::setVideoWindowControl(BbVideoWindowControl *videoControl) +void MmRendererMediaPlayerControl::setVideoWindowControl(MmRendererVideoWindowControl *videoControl) { m_videoWindowControl = videoControl; } -void BbMediaPlayerControl::setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl) +void MmRendererMediaPlayerControl::setMetaDataReaderControl(MmRendererMetaDataReaderControl *metaDataReaderControl) { m_metaDataReaderControl = metaDataReaderControl; } -bool BbMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +void MmRendererMediaPlayerControl::setMmPosition(qint64 newPosition) { - Q_UNUSED(eventType); - Q_UNUSED(result); - - bps_event_t * const event = static_cast<bps_event_t *>(message); - if (!event || - (bps_event_get_domain(event) != mmrenderer_get_domain() && - bps_event_get_domain(event) != screen_get_domain())) - return false; - - if (m_videoWindowControl) - m_videoWindowControl->bpsEventHandler(event); - - if (bps_event_get_domain(event) == mmrenderer_get_domain()) { - if (bps_event_get_code(event) == MMRENDERER_STATE_CHANGE) { - const mmrenderer_state_t newState = mmrenderer_event_get_state(event); - if (newState == MMR_STOPPED) { - - // Only react to stop events that happen when the end of the stream is reached and - // playback is stopped because of this. - // Ignore other stop event sources, souch as calling mmr_stop() ourselves and - // mmr_input_attach(). - if (m_stopEventsToIgnore > 0) { - --m_stopEventsToIgnore; - } else { - setMediaStatus(QMediaPlayer::EndOfMedia); - stopInternal(IgnoreMmRenderer); - } - return false; - } - } - - if (bps_event_get_code(event) == MMRENDERER_STATUS_UPDATE) { - - // Prevent spurious position change events from overriding our own position, for example - // when setting the position to 0 in stop(). - // Also, don't change the position while we're loading the media, as then play() would - // set a wrong initial position. - if (m_state != QMediaPlayer::PlayingState || - m_mediaStatus == QMediaPlayer::LoadingMedia || - m_mediaStatus == QMediaPlayer::NoMedia || - m_mediaStatus == QMediaPlayer::InvalidMedia) - return false; - - const qint64 newPosition = QString::fromLatin1(mmrenderer_event_get_position(event)).toLongLong(); - if (newPosition != 0 && newPosition != m_position) { - m_position = newPosition; - emit positionChanged(m_position); - } + if (newPosition != 0 && newPosition != m_position) { + m_position = newPosition; + emit positionChanged(m_position); + } +} - const QString bufferStatus = QString::fromLatin1(mmrenderer_event_get_bufferlevel(event)); - const int slashPos = bufferStatus.indexOf('/'); - if (slashPos != -1) { - const int fill = bufferStatus.left(slashPos).toInt(); - const int capacity = bufferStatus.mid(slashPos + 1).toInt(); - if (capacity != 0) { - m_bufferStatus = fill / static_cast<float>(capacity) * 100.0f; - emit bufferStatusChanged(m_bufferStatus); - } - } +void MmRendererMediaPlayerControl::setMmBufferStatus(const QString &bufferStatus) +{ + const int slashPos = bufferStatus.indexOf('/'); + if (slashPos != -1) { + const int fill = bufferStatus.left(slashPos).toInt(); + const int capacity = bufferStatus.mid(slashPos + 1).toInt(); + if (capacity != 0) { + m_bufferStatus = fill / static_cast<float>(capacity) * 100.0f; + emit bufferStatusChanged(m_bufferStatus); } } - - return false; } -void BbMediaPlayerControl::updateMetaData() +void MmRendererMediaPlayerControl::updateMetaData() { if (m_mediaStatus == QMediaPlayer::LoadedMedia) m_metaData.parse(m_contextName); @@ -628,7 +616,7 @@ void BbMediaPlayerControl::updateMetaData() emit seekableChanged(m_metaData.isSeekable()); } -void BbMediaPlayerControl::emitMmError(const QString &msg) +void MmRendererMediaPlayerControl::emitMmError(const QString &msg) { int errorCode = MMR_ERROR_NONE; const QString errorMessage = mmErrorMessage(msg, m_context, &errorCode); @@ -636,7 +624,7 @@ void BbMediaPlayerControl::emitMmError(const QString &msg) emit error(errorCode, errorMessage); } -void BbMediaPlayerControl::emitPError(const QString &msg) +void MmRendererMediaPlayerControl::emitPError(const QString &msg) { const QString errorMessage = QString("%1: %2").arg(msg).arg(strerror(errno)); qDebug() << errorMessage; diff --git a/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h index 16505fd5e..a22e71bfc 100644 --- a/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayercontrol.h @@ -38,32 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBMEDIAPLAYERCONTROL_H -#define BBMEDIAPLAYERCONTROL_H +#ifndef MMRENDERERMEDIAPLAYERCONTROL_H +#define MMRENDERERMEDIAPLAYERCONTROL_H -#include "bbmetadata.h" +#include "mmrenderermetadata.h" #include <qmediaplayercontrol.h> #include <QtCore/qabstractnativeeventfilter.h> #include <QtCore/qpointer.h> #include <QtCore/qtimer.h> -struct bps_event_t; typedef struct mmr_connection mmr_connection_t; typedef struct mmr_context mmr_context_t; typedef struct mmrenderer_monitor mmrenderer_monitor_t; QT_BEGIN_NAMESPACE -class BbMetaDataReaderControl; -class BbPlayerVideoRendererControl; -class BbVideoWindowControl; +class MmRendererMetaDataReaderControl; +class MmRendererPlayerVideoRendererControl; +class MmRendererVideoWindowControl; -class BbMediaPlayerControl : public QMediaPlayerControl, public QAbstractNativeEventFilter +class MmRendererMediaPlayerControl : public QMediaPlayerControl, public QAbstractNativeEventFilter { Q_OBJECT public: - explicit BbMediaPlayerControl(QObject *parent = 0); - ~BbMediaPlayerControl(); + explicit MmRendererMediaPlayerControl(QObject *parent = 0); QMediaPlayer::State state() const Q_DECL_OVERRIDE; @@ -100,25 +98,39 @@ public: void pause() Q_DECL_OVERRIDE; void stop() Q_DECL_OVERRIDE; - void setVideoRendererControl(BbPlayerVideoRendererControl *videoControl); - void setVideoWindowControl(BbVideoWindowControl *videoControl); - void setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl); - bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; + MmRendererPlayerVideoRendererControl *videoRendererControl() const; + void setVideoRendererControl(MmRendererPlayerVideoRendererControl *videoControl); + + MmRendererVideoWindowControl *videoWindowControl() const; + void setVideoWindowControl(MmRendererVideoWindowControl *videoControl); + void setMetaDataReaderControl(MmRendererMetaDataReaderControl *metaDataReaderControl); + +protected: + virtual void startMonitoring(int contextId, const QString &contextName) = 0; + virtual void stopMonitoring() = 0; + + QString contextName() const; + void openConnection(); + void emitMmError(const QString &msg); + void emitPError(const QString &msg); + void setMmPosition(qint64 newPosition); + void setMmBufferStatus(const QString &bufferStatus); + void handleMmStopped(); + void handleMmStatusUpdate(qint64 position); + + // must be called from subclass dtors (calls virtual function stopMonitoring()) + void destroy(); private Q_SLOTS: void continueLoadMedia(); private: QByteArray resourcePathForUrl(const QUrl &url); - void openConnection(); void closeConnection(); void attach(); void detach(); void updateMetaData(); - void emitMmError(const QString &msg); - void emitPError(const QString &msg); - // All these set the specified value to the backend, but neither emit changed signals // nor change the member value. void setVolumeInternal(int newVolume); @@ -140,12 +152,11 @@ private: int m_volume; bool m_muted; qreal m_rate; - QPointer<BbPlayerVideoRendererControl> m_videoRendererControl; - QPointer<BbVideoWindowControl> m_videoWindowControl; - QPointer<BbMetaDataReaderControl> m_metaDataReaderControl; - BbMetaData m_metaData; + QPointer<MmRendererPlayerVideoRendererControl> m_videoRendererControl; + QPointer<MmRendererVideoWindowControl> m_videoWindowControl; + QPointer<MmRendererMetaDataReaderControl> m_metaDataReaderControl; + MmRendererMetaData m_metaData; int m_id; - mmrenderer_monitor_t *m_eventMonitor; qint64 m_position; QMediaPlayer::MediaStatus m_mediaStatus; bool m_playAfterMediaLoaded; diff --git a/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp index 5846cc020..1e75674e3 100644 --- a/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.cpp @@ -38,17 +38,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbmediaplayerservice.h" +#include "mmrenderermediaplayerservice.h" -#include "bbmediaplayercontrol.h" -#include "bbmetadatareadercontrol.h" -#include "bbplayervideorenderercontrol.h" -#include "bbutil.h" -#include "bbvideowindowcontrol.h" +#include "mmrenderermediaplayercontrol.h" +#include "mmrenderermetadatareadercontrol.h" +#include "mmrendererplayervideorenderercontrol.h" +#include "mmrendererutil.h" +#include "mmrenderervideowindowcontrol.h" + +#ifdef Q_OS_BLACKBERRY +#include "bpsmediaplayercontrol.h" +typedef BpsMediaPlayerControl PlatformSpecificMediaPlayerControl; +#else +#include "ppsmediaplayercontrol.h" +typedef PpsMediaPlayerControl PlatformSpecificMediaPlayerControl; +#endif QT_BEGIN_NAMESPACE -BbMediaPlayerService::BbMediaPlayerService(QObject *parent) +MmRendererMediaPlayerService::MmRendererMediaPlayerService(QObject *parent) : QMediaService(parent), m_videoRendererControl(0), m_videoWindowControl(0), @@ -59,7 +67,7 @@ BbMediaPlayerService::BbMediaPlayerService(QObject *parent) { } -BbMediaPlayerService::~BbMediaPlayerService() +MmRendererMediaPlayerService::~MmRendererMediaPlayerService() { // Someone should have called releaseControl(), but better be safe delete m_videoRendererControl; @@ -68,18 +76,18 @@ BbMediaPlayerService::~BbMediaPlayerService() delete m_metaDataReaderControl; } -QMediaControl *BbMediaPlayerService::requestControl(const char *name) +QMediaControl *MmRendererMediaPlayerService::requestControl(const char *name) { if (qstrcmp(name, QMediaPlayerControl_iid) == 0) { if (!m_mediaPlayerControl) { - m_mediaPlayerControl = new BbMediaPlayerControl(); + m_mediaPlayerControl = new PlatformSpecificMediaPlayerControl; updateControls(); } return m_mediaPlayerControl; } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) { if (!m_metaDataReaderControl) { - m_metaDataReaderControl = new BbMetaDataReaderControl(); + m_metaDataReaderControl = new MmRendererMetaDataReaderControl(); updateControls(); } return m_metaDataReaderControl; @@ -98,14 +106,14 @@ QMediaControl *BbMediaPlayerService::requestControl(const char *name) } if (!m_videoRendererControl) { - m_videoRendererControl = new BbPlayerVideoRendererControl(); + m_videoRendererControl = new MmRendererPlayerVideoRendererControl(); updateControls(); } return m_videoRendererControl; } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) { if (!m_videoWindowControl) { - m_videoWindowControl = new BbVideoWindowControl(); + m_videoWindowControl = new MmRendererVideoWindowControl(); updateControls(); } return m_videoWindowControl; @@ -113,7 +121,7 @@ QMediaControl *BbMediaPlayerService::requestControl(const char *name) return 0; } -void BbMediaPlayerService::releaseControl(QMediaControl *control) +void MmRendererMediaPlayerService::releaseControl(QMediaControl *control) { if (control == m_videoRendererControl) m_videoRendererControl = 0; @@ -126,7 +134,7 @@ void BbMediaPlayerService::releaseControl(QMediaControl *control) delete control; } -void BbMediaPlayerService::updateControls() +void MmRendererMediaPlayerService::updateControls() { if (m_videoRendererControl && m_mediaPlayerControl) m_mediaPlayerControl->setVideoRendererControl(m_videoRendererControl); diff --git a/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h index 03aa7818f..3d55de8d5 100644 --- a/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermediaplayerservice.h @@ -38,25 +38,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBMEDIAPLAYERSERVICE_H -#define BBMEDIAPLAYERSERVICE_H +#ifndef MMRENDERERMEDIAPLAYERSERVICE_H +#define MMRENDERERMEDIAPLAYERSERVICE_H #include <qmediaservice.h> #include <QtCore/qpointer.h> QT_BEGIN_NAMESPACE -class BbMediaPlayerControl; -class BbMetaDataReaderControl; -class BbPlayerVideoRendererControl; -class BbVideoWindowControl; +class MmRendererMediaPlayerControl; +class MmRendererMetaDataReaderControl; +class MmRendererPlayerVideoRendererControl; +class MmRendererVideoWindowControl; -class BbMediaPlayerService : public QMediaService +class MmRendererMediaPlayerService : public QMediaService { Q_OBJECT public: - explicit BbMediaPlayerService(QObject *parent = 0); - ~BbMediaPlayerService(); + explicit MmRendererMediaPlayerService(QObject *parent = 0); + ~MmRendererMediaPlayerService(); QMediaControl *requestControl(const char *name) Q_DECL_OVERRIDE; void releaseControl(QMediaControl *control) Q_DECL_OVERRIDE; @@ -64,10 +64,10 @@ public: private: void updateControls(); - QPointer<BbPlayerVideoRendererControl> m_videoRendererControl; - QPointer<BbVideoWindowControl> m_videoWindowControl; - QPointer<BbMediaPlayerControl> m_mediaPlayerControl; - QPointer<BbMetaDataReaderControl> m_metaDataReaderControl; + QPointer<MmRendererPlayerVideoRendererControl> m_videoRendererControl; + QPointer<MmRendererVideoWindowControl> m_videoWindowControl; + QPointer<MmRendererMediaPlayerControl> m_mediaPlayerControl; + QPointer<MmRendererMetaDataReaderControl> m_metaDataReaderControl; bool m_appHasDrmPermission : 1; bool m_appHasDrmPermissionChecked : 1; diff --git a/src/plugins/blackberry/mediaplayer/bbmetadata.cpp b/src/plugins/qnx/mediaplayer/mmrenderermetadata.cpp index 680833e85..07f5ddd62 100644 --- a/src/plugins/blackberry/mediaplayer/bbmetadata.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermetadata.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbmetadata.h" +#include "mmrenderermetadata.h" #include <QtCore/qdebug.h> #include <QtCore/qfile.h> @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -BbMetaData::BbMetaData() +MmRendererMetaData::MmRendererMetaData() { clear(); } @@ -64,14 +64,14 @@ static const char * trackKey = "md_title_track"; static const char * widthKey = "md_video_width"; static const char * heightKey = "md_video_height"; static const char * mediaTypeKey = "md_title_mediatype"; -static const char * pixelWidthKey = "md_video_pixel_height"; -static const char * pixelHeightKey = "md_video_pixel_width"; +static const char * pixelWidthKey = "md_video_pixel_width"; +static const char * pixelHeightKey = "md_video_pixel_height"; static const char * seekableKey = "md_title_seekable"; static const int mediaTypeAudioFlag = 4; static const int mediaTypeVideoFlag = 2; -bool BbMetaData::parse(const QString &contextName) +bool MmRendererMetaData::parse(const QString &contextName) { clear(); QString fileName = @@ -138,7 +138,7 @@ bool BbMetaData::parse(const QString &contextName) return true; } -void BbMetaData::clear() +void MmRendererMetaData::clear() { m_duration = 0; m_height = 0; @@ -158,7 +158,7 @@ void BbMetaData::clear() m_track = 0; } -qlonglong BbMetaData::duration() const +qlonglong MmRendererMetaData::duration() const { return m_duration; } @@ -173,17 +173,17 @@ qlonglong BbMetaData::duration() const // is 600x200, which will cause the video to be displayed in an aspect ratio of 3:1 instead of 3:2, // and therefore look correct. -int BbMetaData::height() const +int MmRendererMetaData::height() const { return m_height * m_pixelHeight; } -int BbMetaData::width() const +int MmRendererMetaData::width() const { return m_width * m_pixelWidth; } -bool BbMetaData::hasVideo() const +bool MmRendererMetaData::hasVideo() const { // By default, assume no video if we can't extract the information if (m_mediaType == -1) @@ -192,7 +192,7 @@ bool BbMetaData::hasVideo() const return (m_mediaType & mediaTypeVideoFlag); } -bool BbMetaData::hasAudio() const +bool MmRendererMetaData::hasAudio() const { // By default, assume audio only if we can't extract the information if (m_mediaType == -1) @@ -201,37 +201,37 @@ bool BbMetaData::hasAudio() const return (m_mediaType & mediaTypeAudioFlag); } -QString BbMetaData::title() const +QString MmRendererMetaData::title() const { return m_title; } -bool BbMetaData::isSeekable() const +bool MmRendererMetaData::isSeekable() const { return m_seekable; } -QString BbMetaData::artist() const +QString MmRendererMetaData::artist() const { return m_artist; } -QString BbMetaData::comment() const +QString MmRendererMetaData::comment() const { return m_comment; } -QString BbMetaData::genre() const +QString MmRendererMetaData::genre() const { return m_genre; } -int BbMetaData::year() const +int MmRendererMetaData::year() const { return m_year; } -QString BbMetaData::mediaType() const +QString MmRendererMetaData::mediaType() const { if (hasVideo()) return QLatin1String("video"); @@ -241,27 +241,27 @@ QString BbMetaData::mediaType() const return QString(); } -int BbMetaData::audioBitRate() const +int MmRendererMetaData::audioBitRate() const { return m_audioBitRate; } -int BbMetaData::sampleRate() const +int MmRendererMetaData::sampleRate() const { return m_sampleRate; } -QString BbMetaData::album() const +QString MmRendererMetaData::album() const { return m_album; } -int BbMetaData::track() const +int MmRendererMetaData::track() const { return m_track; } -QSize BbMetaData::resolution() const +QSize MmRendererMetaData::resolution() const { return QSize(width(), height()); } diff --git a/src/plugins/blackberry/mediaplayer/bbmetadata.h b/src/plugins/qnx/mediaplayer/mmrenderermetadata.h index f4b742296..deb848a80 100644 --- a/src/plugins/blackberry/mediaplayer/bbmetadata.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermetadata.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBMETADATA_H -#define BBMETADATA_H +#ifndef MMRENDERERMETADATA_H +#define MMRENDERERMETADATA_H #include <QtCore/qglobal.h> #include <QtCore/QSize> @@ -47,10 +47,10 @@ QT_BEGIN_NAMESPACE -class BbMetaData +class MmRendererMetaData { public: - BbMetaData(); + MmRendererMetaData(); bool parse(const QString &contextName); void clear(); diff --git a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.cpp index 99e3c5125..c0fe7d085 100644 --- a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.cpp @@ -38,22 +38,22 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbmetadatareadercontrol.h" +#include "mmrenderermetadatareadercontrol.h" #include <QtMultimedia/qmediametadata.h> QT_BEGIN_NAMESPACE -BbMetaDataReaderControl::BbMetaDataReaderControl(QObject *parent) +MmRendererMetaDataReaderControl::MmRendererMetaDataReaderControl(QObject *parent) : QMetaDataReaderControl(parent) { } -bool BbMetaDataReaderControl::isMetaDataAvailable() const +bool MmRendererMetaDataReaderControl::isMetaDataAvailable() const { return !availableMetaData().isEmpty(); } -QVariant BbMetaDataReaderControl::metaData(const QString &key) const +QVariant MmRendererMetaDataReaderControl::metaData(const QString &key) const { if (key == QMediaMetaData::Title) return m_metaData.title(); @@ -83,7 +83,7 @@ QVariant BbMetaDataReaderControl::metaData(const QString &key) const return QVariant(); } -QStringList BbMetaDataReaderControl::availableMetaData() const +QStringList MmRendererMetaDataReaderControl::availableMetaData() const { QStringList metaData; @@ -115,9 +115,9 @@ QStringList BbMetaDataReaderControl::availableMetaData() const return metaData; } -void BbMetaDataReaderControl::setMetaData(const BbMetaData &data) +void MmRendererMetaDataReaderControl::setMetaData(const MmRendererMetaData &data) { - const BbMetaData oldMetaData = m_metaData; + const MmRendererMetaData oldMetaData = m_metaData; const bool oldMetaDataAvailable = isMetaDataAvailable(); m_metaData = data; diff --git a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h b/src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.h index c825b54f3..f824ca4d0 100644 --- a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h +++ b/src/plugins/qnx/mediaplayer/mmrenderermetadatareadercontrol.h @@ -38,29 +38,29 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBMETADATAREADERCONTROL_H -#define BBMETADATAREADERCONTROL_H +#ifndef MMRENDERERMETADATAREADERCONTROL_H +#define MMRENDERERMETADATAREADERCONTROL_H -#include "bbmetadata.h" +#include "mmrenderermetadata.h" #include <qmetadatareadercontrol.h> QT_BEGIN_NAMESPACE -class BbMetaDataReaderControl : public QMetaDataReaderControl +class MmRendererMetaDataReaderControl : public QMetaDataReaderControl { Q_OBJECT public: - explicit BbMetaDataReaderControl(QObject *parent = 0); + explicit MmRendererMetaDataReaderControl(QObject *parent = 0); bool isMetaDataAvailable() const Q_DECL_OVERRIDE; QVariant metaData(const QString &key) const Q_DECL_OVERRIDE; QStringList availableMetaData() const Q_DECL_OVERRIDE; - void setMetaData(const BbMetaData &data); + void setMetaData(const MmRendererMetaData &data); private: - BbMetaData m_metaData; + MmRendererMetaData m_metaData; }; QT_END_NAMESPACE diff --git a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp b/src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp index d9226d91f..0abdfec49 100644 --- a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "bbplayervideorenderercontrol.h" +#include "mmrendererplayervideorenderercontrol.h" #include "windowgrabber.h" @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE static int winIdCounter = 0; -BbPlayerVideoRendererControl::BbPlayerVideoRendererControl(QObject *parent) +MmRendererPlayerVideoRendererControl::MmRendererPlayerVideoRendererControl(QObject *parent) : QVideoRendererControl(parent) , m_windowGrabber(new WindowGrabber(this)) , m_context(0) @@ -62,40 +62,40 @@ BbPlayerVideoRendererControl::BbPlayerVideoRendererControl(QObject *parent) connect(m_windowGrabber, SIGNAL(frameGrabbed(QImage)), SLOT(frameGrabbed(QImage))); } -BbPlayerVideoRendererControl::~BbPlayerVideoRendererControl() +MmRendererPlayerVideoRendererControl::~MmRendererPlayerVideoRendererControl() { detachDisplay(); } -QAbstractVideoSurface *BbPlayerVideoRendererControl::surface() const +QAbstractVideoSurface *MmRendererPlayerVideoRendererControl::surface() const { return m_surface; } -void BbPlayerVideoRendererControl::setSurface(QAbstractVideoSurface *surface) +void MmRendererPlayerVideoRendererControl::setSurface(QAbstractVideoSurface *surface) { m_surface = QPointer<QAbstractVideoSurface>(surface); } -void BbPlayerVideoRendererControl::attachDisplay(mmr_context_t *context) +void MmRendererPlayerVideoRendererControl::attachDisplay(mmr_context_t *context) { if (m_videoId != -1) { - qWarning() << "BbPlayerVideoRendererControl: Video output already attached!"; + qWarning() << "MmRendererPlayerVideoRendererControl: Video output already attached!"; return; } if (!context) { - qWarning() << "BbPlayerVideoRendererControl: No media player context!"; + qWarning() << "MmRendererPlayerVideoRendererControl: No media player context!"; return; } const QByteArray windowGroupId = m_windowGrabber->windowGroupId(); if (windowGroupId.isEmpty()) { - qWarning() << "BbPlayerVideoRendererControl: Unable to find window group"; + qWarning() << "MmRendererPlayerVideoRendererControl: Unable to find window group"; return; } - const QString windowName = QStringLiteral("BbPlayerVideoRendererControl_%1_%2") + const QString windowName = QStringLiteral("MmRendererPlayerVideoRendererControl_%1_%2") .arg(winIdCounter++) .arg(QCoreApplication::applicationPid()); @@ -115,7 +115,7 @@ void BbPlayerVideoRendererControl::attachDisplay(mmr_context_t *context) m_context = context; } -void BbPlayerVideoRendererControl::detachDisplay() +void MmRendererPlayerVideoRendererControl::detachDisplay() { m_windowGrabber->stop(); @@ -129,17 +129,17 @@ void BbPlayerVideoRendererControl::detachDisplay() m_videoId = -1; } -void BbPlayerVideoRendererControl::pause() +void MmRendererPlayerVideoRendererControl::pause() { m_windowGrabber->pause(); } -void BbPlayerVideoRendererControl::resume() +void MmRendererPlayerVideoRendererControl::resume() { m_windowGrabber->resume(); } -void BbPlayerVideoRendererControl::frameGrabbed(const QImage &frame) +void MmRendererPlayerVideoRendererControl::frameGrabbed(const QImage &frame) { if (m_surface) { if (!m_surface->isActive()) { diff --git a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h b/src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.h index fff80dfe8..4e271ad5d 100644 --- a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h +++ b/src/plugins/qnx/mediaplayer/mmrendererplayervideorenderercontrol.h @@ -38,26 +38,25 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBPLAYERVIDEORENDERERCONTROL_H -#define BBPLAYERVIDEORENDERERCONTROL_H +#ifndef MMRENDERERPLAYERVIDEORENDERERCONTROL_H +#define MMRENDERERPLAYERVIDEORENDERERCONTROL_H #include <QPointer> #include <qabstractvideosurface.h> #include <qvideorenderercontrol.h> typedef struct mmr_context mmr_context_t; -struct bps_event_t; QT_BEGIN_NAMESPACE class WindowGrabber; -class BbPlayerVideoRendererControl : public QVideoRendererControl +class MmRendererPlayerVideoRendererControl : public QVideoRendererControl { Q_OBJECT public: - explicit BbPlayerVideoRendererControl(QObject *parent = 0); - ~BbPlayerVideoRendererControl(); + explicit MmRendererPlayerVideoRendererControl(QObject *parent = 0); + ~MmRendererPlayerVideoRendererControl(); QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE; void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE; diff --git a/src/plugins/blackberry/mediaplayer/bbutil.cpp b/src/plugins/qnx/mediaplayer/mmrendererutil.cpp index 2e95c3571..61f85f3d9 100644 --- a/src/plugins/blackberry/mediaplayer/bbutil.cpp +++ b/src/plugins/qnx/mediaplayer/mmrendererutil.cpp @@ -38,7 +38,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbutil.h" +#include "mmrendererutil.h" #include <QDebug> #include <QDir> diff --git a/src/plugins/blackberry/mediaplayer/bbutil.h b/src/plugins/qnx/mediaplayer/mmrendererutil.h index 35d59fe48..4b9adc27e 100644 --- a/src/plugins/blackberry/mediaplayer/bbutil.h +++ b/src/plugins/qnx/mediaplayer/mmrendererutil.h @@ -38,8 +38,8 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBUTIL_H -#define BBUTIL_H +#ifndef MMRENDERERUTIL_H +#define MMRENDERERUTIL_H #include <QtCore/qglobal.h> diff --git a/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp index d29f36f0a..c35c6d1ad 100644 --- a/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp +++ b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.cpp @@ -38,21 +38,20 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include "bbvideowindowcontrol.h" -#include "bbutil.h" +#include "mmrenderervideowindowcontrol.h" +#include "mmrendererutil.h" #include <QtCore/qdebug.h> #include <QtGui/qguiapplication.h> #include <QtGui/qpa/qplatformnativeinterface.h> #include <QtGui/qscreen.h> #include <QtGui/qwindow.h> #include <mm/renderer.h> -#include <bps/screen.h> QT_BEGIN_NAMESPACE static int winIdCounter = 0; -BbVideoWindowControl::BbVideoWindowControl(QObject *parent) +MmRendererVideoWindowControl::MmRendererVideoWindowControl(QObject *parent) : QVideoWindowControl(parent), m_videoId(-1), m_winId(0), @@ -67,26 +66,26 @@ BbVideoWindowControl::BbVideoWindowControl(QObject *parent) { } -BbVideoWindowControl::~BbVideoWindowControl() +MmRendererVideoWindowControl::~MmRendererVideoWindowControl() { } -WId BbVideoWindowControl::winId() const +WId MmRendererVideoWindowControl::winId() const { return m_winId; } -void BbVideoWindowControl::setWinId(WId id) +void MmRendererVideoWindowControl::setWinId(WId id) { m_winId = id; } -QRect BbVideoWindowControl::displayRect() const +QRect MmRendererVideoWindowControl::displayRect() const { return m_displayRect ; } -void BbVideoWindowControl::setDisplayRect(const QRect &rect) +void MmRendererVideoWindowControl::setDisplayRect(const QRect &rect) { if (m_displayRect != rect) { m_displayRect = rect; @@ -94,12 +93,12 @@ void BbVideoWindowControl::setDisplayRect(const QRect &rect) } } -bool BbVideoWindowControl::isFullScreen() const +bool MmRendererVideoWindowControl::isFullScreen() const { return m_fullscreen; } -void BbVideoWindowControl::setFullScreen(bool fullScreen) +void MmRendererVideoWindowControl::setFullScreen(bool fullScreen) { if (m_fullscreen != fullScreen) { m_fullscreen = fullScreen; @@ -108,32 +107,32 @@ void BbVideoWindowControl::setFullScreen(bool fullScreen) } } -void BbVideoWindowControl::repaint() +void MmRendererVideoWindowControl::repaint() { // Nothing we can or should do here } -QSize BbVideoWindowControl::nativeSize() const +QSize MmRendererVideoWindowControl::nativeSize() const { return QSize(m_metaData.width(), m_metaData.height()); } -Qt::AspectRatioMode BbVideoWindowControl::aspectRatioMode() const +Qt::AspectRatioMode MmRendererVideoWindowControl::aspectRatioMode() const { return m_aspectRatioMode; } -void BbVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) +void MmRendererVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode) { m_aspectRatioMode = mode; } -int BbVideoWindowControl::brightness() const +int MmRendererVideoWindowControl::brightness() const { return m_brightness; } -void BbVideoWindowControl::setBrightness(int brightness) +void MmRendererVideoWindowControl::setBrightness(int brightness) { if (m_brightness != brightness) { m_brightness = brightness; @@ -142,12 +141,12 @@ void BbVideoWindowControl::setBrightness(int brightness) } } -int BbVideoWindowControl::contrast() const +int MmRendererVideoWindowControl::contrast() const { return m_contrast; } -void BbVideoWindowControl::setContrast(int contrast) +void MmRendererVideoWindowControl::setContrast(int contrast) { if (m_contrast != contrast) { m_contrast = contrast; @@ -156,12 +155,12 @@ void BbVideoWindowControl::setContrast(int contrast) } } -int BbVideoWindowControl::hue() const +int MmRendererVideoWindowControl::hue() const { return m_hue; } -void BbVideoWindowControl::setHue(int hue) +void MmRendererVideoWindowControl::setHue(int hue) { if (m_hue != hue) { m_hue = hue; @@ -170,12 +169,12 @@ void BbVideoWindowControl::setHue(int hue) } } -int BbVideoWindowControl::saturation() const +int MmRendererVideoWindowControl::saturation() const { return m_saturation; } -void BbVideoWindowControl::setSaturation(int saturation) +void MmRendererVideoWindowControl::setSaturation(int saturation) { if (m_saturation != saturation) { m_saturation = saturation; @@ -184,40 +183,44 @@ void BbVideoWindowControl::setSaturation(int saturation) } } -void BbVideoWindowControl::attachDisplay(mmr_context_t *context) +void MmRendererVideoWindowControl::attachDisplay(mmr_context_t *context) { if (m_videoId != -1) { - qDebug() << "BbVideoWindowControl: Video output already attached!"; + qDebug() << "MmRendererVideoWindowControl: Video output already attached!"; return; } if (!context) { - qDebug() << "BbVideoWindowControl: No media player context!"; + qDebug() << "MmRendererVideoWindowControl: No media player context!"; return; } - QWindow * const window = findWindow(m_winId); + QWindow *window = findWindow(m_winId); if (!window) { - qDebug() << "BbVideoWindowControl: No video window!"; + qDebug() << "MmRendererVideoWindowControl: No video window!"; return; } QPlatformNativeInterface * const nativeInterface = QGuiApplication::platformNativeInterface(); if (!nativeInterface) { - qDebug() << "BbVideoWindowControl: Unable to get platform native interface"; + qDebug() << "MmRendererVideoWindowControl: Unable to get platform native interface"; return; } const char * const groupNameData = static_cast<const char *>( nativeInterface->nativeResourceForWindow("windowGroup", window)); if (!groupNameData) { - qDebug() << "BbVideoWindowControl: Unable to find window group for window" << window; + qDebug() << "MmRendererVideoWindowControl: Unable to find window group for window" << window; return; } const QString groupName = QString::fromLatin1(groupNameData); - m_windowName = QString("BbVideoWindowControl_%1_%2").arg(winIdCounter++) + m_windowName = QString("MmRendererVideoWindowControl_%1_%2").arg(winIdCounter++) .arg(QCoreApplication::applicationPid()); + + nativeInterface->setWindowProperty(window->handle(), + QStringLiteral("mmRendererWindowName"), m_windowName); + // Start with an invisible window. If it would be visible right away, it would be at the wrong // position, and we can only change the position once we get the window handle. const QString videoDeviceUrl = @@ -237,7 +240,7 @@ void BbVideoWindowControl::attachDisplay(mmr_context_t *context) updateSaturation(); } -void BbVideoWindowControl::updateVideoPosition() +void MmRendererVideoWindowControl::updateVideoPosition() { QWindow * const window = findWindow(m_winId); if (m_context && m_videoId != -1 && window) { @@ -303,7 +306,7 @@ void BbVideoWindowControl::updateVideoPosition() } } -void BbVideoWindowControl::updateBrightness() +void MmRendererVideoWindowControl::updateBrightness() { if (m_window != 0) { const int backendValue = m_brightness * 2.55f; @@ -312,7 +315,7 @@ void BbVideoWindowControl::updateBrightness() } } -void BbVideoWindowControl::updateContrast() +void MmRendererVideoWindowControl::updateContrast() { if (m_window != 0) { const int backendValue = m_contrast * 1.27f; @@ -321,7 +324,7 @@ void BbVideoWindowControl::updateContrast() } } -void BbVideoWindowControl::updateHue() +void MmRendererVideoWindowControl::updateHue() { if (m_window != 0) { const int backendValue = m_hue * 1.27f; @@ -330,7 +333,7 @@ void BbVideoWindowControl::updateHue() } } -void BbVideoWindowControl::updateSaturation() +void MmRendererVideoWindowControl::updateSaturation() { if (m_window != 0) { const int backendValue = m_saturation * 1.27f; @@ -339,7 +342,7 @@ void BbVideoWindowControl::updateSaturation() } } -void BbVideoWindowControl::detachDisplay() +void MmRendererVideoWindowControl::detachDisplay() { if (m_context && m_videoId != -1) mmr_output_detach(m_context, m_videoId); @@ -355,7 +358,7 @@ void BbVideoWindowControl::detachDisplay() m_saturation = 0; } -void BbVideoWindowControl::setMetaData(const BbMetaData &metaData) +void MmRendererVideoWindowControl::setMetaData(const MmRendererMetaData &metaData) { m_metaData = metaData; emit nativeSizeChanged(); @@ -364,47 +367,43 @@ void BbVideoWindowControl::setMetaData(const BbMetaData &metaData) updateVideoPosition(); } -void BbVideoWindowControl::bpsEventHandler(bps_event_t *event) +void MmRendererVideoWindowControl::screenEventHandler(const screen_event_t &screen_event) { - if (event && bps_event_get_domain(event) == screen_get_domain()) { - const screen_event_t screen_event = screen_event_get_event(event); - - int eventType; - if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) { - perror("BbVideoWindowControl: Failed to query screen event type"); - return; - } + int eventType; + if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) { + perror("MmRendererVideoWindowControl: Failed to query screen event type"); + return; + } - if (eventType != SCREEN_EVENT_CREATE) - return; + if (eventType != SCREEN_EVENT_CREATE) + return; - screen_window_t window = 0; - if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) { - perror("BbVideoWindowControl: Failed to query window property"); - return; - } + screen_window_t window = 0; + if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) { + perror("MmRendererVideoWindowControl: Failed to query window property"); + return; + } - const int maxIdStrLength = 128; - char idString[maxIdStrLength]; - if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) { - perror("BbVideoWindowControl: Failed to query window ID string"); - return; - } + const int maxIdStrLength = 128; + char idString[maxIdStrLength]; + if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) { + perror("MmRendererVideoWindowControl: Failed to query window ID string"); + return; + } - if (m_windowName == idString) { - m_window = window; - updateVideoPosition(); + if (m_windowName == idString) { + m_window = window; + updateVideoPosition(); - const int visibleFlag = 1; - if (screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &visibleFlag) != 0) { - perror("BbVideoWindowControl: Failed to make window visible"); - return; - } + const int visibleFlag = 1; + if (screen_set_window_property_iv(m_window, SCREEN_PROPERTY_VISIBLE, &visibleFlag) != 0) { + perror("MmRendererVideoWindowControl: Failed to make window visible"); + return; } } } -QWindow *BbVideoWindowControl::findWindow(WId id) const +QWindow *MmRendererVideoWindowControl::findWindow(WId id) const { Q_FOREACH (QWindow *window, QGuiApplication::allWindows()) if (window->winId() == id) diff --git a/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.h index 81bf79682..cfc9603bb 100644 --- a/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h +++ b/src/plugins/qnx/mediaplayer/mmrenderervideowindowcontrol.h @@ -38,24 +38,23 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef BBVIDEOWINDOWCONTROL_H -#define BBVIDEOWINDOWCONTROL_H +#ifndef MMRENDERERVIDEOWINDOWCONTROL_H +#define MMRENDERERVIDEOWINDOWCONTROL_H -#include "bbmetadata.h" +#include "mmrenderermetadata.h" #include <qvideowindowcontrol.h> #include <screen/screen.h> typedef struct mmr_context mmr_context_t; -struct bps_event_t; QT_BEGIN_NAMESPACE -class BbVideoWindowControl : public QVideoWindowControl +class MmRendererVideoWindowControl : public QVideoWindowControl { Q_OBJECT public: - explicit BbVideoWindowControl(QObject *parent = 0); - ~BbVideoWindowControl(); + explicit MmRendererVideoWindowControl(QObject *parent = 0); + ~MmRendererVideoWindowControl(); WId winId() const Q_DECL_OVERRIDE; void setWinId(WId id) Q_DECL_OVERRIDE; @@ -90,8 +89,8 @@ public: // void detachDisplay(); void attachDisplay(mmr_context_t *context); - void setMetaData(const BbMetaData &metaData); - void bpsEventHandler(bps_event_t *event); + void setMetaData(const MmRendererMetaData &metaData); + void screenEventHandler(const screen_event_t &event); private: QWindow *findWindow(WId id) const; @@ -106,7 +105,7 @@ private: QRect m_displayRect; mmr_context_t *m_context; bool m_fullscreen; - BbMetaData m_metaData; + MmRendererMetaData m_metaData; Qt::AspectRatioMode m_aspectRatioMode; QString m_windowName; screen_window_t m_window; diff --git a/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp new file mode 100644 index 000000000..eb0842fb9 --- /dev/null +++ b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** 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 "ppsmediaplayercontrol.h" +#include "mmrenderervideowindowcontrol.h" + +#include <QtCore/qfile.h> +#include <QtCore/qsocketnotifier.h> +#include <QtCore/private/qcore_unix_p.h> + +#include <screen/screen.h> +#include <sys/pps.h> + +QT_BEGIN_NAMESPACE + +PpsMediaPlayerControl::PpsMediaPlayerControl(QObject *parent) + : MmRendererMediaPlayerControl(parent), + m_ppsStatusNotifier(0), + m_ppsStatusFd(-1), + m_ppsStateNotifier(0), + m_ppsStateFd(-1) + , m_previouslySeenState("STOPPED") +{ + openConnection(); +} + +PpsMediaPlayerControl::~PpsMediaPlayerControl() +{ + destroy(); +} + +void PpsMediaPlayerControl::startMonitoring(int, const QString &contextName) +{ + const QString ppsContextPath = QStringLiteral("/pps/services/multimedia/renderer/context/%1/").arg(contextName); + const QString ppsStatusPath = ppsContextPath + QStringLiteral("/status"); + + Q_ASSERT(m_ppsStatusFd == -1); + errno = 0; + m_ppsStatusFd = qt_safe_open(QFile::encodeName(ppsStatusPath).constData(), O_RDONLY); + if (m_ppsStatusFd == -1) { + emitPError(QStringLiteral("Unable to open %1: %2").arg(ppsStatusPath, qt_error_string(errno))); + return; + } + + Q_ASSERT(!m_ppsStatusNotifier); + m_ppsStatusNotifier = new QSocketNotifier(m_ppsStatusFd, QSocketNotifier::Read); + connect(m_ppsStatusNotifier, SIGNAL(activated(int)), this, SLOT(ppsReadyRead(int))); + + + const QString ppsStatePath = ppsContextPath + QStringLiteral("/state"); + + Q_ASSERT(m_ppsStateFd == -1); + errno = 0; + m_ppsStateFd = qt_safe_open(QFile::encodeName(ppsStatePath).constData(), O_RDONLY); + if (m_ppsStateFd == -1) { + emitPError(QStringLiteral("Unable to open %1: %2").arg(ppsStatePath, qt_error_string(errno))); + return; + } + + Q_ASSERT(!m_ppsStateNotifier); + m_ppsStateNotifier = new QSocketNotifier(m_ppsStateFd, QSocketNotifier::Read); + connect(m_ppsStateNotifier, SIGNAL(activated(int)), this, SLOT(ppsReadyRead(int))); + + //ensure we receive any initial state + ppsReadyRead(m_ppsStatusFd); + ppsReadyRead(m_ppsStateFd); +} + +void PpsMediaPlayerControl::stopMonitoring() +{ + + if (m_ppsStatusFd != -1) { + ::close(m_ppsStatusFd); + m_ppsStatusFd = -1; + } + + delete m_ppsStatusNotifier; + m_ppsStatusNotifier = 0; + + if (m_ppsStateFd != -1) { + ::close(m_ppsStateFd); + m_ppsStateFd = -1; + } + + delete m_ppsStateNotifier; + m_ppsStateNotifier = 0; +} + +bool PpsMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result) +{ + Q_UNUSED(result) + if (eventType == "screen_event_t") { + screen_event_t event = static_cast<screen_event_t>(message); + if (MmRendererVideoWindowControl *control = videoWindowControl()) + control->screenEventHandler(event); + } + + return false; +} + +void PpsMediaPlayerControl::ppsReadyRead(int fd) +{ + Q_ASSERT(fd == m_ppsStateFd || fd == m_ppsStatusFd); + const int bufferSize = 2048; + char buffer[bufferSize]; + const ssize_t nread = qt_safe_read(fd, buffer, bufferSize - 1); + if (nread < 0) { + //TODO emit error? + } + + if (nread == 0) { + return; + } + + // nread is the real space necessary, not the amount read. + if (static_cast<size_t>(nread) > bufferSize - 1) { + //TODO emit error? + qCritical("BBMediaPlayerControl: PPS buffer size too short; need %u.", nread + 1); + return; + } + + buffer[nread] = 0; + + pps_decoder_t decoder; + + if (pps_decoder_initialize(&decoder, buffer) != PPS_DECODER_OK) { + //TODO emit error? + qCritical("Could not initialize pps_decoder"); + pps_decoder_cleanup(&decoder); + return; + } + + pps_decoder_push(&decoder, 0); + + const char *value = 0; + if (pps_decoder_get_string(&decoder, "bufferlevel", &value) == PPS_DECODER_OK) { + setMmBufferStatus(QString::fromLatin1(value)); + } + + if (pps_decoder_get_string(&decoder, "state", &value) == PPS_DECODER_OK) { + const QByteArray state = value; + if (state != m_previouslySeenState && state == "STOPPED") + handleMmStopped(); + m_previouslySeenState = state; + } + + if (pps_decoder_get_string(&decoder, "position", &value) == PPS_DECODER_OK) { + const QByteArray valueBa = QByteArray(value); + bool ok; + const qint64 position = valueBa.toLongLong(&ok); + if (!ok) { + qCritical("Could not parse position from '%s'", valueBa.constData()); + } else { + setMmPosition(position); + } + } + + pps_decoder_cleanup(&decoder); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.h b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.h new file mode 100644 index 000000000..e00d44dfd --- /dev/null +++ b/src/plugins/qnx/mediaplayer/ppsmediaplayercontrol.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Research In Motion +** 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 PPSMEDIAPLAYERCONTROL_H +#define PPSMEDIAPLAYERCONTROL_H + +#include "mmrenderermediaplayercontrol.h" + +QT_BEGIN_NAMESPACE + +class QSocketNotifier; + +class PpsMediaPlayerControl Q_DECL_FINAL : public MmRendererMediaPlayerControl +{ + Q_OBJECT +public: + explicit PpsMediaPlayerControl(QObject *parent = 0); + ~PpsMediaPlayerControl(); + + void startMonitoring(int contextId, const QString &contextName) Q_DECL_OVERRIDE; + void stopMonitoring() Q_DECL_OVERRIDE; + + bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE; + +private Q_SLOTS: + void ppsReadyRead(int fd); + +private: + QSocketNotifier *m_ppsStatusNotifier; + int m_ppsStatusFd; + QSocketNotifier *m_ppsStateNotifier; + int m_ppsStateFd; + QByteArray m_previouslySeenState; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/qnx/neutrino_mediaservice.json b/src/plugins/qnx/neutrino_mediaservice.json new file mode 100644 index 000000000..919368d73 --- /dev/null +++ b/src/plugins/qnx/neutrino_mediaservice.json @@ -0,0 +1,4 @@ +{ + "Keys": ["neutrinomultimedia"], + "Services": ["org.qt-project.qt.mediaplayer"] +} diff --git a/src/plugins/qnx/neutrinoserviceplugin.cpp b/src/plugins/qnx/neutrinoserviceplugin.cpp new file mode 100644 index 000000000..423af1a84 --- /dev/null +++ b/src/plugins/qnx/neutrinoserviceplugin.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** 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 "neutrinoserviceplugin.h" + +#include "mmrenderermediaplayerservice.h" + +QT_BEGIN_NAMESPACE + +NeutrinoServicePlugin::NeutrinoServicePlugin() +{ +} + +QMediaService *NeutrinoServicePlugin::create(const QString &key) +{ + if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)) + return new MmRendererMediaPlayerService(); + + return 0; +} + +void NeutrinoServicePlugin::release(QMediaService *service) +{ + delete service; +} + +QMediaServiceProviderHint::Features NeutrinoServicePlugin::supportedFeatures(const QByteArray &service) const +{ + Q_UNUSED(service) + return QMediaServiceProviderHint::Features(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/qnx/neutrinoserviceplugin.h b/src/plugins/qnx/neutrinoserviceplugin.h new file mode 100644 index 000000000..2fc28233f --- /dev/null +++ b/src/plugins/qnx/neutrinoserviceplugin.h @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Research In Motion +** 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 NEUTRINOSERVICEPLUGIN_H +#define NEUTRINOSERVICEPLUGIN_H + +#include <qmediaserviceproviderplugin.h> + +QT_BEGIN_NAMESPACE + +class NeutrinoServicePlugin + : public QMediaServiceProviderPlugin, + public QMediaServiceFeaturesInterface +{ + Q_OBJECT + Q_INTERFACES(QMediaServiceFeaturesInterface) + Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "neutrino_mediaservice.json") +public: + NeutrinoServicePlugin(); + + QMediaService *create(const QString &key) Q_DECL_OVERRIDE; + void release(QMediaService *service) Q_DECL_OVERRIDE; + QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index 3049729b8..f01562116 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -1,3 +1,22 @@ -TEMPLATE = subdirs +TARGET = qtmedia_qnx +QT += multimedia-private gui-private -SUBDIRS = audio +PLUGIN_TYPE=mediaservice +PLUGIN_CLASS_NAME = BbServicePlugin +load(qt_plugin) + +LIBS += -lscreen + +include(common/common.pri) +include(mediaplayer/mediaplayer.pri) + +blackberry { + include(camera/camera.pri) + HEADERS += bbserviceplugin.h + SOURCES += bbserviceplugin.cpp + OTHER_FILES += blackberry_mediaservice.json +} else { + HEADERS += neutrinoserviceplugin.h + SOURCES += neutrinoserviceplugin.cpp + OTHER_FILES += neutrino_mediaservice.json +} diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp index cca42e2ff..adc762d6e 100644 --- a/src/plugins/wmf/player/mfplayersession.cpp +++ b/src/plugins/wmf/player/mfplayersession.cpp @@ -1936,10 +1936,12 @@ void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent) m_request.command = CmdNone; m_request.prevCmd = CmdNone; - changeStatus(QMediaPlayer::EndOfMedia); m_varStart.vt = VT_I8; //keep reporting the final position after end of media m_varStart.hVal.QuadPart = m_duration; + emit positionChanged(position()); + + changeStatus(QMediaPlayer::EndOfMedia); break; case MEEndOfPresentationSegment: break; |