Remove some obsolete bits.

They can be updated again later when things are more stable, if needed.

Change-Id: I73bdacdd3d1fd43a60cd3a0c14b925fa9c32ee27
Reviewed-on: http://codereview.qt.nokia.com/1724
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Jonas Rabbe <jonas.rabbe@nokia.com>
This commit is contained in:
Michael Goddard
2011-07-18 10:32:16 +10:00
committed by Qt by Nokia
parent 7085775a11
commit 1403a1c7be
264 changed files with 47 additions and 51130 deletions

View File

@@ -2,7 +2,6 @@
TEMPLATE = lib
TARGET = qtmmksnippets
include(../../../../features/basic_examples_setup.pri)
INCLUDEPATH += ../../../../src/global \
../../../../src/multimediakit \

View File

@@ -1,59 +0,0 @@
symbian: {
vendorinfo = \
"; Localised Vendor name" \
"%{\"Nokia, Qt\"}" \
" " \
"; Unique Vendor name" \
":\"Nokia, Qt\"" \
" "
examples_deployment.pkg_prerules += vendorinfo
DEPLOYMENT += examples_deployment
}
win32:contains(CONFIG_WIN32,build_all):Win32DebugAndRelease=yes
mac | contains(Win32DebugAndRelease,yes) {
#due to different debug/release library names we have to comply with
#whatever Qt does
!contains(QT_CONFIG,debug)|!contains(QT_CONFIG,release) {
CONFIG -= debug_and_release debug release
contains(QT_CONFIG,debug): CONFIG+=debug
contains(QT_CONFIG,release): CONFIG+=release
}
}
CONFIG(debug, debug|release) {
SUBDIRPART=Debug
} else {
SUBDIRPART=Release
}
OUTPUT_DIR = $$QT_MOBILITY_BUILD_TREE
MOC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/moc
RCC_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/rcc
UI_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET/ui
OBJECTS_DIR = $$OUTPUT_DIR/build/$$SUBDIRPART/$$TARGET
# See common.pri for comments on why using QMAKE_FRAMEWORKPATH/QMAKE_LIBDIR
# rather than LIBS here.
mac:contains(QT_CONFIG,qt_framework) {
QMAKE_FRAMEWORKPATH = $$OUTPUT_DIR/lib
}
QMAKE_LIBDIR = $$OUTPUT_DIR/lib
QMAKE_RPATHDIR+=$$QT_MOBILITY_LIB
INCLUDEPATH+= $$QT_MOBILITY_SOURCE_TREE/src/global
maemo6 {
DEFINES+= Q_WS_MAEMO_6
DEFINES+= QTM_EXAMPLES_SMALL_SCREEN
DEFINES+= QTM_EXAMPLES_PREFER_LANDSCAPE
}
maemo5 {
error(Maemo5/Freemantle not supported by QtMobility 1.2+ \(Not building any examples and demos\).)
DEFINES+= Q_WS_MAEMO_5
DEFINES+= QTM_EXAMPLES_SMALL_SCREEN
DEFINES+= QTM_EXAMPLES_PREFER_LANDSCAPE
}
symbian {
DEFINES+= QTM_EXAMPLES_SMALL_SCREEN
}

View File

@@ -1,61 +0,0 @@
headers.files = $$PUBLIC_HEADERS
headers.path = $$QT_MOBILITY_INCLUDE/$$TARGET
contains(TEMPLATE,.*lib) {
target.path=$$QT_MOBILITY_LIB
maemo5|maemo6|meego {
CONFIG += create_pc create_prl
QMAKE_PKGCONFIG_NAME = lib$$TARGET
QMAKE_PKGCONFIG_DESTDIR = pkgconfig
QMAKE_PKGCONFIG_LIBDIR = $$target.path
QMAKE_PKGCONFIG_INCDIR = $$headers.path
QMAKE_PKGCONFIG_CFLAGS = -I$${QT_MOBILITY_INCLUDE}/QtMobility
pkgconfig.files = $${TARGET}.pc
pkgconfig.path = $$QT_MOBILITY_LIB/pkgconfig
INSTALLS += pkgconfig
}
TARGET = $$qtLibraryTarget($${TARGET}$${QT_LIBINFIX})
symbian {
middleware { path=$$MW_LAYER_PUBLIC_EXPORT_PATH("") }
app { path=$$APP_LAYER_PUBLIC_EXPORT_PATH("") }
exportPath=$$EPOCROOT"."$$dirname(path)
nativePath=$$replace(exportPath,/,\\)
exists($$nativePath) {
} else {
system($$QMAKE_MKDIR $$nativePath)
}
for(header, headers.files) {
middleware { BLD_INF_RULES.prj_exports += "$$header $$MW_LAYER_PUBLIC_EXPORT_PATH($$basename(header))"}
app { BLD_INF_RULES.prj_exports += "$$header $$APP_LAYER_PUBLIC_EXPORT_PATH($$basename(header))"}
}
}
} else {
contains(TEMPLATE,.*app):target.path=$$QT_MOBILITY_BIN
}
INSTALLS+=target headers
mac:contains(QT_CONFIG,qt_framework) {
CONFIG += lib_bundle absolute_library_soname
CONFIG(debug, debug|release) {
!build_pass:CONFIG += build_all
} else { #release
!debug_and_release|build_pass {
FRAMEWORK_HEADERS.version = Versions
FRAMEWORK_HEADERS.files = $${PUBLIC_HEADERS}
FRAMEWORK_HEADERS.path = Headers
}
QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
}
}
CONFIG+= create_prl

View File

@@ -1,130 +0,0 @@
!isEmpty(QT_MOBILITY_BUILD_TREE):CONFIG+=mobility_build
defineTest(qtMobilityAddLibrary) {
# If we are currently building Mobility itself, do not add the install
# include paths. It can't help since we haven't installed our headers yet,
# and it may hurt since incompatible headers may be present from an
# earlier build.
!mobility_build:!isEmpty(MOBILITY_INCLUDE) {
INCLUDEPATH -= $${MOBILITY_INCLUDE}/$$1
INCLUDEPATH = $${MOBILITY_INCLUDE}/$$1 $$INCLUDEPATH
}
# qtAddLibrary will add $$QMAKE_INCDIR_QT/$$1 to the INCLUDEPATH, which we
# don't want, but we want everything else it does.
OLD_INCLUDEPATH = $$INCLUDEPATH
qtAddLibrary($$1)
INCLUDEPATH = $$OLD_INCLUDEPATH
export(INCLUDEPATH)
}
!symbian {
!mobility_build:INCLUDEPATH += $${MOBILITY_INCLUDE}
} else {
load(data_caging_paths)
contains(MOBILITY, contacts|versit|organizer) {
INCLUDEPATH+=$$APP_LAYER_SYSTEMINCLUDE
}
INCLUDEPATH+=$$MW_LAYER_SYSTEMINCLUDE
}
!mobility_build {
mac: LIBS += -F$${MOBILITY_LIB}
LIBS+= -L$${MOBILITY_LIB}
}
QMAKE_RPATHDIR+=$${MOBILITY_LIB}
# versit depends on contacts
contains(MOBILITY, versit) {
MOBILITY += contacts
}
simulator: qtMobilityAddLibrary(QtMobilitySimulator)
contains(MOBILITY, bearer) {
DEFINES += QT_MOBILITY_BEARER
qtMobilityAddLibrary(QtBearer)
!equals(QT_MAJOR_VERSION,4)|!equals(QT_MINOR_VERSION, 6) {
message(Qt Mobility Bearer API is deprecated when using Qt 4.7 or higher.)
message(Please use source compatible replacement Bearer API in QtNetwork.)
}
}
#for includes from src/global
!mobility_build:!isEmpty(MOBILITY_INCLUDE):INCLUDEPATH += $${MOBILITY_INCLUDE}/QtMobility
contains(MOBILITY, publishsubscribe) {
qtMobilityAddLibrary(QtPublishSubscribe)
}
contains(MOBILITY, location) {
qtMobilityAddLibrary(QtLocation)
}
contains(MOBILITY, serviceframework) {
qtMobilityAddLibrary(QtServiceFramework)
}
contains(MOBILITY, systeminfo) {
#QSystemInfo header requires QNetworkInterface
QT += network
qtMobilityAddLibrary(QtSystemInfo)
}
contains(MOBILITY, multimedia) {
QT += network
contains(QT_CONFIG, opengl): QT += opengl
qtMobilityAddLibrary(QtMultimediaKit)
}
contains(MOBILITY, contacts) {
qtMobilityAddLibrary(QtContacts)
}
contains(MOBILITY, messaging) {
qtMobilityAddLibrary(QtMessaging)
}
contains(MOBILITY, versit) {
qtMobilityAddLibrary(QtVersit)
contains(MOBILITY, organizer) {
qtMobilityAddLibrary(QtVersitOrganizer)
}
}
contains(MOBILITY, sensors) {
qtMobilityAddLibrary(QtSensors)
}
contains(MOBILITY, feedback) {
qtMobilityAddLibrary(QtFeedback)
}
contains(MOBILITY, gallery) {
qtMobilityAddLibrary(QtGallery)
}
contains(MOBILITY, organizer) {
qtMobilityAddLibrary(QtOrganizer)
}
contains(MOBILITY, connectivity) {
INCLUDEPATH += $${QMAKE_INCDIR_QT}/QtNetwork
qtMobilityAddLibrary(QtConnectivity)
}
# Add dependency to QtMobility package to all projects besides QtMobility package itself.
# Mobility libs have UID3 0x2002AC89
# self-signed Mobility libs have UID3 0xE002AC89
symbian:contains(CONFIG, mobility)::contains(default_deployment.pkg_prerules, pkg_depends_qt):!contains(TARGET.UID3, 0x2002AC89):!contains(TARGET.UID3, 0xE002AC89) {
mobility_pkg_name = QtMobility
mobility_default_deployment.pkg_prerules += \
"; Default dependency to QtMobility libraries" \
"(0x2002AC89), 1, 2, 0, {$$addLanguageDependentPkgItem(mobility_pkg_name)}"
DEPLOYMENT += mobility_default_deployment
}

View File

@@ -1,19 +0,0 @@
This directory contains the metadata for building and
packaging Qt Mobility on Harmattan.
HOW TO BUILD FOR HARMATTAN
==========================
(note: this is a brief overview and many aspects are uncovered)
From within Scratchbox, at the top level of the Mobility
source tree:
$ ln -s src/harmattaninstalls debian
$ dpkg-checkbuilddeps
$ fakeroot apt-get install (any missing dependencies mentioned above)
$ dpkg-buildpackage -rfakeroot

View File

@@ -1,92 +0,0 @@
interface: QtContacts
type: library
scope: Nokia MeeGo
state: stable
libs-pkg: libqtm-contacts
dev-pkg: libqtm-common-dev libqtm-contacts-dev
interface: QtFeedback
type: library
scope: Nokia MeeGo
state: stable
libs-pkg: libqtm-feedback
dev-pkg: libqtm-common-dev libqtm-feedback-dev
interface: QtGallery
type: library
libs-pkg: libqtm-gallery
dev-pkg: libqtm-common-dev libqtm-gallery-dev
state: stable
scope: Nokia MeeGo
interface: QtLocation
type: library
libs-pkg: libqtm-location
dev-pkg: libqtm-common-dev libqtm-location-dev
state: stable
scope: Nokia MeeGo
interface: QtMessaging
type: library
libs-pkg: libqtm-messaging
dev-pkg: libqtm-common-dev libqtm-messaging-dev
state: stable
scope: Nokia MeeGo
interface: QtMultimediaKit
type: library
libs-pkg: libqtm-multimedia
dev-pkg: libqtm-common-dev libqtm-multimedia-dev
state: stable
scope: Nokia MeeGo
interface: QtOrganizer
type: library
libs-pkg: libqtm-organizer
dev-pkg: libqtm-common-dev libqtm-organizer-dev
state: stable
scope: Nokia MeeGo
interface: QtPublishSubscribe
type: library
libs-pkg: libqtm-publishsubscribe
dev-pkg: libqtm-common-dev libqtm-publishsubscribe-dev
state: stable
scope: Nokia MeeGo
interface: QtSensors
type: library
libs-pkg: libqtm-sensors
dev-pkg: libqtm-common-dev libqtm-sensors-dev
state: stable
scope: Nokia MeeGo
interface: QtServiceFramework
type: library
libs-pkg: libqtm-serviceframework
dev-pkg: libqtm-common-dev libqtm-serviceframework-dev
state: stable
scope: Nokia MeeGo
interface: QtSystemInfo
type: library
libs-pkg: libqtm-systeminfo
dev-pkg: libqtm-common-dev libqtm-systeminfo-dev
state: stable
scope: Nokia MeeGo
interface: QtVersit
type: library
libs-pkg: libqtm-versit
dev-pkg: libqtm-common-dev libqtm-versit-dev
state: stable
scope: Nokia MeeGo
interface: QtVersitOrganizer
type: library
libs-pkg: libqtm-versitorganizer
dev-pkg: libqtm-common-dev libqtm-versitorganizer-dev
state: stable
scope: Nokia MeeGo

View File

@@ -1,178 +0,0 @@
qt-mobility (1.2.0~git20110225) unstable; urgency=low
* Bumped up the version
-- Sunil Thaha <sunil.thaha@nokia.com> Fri, 25 Feb 2011 13:59:48 +1000
qt-mobility (1.2.0~git20110210) unstable; urgency=low
* Bump version to 1.2
* Fixes: NB#206728
-- Sunil Thaha <sunil.thaha@nokia.com> Wed, 10 Feb 2011 13:59:48 +1000
qt-mobility (1.1.1~git20110106) unstable; urgency=low
* Fixes: NB#212701 : added the commit 95e140e7 as a patch
-- Sunil Thaha <sunil.thaha@nokia.com> Thu, 06 Jan 2011 10:02:05 +1000
qt-mobility (1.1.1~git20101224) unstable; urgency=low
* Fixes: NB#212701 : added the commit feb61b9 as a patch
-- Sunil Thaha <sunil.thaha@nokia.com> Fri, 24 Dec 2010 17:30:55 +1000
qt-mobility (1.1.1~git20101217) unstable; urgency=low
* Updated the code base to releases/1.1.1
* Fixes: NB#212701 : added the commit feb61b9 as a patch
-- Sunil Thaha <sunil.thaha@nokia.com> Fri, 17 Dec 2010 17:30:55 +1000
qt-mobility (1.1.1~git20101207) unstable; urgency=low
* Fixes: NB#209489
-- Sunil Thaha <sunil.thaha@nokia.com> Tue, 07 Dec 2010 17:30:55 +1000
qt-mobility (1.1.1~git20101201) unstable; urgency=low
* Fixes: NB#189902
* Fixes: NB#189902
* Fixes: NB#199411
* Fixes: NB#198751
* Fixes: NB#201514
* Fixes: NB#203941
* Fixes: NB#208483
-- Qt Development Frameworks <qt-info@nokia.com> Wed, 01 Dec 2010 11:39:00 +1000
qt-mobility (1.1.1~git20101119-0maemo1) unstable; urgency=low
* Qt Organizer module
* Classes for calendar entries, todo tasks, journal entries and notes
* Qt Feedback module
* Classes for feedback (haptic/tactile feedback, general multimedia feedback)
* Initial release has limited multimedia support
* Qt Gallery module
* Classes for searching for documents, and viewing document meta-data.
* Qt Maps and Navigation API
Part of the Location module
* Class for routing, geocoding and reverse geocoding, and for displaying and interacting with maps.
* Qt Landmarks module
* Part of the Location module
* Classes for saving, retrieving and deleting landmarks
-- Qt Development Frameworks <qt-info@nokia.com> Fri, 19 Oct 2010 11:39:00 +1000
qt-mobility (1.1.0~git20101026-0maemo1) unstable; urgency=low
* New Modules:
* Feedback
*
* Modules Changed:
*
* Bug Fixes:
* JIRA#MOBILITY-1780
-- Qt Development Frameworks <qt-info@nokia.com> Tue, 26 Oct 2010 11:39:00 +1000
qt-mobility (1.1.0~git20101005-0maemo1) unstable; urgency=low
* Modules Integrated:
* QtContacts
* QtLocation
* QtMessaging
* QtMultimedia
* QtOrganizer
* QtPublishsubscribe
* QtSensors
* QtServiceframework
* QtSysteminfo
* QtVersit
* Bug Fixes
* NB#189907 : QtPositionProvider has too slow initiation
* NB#195969 : libqtm-organizer depends on libextendedkcal and it is deprecated
-- Qt Development Frameworks <qt-info@nokia.com> Tue, 05 Oct 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100922-0maemo1) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Wed, 22 Sep 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100917-0maemo1) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Fri, 17 Sep 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100916-0maemo2) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Thu, 16 Sep 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100909-0maemo2) unstable; urgency=low
* Updated base code 1.1
* Fixes: NB#190298 - [METABUG] Upgrade Qt Mobility APIs to version 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Tue, 10 Sep 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100906-0maemo1) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Tue, 06 Sep 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100831-0maemo1) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Tue, 31 Aug 2010 11:39:00 +1000
qt-mobility (1.1.0~git20100817-0maemo1) unstable; urgency=low
* Updated base code 1.1
-- Qt Development Frameworks <qt-info@nokia.com> Fri, 20 Aug 2010 11:39:00 +1000
qt-mobility (1.0.2~git20100721-0maemo1) unstable; urgency=low
* Move component headers to their specific dev packages.
* Add missing pkgconfig files.
* Fixes: NB#180932 - Missing QtLocation.pc.
-- Qt Development Frameworks <qt-info@nokia.com> Wed, 21 Jul 2010 14:39:00 +1000
qt-mobility (1.0.2~git20100714-0maemo1) unstable; urgency=low
* Pull from upstream (qtmobility-releases/1.0.2)
* Fixes: 173824 - [METABUG] Integrate Qt Mobility APIs (contacts, versit, location)
* Fixes: 172247 - Headers missing from libqtm-serviceframework-dev package and installation issues.
-- Qt Development Frameworks <qt-info@nokia.com> Wed, 14 Jul 2010 17:00:00 +1000
qt-mobility (1.0.2~git20100623-0maemo1) unstable; urgency=low
* Pull from upstream (qtmobility/1.0)
-- Qt Development Frameworks <qt-info@nokia.com> Thu, 10 Jun 2010 13:50:00 +0200
qt-mobility (1.0.0~git20100429-0maemo1) unstable; urgency=low
* Pull from upstream
-- Qt Development Frameworks <qt-info@nokia.com> Fri, 30 Apr 2010 12:30:00 +1000
qt-mobility (1.0.0~git20100422-0maemo1) unstable; urgency=low
* Pull from upstream
-- Qt Development Frameworks <qt-info@nokia.com> Fri, 23 Apr 2010 15:10:00 +1000
qt-mobility (1.0.0~git20100304-0maemo1) unstable; urgency=low
* Initial release
-- Qt Development Frameworks <qt-info@nokia.com> Thu, 04 Mar 2010 15:52:12 +1000

View File

@@ -1 +0,0 @@
5

View File

@@ -1,716 +0,0 @@
Source: qt-mobility
Section: libs
Priority: extra
Maintainer: Qt Development Frameworks <qt-info@nokia.com>
Build-Depends: libqt4-dev (>= 4.7.0), cdbs, debhelper (>= 5), quilt, aegis-builder (>= 1.4),
libicd-network-wlan-dev, libqt4-opengl-dev (>= 4.7.0),
libconninet0-dev, libcontextsubscriber-dev, libbluetooth3-dev, libcontextprovider-dev,
libx11-dev, libsensord-dev (>= 0.6.4), libqt4-declarative-dev (>= 4.7.0),
libxrandr-dev, gstreamer0.10-plugins-bad-dev, icd2-dev, libasound2-dev,
libconnsettings0-dev, libgstreamer-plugins-base0.10-dev, libgstreamer0.10-dev, libtelepathy-qt4-1-dev,
libxrandr-dev, libxv-dev, osso-wlan-dev, x11proto-video-dev, libqmf-dev,
libmessagingif-dev, libcommhistory-dev, libblkid-dev, pulseaudio-dev, libimmvibe-dev[armel], libqtsparql-dev,
libmkcal-dev, libkcalcoren-dev, libresourceqt-dev, libqmsystem2-dev, libqtsparql-tracker-extensions-dev,
libudev-dev, libiphb-dev, meego-gstreamer0.10-interfaces-dev[armel], libbmeipc-dev, libiphb-dev
Standards-Version: 3.8.0
Package: libqtm-examples
Architecture: any
Section: devel
Depends: qt4-declarative-qmlviewer, ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility examples package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-dev
Architecture: any
Section: devel
Depends: ${shlibs:Depends}, ${misc:Depends}, libqtm-common-dev(= ${binary:Version}),
libqtm-contacts-dev(= ${binary:Version}), libqtm-feedback-dev(= ${binary:Version}),
libqtm-gallery-dev(= ${binary:Version}), libqtm-location-dev(= ${binary:Version}),
libqtm-messaging-dev(= ${binary:Version}), libqtm-multimedia-dev(= ${binary:Version}),
libqtm-organizer-dev(= ${binary:Version}), libqtm-publishsubscribe-dev(= ${binary:Version}),
libqtm-sensors-dev(= ${binary:Version}), libqtm-serviceframework-dev(= ${binary:Version}),
libqtm-systeminfo-dev(= ${binary:Version}), libqtm-versit-dev(= ${binary:Version}),
libqtm-versitorganizer-dev(= ${binary:Version}), libqtm-connectivity-dev(= ${binary:Version})
Description: Qt Mobility development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
This package contains development headers of each Mobility component
Package: libqtm-common-dev
Architecture: any
Section: devel
Depends: ${shlibs:Depends}, ${misc:Depends}, libqt4-dev, libqt4-declarative-dev
Description: Qt Mobility development package that contains the headers common to all modules
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
This package contains development headers common to each Mobility component
#Package: libqtm-doc
#Architecture: any
#Section: devel
#Depends: ${shlibs:Depends}, ${misc:Depends}
#Description: Qt Mobility documentation package
# Qt Mobility Project delivers a set of new APIs to Qt with features that are
# well known from the mobile device world, in particular phones. However,
# these APIs allow the developer to use these features with ease from one
# framework and apply them to phones, netbooks and non-mobile personal
# computers.
# .
# This package contains documentation for all Mobility components
Package: libqtm-multimedia
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Multimedia module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-multimedia-dbg
Architecture: any
Section: libdevel
Depends: libqtm-multimedia (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Multimedia debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-multimedia-dev
Architecture: any
Section: libs
Depends: libqtm-multimedia (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Multimedia development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-multimedia-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends},${misc:Depends}
XB-Maemo-CI-Packages: libqtm-multimedia
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Multimedia autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-feedback
Architecture: any
Section: libs
Depends: immvibed[armel], libqtm-multimedia (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Feedback module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-feedback-dbg
Architecture: any
Section: libdevel
Depends: libqtm-feedback (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Feedback debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-feedback-dev
Architecture: any
Section: libs
Depends: libqtm-feedback (= ${binary:Version}), libqtm-multimedia-dev (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Feedback development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-feedback-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${shlibs:Depends},${misc:Depends}
XB-Maemo-CI-Packages: libqtm-feedback
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Feedback autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-gallery
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Gallery Framework module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-gallery-dbg
Architecture: any
Section: libdevel
Depends: libqtm-gallery (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Gallery Framework debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-gallery-dev
Architecture: any
Section: libs
Depends: libqtm-gallery (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Gallery Framework development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-gallery-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${shlibs:Depends},${misc:Depends}
XB-Maemo-CI-Packages: libqtm-gallery
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Gallery autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-serviceframework
Architecture: any
Section: libs
Depends: libqt4-sql (>= 4.6.0), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Service Framework module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-serviceframework-dbg
Architecture: any
Section: libdevel
Depends: libqtm-serviceframework (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Service Framework debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-serviceframework-dev
Architecture: any
Section: libs
Depends: libqtm-serviceframework (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Service Framework development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-serviceframework-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends},${misc:Depends}
XB-Maemo-CI-Packages: libqtm-serviceframework
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Serviceframework autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-messaging
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Messaging module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-messaging-dbg
Architecture: any
Section: libdevel
Depends: libqtm-messaging (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Messaging debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-messaging-dev
Architecture: any
Section: libs
Depends: libqtm-messaging (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends},${misc:Depends}
Description: Qt Mobility Messaging development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-messaging-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends},${misc:Depends}
XB-Maemo-CI-Packages: libqtm-messaging
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Messaging autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-contacts
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Contacts module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-contacts-dbg
Architecture: any
Section: libdevel
Depends: libqtm-contacts (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Contacts debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-contacts-dev
Architecture: any
Section: libs
Depends: libqtm-contacts (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Contacts development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-contacts-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-contacts
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Contacts autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versit
Architecture: any
Section: libs
Depends: libqtm-contacts (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versit-dbg
Architecture: any
Section: libdevel
Depends: libqtm-versit (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versit-dev
Architecture: any
Section: libs
Depends: libqtm-versit (= ${binary:Version}), libqtm-contacts-dev (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versit-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-versit
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Versit autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-organizer
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Organizer module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-organizer-dbg
Architecture: any
Section: libdevel
Depends: libqtm-organizer (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Organizer debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-organizer-dev
Architecture: any
Section: libs
Depends: libqtm-organizer (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Organizer development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-organizer-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-organizer
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Organizer autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versitorganizer
Architecture: any
Section: libs
Depends: libqtm-versit (= ${binary:Version}), libqtm-organizer (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit Organizer module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versitorganizer-dbg
Architecture: any
Section: libdevel
Depends: libqtm-versitorganizer (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit Organizer debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-versitorganizer-dev
Architecture: any
Section: libs
Depends: libqtm-versitorganizer (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), libqtm-versit-dev (= ${binary:Version}),
libqtm-organizer-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Versit Organizer development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
#Package: libqtm-versitorganizer-tests
#Architecture: any
#Section: libs
#Depends: ci-testing, ${shlibs:Depends}
#XB-Maemo-CI-Packages: libqtm-versitorganizer
#XB-Maemo-CI-Stage: staging
#Description: Qt Mobility Versit Organizer autotest package
# Qt Mobility Project delivers a set of new APIs to Qt with features that are
# well known from the mobile device world, in particular phones. However,
# these APIs allow the developer to use these features with ease from one
# framework and apply them to phones, netbooks and non-mobile personal
# computers.
Package: libqtm-publishsubscribe
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility PublishSubscribe module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-publishsubscribe-dbg
Architecture: any
Section: libdevel
Depends: libqtm-publishsubscribe (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility PublishSubscribe debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-publishsubscribe-dev
Architecture: any
Section: libs
Depends: libqtm-publishsubscribe (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility PublishSubscribe development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-publishsubscribe-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-publishsubscribe
XB-Maemo-CI-Stage: staging
Description: Qt Mobility PublishSubscribe autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-location
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}, libqtsparql-tracker, tracker (>= 0.9.35)
Recommends: positioningd
Description: Qt Mobility Location module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-location-dbg
Architecture: any
Section: libdevel
Depends: libqtm-location (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Location debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-location-dev
Architecture: any
Section: libs
Depends: libqtm-location (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Location development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-location-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-location
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Location autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-sensors
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Sensors module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-sensors-dbg
Architecture: any
Section: libdevel
Depends: libqtm-sensors (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Sensors debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-sensors-dev
Architecture: any
Section: libs
Depends: libqtm-sensors (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Sensors development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-sensors-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-sensors
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Sensors autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-systeminfo
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}, sysinfo-dbus
Description: Qt Mobility SystemInfo module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-systeminfo-dbg
Architecture: any
Section: libdevel
Depends: libqtm-systeminfo (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility SystemInfo debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-systeminfo-dev
Architecture: any
Section: libs
Depends: libqtm-systeminfo (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility SystemInfo development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-systeminfo-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-systeminfo
XB-Maemo-CI-Stage: staging
Description: Qt Mobility SystemInfo autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-connectivity
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Connectivity module
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-connectivity-dbg
Architecture: any
Section: libdevel
Depends: libqtm-connectivity (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Connectivity debugging symbols
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-connectivity-dev
Architecture: any
Section: libs
Depends: libqtm-connectivity (= ${binary:Version}), libqtm-common-dev (= ${binary:Version}), ${shlibs:Depends}, ${misc:Depends}
Description: Qt Mobility Connectivity development package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.
Package: libqtm-connectivity-tests
Architecture: any
Section: libs
Depends: ci-testing, ${shlibs:Depends}, ${misc:Depends}
XB-Maemo-CI-Packages: libqtm-connectivity
XB-Maemo-CI-Stage: staging
Description: Qt Mobility Connectivity autotest package
Qt Mobility Project delivers a set of new APIs to Qt with features that are
well known from the mobile device world, in particular phones. However,
these APIs allow the developer to use these features with ease from one
framework and apply them to phones, netbooks and non-mobile personal
computers.

View File

@@ -1,2 +0,0 @@
INSTALL.txt
LGPL_EXCEPTION.txt

View File

@@ -1,13 +0,0 @@
<aegis>
<request>
<credential name="GRP::metadata-users" />
<credential name="TrackerReadAccess" />
<credential name="TrackerWriteAccess" />
<for path="/usr/tests/qtm/tst_qcontactasync" />
<for path="/usr/tests/qtm/tst_qcontactmanagerdetails" />
<for path="/usr/tests/qtm/tst_qcontactmanager" />
<for path="/usr/tests/qtm/tst_qcontactmanagerfiltering" />
<for path="/usr/tests/qtm/tst_bm_contactsoverhead" />
<for path="/usr/tests/qtm/tst_bm_contacts" />
</request>
</aegis>

View File

@@ -1 +0,0 @@
usr/doc/html/* usr/share/qt4/QtMobility/doc/html

View File

@@ -1,54 +0,0 @@
<aegis>
<request>
<credential name="TrackerReadAccess" />
<for path="/usr/lib/qtmobility/examples/declarative-music-browser" />
<for path="/usr/lib/qtmobility/examples/documentproperties" />
<for path="/usr/lib/qtmobility/examples/mediabrowser" />
</request>
<request>
<credential name="TrackerReadAccess" />
<credential name="TrackerWriteAccess" />
<credential name="GRP::metadata-users"/>
<for path="/usr/lib/qtmobility/examples/samplephonebook" />
<for path="/usr/lib/qtmobility/demos/qmlcontacts" />
</request>
<request>
<credential name="Location" />
<credential name="TrackerReadAccess" />
<credential name="TrackerWriteAccess" />
<for path="/usr/lib/qtmobility/examples/landmarkbrowser" />
<for path="/usr/lib/qtmobility/examples/qml_landmarkmap" />
<for path="/usr/lib/qtmobility/examples/qml_location_flickr" />
<for path="/usr/lib/qtmobility/examples/qml_mapviewer" />
<for path="/usr/lib/qtmobility/examples/flickrdemo" />
<for path="/usr/lib/qtmobility/demos/lightmaps_with_location" />
<for path="/usr/lib/qtmobility/demos/weatherinfo_with_location" />
</request>
<request>
<credential name="Cellular" />
<credential name="TrackerReadAccess" />
<for path="/usr/lib/qtmobility/demos/serviceactions" />
<for path="/usr/lib/qtmobility/examples/writemessage" />
<for path="/usr/lib/qtmobility/examples/querymessages" />
<for path="/usr/lib/qtmobility/examples/keepintouch" />
<for path="/usr/lib/qtmobility/examples/qml_messages" />
</request>
<request>
<credential name="Cellular" />
<credential name="Location" />
<credential name="TrackerReadAccess" />
<credential name="TrackerWriteAccess" />
<for path="/usr/lib/qtmobility/examples/mapsdemo" />
</request>
<request>
<credential name="mce::TKLockControl" />
<for path="/usr/lib/qtmobility/examples/qsysinfo" />
</request>
<request>
<credential name="GRP::video" />
<credential name="GRP::pulse-access" />
<for path="/usr/lib/qtmobility/demos/player" />
<for path="/usr/lib/qtmobility/examples/camera" />
<for path="/usr/lib/qtmobility/examples/qml_camera" />
</request>
</aegis>

View File

@@ -1,100 +0,0 @@
usr/lib/qt4/plugins/serviceframework/libserviceframework_bluetoothtransferplugin.so
usr/lib/qt4/plugins/serviceframework/libserviceframework_filemanagerplugin.so
usr/lib/qt4/plugins/serviceframework/libserviceframework_landlinedialerservice.so
usr/lib/qt4/plugins/serviceframework/libserviceframework_notesmanagerplugin.so
usr/lib/qt4/plugins/serviceframework/libserviceframework_voipdialerservice.so
usr/lib/qtmobility/demos/lightmaps_with_location
usr/lib/qtmobility/demos/nmealog.txt
usr/lib/qtmobility/demos/player
usr/lib/qtmobility/demos/qmlcontacts
usr/lib/qtmobility/demos/serviceactions
usr/lib/qtmobility/demos/smallsensors
usr/lib/qtmobility/demos/weatherinfo_with_location
usr/lib/qtmobility/examples/accel
usr/lib/qtmobility/examples/annotatedurl
usr/lib/qtmobility/examples/arrowkeys
usr/lib/qtmobility/examples/audiodevices
usr/lib/qtmobility/examples/audioinput
usr/lib/qtmobility/examples/audiooutput
usr/lib/qtmobility/examples/audiorecorder
usr/lib/qtmobility/examples/battery-publisher
usr/lib/qtmobility/examples/battery-subscriber/battery-subscriber.qml
usr/lib/qtmobility/examples/battery-subscriber/content/bubble.png
usr/lib/qtmobility/examples/btchat
usr/lib/qtmobility/examples/btfiletransfer
usr/lib/qtmobility/examples/btscanner
usr/lib/qtmobility/examples/bttennis
usr/lib/qtmobility/examples/calendardemo
usr/lib/qtmobility/examples/camera
usr/lib/qtmobility/examples/cubehouse
usr/lib/qtmobility/examples/declarative-music-browser
usr/lib/qtmobility/examples/dialer_service
usr/lib/qtmobility/examples/documentproperties
usr/lib/qtmobility/examples/flickrdemo
usr/lib/qtmobility/examples/grueapp
usr/lib/qtmobility/examples/hapticsplayer
usr/lib/qtmobility/examples/hapticsquare
usr/lib/qtmobility/examples/keepintouch
usr/lib/qtmobility/examples/landmarkbrowser
usr/lib/qtmobility/examples/logfilepositionsource
usr/lib/qtmobility/examples/mapsdemo
usr/lib/qtmobility/examples/mediabrowser
usr/lib/qtmobility/examples/metadata
usr/lib/qtmobility/examples/metadata2
usr/lib/qtmobility/examples/moreplaces.lmx
usr/lib/qtmobility/examples/mylm.lmx
usr/lib/qtmobility/examples/ndefeditor
usr/lib/qtmobility/examples/nmealog.txt
usr/lib/qtmobility/examples/orientation
usr/lib/qtmobility/examples/places.gpx
usr/lib/qtmobility/examples/publish-subscribe
usr/lib/qtmobility/examples/qml_battery
usr/lib/qtmobility/examples/qml_battery2
usr/lib/qtmobility/examples/qml_camera
usr/lib/qtmobility/examples/qml_device
usr/lib/qtmobility/examples/qmldialer
usr/lib/qtmobility/examples/qml_landmarkmap
usr/lib/qtmobility/examples/qml_location_flickr
usr/lib/qtmobility/examples/qml_mapviewer
usr/lib/qtmobility/examples/qml_networkinfo
usr/lib/qtmobility/examples/qmlnotes
usr/lib/qtmobility/examples/qmlorganizer
usr/lib/qtmobility/examples/qml_poster
usr/lib/qtmobility/examples/qml_scanner
usr/lib/qtmobility/examples/qml_storageinfo
usr/lib/qtmobility/examples/qml_tennis
usr/lib/qtmobility/examples/qsysinfo
usr/lib/qtmobility/examples/qsystemalignedtimer
usr/lib/qtmobility/examples/querymessages
usr/lib/qtmobility/examples/radio
usr/lib/qtmobility/examples/samplephonebook
usr/lib/qtmobility/examples/sensor_explorer
usr/lib/qtmobility/examples/servicebrowser
usr/lib/qtmobility/examples/sfwecho_client
usr/lib/qtmobility/examples/sfwecho_service
usr/lib/qtmobility/examples/sfw-notes
usr/lib/qtmobility/examples/show_acceleration
usr/lib/qtmobility/examples/show_als
usr/lib/qtmobility/examples/show_compass
usr/lib/qtmobility/examples/show_gyroscope
usr/lib/qtmobility/examples/show_light
usr/lib/qtmobility/examples/show_magneticflux
usr/lib/qtmobility/examples/show_orientation
usr/lib/qtmobility/examples/show_proximity
usr/lib/qtmobility/examples/show_reflectance
usr/lib/qtmobility/examples/show_rotation
usr/lib/qtmobility/examples/show_tap
usr/lib/qtmobility/examples/simplelog.txt
usr/lib/qtmobility/examples/slideshow
usr/lib/qtmobility/examples/todo
usr/lib/qtmobility/examples/videographicsitem
usr/lib/qtmobility/examples/videowidget
usr/lib/qtmobility/examples/writemessage
usr/lib/qtmobility/examples/xmldata/bluetoothtransferservice.xml
usr/lib/qtmobility/examples/xmldata/filemanagerservice.xml
usr/lib/qtmobility/examples/xmldata/landlinedialerservice.xml
usr/lib/qtmobility/examples/xmldata/notesmanagerservice.xml
usr/lib/qtmobility/examples/xmldata/remotedialerservice.xml
usr/lib/qtmobility/examples/xmldata/sfwechoservice.xml
usr/lib/qtmobility/examples/xmldata/voipdialerservice.xml
usr/lib/qtmobility/examples/qml_messages

View File

@@ -1,145 +0,0 @@
usr/include/qt4/QtMultimediaKit/QAbstractAudioDeviceInfo
usr/include/qt4/QtMultimediaKit/QAbstractAudioInput
usr/include/qt4/QtMultimediaKit/QAbstractAudioOutput
usr/include/qt4/QtMultimediaKit/QAbstractVideoBuffer
usr/include/qt4/QtMultimediaKit/QAbstractVideoSurface
usr/include/qt4/QtMultimediaKit/QAudio
usr/include/qt4/QtMultimediaKit/QAudioCaptureSource
usr/include/qt4/QtMultimediaKit/QAudioDeviceInfo
usr/include/qt4/QtMultimediaKit/QAudioEncoderControl
usr/include/qt4/QtMultimediaKit/QAudioEncoderSettings
usr/include/qt4/QtMultimediaKit/QAudioEndpointSelector
usr/include/qt4/QtMultimediaKit/QAudioFormat
usr/include/qt4/QtMultimediaKit/QAudioInput
usr/include/qt4/QtMultimediaKit/QAudioOutput
usr/include/qt4/QtMultimediaKit/QAudioSystemPlugin
usr/include/qt4/QtMultimediaKit/QCamera
usr/include/qt4/QtMultimediaKit/QCameraControl
usr/include/qt4/QtMultimediaKit/QCameraExposure
usr/include/qt4/QtMultimediaKit/QCameraExposureControl
usr/include/qt4/QtMultimediaKit/QCameraFlashControl
usr/include/qt4/QtMultimediaKit/QCameraFocus
usr/include/qt4/QtMultimediaKit/QCameraFocusControl
usr/include/qt4/QtMultimediaKit/QCameraFocusZone
usr/include/qt4/QtMultimediaKit/QCameraImageCapture
usr/include/qt4/QtMultimediaKit/QCameraImageCaptureControl
usr/include/qt4/QtMultimediaKit/QCameraCaptureBufferFormatControl
usr/include/qt4/QtMultimediaKit/QCameraCaptureDestinationControl
usr/include/qt4/QtMultimediaKit/QCameraImageProcessing
usr/include/qt4/QtMultimediaKit/QCameraImageProcessingControl
usr/include/qt4/QtMultimediaKit/QCameraLocksControl
usr/include/qt4/QtMultimediaKit/QCameraViewfinder
usr/include/qt4/QtMultimediaKit/QGraphicsVideoItem
usr/include/qt4/QtMultimediaKit/QImageEncoderControl
usr/include/qt4/QtMultimediaKit/QImageEncoderSettings
usr/include/qt4/QtMultimediaKit/QLocalMediaPlaylistProvider
usr/include/qt4/QtMultimediaKit/QMediaBindableInterface
usr/include/qt4/QtMultimediaKit/QMediaContainerControl
usr/include/qt4/QtMultimediaKit/QMediaContent
usr/include/qt4/QtMultimediaKit/QMediaControl
usr/include/qt4/QtMultimediaKit/QMediaImageViewer
usr/include/qt4/QtMultimediaKit/QMediaNetworkAccessControl
usr/include/qt4/QtMultimediaKit/QMediaObject
usr/include/qt4/QtMultimediaKit/QMediaPlayer
usr/include/qt4/QtMultimediaKit/QMediaPlayerControl
usr/include/qt4/QtMultimediaKit/QMediaPlaylist
usr/include/qt4/QtMultimediaKit/QMediaPlaylistControl
usr/include/qt4/QtMultimediaKit/QMediaPlaylistIOPlugin
usr/include/qt4/QtMultimediaKit/QMediaPlaylistNavigator
usr/include/qt4/QtMultimediaKit/QMediaPlaylistProvider
usr/include/qt4/QtMultimediaKit/QMediaPlaylistReader
usr/include/qt4/QtMultimediaKit/QMediaPlaylistSourceControl
usr/include/qt4/QtMultimediaKit/QMediaPlaylistWriter
usr/include/qt4/QtMultimediaKit/QMediaRecorder
usr/include/qt4/QtMultimediaKit/QMediaRecorderControl
usr/include/qt4/QtMultimediaKit/QMediaResource
usr/include/qt4/QtMultimediaKit/QMediaService
usr/include/qt4/QtMultimediaKit/QMediaServiceProvider
usr/include/qt4/QtMultimediaKit/QMediaServiceProviderHint
usr/include/qt4/QtMultimediaKit/QMediaServiceProviderPlugin
usr/include/qt4/QtMultimediaKit/QMediaStreamsControl
usr/include/qt4/QtMultimediaKit/QMediaTimeInterval
usr/include/qt4/QtMultimediaKit/QMediaTimeRange
usr/include/qt4/QtMultimediaKit/QMetaDataReaderControl
usr/include/qt4/QtMultimediaKit/QMetaDataWriterControl
usr/include/qt4/QtMultimediaKit/QRadioTuner
usr/include/qt4/QtMultimediaKit/QRadioTunerControl
usr/include/qt4/QtMultimediaKit/QVideoDeviceControl
usr/include/qt4/QtMultimediaKit/QVideoEncoderControl
usr/include/qt4/QtMultimediaKit/QVideoEncoderSettings
usr/include/qt4/QtMultimediaKit/QVideoFrame
usr/include/qt4/QtMultimediaKit/QVideoRendererControl
usr/include/qt4/QtMultimediaKit/QVideoSurfaceFormat
usr/include/qt4/QtMultimediaKit/QVideoWidget
usr/include/qt4/QtMultimediaKit/QVideoWidgetControl
usr/include/qt4/QtMultimediaKit/QVideoWindowControl
usr/include/qt4/QtMultimediaKit/qabstractvideobuffer.h
usr/include/qt4/QtMultimediaKit/qabstractvideosurface.h
usr/include/qt4/QtMultimediaKit/qaudio.h
usr/include/qt4/QtMultimediaKit/qaudiocapturesource.h
usr/include/qt4/QtMultimediaKit/qaudiodeviceinfo.h
usr/include/qt4/QtMultimediaKit/qaudioencodercontrol.h
usr/include/qt4/QtMultimediaKit/qaudioendpointselector.h
usr/include/qt4/QtMultimediaKit/qaudioformat.h
usr/include/qt4/QtMultimediaKit/qaudioinput.h
usr/include/qt4/QtMultimediaKit/qaudiooutput.h
usr/include/qt4/QtMultimediaKit/qaudiosystem.h
usr/include/qt4/QtMultimediaKit/qaudiosystemplugin.h
usr/include/qt4/QtMultimediaKit/qcamera.h
usr/include/qt4/QtMultimediaKit/qcameracontrol.h
usr/include/qt4/QtMultimediaKit/qcameraexposure.h
usr/include/qt4/QtMultimediaKit/qcameraexposurecontrol.h
usr/include/qt4/QtMultimediaKit/qcameraflashcontrol.h
usr/include/qt4/QtMultimediaKit/qcamerafocus.h
usr/include/qt4/QtMultimediaKit/qcamerafocuscontrol.h
usr/include/qt4/QtMultimediaKit/qcameraimagecapture.h
usr/include/qt4/QtMultimediaKit/qcameraimagecapturecontrol.h
usr/include/qt4/QtMultimediaKit/qcameracapturedestinationcontrol.h
usr/include/qt4/QtMultimediaKit/qcameracapturebufferformatcontrol.h
usr/include/qt4/QtMultimediaKit/qcameraimageprocessing.h
usr/include/qt4/QtMultimediaKit/qcameraimageprocessingcontrol.h
usr/include/qt4/QtMultimediaKit/qcameralockscontrol.h
usr/include/qt4/QtMultimediaKit/qcameraviewfinder.h
usr/include/qt4/QtMultimediaKit/qgraphicsvideoitem.h
usr/include/qt4/QtMultimediaKit/qimageencodercontrol.h
usr/include/qt4/QtMultimediaKit/qlocalmediaplaylistprovider.h
usr/include/qt4/QtMultimediaKit/qmediabindableinterface.h
usr/include/qt4/QtMultimediaKit/qmediacontainercontrol.h
usr/include/qt4/QtMultimediaKit/qmediacontent.h
usr/include/qt4/QtMultimediaKit/qmediacontrol.h
usr/include/qt4/QtMultimediaKit/qmediaencodersettings.h
usr/include/qt4/QtMultimediaKit/qmediaenumdebug.h
usr/include/qt4/QtMultimediaKit/qmediaimageviewer.h
usr/include/qt4/QtMultimediaKit/qmedianetworkaccesscontrol.h
usr/include/qt4/QtMultimediaKit/qmediaobject.h
usr/include/qt4/QtMultimediaKit/qmediaplayer.h
usr/include/qt4/QtMultimediaKit/qmediaplayercontrol.h
usr/include/qt4/QtMultimediaKit/qmediaplaylist.h
usr/include/qt4/QtMultimediaKit/qmediaplaylistcontrol.h
usr/include/qt4/QtMultimediaKit/qmediaplaylistioplugin.h
usr/include/qt4/QtMultimediaKit/qmediaplaylistnavigator.h
usr/include/qt4/QtMultimediaKit/qmediaplaylistprovider.h
usr/include/qt4/QtMultimediaKit/qmediaplaylistsourcecontrol.h
usr/include/qt4/QtMultimediaKit/qmediarecorder.h
usr/include/qt4/QtMultimediaKit/qmediarecordercontrol.h
usr/include/qt4/QtMultimediaKit/qmediaresource.h
usr/include/qt4/QtMultimediaKit/qmediaservice.h
usr/include/qt4/QtMultimediaKit/qmediaserviceprovider.h
usr/include/qt4/QtMultimediaKit/qmediaserviceproviderplugin.h
usr/include/qt4/QtMultimediaKit/qmediastreamscontrol.h
usr/include/qt4/QtMultimediaKit/qmediatimerange.h
usr/include/qt4/QtMultimediaKit/qmetadatareadercontrol.h
usr/include/qt4/QtMultimediaKit/qmetadatawritercontrol.h
usr/include/qt4/QtMultimediaKit/qradiotuner.h
usr/include/qt4/QtMultimediaKit/qradiotunercontrol.h
usr/include/qt4/QtMultimediaKit/qtmedianamespace.h
usr/include/qt4/QtMultimediaKit/qvideodevicecontrol.h
usr/include/qt4/QtMultimediaKit/qvideoencodercontrol.h
usr/include/qt4/QtMultimediaKit/qvideoframe.h
usr/include/qt4/QtMultimediaKit/qvideorenderercontrol.h
usr/include/qt4/QtMultimediaKit/qvideosurfaceformat.h
usr/include/qt4/QtMultimediaKit/qvideowidget.h
usr/include/qt4/QtMultimediaKit/qvideowidgetcontrol.h
usr/include/qt4/QtMultimediaKit/qvideowindowcontrol.h
usr/lib/libQtMultimediaKit.so
usr/lib/pkgconfig/QtMultimediaKit.pc

View File

@@ -1,32 +0,0 @@
usr/tests/qtm/tst_qmediaresource
usr/tests/qtm/tst_qmediatimerange
usr/tests/qtm/tst_qaudiooutput
usr/tests/qtm/tst_qabstractvideosurface
usr/tests/qtm/tst_qmediaimageviewer
usr/tests/qtm/tst_qcamera
usr/tests/qtm/tst_qmediaplayerbackend
usr/tests/qtm/tst_qvideoframe
usr/tests/qtm/tst_qabstractvideobuffer
usr/tests/qtm/tst_qdeclarativevideo
usr/tests/qtm/tst_qmediapluginloader
usr/tests/qtm/tst_qmediaplaylist
usr/tests/qtm/tst_qaudiocapturesource
usr/tests/qtm/tst_qmediarecorder
usr/tests/qtm/tst_qmediaserviceprovider
usr/tests/qtm/tst_qvideowidget
usr/tests/qtm/tst_qaudioinput
usr/tests/qtm/tst_qmediacontent
usr/tests/qtm/tst_qmediaplayer
usr/tests/qtm/tst_qpaintervideosurface
usr/tests/qtm/tst_qmediaplaylistnavigator
usr/tests/qtm/tst_qradiotuner
usr/tests/qtm/tst_qaudioformat
usr/tests/qtm/tst_qmediaservice
usr/tests/qtm/tst_qaudiodeviceinfo
usr/tests/qtm/tst_qsoundeffect
usr/tests/qtm/tst_qvideosurfaceformat
usr/tests/qtm/tst_qgraphicsvideoitem
usr/tests/qtm/tst_qdeclarativeaudio
usr/tests/qtm/tst_qmediaobject
usr/tests/qtm/tst_qcamerabackend
usr/share/libqtm-multimedia-tests/tests.xml

View File

@@ -1,8 +0,0 @@
usr/lib/libQtMultimediaKit.so.1.2.0
usr/lib/libQtMultimediaKit.so.1.2
usr/lib/libQtMultimediaKit.so.1
usr/lib/qt4/imports/QtMultimediaKit/libdeclarative_multimedia.so
usr/lib/qt4/imports/QtMultimediaKit/qmldir
usr/lib/qt4/plugins/audio/libqtmedia_pulse.so
usr/lib/qt4/plugins/mediaservice/libqgstengine.so
usr/lib/qt4/plugins/playlistformats/libqtmultimediakit_m3u.so

View File

@@ -1,10 +0,0 @@
<aegis>
<request>
<credential name="mce::TKLockControl" />
<for path="/usr/tests/qtm/tst_qsystemscreensaver" />
</request>
<request>
<credential name="mce::DeviceModeControl" />
<for path="/usr/tests/qtm/tst_qsystemnetworkinfo" />
</request>
</aegis>

View File

@@ -1,110 +0,0 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
# set MOBILITY_ENABLE_STATIC_CONFIG to 0 to disable using staticconfig in configure
MOBILITY_ENABLE_STATIC_CONFIG=1
include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/rules/utils.mk
include /usr/share/cdbs/1/rules/patchsys-quilt.mk
include /usr/share/cdbs/1/class/autotools.mk
# Find out how many parallel threads to run
TMP_BUILD_OPTS = $(subst $(comma),$(space),$(DEB_BUILD_OPTIONS))
ifneq (,$(filter parallel=%,$(TMP_BUILD_OPTS)))
NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(TMP_BUILD_OPTS)))
PARALLEL_MAKEFLAGS += -j$(NUMJOBS)
endif
DEB_MAKE_INVOKE := $(MAKE) $(PARALLEL_MAKEFLAGS)
DEB_MAKE_INSTALL_TARGET := INSTALL_ROOT=$(DEB_DESTDIR) install
DEB_DH_INSTALL_SOURCEDIR := debian/tmp
# DEB_DH_INSTALL_ARGS ensures that the build breaks if a file installed
# to DEB_DH_INSTALL_SOURCEDIR is not listed in any of the libqtm*.install files
# except the *.prl files (-X.prl)
DEB_DH_INSTALL_ARGS := --fail-missing -X.prl
# bearer location contacts multimedia publishsubscribe versit messaging systeminfo serviceframework sensors gallery organizer feedback connectivity
QTM_MODULES += connectivity
QTM_MODULES += contacts
QTM_MODULES += feedback
QTM_MODULES += gallery
QTM_MODULES += location
QTM_MODULES += messaging
QTM_MODULES += multimedia
QTM_MODULES += organizer
QTM_MODULES += publishsubscribe
QTM_MODULES += sensors
QTM_MODULES += serviceframework
QTM_MODULES += systeminfo
QTM_MODULES += versit
# Add here any variable or target overrides you need.
# Arguments to configure
DEB_CONFIGURE_NORMAL_ARGS := -maemo6 -prefix /usr -headerdir /usr/include/qt4 \
-plugindir /usr/lib/qt4/plugins -modules "$(QTM_MODULES)" \
-examples -examplesdir /usr/lib/qtmobility/examples \
-demos -demosdir /usr/lib/qtmobility/demos \
-silent -release -tests
# enable static config if set
ifeq ($(MOBILITY_ENABLE_STATIC_CONFIG),1)
TARGET_BUILD=x86
ifeq ($(DEB_HOST_ARCH),arm)
TARGET_BUILD=arm
endif
ifeq ($(DEB_HOST_ARCH),armel)
TARGET_BUILD=arm
endif
DEB_CONFIGURE_EXTRA_FLAGS := -staticconfig harmattan_$(TARGET_BUILD)
endif
common-install-arch:: install-autotests
#List of auto tests
QTM_MAEMO_TESTDIR := debian/tests
QTM_AUTOTESTS_SIMPLE := debian/libqtm-connectivity-tests.install \
debian/libqtm-contacts-tests.install \
debian/libqtm-feedback-tests.install \
debian/libqtm-gallery-tests.install \
debian/libqtm-location-tests.install \
debian/libqtm-messaging-tests.install \
debian/libqtm-multimedia-tests.install \
debian/libqtm-organizer-tests.install \
debian/libqtm-publishsubscribe-tests.install \
debian/libqtm-sensors-tests.install \
debian/libqtm-serviceframework-tests.install \
debian/libqtm-systeminfo-tests.install \
debian/libqtm-versit-tests.install
export QTM_TEST_INSTALL_FILE=$(CURDIR)/debian/pkg.install
#installation
install-autotests:
$(DEB_MAKE_INVOKE) -C tests INSTALL_ROOT=$(DEB_DESTDIR) installtests
$(QTM_MAEMO_TESTDIR)/install_tests -d debian -t $(QTM_MAEMO_TESTDIR) \
-i $(DEB_DESTDIR) -c -xml $(QTM_AUTOTESTS_SIMPLE)
PACKAGE_TARGETS := $(foreach pkg,$(DEB_ALL_PACKAGES),binary/$(pkg))
$(PACKAGE_TARGETS)::
[ ! -f debian/$(notdir $@).aegis ] || aegis-deb-add -control debian/$(notdir $@)/DEBIAN/control .. debian/$(notdir $@).aegis=_aegis
clean::
find \( -false \
-o -type f -name mobility*.prf \
\) -delete
rm -rf include build lib patches
# Delete the config tests and
rm -f \
config.tests/maemo-icd-network-wlan/maemo-icd-network-wlan \
config.tests/maemo-icd/maemo-icd \
config.tests/sensord/sensord \
config.tests/gstreamer-photography/gstreamer-photography \
config.tests/immersion/immersion \
config.tests/maemo6-landmarks/maemo6-landmarks \
config.tests/pulseaudio/pulseaudio

View File

@@ -1,201 +0,0 @@
#!/bin/sh
#############################################################################
##
## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
## All rights reserved.
## Contact: Nokia Corporation (qt-info@nokia.com)
##
## This file is the build configuration utility of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## GNU Lesser General Public License Usage
## 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, Nokia gives you certain additional
## rights. These rights are described in the Nokia 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.
##
## Other Usage
## Alternatively, this file may be used in accordance with the terms and
## conditions contained in a signed written agreement between you and Nokia.
##
##
##
##
##
## $QT_END_LICENSE$
##
#############################################################################
set -e
#-------------------------------------------------------------------------------
#Design assumptions:
## The name of the test application binary is tst_<subdir_where_test_is_located>
## The name of the project file passed to the scrpt is <package name>.<ext>
## The extension string is not relevant. Typical values: .pri, .pro, .conf
#-------------------------------------------------------------------------------
xmlInstallDir="usr/share"
testSuiteHeader="testsuite_header.txt"
testSuiteFooter="testsuite_footer.txt"
testSetTemplate="testset.txt"
#-------------------------------------------------------------------------------
#Parameters: $1 the project file where the tests are defined
#-------------------------------------------------------------------------------
install_tests()
{
#derive the package name from the file name
extension=".$(echo $1 | awk -F"." '{print $NF}')"
packageName=$(basename "$1" "$extension")
installFile="$packageDir/${packageName}.install"
mkdir -p $installDir/$xmlInstallDir/$packageName
xmlFile="$installDir/$xmlInstallDir/$packageName/tests.xml"
begin_test_suite $xmlFile
# only run applications, not test data or plugins (which will have a '.' in the name)
grep -v -F . "$installFile" | while read testApp; do
add_test_set "$testApp" "$xmlFile"
done
end_test_suite $xmlFile
}
#-------------------------------------------------------------------------------
#Parameters: $1 the xml output file'
#-------------------------------------------------------------------------------
begin_test_suite()
{
optstr="/<suite/s;name=\"[^\"]*\";name=\"$packageName\";g"
template="$templateDir/$testSuiteHeader"
runsed $optstr $template > "$1"
}
#Parameters: $1 the xml output file
end_test_suite()
{
cat "$templateDir/$testSuiteFooter" >> "$1"
}
#-------------------------------------------------------------------------------
#Parameters: $1 the name of the test application
#Parameters: $2 the xml output file
#-------------------------------------------------------------------------------
add_test_set()
{
templateSetFile="$templateDir/$testSetTemplate"
testSuiteName=$(basename $1)
insignificantTest="false"
# *.insignificant_test files indicate that the test should be marked as insignificant - run but not counted
if [ -e "$installDir/$1.insignificant_test" ]; then
insignificantTest="true"
rm "$installDir/$1.insignificant_test"
fi
# *.manual_test files indicate that the test is not to be run in CITA
if [ ! -e "$installDir/$1.manual_test" ]; then
add_set_name "$testSuiteName" "$templateSetFile" |add_description "$testSuiteName" |add_case_name "$testSuiteName" |add_insignificant_test "$insignificantTest" | add_step "$1" >> "$2"
else
rm "$installDir/$1.manual_test"
fi
}
add_set_name()
{
optstr="/<set/s;name=\"[^\"]*\";name=\"${packageName}_$1\";g"
runsed "$optstr" "$2"
}
add_case_name()
{
optstr="/<case/s;name=\"[^\"]*\";name=\"$1\";g"
runsed "$optstr" "$2"
}
add_description()
{
optstr="s;<description>.*</description>;<description>${packageName}:$1</description>;g"
runsed "$optstr" "$2"
}
add_step()
{
if [ -n "$testCliOptions" ]; then
optstr="s;<step>.*</step>;<step>/$1 $testCliOptions</step>;g"
else
optstr="s;<step>.*</step>;<step>/$1</step>;g"
fi
runsed "$optstr" "$2"
}
add_insignificant_test()
{
optstr="s;insignificant=\"[^\"]*\";insignificant=\"$1\";g"
runsed "$optstr" "$2"
}
runsed()
{
sedopt=$(echo $1)
cmd='sed -e "$sedopt" $2'
eval $cmd
}
#======= main =========
programName="$0"
usage="Usage: `basename $programName` -t <template_dir> -d <debian_dir> \
-i <dir_where_tests_will_be_installed> <project_files>"
if [ $# -le 0 ]; then
echo "$usage" 1>&2
exit 1
fi
while [ $# -gt 0 ]; do
case "$1" in
-t) templateDir=$(cd "$2"; pwd)
shift
;;
-d) packageDir=$(cd "$2"; pwd)
shift
;;
-i) installDir=$(cd "$2"; pwd)
shift
;;
-c) testCliOptions="$2"
shift
;;
*) projFileList="$projFileList $1";;
esac
shift
done
if [ -z "$templateDir" ]|| [ -z "$packageDir" ] || [ -z "$installDir" ]; then
echo "$usage" 1>&2
exit 1
fi
for projFile in $projFileList; do
install_tests $projFile
done

View File

@@ -1,11 +0,0 @@
<set feature="qtmobility" level="Component" name="##Package-name_test_name##" type="Functional">
<description>##Package-name:test_name##</description>
<case level="Component" name="##tst_foo##" type="Functional" insignificant="false">
<description>##Package-name:test_name##</description>
<step>/usr/tests/qtm/tst_foo</step>
</case>
<environments>
<scratchbox>true</scratchbox>
<hardware>true</hardware>
</environments>
</set>

View File

@@ -1,2 +0,0 @@
</suite>
</testdefinition>

View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<testdefinition version="1.0">
<suite domain="Application framework" level="Component" name="##Add your name here##" type="Functional">
<description />

View File

@@ -241,8 +241,6 @@ void QDeclarativeCamera::_q_captureFailed(int id, QCameraImageCapture::Error err
You can use the \c Camera element to capture images from a camera, and manipulate the capture and
processing settings that get applied to the image.
\note On Symbian, your process requires the \c UserEnvironment capability to use this element.
*/
/*!
@@ -262,14 +260,6 @@ QDeclarativeCamera::QDeclarativeCamera(QDeclarativeItem *parent) :
m_isStateSet(false),
m_isValid(true)
{
#if defined(Q_OS_SYMBIAN)
RProcess thisProcess;
if (!thisProcess.HasCapability(ECapabilityUserEnvironment)) {
qmlInfo(this) << "Camera Element requires UserEnvironment Capability to be successfully used on Symbian";
m_isValid = false;
return;
}
#endif
m_camera = new QCamera(this);
m_viewfinderItem = new QGraphicsVideoItem(this);
m_camera->setViewfinder(m_viewfinderItem);

View File

@@ -1,10 +1,9 @@
load(qt_module)
symbian:load(qt_plugin)
TEMPLATE = lib
CONFIG += qt plugin
win32|mac:!wince*:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
win32|mac:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
isEmpty(TARGETPATH) {
error("qimportbase.pri: You must provide a TARGETPATH!")
@@ -29,10 +28,3 @@ contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
load(qt_targets)
wince*:LIBS += $$QMAKE_LIBS_GUI
symbian: {
TARGET.EPOCALLOWDLLDATA=1
TARGET.CAPABILITY = All -Tcb
load(armcc_warnings)
}

View File

@@ -40,29 +40,10 @@ win32 {
SOURCES += audio/qaudiodeviceinfo_win32_p.cpp \
audio/qaudiooutput_win32_p.cpp \
audio/qaudioinput_win32_p.cpp
!wince*:LIBS += -lwinmm
wince*:LIBS += -lcoredll
LIBS += -lstrmiids -lole32 -loleaut32
LIBS += -lwinmm -lstrmiids -lole32 -loleaut32
}
symbian {
INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/common
INCLUDEPATH += $${EPOCROOT}epoc32/include/mmf/server
PRIVATE_HEADERS += audio/qaudio_symbian_p.h \
audio/qaudiodeviceinfo_symbian_p.h \
audio/qaudioinput_symbian_p.h \
audio/qaudiooutput_symbian_p.h
SOURCES += audio/qaudio_symbian_p.cpp \
audio/qaudiodeviceinfo_symbian_p.cpp \
audio/qaudioinput_symbian_p.cpp \
audio/qaudiooutput_symbian_p.cpp
LIBS += -lmmfdevsound
}
unix:!mac:!symbian {
unix:!mac {
contains(pulseaudio_enabled, yes) {
DEFINES += QT_NO_AUDIO_BACKEND
}

View File

@@ -1,663 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudio_symbian_p.h"
#include <mmffourcc.h>
QT_BEGIN_NAMESPACE
namespace SymbianAudio {
namespace Utils {
//-----------------------------------------------------------------------------
// Static data
//-----------------------------------------------------------------------------
// Sample rate / frequency
typedef TMMFSampleRate SampleRateNative;
typedef int SampleRateQt;
const int SampleRateCount = 12;
const SampleRateNative SampleRateListNative[SampleRateCount] = {
EMMFSampleRate8000Hz
, EMMFSampleRate11025Hz
, EMMFSampleRate12000Hz
, EMMFSampleRate16000Hz
, EMMFSampleRate22050Hz
, EMMFSampleRate24000Hz
, EMMFSampleRate32000Hz
, EMMFSampleRate44100Hz
, EMMFSampleRate48000Hz
, EMMFSampleRate64000Hz
, EMMFSampleRate88200Hz
, EMMFSampleRate96000Hz
};
const SampleRateQt SampleRateListQt[SampleRateCount] = {
8000
, 11025
, 12000
, 16000
, 22050
, 24000
, 32000
, 44100
, 48000
, 64000
, 88200
, 96000
};
// Channels
typedef TMMFMonoStereo ChannelsNative;
typedef int ChannelsQt;
const int ChannelsCount = 2;
const ChannelsNative ChannelsListNative[ChannelsCount] = {
EMMFMono
, EMMFStereo
};
const ChannelsQt ChannelsListQt[ChannelsCount] = {
1
, 2
};
// Encoding
const int EncodingCount = 6;
const TUint32 EncodingFourCC[EncodingCount] = {
KMMFFourCCCodePCM8 // 0
, KMMFFourCCCodePCMU8 // 1
, KMMFFourCCCodePCM16 // 2
, KMMFFourCCCodePCMU16 // 3
, KMMFFourCCCodePCM16B // 4
, KMMFFourCCCodePCMU16B // 5
};
// The characterised DevSound API specification states that the iEncoding
// field in TMMFCapabilities is ignored, and that the FourCC should be used
// to specify the PCM encoding.
// See "SGL.GT0287.102 Multimedia DevSound Baseline Compatibility.doc" in the
// mm_info/mm_docs repository.
const TMMFSoundEncoding EncodingNative[EncodingCount] = {
EMMFSoundEncoding16BitPCM // 0
, EMMFSoundEncoding16BitPCM // 1
, EMMFSoundEncoding16BitPCM // 2
, EMMFSoundEncoding16BitPCM // 3
, EMMFSoundEncoding16BitPCM // 4
, EMMFSoundEncoding16BitPCM // 5
};
const int EncodingSampleSize[EncodingCount] = {
8 // 0
, 8 // 1
, 16 // 2
, 16 // 3
, 16 // 4
, 16 // 5
};
const QAudioFormat::Endian EncodingByteOrder[EncodingCount] = {
QAudioFormat::LittleEndian // 0
, QAudioFormat::LittleEndian // 1
, QAudioFormat::LittleEndian // 2
, QAudioFormat::LittleEndian // 3
, QAudioFormat::BigEndian // 4
, QAudioFormat::BigEndian // 5
};
const QAudioFormat::SampleType EncodingSampleType[EncodingCount] = {
QAudioFormat::SignedInt // 0
, QAudioFormat::UnSignedInt // 1
, QAudioFormat::SignedInt // 2
, QAudioFormat::UnSignedInt // 3
, QAudioFormat::SignedInt // 4
, QAudioFormat::UnSignedInt // 5
};
//-----------------------------------------------------------------------------
// Private functions
//-----------------------------------------------------------------------------
// Helper functions for implementing parameter conversions
template<typename Input>
bool findValue(const Input *inputArray, int length, Input input, int &index) {
bool result = false;
for (int i=0; !result && i<length; ++i)
if (inputArray[i] == input) {
index = i;
result = true;
}
return result;
}
template<typename Input, typename Output>
bool convertValue(const Input *inputArray, const Output *outputArray,
int length, Input input, Output &output) {
int index;
const bool result = findValue<Input>(inputArray, length, input, index);
if (result)
output = outputArray[index];
return result;
}
/**
* Macro which is used to generate the implementation of the conversion
* functions. The implementation is just a wrapper around the templated
* convertValue function, e.g.
*
* CONVERSION_FUNCTION_IMPL(SampleRate, Qt, Native)
*
* expands to
*
* bool SampleRateQtToNative(int input, TMMFSampleRate &output) {
* return convertValue<SampleRateQt, SampleRateNative>
* (SampleRateListQt, SampleRateListNative, SampleRateCount,
* input, output);
* }
*/
#define CONVERSION_FUNCTION_IMPL(FieldLc, Field, Input, Output) \
bool FieldLc##Input##To##Output(Field##Input input, Field##Output &output) { \
return convertValue<Field##Input, Field##Output>(Field##List##Input, \
Field##List##Output, Field##Count, input, output); \
}
//-----------------------------------------------------------------------------
// Local helper functions
//-----------------------------------------------------------------------------
CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Qt, Native)
CONVERSION_FUNCTION_IMPL(sampleRate, SampleRate, Native, Qt)
CONVERSION_FUNCTION_IMPL(channels, Channels, Qt, Native)
CONVERSION_FUNCTION_IMPL(channels, Channels, Native, Qt)
bool sampleInfoQtToNative(int inputSampleSize,
QAudioFormat::Endian inputByteOrder,
QAudioFormat::SampleType inputSampleType,
TUint32 &outputFourCC,
TMMFSoundEncoding &outputEncoding) {
bool found = false;
for (int i=0; i<EncodingCount && !found; ++i) {
if ( EncodingSampleSize[i] == inputSampleSize
&& EncodingByteOrder[i] == inputByteOrder
&& EncodingSampleType[i] == inputSampleType) {
outputFourCC = EncodingFourCC[i];
outputEncoding = EncodingNative[i]; // EMMFSoundEncoding16BitPCM
found = true;
}
}
return found;
}
void capabilitiesNativeToQt(const TMMFCapabilities &caps,
const TFourCC &fourcc,
QList<int> &frequencies,
QList<int> &channels,
QList<int> &sampleSizes,
QList<QAudioFormat::Endian> &byteOrders,
QList<QAudioFormat::SampleType> &sampleTypes) {
frequencies.clear();
sampleSizes.clear();
byteOrders.clear();
sampleTypes.clear();
channels.clear();
for (int i=0; i<SampleRateCount; ++i)
if (caps.iRate & SampleRateListNative[i])
frequencies += SampleRateListQt[i];
for (int i=0; i<ChannelsCount; ++i)
if (caps.iChannels & ChannelsListNative[i])
channels += ChannelsListQt[i];
for (int i=0; i<EncodingCount; ++i) {
if (fourcc == EncodingFourCC[i]) {
sampleSizes += EncodingSampleSize[i];
byteOrders += EncodingByteOrder[i];
sampleTypes += EncodingSampleType[i];
}
}
}
bool formatQtToNative(const QAudioFormat &inputFormat,
TUint32 &outputFourCC,
TMMFCapabilities &outputFormat) {
bool result = false;
// Need to use temporary variables because TMMFCapabilities fields are all
// TInt, rather than MMF enumerated types.
TMMFSampleRate outputSampleRate;
TMMFMonoStereo outputChannels;
TMMFSoundEncoding outputEncoding;
if (inputFormat.codec() == QLatin1String("audio/pcm")) {
result =
sampleRateQtToNative(inputFormat.frequency(), outputSampleRate)
&& channelsQtToNative(inputFormat.channels(), outputChannels)
&& sampleInfoQtToNative(inputFormat.sampleSize(),
inputFormat.byteOrder(),
inputFormat.sampleType(),
outputFourCC,
outputEncoding);
}
if (result) {
outputFormat.iRate = outputSampleRate;
outputFormat.iChannels = outputChannels;
outputFormat.iEncoding = outputEncoding;
}
return result;
}
QAudio::State stateNativeToQt(State nativeState)
{
switch (nativeState) {
case ClosedState:
return QAudio::StoppedState;
case InitializingState:
return QAudio::StoppedState;
case ActiveState:
return QAudio::ActiveState;
case IdleState:
return QAudio::IdleState;
case SuspendedPausedState:
case SuspendedStoppedState:
return QAudio::SuspendedState;
default:
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid state");
return QAudio::StoppedState; // suppress compiler warning
}
}
qint64 bytesToSamples(const QAudioFormat &format, qint64 length)
{
return length / ((format.sampleSize() / 8) * format.channels());
}
qint64 samplesToBytes(const QAudioFormat &format, qint64 samples)
{
return samples * (format.sampleSize() / 8) * format.channels();
}
} // namespace Utils
//-----------------------------------------------------------------------------
// DevSoundWrapper
//-----------------------------------------------------------------------------
DevSoundWrapper::DevSoundWrapper(QAudio::Mode mode, QObject *parent)
: QObject(parent)
, m_mode(mode)
, m_state(StateIdle)
, m_devsound(0)
, m_fourcc(0)
{
QT_TRAP_THROWING(m_devsound = CMMFDevSound::NewL());
switch (mode) {
case QAudio::AudioOutput:
m_nativeMode = EMMFStatePlaying;
break;
case QAudio::AudioInput:
m_nativeMode = EMMFStateRecording;
break;
default:
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
}
getSupportedCodecs();
}
DevSoundWrapper::~DevSoundWrapper()
{
delete m_devsound;
}
const QList<QString>& DevSoundWrapper::supportedCodecs() const
{
return m_supportedCodecs;
}
void DevSoundWrapper::initialize(const QString& codec)
{
Q_ASSERT(StateInitializing != m_state);
m_state = StateInitializing;
if (QLatin1String("audio/pcm") == codec) {
m_fourcc = KMMFFourCCCodePCM16;
TRAPD(err, m_devsound->InitializeL(*this, m_fourcc, m_nativeMode));
if (KErrNone != err) {
m_state = StateIdle;
emit initializeComplete(err);
}
} else {
emit initializeComplete(KErrNotSupported);
}
}
const QList<int>& DevSoundWrapper::supportedFrequencies() const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedFrequencies;
}
const QList<int>& DevSoundWrapper::supportedChannels() const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedChannels;
}
const QList<int>& DevSoundWrapper::supportedSampleSizes() const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedSampleSizes;
}
const QList<QAudioFormat::Endian>& DevSoundWrapper::supportedByteOrders() const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedByteOrders;
}
const QList<QAudioFormat::SampleType>& DevSoundWrapper::supportedSampleTypes() const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedSampleTypes;
}
bool DevSoundWrapper::isFormatSupported(const QAudioFormat &format) const
{
Q_ASSERT(StateInitialized == m_state);
return m_supportedCodecs.contains(format.codec())
&& m_supportedFrequencies.contains(format.frequency())
&& m_supportedChannels.contains(format.channels())
&& m_supportedSampleSizes.contains(format.sampleSize())
&& m_supportedSampleTypes.contains(format.sampleType())
&& m_supportedByteOrders.contains(format.byteOrder());
}
int DevSoundWrapper::samplesProcessed() const
{
int result = 0;
if (StateInitialized == m_state) {
switch (m_mode) {
case QAudio::AudioInput:
result = m_devsound->SamplesRecorded();
break;
case QAudio::AudioOutput:
result = m_devsound->SamplesPlayed();
break;
}
}
return result;
}
bool DevSoundWrapper::setFormat(const QAudioFormat &format)
{
Q_ASSERT(StateInitialized == m_state);
bool result = false;
TUint32 fourcc;
TMMFCapabilities nativeFormat;
if (Utils::formatQtToNative(format, fourcc, nativeFormat)) {
TMMFCapabilities currentNativeFormat = m_devsound->Config();
nativeFormat.iBufferSize = currentNativeFormat.iBufferSize;
TRAPD(err, m_devsound->SetConfigL(nativeFormat));
result = (KErrNone == err);
}
return result;
}
bool DevSoundWrapper::start()
{
Q_ASSERT(StateInitialized == m_state);
int err = KErrArgument;
switch (m_mode) {
case QAudio::AudioInput:
TRAP(err, m_devsound->RecordInitL());
break;
case QAudio::AudioOutput:
TRAP(err, m_devsound->PlayInitL());
break;
}
return (KErrNone == err);
}
bool DevSoundWrapper::pause()
{
Q_ASSERT(StateInitialized == m_state);
#ifndef PRE_S60_52_PLATFORM
if (m_mode == QAudio::AudioOutput ) {
m_devsound->Pause();
return true;
} else {
const bool canPause = isResumeSupported();
if (canPause)
m_devsound->Pause();
else
stop();
return canPause;
}
#else
const bool canPause = isResumeSupported();
if (canPause)
m_devsound->Pause();
else
stop();
return canPause;
#endif
}
void DevSoundWrapper::resume()
{
Q_ASSERT(StateInitialized == m_state);
Q_ASSERT(isResumeSupported());
// TODO: QTBUG-13625
}
void DevSoundWrapper::stop()
{
m_devsound->Stop();
}
void DevSoundWrapper::bufferProcessed()
{
Q_ASSERT(StateInitialized == m_state);
switch (m_mode) {
case QAudio::AudioInput:
m_devsound->RecordData();
break;
case QAudio::AudioOutput:
m_devsound->PlayData();
break;
}
}
void DevSoundWrapper::getSupportedCodecs()
{
/*
* TODO: once we support formats other than PCM, this function should
* convert the array of FourCC codes into MIME types for each codec.
*
RArray<TFourCC> fourcc;
QT_TRAP_THROWING(CleanupClosePushL(&fourcc));
TMMFPrioritySettings settings;
switch (mode) {
case QAudio::AudioOutput:
settings.iState = EMMFStatePlaying;
m_devsound->GetSupportedInputDataTypesL(fourcc, settings);
break;
case QAudio::AudioInput:
settings.iState = EMMFStateRecording;
m_devsound->GetSupportedInputDataTypesL(fourcc, settings);
break;
default:
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
}
CleanupStack::PopAndDestroy(); // fourcc
*/
m_supportedCodecs.append(QLatin1String("audio/pcm"));
}
void DevSoundWrapper::populateCapabilities()
{
m_supportedFrequencies.clear();
m_supportedChannels.clear();
m_supportedSampleSizes.clear();
m_supportedByteOrders.clear();
m_supportedSampleTypes.clear();
const TMMFCapabilities caps = m_devsound->Capabilities();
for (int i=0; i<Utils::SampleRateCount; ++i)
if (caps.iRate & Utils::SampleRateListNative[i])
m_supportedFrequencies += Utils::SampleRateListQt[i];
for (int i=0; i<Utils::ChannelsCount; ++i)
if (caps.iChannels & Utils::ChannelsListNative[i])
m_supportedChannels += Utils::ChannelsListQt[i];
for (int i=0; i<Utils::EncodingCount; ++i) {
if (m_fourcc == Utils::EncodingFourCC[i]) {
m_supportedSampleSizes += Utils::EncodingSampleSize[i];
m_supportedByteOrders += Utils::EncodingByteOrder[i];
m_supportedSampleTypes += Utils::EncodingSampleType[i];
}
}
}
bool DevSoundWrapper::isResumeSupported() const
{
// TODO: QTBUG-13625
return false;
}
void DevSoundWrapper::InitializeComplete(TInt aError)
{
Q_ASSERT(StateInitializing == m_state);
if (KErrNone == aError) {
m_state = StateInitialized;
populateCapabilities();
} else {
m_state = StateIdle;
}
emit initializeComplete(aError);
}
void DevSoundWrapper::ToneFinished(TInt aError)
{
Q_UNUSED(aError)
// This class doesn't use DevSound's tone playback functions, so should
// never receive this callback.
Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
}
void DevSoundWrapper::BufferToBeFilled(CMMFBuffer *aBuffer)
{
Q_ASSERT(QAudio::AudioOutput == m_mode);
emit bufferToBeProcessed(aBuffer);
}
void DevSoundWrapper::PlayError(TInt aError)
{
Q_ASSERT(QAudio::AudioOutput == m_mode);
emit processingError(aError);
}
void DevSoundWrapper::BufferToBeEmptied(CMMFBuffer *aBuffer)
{
Q_ASSERT(QAudio::AudioInput == m_mode);
emit bufferToBeProcessed(aBuffer);
}
void DevSoundWrapper::RecordError(TInt aError)
{
Q_ASSERT(QAudio::AudioInput == m_mode);
emit processingError(aError);
}
void DevSoundWrapper::ConvertError(TInt aError)
{
Q_UNUSED(aError)
// This class doesn't use DevSound's format conversion functions, so
// should never receive this callback.
Q_ASSERT_X(false, Q_FUNC_INFO, "Unexpected callback");
}
void DevSoundWrapper::DeviceMessage(TUid aMessageType, const TDesC8 &aMsg)
{
Q_UNUSED(aMessageType)
Q_UNUSED(aMsg)
// Ignore this callback.
}
#ifndef PRE_S60_52_PLATFORM
int DevSoundWrapper::flush()
{
return m_devsound->EmptyBuffers();
}
#endif
} // namespace SymbianAudio
QT_END_NAMESPACE

View File

@@ -1,204 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QAUDIO_SYMBIAN_P_H
#define QAUDIO_SYMBIAN_P_H
#include <QtCore/qnamespace.h>
#include <QtCore/QList>
#include <QtCore/QString>
#include <qaudioformat.h>
#include <qaudio.h>
#include <sounddevice.h>
QT_BEGIN_NAMESPACE
namespace SymbianAudio {
/**
* Default values used by audio input and output classes, when underlying
* DevSound instance has not yet been created.
*/
const int DefaultBufferSize = 4096; // bytes
const int DefaultNotifyInterval = 1000; // ms
/**
* Enumeration used to track state of internal DevSound instances.
* Values are translated to the corresponding QAudio::State values by
* SymbianAudio::Utils::stateNativeToQt.
*/
enum State {
ClosedState
, InitializingState
, ActiveState
, IdleState
// QAudio is suspended; DevSound is paused
, SuspendedPausedState
// QAudio is suspended; DevSound is stopped
, SuspendedStoppedState
};
/**
* Wrapper around DevSound instance
*/
class DevSoundWrapper
: public QObject
, public MDevSoundObserver
{
Q_OBJECT
public:
DevSoundWrapper(QAudio::Mode mode, QObject *parent = 0);
~DevSoundWrapper();
public:
// List of supported codecs; can be called once object is constructed
const QList<QString>& supportedCodecs() const;
// Asynchronous initialization function; emits devsoundInitializeComplete
void initialize(const QString& codec);
// Capabilities, for selected codec. Can be called once initialize has returned
// successfully.
const QList<int>& supportedFrequencies() const;
const QList<int>& supportedChannels() const;
const QList<int>& supportedSampleSizes() const;
const QList<QAudioFormat::Endian>& supportedByteOrders() const;
const QList<QAudioFormat::SampleType>& supportedSampleTypes() const;
bool isFormatSupported(const QAudioFormat &format) const;
int samplesProcessed() const;
bool setFormat(const QAudioFormat &format);
bool start();
// If DevSound implementation supports pause, calls pause and returns true.
// Otherwise calls stop and returns false. In this case, all DevSound buffers
// currently held by the backend must be discarded.
bool pause();
void resume();
void stop();
void bufferProcessed();
#ifndef PRE_S60_52_PLATFORM
int flush();
#endif
public:
// MDevSoundObserver
void InitializeComplete(TInt aError);
void ToneFinished(TInt aError);
void BufferToBeFilled(CMMFBuffer *aBuffer);
void PlayError(TInt aError);
void BufferToBeEmptied(CMMFBuffer *aBuffer);
void RecordError(TInt aError);
void ConvertError(TInt aError);
void DeviceMessage(TUid aMessageType, const TDesC8 &aMsg);
signals:
void initializeComplete(int error);
void bufferToBeProcessed(CMMFBuffer *buffer);
void processingError(int error);
private:
void getSupportedCodecs();
void populateCapabilities();
bool isResumeSupported() const;
private:
const QAudio::Mode m_mode;
TMMFState m_nativeMode;
enum State {
StateIdle,
StateInitializing,
StateInitialized
} m_state;
CMMFDevSound* m_devsound;
TFourCC m_fourcc;
QList<QString> m_supportedCodecs;
QList<int> m_supportedFrequencies;
QList<int> m_supportedChannels;
QList<int> m_supportedSampleSizes;
QList<QAudioFormat::Endian> m_supportedByteOrders;
QList<QAudioFormat::SampleType> m_supportedSampleTypes;
};
namespace Utils {
/**
* Convert internal states to QAudio states.
*/
QAudio::State stateNativeToQt(State nativeState);
/**
* Convert data length to number of samples.
*/
qint64 bytesToSamples(const QAudioFormat &format, qint64 length);
/**
* Convert number of samples to data length.
*/
qint64 samplesToBytes(const QAudioFormat &format, qint64 samples);
} // namespace Utils
} // namespace SymbianAudio
QT_END_NAMESPACE
#endif

View File

@@ -60,10 +60,6 @@
#include "qaudiodeviceinfo_alsa_p.h"
#include "qaudiooutput_alsa_p.h"
#include "qaudioinput_alsa_p.h"
#elif defined(Q_OS_SYMBIAN)
#include "qaudiodeviceinfo_symbian_p.h"
#include "qaudiooutput_symbian_p.h"
#include "qaudioinput_symbian_p.h"
#endif
#endif
@@ -139,7 +135,7 @@ QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode)
{
QList<QAudioDeviceInfo> devices;
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
#endif
@@ -174,7 +170,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
#endif
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
#endif
#endif
@@ -194,7 +190,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
#endif
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
#endif
#endif
@@ -206,7 +202,7 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re
QAbstractAudioDeviceInfo *rc = 0;
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (realm == QLatin1String("builtin"))
return new QAudioDeviceInfoInternal(handle, mode);
#endif
@@ -238,7 +234,7 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con
if (deviceInfo.isNull())
return new QNullInputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);
@@ -265,7 +261,7 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c
if (deviceInfo.isNull())
return new QNullOutputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA) || defined(Q_OS_SYMBIAN))
#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);

View File

@@ -1,235 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/QCoreApplication>
#include "qaudiodeviceinfo_symbian_p.h"
#include "qaudio_symbian_p.h"
QT_BEGIN_NAMESPACE
QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray device,
QAudio::Mode mode)
: m_deviceName(QLatin1String(device))
, m_mode(mode)
, m_updated(false)
{
}
QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal()
{
}
QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
{
QAudioFormat format;
switch (m_mode) {
case QAudio::AudioOutput:
format.setFrequency(44100);
format.setChannels(2);
format.setSampleSize(16);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::SignedInt);
format.setCodec(QLatin1String("audio/pcm"));
break;
case QAudio::AudioInput:
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(16);
format.setByteOrder(QAudioFormat::LittleEndian);
format.setSampleType(QAudioFormat::SignedInt);
format.setCodec(QLatin1String("audio/pcm"));
break;
default:
Q_ASSERT_X(false, Q_FUNC_INFO, "Invalid mode");
}
if (!isFormatSupported(format)) {
format = QAudioFormat();
format.setCodec(QLatin1String("audio/pcm"));
if (m_capabilities.contains(format.codec())) {
const Capabilities &codecCaps = m_capabilities[format.codec()];
if (codecCaps.m_frequencies.size())
format.setFrequency(codecCaps.m_frequencies[0]);
if (codecCaps.m_channels.size())
format.setChannels(codecCaps.m_channels[0]);
if (codecCaps.m_sampleSizes.size())
format.setSampleSize(codecCaps.m_sampleSizes[0]);
if (codecCaps.m_byteOrders.size())
format.setByteOrder(codecCaps.m_byteOrders[0]);
if (codecCaps.m_sampleTypes.size())
format.setSampleType(codecCaps.m_sampleTypes[0]);
}
}
return format;
}
bool QAudioDeviceInfoInternal::isFormatSupported(
const QAudioFormat &format) const
{
getSupportedFormats();
bool supported = false;
if (m_capabilities.contains(format.codec())) {
const Capabilities &codecCaps = m_capabilities[format.codec()];
supported = codecCaps.m_frequencies.contains(format.frequency())
&& codecCaps.m_channels.contains(format.channels())
&& codecCaps.m_sampleSizes.contains(format.sampleSize())
&& codecCaps.m_byteOrders.contains(format.byteOrder())
&& codecCaps.m_sampleTypes.contains(format.sampleType());
}
return supported;
}
QString QAudioDeviceInfoInternal::deviceName() const
{
return m_deviceName;
}
QStringList QAudioDeviceInfoInternal::supportedCodecs()
{
getSupportedFormats();
return m_capabilities.keys();
}
QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
{
getSupportedFormats();
return m_unionCapabilities.m_frequencies;
}
QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
{
getSupportedFormats();
return m_unionCapabilities.m_channels;
}
QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
{
getSupportedFormats();
return m_unionCapabilities.m_sampleSizes;
}
QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
{
getSupportedFormats();
return m_unionCapabilities.m_byteOrders;
}
QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
{
getSupportedFormats();
return m_unionCapabilities. m_sampleTypes;
}
QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
{
return QByteArray("default");
}
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
{
return QByteArray("default");
}
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode)
{
QList<QByteArray> result;
result += QByteArray("default");
return result;
}
void QAudioDeviceInfoInternal::devsoundInitializeComplete(int err)
{
m_intializationResult = err;
m_initializing = false;
}
// Helper function
template<typename T>
void appendUnique(QList<T> &left, const QList<T> &right)
{
foreach (const T &value, right)
if (!left.contains(value))
left += value;
}
void QAudioDeviceInfoInternal::getSupportedFormats() const
{
if (!m_updated) {
QScopedPointer<SymbianAudio::DevSoundWrapper> devsound(new SymbianAudio::DevSoundWrapper(m_mode));
connect(devsound.data(), SIGNAL(initializeComplete(int)),
this, SLOT(devsoundInitializeComplete(int)));
foreach (const QString& codec, devsound->supportedCodecs()) {
m_initializing = true;
devsound->initialize(codec);
while (m_initializing)
QCoreApplication::instance()->processEvents(QEventLoop::WaitForMoreEvents);
if (KErrNone == m_intializationResult) {
m_capabilities[codec].m_frequencies = devsound->supportedFrequencies();
appendUnique(m_unionCapabilities.m_frequencies, devsound->supportedFrequencies());
m_capabilities[codec].m_channels = devsound->supportedChannels();
appendUnique(m_unionCapabilities.m_channels, devsound->supportedChannels());
m_capabilities[codec].m_sampleSizes = devsound->supportedSampleSizes();
appendUnique(m_unionCapabilities.m_sampleSizes, devsound->supportedSampleSizes());
m_capabilities[codec].m_byteOrders = devsound->supportedByteOrders();
appendUnique(m_unionCapabilities.m_byteOrders, devsound->supportedByteOrders());
m_capabilities[codec].m_sampleTypes = devsound->supportedSampleTypes();
appendUnique(m_unionCapabilities.m_sampleTypes, devsound->supportedSampleTypes());
}
}
m_updated = true;
}
}
QT_END_NAMESPACE
#include "moc_qaudiodeviceinfo_symbian_p.cpp"

View File

@@ -1,116 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QAUDIODEVICEINFO_SYMBIAN_P_H
#define QAUDIODEVICEINFO_SYMBIAN_P_H
#include <QtCore/QMap>
#include <qaudiosystem.h>
#include <sounddevice.h>
QT_BEGIN_NAMESPACE
class QAudioDeviceInfoInternal
: public QAbstractAudioDeviceInfo
{
Q_OBJECT
public:
QAudioDeviceInfoInternal(QByteArray device, QAudio::Mode mode);
~QAudioDeviceInfoInternal();
// QAbstractAudioDeviceInfo
QAudioFormat preferredFormat() const;
bool isFormatSupported(const QAudioFormat &format) const;
QString deviceName() const;
QStringList supportedCodecs();
QList<int> supportedSampleRates();
QList<int> supportedChannelCounts();
QList<int> supportedSampleSizes();
QList<QAudioFormat::Endian> supportedByteOrders();
QList<QAudioFormat::SampleType> supportedSampleTypes();
static QByteArray defaultInputDevice();
static QByteArray defaultOutputDevice();
static QList<QByteArray> availableDevices(QAudio::Mode);
private slots:
void devsoundInitializeComplete(int err);
private:
void getSupportedFormats() const;
private:
mutable bool m_initializing;
int m_intializationResult;
QString m_deviceName;
QAudio::Mode m_mode;
struct Capabilities
{
QList<int> m_frequencies;
QList<int> m_channels;
QList<int> m_sampleSizes;
QList<QAudioFormat::Endian> m_byteOrders;
QList<QAudioFormat::SampleType> m_sampleTypes;
};
// Mutable to allow lazy initialization when called from const-qualified
// public functions (isFormatSupported, nearestFormat)
mutable bool m_updated;
mutable QMap<QString, Capabilities> m_capabilities;
mutable Capabilities m_unionCapabilities;
};
QT_END_NAMESPACE
#endif

View File

@@ -315,12 +315,10 @@ void QAudioDeviceInfoInternal::updateLists()
|| (fmt && WAVE_FORMAT_2S08)
|| (fmt && WAVE_FORMAT_4M08)
|| (fmt && WAVE_FORMAT_4S08)
#ifndef Q_OS_WINCE
|| (fmt && WAVE_FORMAT_48M08)
|| (fmt && WAVE_FORMAT_48S08)
|| (fmt && WAVE_FORMAT_96M08)
|| (fmt && WAVE_FORMAT_96S08)
#endif
) {
sizez.append(8);
}
@@ -330,12 +328,10 @@ void QAudioDeviceInfoInternal::updateLists()
|| (fmt && WAVE_FORMAT_2S16)
|| (fmt && WAVE_FORMAT_4M16)
|| (fmt && WAVE_FORMAT_4S16)
#ifndef Q_OS_WINCE
|| (fmt && WAVE_FORMAT_48M16)
|| (fmt && WAVE_FORMAT_48S16)
|| (fmt && WAVE_FORMAT_96M16)
|| (fmt && WAVE_FORMAT_96S16)
#endif
) {
sizez.append(16);
}
@@ -357,7 +353,6 @@ void QAudioDeviceInfoInternal::updateLists()
|| (fmt && WAVE_FORMAT_4S16)) {
freqz.append(44100);
}
#ifndef Q_OS_WINCE
if((fmt && WAVE_FORMAT_48M08)
|| (fmt && WAVE_FORMAT_48S08)
|| (fmt && WAVE_FORMAT_48M16)
@@ -370,7 +365,6 @@ void QAudioDeviceInfoInternal::updateLists()
|| (fmt && WAVE_FORMAT_96S16)) {
freqz.append(96000);
}
#endif
channelz.append(1);
channelz.append(2);
if (mode == QAudio::AudioOutput) {

View File

@@ -117,20 +117,6 @@ QT_BEGIN_NAMESPACE
\snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio input state changed
\sa QAudioOutput, QAudioDeviceInfo
\section1 Symbian Platform Security Requirements
On Symbian, processes which use this class must have the
\c UserEnvironment platform security capability. If the client
process lacks this capability, calls to either overload of start()
will fail.
This failure is indicated by the QAudioInput object setting
its error() value to \l{QAudio::OpenError} and then emitting a
\l{stateChanged()}{stateChanged}(\l{QAudio::StoppedState}) signal.
Platform security capabilities are added via the
\l{qmake-variable-reference.html#target-capability}{TARGET.CAPABILITY}
qmake variable.
*/
/*!
@@ -184,8 +170,6 @@ QAudioInput::~QAudioInput()
If a problem occurs during this process the error() is set to QAudio::OpenError,
state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
\l{QAudioInput#Symbian Platform Security Requirements}
\since 1.0
\sa QIODevice
*/
@@ -207,8 +191,6 @@ void QAudioInput::start(QIODevice* device)
If a problem occurs during this process the error() is set to QAudio::OpenError,
state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
\l{QAudioInput#Symbian Platform Security Requirements}
\since 1.0
\sa QIODevice
*/

View File

@@ -1,594 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudioinput_symbian_p.h"
QT_BEGIN_NAMESPACE
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
const int PushInterval = 50; // ms
//-----------------------------------------------------------------------------
// Private class
//-----------------------------------------------------------------------------
SymbianAudioInputPrivate::SymbianAudioInputPrivate(
QAudioInputPrivate *audioDevice)
: m_audioDevice(audioDevice)
{
}
SymbianAudioInputPrivate::~SymbianAudioInputPrivate()
{
}
qint64 SymbianAudioInputPrivate::readData(char *data, qint64 len)
{
qint64 totalRead = 0;
if (m_audioDevice->state() == QAudio::ActiveState ||
m_audioDevice->state() == QAudio::IdleState) {
while (totalRead < len) {
const qint64 read = m_audioDevice->read(data + totalRead,
len - totalRead);
if (read > 0)
totalRead += read;
else
break;
}
}
return totalRead;
}
qint64 SymbianAudioInputPrivate::writeData(const char *data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
return 0;
}
void SymbianAudioInputPrivate::dataReady()
{
emit readyRead();
}
//-----------------------------------------------------------------------------
// Public functions
//-----------------------------------------------------------------------------
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
: m_device(device)
, m_clientBufferSize(SymbianAudio::DefaultBufferSize)
, m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
, m_notifyTimer(new QTimer(this))
, m_lastNotifyPosition(0)
, m_error(QAudio::NoError)
, m_internalState(SymbianAudio::ClosedState)
, m_externalState(QAudio::StoppedState)
, m_pullMode(false)
, m_sink(0)
, m_pullTimer(new QTimer(this))
, m_devSound(0)
, m_devSoundBuffer(0)
, m_devSoundBufferSize(0)
, m_totalBytesReady(0)
, m_devSoundBufferPos(0)
, m_totalSamplesRecorded(0)
{
qRegisterMetaType<CMMFBuffer *>("CMMFBuffer *");
connect(m_notifyTimer.data(), SIGNAL(timeout()),
this, SIGNAL(notifyTimerExpired()));
m_pullTimer->setInterval(PushInterval);
connect(m_pullTimer.data(), SIGNAL(timeout()), this, SLOT(pullData()));
}
void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
{
m_format = fmt;
}
QAudioInputPrivate::~QAudioInputPrivate()
{
close();
}
void QAudioInputPrivate::start(QIODevice *device)
{
stop();
open();
if (SymbianAudio::ClosedState != m_internalState) {
m_pullMode = true;
m_sink = device;
m_elapsed.restart();
}
}
QIODevice* QAudioInputPrivate::start()
{
stop();
open();
if (SymbianAudio::ClosedState != m_internalState) {
m_sink = new SymbianAudioInputPrivate(this);
m_sink->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
m_elapsed.restart();
}
return m_sink;
}
void QAudioInputPrivate::stop()
{
close();
}
void QAudioInputPrivate::reset()
{
m_totalSamplesRecorded += getSamplesRecorded();
m_devSound->stop();
startRecording();
}
void QAudioInputPrivate::suspend()
{
if (SymbianAudio::ActiveState == m_internalState
|| SymbianAudio::IdleState == m_internalState) {
m_pullTimer->stop();
const qint64 samplesRecorded = getSamplesRecorded();
m_totalSamplesRecorded += samplesRecorded;
const bool paused = m_devSound->pause();
if (paused) {
if (m_devSoundBuffer)
m_devSoundBufferQ.append(m_devSoundBuffer);
m_devSoundBuffer = 0;
setState(SymbianAudio::SuspendedPausedState);
} else {
m_devSoundBuffer = 0;
m_devSoundBufferQ.clear();
m_devSoundBufferPos = 0;
setState(SymbianAudio::SuspendedStoppedState);
}
}
}
void QAudioInputPrivate::resume()
{
if (QAudio::SuspendedState == m_externalState) {
if (SymbianAudio::SuspendedPausedState == m_internalState)
m_devSound->resume();
else
m_devSound->start();
startDataTransfer();
}
}
int QAudioInputPrivate::bytesReady() const
{
Q_ASSERT(m_devSoundBufferPos <= m_totalBytesReady);
return m_totalBytesReady - m_devSoundBufferPos;
}
int QAudioInputPrivate::periodSize() const
{
return bufferSize();
}
void QAudioInputPrivate::setBufferSize(int value)
{
// Note that DevSound does not allow its client to specify the buffer size.
// This functionality is available via custom interfaces, but since these
// cannot be guaranteed to work across all DevSound implementations, we
// do not use them here.
// In order to comply with the expected bevahiour of QAudioInput, we store
// the value and return it from bufferSize(), but the underlying DevSound
// buffer size remains unchanged.
if (value > 0)
m_clientBufferSize = value;
}
int QAudioInputPrivate::bufferSize() const
{
return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
}
void QAudioInputPrivate::setNotifyInterval(int ms)
{
if (ms >= 0) {
//const int oldNotifyInterval = m_notifyInterval;
m_notifyInterval = ms;
if (m_notifyInterval && (SymbianAudio::ActiveState == m_internalState ||
SymbianAudio::IdleState == m_internalState))
m_notifyTimer->start(m_notifyInterval);
else
m_notifyTimer->stop();
}
}
int QAudioInputPrivate::notifyInterval() const
{
return m_notifyInterval;
}
qint64 QAudioInputPrivate::processedUSecs() const
{
int samplesPlayed = 0;
if (m_devSound && QAudio::SuspendedState != m_externalState)
samplesPlayed = getSamplesRecorded();
// Protect against division by zero
Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
const qint64 result = qint64(1000000) *
(samplesPlayed + m_totalSamplesRecorded)
/ m_format.frequency();
return result;
}
qint64 QAudioInputPrivate::elapsedUSecs() const
{
const qint64 result = (QAudio::StoppedState == state()) ?
0 : m_elapsed.elapsed() * 1000;
return result;
}
QAudio::Error QAudioInputPrivate::error() const
{
return m_error;
}
QAudio::State QAudioInputPrivate::state() const
{
return m_externalState;
}
QAudioFormat QAudioInputPrivate::format() const
{
return m_format;
}
//-----------------------------------------------------------------------------
// Private functions
//-----------------------------------------------------------------------------
void QAudioInputPrivate::open()
{
Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
Q_FUNC_INFO, "DevSound already opened");
Q_ASSERT(!m_devSound);
m_devSound = new SymbianAudio::DevSoundWrapper(QAudio::AudioInput, this);
connect(m_devSound, SIGNAL(initializeComplete(int)),
this, SLOT(devsoundInitializeComplete(int)));
connect(m_devSound, SIGNAL(bufferToBeProcessed(CMMFBuffer *)),
this, SLOT(devsoundBufferToBeEmptied(CMMFBuffer *)));
connect(m_devSound, SIGNAL(processingError(int)),
this, SLOT(devsoundRecordError(int)));
setState(SymbianAudio::InitializingState);
m_devSound->initialize(m_format.codec());
}
void QAudioInputPrivate::startRecording()
{
const int samplesRecorded = m_devSound->samplesProcessed();
Q_ASSERT(samplesRecorded == 0);
bool ok = m_devSound->setFormat(m_format);
if (ok)
ok = m_devSound->start();
if (ok) {
startDataTransfer();
} else {
setError(QAudio::OpenError);
close();
}
}
void QAudioInputPrivate::startDataTransfer()
{
if (m_notifyInterval)
m_notifyTimer->start(m_notifyInterval);
if (m_pullMode)
m_pullTimer->start();
if (bytesReady()) {
setState(SymbianAudio::ActiveState);
if (!m_pullMode)
pushData();
} else {
if (QAudio::SuspendedState == m_externalState)
setState(SymbianAudio::ActiveState);
else
setState(SymbianAudio::IdleState);
}
}
CMMFDataBuffer* QAudioInputPrivate::currentBuffer() const
{
CMMFDataBuffer *result = m_devSoundBuffer;
if (!result && !m_devSoundBufferQ.empty())
result = m_devSoundBufferQ.front();
return result;
}
void QAudioInputPrivate::pushData()
{
Q_ASSERT_X(bytesReady(), Q_FUNC_INFO, "No data available");
Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO, "pushData called when in pull mode");
qobject_cast<SymbianAudioInputPrivate *>(m_sink)->dataReady();
}
qint64 QAudioInputPrivate::read(char *data, qint64 len)
{
// SymbianAudioInputPrivate is ready to read data
Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
"read called when in pull mode");
qint64 bytesRead = 0;
CMMFDataBuffer *buffer = 0;
buffer = currentBuffer();
while (buffer && (bytesRead < len)) {
if (SymbianAudio::IdleState == m_internalState)
setState(SymbianAudio::ActiveState);
TDesC8 &inputBuffer = buffer->Data();
Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos);
const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos;
const qint64 outputBytes = len - bytesRead;
const qint64 copyBytes = outputBytes < inputBytes ?
outputBytes : inputBytes;
memcpy(data, inputBuffer.Ptr() + m_devSoundBufferPos, copyBytes);
m_devSoundBufferPos += copyBytes;
data += copyBytes;
bytesRead += copyBytes;
if (inputBytes == copyBytes)
bufferEmptied();
buffer = currentBuffer();
}
return bytesRead;
}
void QAudioInputPrivate::notifyTimerExpired()
{
const qint64 pos = processedUSecs();
if (pos > m_lastNotifyPosition) {
int count = (pos - m_lastNotifyPosition) / (m_notifyInterval * 1000);
while (count--) {
emit notify();
m_lastNotifyPosition += m_notifyInterval * 1000;
}
}
}
void QAudioInputPrivate::pullData()
{
Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
"pullData called when in push mode");
CMMFDataBuffer *buffer = 0;
buffer = currentBuffer();
while (buffer) {
if (SymbianAudio::IdleState == m_internalState)
setState(SymbianAudio::ActiveState);
TDesC8 &inputBuffer = buffer->Data();
Q_ASSERT(inputBuffer.Length() >= m_devSoundBufferPos);
const qint64 inputBytes = inputBuffer.Length() - m_devSoundBufferPos;
const qint64 bytesPushed = m_sink->write(
(char*)inputBuffer.Ptr() + m_devSoundBufferPos, inputBytes);
m_devSoundBufferPos += bytesPushed;
if (inputBytes == bytesPushed)
bufferEmptied();
if (!bytesPushed)
break;
buffer = currentBuffer();
}
}
void QAudioInputPrivate::devsoundInitializeComplete(int err)
{
Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
Q_FUNC_INFO, "Invalid state");
if (!err && m_devSound->isFormatSupported(m_format))
startRecording();
else
setError(QAudio::OpenError);
}
void QAudioInputPrivate::devsoundBufferToBeEmptied(CMMFBuffer *baseBuffer)
{
// Following receipt of this signal, DevSound should not provide another
// buffer until we have returned the current one.
Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
CMMFDataBuffer *const buffer = static_cast<CMMFDataBuffer*>(baseBuffer);
if (!m_devSoundBufferSize)
m_devSoundBufferSize = buffer->Data().MaxLength();
m_totalBytesReady += buffer->Data().Length();
if (SymbianAudio::SuspendedPausedState == m_internalState) {
m_devSoundBufferQ.append(buffer);
} else {
// Will be returned to DevSoundWrapper by bufferProcessed().
m_devSoundBuffer = buffer;
m_devSoundBufferPos = 0;
if (bytesReady() && !m_pullMode)
pushData();
}
}
void QAudioInputPrivate::devsoundRecordError(int err)
{
Q_UNUSED(err)
setError(QAudio::IOError);
}
void QAudioInputPrivate::bufferEmptied()
{
m_devSoundBufferPos = 0;
if (m_devSoundBuffer) {
m_totalBytesReady -= m_devSoundBuffer->Data().Length();
m_devSoundBuffer = 0;
m_devSound->bufferProcessed();
} else {
Q_ASSERT(!m_devSoundBufferQ.empty());
m_totalBytesReady -= m_devSoundBufferQ.front()->Data().Length();
m_devSoundBufferQ.erase(m_devSoundBufferQ.begin());
// If the queue has been emptied, resume transfer from the hardware
if (m_devSoundBufferQ.empty())
if (!m_devSound->start())
setError(QAudio::IOError);
}
Q_ASSERT(m_totalBytesReady >= 0);
}
void QAudioInputPrivate::close()
{
m_lastNotifyPosition = 0;
m_pullTimer->stop();
m_error = QAudio::NoError;
if (m_devSound)
m_devSound->stop();
delete m_devSound;
m_devSound = 0;
m_devSoundBuffer = 0;
m_devSoundBufferSize = 0;
m_totalBytesReady = 0;
if (!m_pullMode) // m_sink is owned
delete m_sink;
m_pullMode = false;
m_sink = 0;
m_devSoundBufferQ.clear();
m_devSoundBufferPos = 0;
m_totalSamplesRecorded = 0;
setState(SymbianAudio::ClosedState);
}
qint64 QAudioInputPrivate::getSamplesRecorded() const
{
qint64 result = 0;
if (m_devSound)
result = qint64(m_devSound->samplesProcessed());
return result;
}
void QAudioInputPrivate::setError(QAudio::Error error)
{
m_error = error;
// Although no state transition actually occurs here, a stateChanged event
// must be emitted to inform the client that the call to start() was
// unsuccessful.
if (QAudio::OpenError == error) {
emit stateChanged(QAudio::StoppedState);
} else {
if (QAudio::UnderrunError == error)
setState(SymbianAudio::IdleState);
else
// Close the DevSound instance. This causes a transition to
// StoppedState. This must be done asynchronously in case the
// current function was called from a DevSound event handler, in which
// case deleting the DevSound instance may cause an exception.
QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
}
}
void QAudioInputPrivate::setState(SymbianAudio::State newInternalState)
{
const QAudio::State oldExternalState = m_externalState;
m_internalState = newInternalState;
m_externalState = SymbianAudio::Utils::stateNativeToQt(m_internalState);
if (m_externalState != QAudio::ActiveState &&
m_externalState != QAudio::IdleState)
m_notifyTimer->stop();
if (m_externalState != oldExternalState)
emit stateChanged(m_externalState);
}
QT_END_NAMESPACE
#include "moc_qaudioinput_symbian_p.cpp"

View File

@@ -1,178 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QAUDIOINPUT_SYMBIAN_P_H
#define QAUDIOINPUT_SYMBIAN_P_H
#include <qaudiosystem.h>
#include <QTime>
#include <QTimer>
#include "qaudio_symbian_p.h"
QT_BEGIN_NAMESPACE
class QAudioInputPrivate;
class SymbianAudioInputPrivate : public QIODevice
{
friend class QAudioInputPrivate;
Q_OBJECT
public:
SymbianAudioInputPrivate(QAudioInputPrivate *audio);
~SymbianAudioInputPrivate();
qint64 readData(char *data, qint64 len);
qint64 writeData(const char *data, qint64 len);
void dataReady();
private:
QAudioInputPrivate *const m_audioDevice;
};
class QAudioInputPrivate
: public QAbstractAudioInput
{
friend class SymbianAudioInputPrivate;
Q_OBJECT
public:
QAudioInputPrivate(const QByteArray &device);
~QAudioInputPrivate();
// QAbstractAudioInput
void start(QIODevice *device);
QIODevice* start();
void stop();
void reset();
void suspend();
void resume();
int bytesReady() const;
int periodSize() const;
void setBufferSize(int value);
int bufferSize() const;
void setNotifyInterval(int milliSeconds);
int notifyInterval() const;
qint64 processedUSecs() const;
qint64 elapsedUSecs() const;
QAudio::Error error() const;
QAudio::State state() const;
QAudioFormat format() const;
void setFormat(const QAudioFormat& fmt);
private slots:
void notifyTimerExpired();
void pullData();
void devsoundInitializeComplete(int err);
void devsoundBufferToBeEmptied(CMMFBuffer *);
void devsoundRecordError(int err);
private:
void open();
void startRecording();
void startDataTransfer();
CMMFDataBuffer* currentBuffer() const;
void pushData();
qint64 read(char *data, qint64 len);
void bufferEmptied();
Q_INVOKABLE void close();
qint64 getSamplesRecorded() const;
void setError(QAudio::Error error);
void setState(SymbianAudio::State state);
private:
const QByteArray m_device;
QAudioFormat m_format;
int m_clientBufferSize;
int m_notifyInterval;
QScopedPointer<QTimer> m_notifyTimer;
qint64 m_lastNotifyPosition;
QTime m_elapsed;
QAudio::Error m_error;
SymbianAudio::State m_internalState;
QAudio::State m_externalState;
bool m_pullMode;
QIODevice *m_sink;
QScopedPointer<QTimer> m_pullTimer;
SymbianAudio::DevSoundWrapper* m_devSound;
// Latest buffer provided by DevSound, to be empied of data.
CMMFDataBuffer *m_devSoundBuffer;
int m_devSoundBufferSize;
// Total amount of data in buffers provided by DevSound
int m_totalBytesReady;
// Queue of buffers returned after call to CMMFDevSound::Pause().
QList<CMMFDataBuffer *> m_devSoundBufferQ;
// Current read position within m_devSoundBuffer
qint64 m_devSoundBufferPos;
// Samples recorded up to the last call to suspend(). It is necessary
// to cache this because suspend() is implemented using
// CMMFDevSound::Stop(), which resets DevSound's SamplesRecorded() counter.
quint32 m_totalSamplesRecorded;
};
QT_END_NAMESPACE
#endif

View File

@@ -250,17 +250,10 @@ bool QAudioInputPrivate::open()
= (settings.frequency()
* settings.channelCount()
* settings.sampleSize()
#ifndef Q_OS_WINCE // Default buffer size, 200ms, default period size is 40ms
+ 39) / 40;
period_size = buffer_size / 5;
} else {
period_size = buffer_size / 5;
#else // For wince reduce size to 40ms for buffer size and 20ms period
+ 199) / 200;
period_size = buffer_size / 2;
} else {
period_size = buffer_size / 2;
#endif
}
if (period_size == 0) {

View File

@@ -1,713 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qaudiooutput_symbian_p.h"
QT_BEGIN_NAMESPACE
//-----------------------------------------------------------------------------
// Constants
//-----------------------------------------------------------------------------
const int UnderflowTimerInterval = 50; // ms
//-----------------------------------------------------------------------------
// Private class
//-----------------------------------------------------------------------------
SymbianAudioOutputPrivate::SymbianAudioOutputPrivate(
QAudioOutputPrivate *audioDevice)
: m_audioDevice(audioDevice)
{
}
SymbianAudioOutputPrivate::~SymbianAudioOutputPrivate()
{
}
qint64 SymbianAudioOutputPrivate::readData(char *data, qint64 len)
{
Q_UNUSED(data)
Q_UNUSED(len)
return 0;
}
qint64 SymbianAudioOutputPrivate::writeData(const char *data, qint64 len)
{
qint64 totalWritten = 0;
if (m_audioDevice->state() == QAudio::ActiveState ||
m_audioDevice->state() == QAudio::IdleState) {
while (totalWritten < len) {
const qint64 written = m_audioDevice->pushData(data + totalWritten,
len - totalWritten);
if (written > 0)
totalWritten += written;
else
break;
}
}
return totalWritten;
}
//-----------------------------------------------------------------------------
// Public functions
//-----------------------------------------------------------------------------
QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
: m_device(device)
, m_clientBufferSize(SymbianAudio::DefaultBufferSize)
, m_notifyInterval(SymbianAudio::DefaultNotifyInterval)
, m_notifyTimer(new QTimer(this))
, m_lastNotifyPosition(0)
, m_error(QAudio::NoError)
, m_internalState(SymbianAudio::ClosedState)
, m_externalState(QAudio::StoppedState)
, m_pullMode(false)
, m_source(0)
, m_devSound(0)
, m_devSoundBuffer(0)
, m_devSoundBufferSize(0)
, m_bytesWritten(0)
, m_pushDataReady(false)
, m_bytesPadding(0)
, m_underflow(false)
, m_lastBuffer(false)
, m_underflowTimer(new QTimer(this))
, m_samplesPlayed(0)
, m_totalSamplesPlayed(0)
{
connect(m_notifyTimer.data(), SIGNAL(timeout()),
this, SLOT(notifyTimerExpired()));
m_underflowTimer->setInterval(UnderflowTimerInterval);
connect(m_underflowTimer.data(), SIGNAL(timeout()), this,
SLOT(underflowTimerExpired()));
}
QAudioOutputPrivate::~QAudioOutputPrivate()
{
close();
}
void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
{
m_format = fmt;
}
void QAudioOutputPrivate::start(QIODevice *device)
{
stop();
// We have to set these before the call to open() because of the
// logic in initializingState()
m_pullMode = true;
m_source = device;
open();
if (SymbianAudio::ClosedState != m_internalState) {
connect(m_source, SIGNAL(readyRead()), this, SLOT(dataReady()));
m_elapsed.restart();
}
}
QIODevice* QAudioOutputPrivate::start()
{
stop();
open();
if (SymbianAudio::ClosedState != m_internalState) {
m_source = new SymbianAudioOutputPrivate(this);
m_source->open(QIODevice::WriteOnly | QIODevice::Unbuffered);
m_elapsed.restart();
}
return m_source;
}
void QAudioOutputPrivate::stop()
{
close();
}
void QAudioOutputPrivate::reset()
{
#ifndef PRE_S60_52_PLATFORM
int err = m_devSound->flush();
if (err != 0)
setError(QAudio::FatalError);
#else
m_totalSamplesPlayed += getSamplesPlayed();
m_devSound->stop();
m_bytesPadding = 0;
startPlayback();
#endif
}
void QAudioOutputPrivate::suspend()
{
if (SymbianAudio::ActiveState == m_internalState
|| SymbianAudio::IdleState == m_internalState) {
m_underflowTimer->stop();
const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
m_format, m_bytesWritten);
const qint64 samplesPlayed = getSamplesPlayed();
#ifdef PRE_S60_52_PLATFORM
m_totalSamplesPlayed += samplesPlayed;
m_bytesWritten = 0;
#endif
const bool paused = m_devSound->pause();
if (paused) {
setState(SymbianAudio::SuspendedPausedState);
} else {
m_devSoundBuffer = 0;
// Calculate the amount of data dropped
const qint64 paddingSamples = samplesWritten - samplesPlayed;
Q_ASSERT(paddingSamples >= 0);
m_bytesPadding = SymbianAudio::Utils::samplesToBytes(m_format,
paddingSamples);
setState(SymbianAudio::SuspendedStoppedState);
}
}
}
void QAudioOutputPrivate::resume()
{
if (QAudio::SuspendedState == m_externalState) {
if (SymbianAudio::SuspendedPausedState == m_internalState) {
#ifndef PRE_S60_52_PLATFORM
setState(SymbianAudio::ActiveState);
if (m_devSoundBuffer != 0)
devsoundBufferToBeFilled(m_devSoundBuffer);
m_devSound->start();
#else
//defined in else part of macro to enable compatibility of previous code
m_devSound->resume();
#endif
} else {
startPlayback();
}
}
}
int QAudioOutputPrivate::bytesFree() const
{
int result = 0;
if (m_devSoundBuffer) {
const TDes8 &outputBuffer = m_devSoundBuffer->Data();
result = outputBuffer.MaxLength() - outputBuffer.Length();
}
return result;
}
int QAudioOutputPrivate::periodSize() const
{
return bufferSize();
}
void QAudioOutputPrivate::setBufferSize(int value)
{
// Note that DevSound does not allow its client to specify the buffer size.
// This functionality is available via custom interfaces, but since these
// cannot be guaranteed to work across all DevSound implementations, we
// do not use them here.
// In order to comply with the expected bevahiour of QAudioOutput, we store
// the value and return it from bufferSize(), but the underlying DevSound
// buffer size remains unchanged.
if (value > 0)
m_clientBufferSize = value;
}
int QAudioOutputPrivate::bufferSize() const
{
return m_devSoundBufferSize ? m_devSoundBufferSize : m_clientBufferSize;
}
void QAudioOutputPrivate::setNotifyInterval(int ms)
{
if (ms >= 0) {
//const int oldNotifyInterval = m_notifyInterval;
m_notifyInterval = ms;
if (m_notifyInterval && (SymbianAudio::ActiveState == m_internalState ||
SymbianAudio::IdleState == m_internalState))
m_notifyTimer->start(m_notifyInterval);
else
m_notifyTimer->stop();
}
}
int QAudioOutputPrivate::notifyInterval() const
{
return m_notifyInterval;
}
qint64 QAudioOutputPrivate::processedUSecs() const
{
int samplesPlayed = 0;
if (!m_devSound)
return samplesPlayed;
if (QAudio::SuspendedState != m_externalState)
samplesPlayed = getSamplesPlayed();
// Protect against division by zero
Q_ASSERT_X(m_format.frequency() > 0, Q_FUNC_INFO, "Invalid frequency");
#ifndef PRE_S60_52_PLATFORM
const qint64 devSoundSamplesPlayed(m_devSound->samplesProcessed());
const qint64 result = qint64(1000000) *
(devSoundSamplesPlayed)
/ m_format.frequency();
#else
const qint64 result = qint64(1000000) *
(samplesPlayed + m_totalSamplesPlayed)
/ m_format.frequency();
#endif
return result;
}
qint64 QAudioOutputPrivate::elapsedUSecs() const
{
const qint64 result = (QAudio::StoppedState == state()) ?
0 : m_elapsed.elapsed() * 1000;
return result;
}
QAudio::Error QAudioOutputPrivate::error() const
{
return m_error;
}
QAudio::State QAudioOutputPrivate::state() const
{
return m_externalState;
}
QAudioFormat QAudioOutputPrivate::format() const
{
return m_format;
}
//-----------------------------------------------------------------------------
// Private functions
//-----------------------------------------------------------------------------
void QAudioOutputPrivate::notifyTimerExpired()
{
const qint64 pos = processedUSecs();
if (pos > m_lastNotifyPosition) {
int count = (pos - m_lastNotifyPosition) / (m_notifyInterval * 1000);
while (count--) {
emit notify();
m_lastNotifyPosition += m_notifyInterval * 1000;
}
}
}
void QAudioOutputPrivate::dataReady()
{
// Client-provided QIODevice has data ready to read.
Q_ASSERT_X(m_source->bytesAvailable(), Q_FUNC_INFO,
"readyRead signal received, but no data available");
if (!m_bytesPadding)
pullData();
}
void QAudioOutputPrivate::underflowTimerExpired()
{
const TInt samplesPlayed = getSamplesPlayed();
if (m_samplesPlayed && (samplesPlayed == m_samplesPlayed)) {
setError(QAudio::UnderrunError);
#ifndef PRE_S60_52_PLATFORM
m_underflowTimer->stop();
#endif
} else {
m_samplesPlayed = samplesPlayed;
m_underflowTimer->start();
}
}
void QAudioOutputPrivate::devsoundInitializeComplete(int err)
{
Q_ASSERT_X(SymbianAudio::InitializingState == m_internalState,
Q_FUNC_INFO, "Invalid state");
if (!err && m_devSound->isFormatSupported(m_format))
startPlayback();
else
setError(QAudio::OpenError);
}
void QAudioOutputPrivate::devsoundBufferToBeFilled(CMMFBuffer *bufferBase)
{
// Following receipt of this signal, DevSound should not provide another
// buffer until we have returned the current one.
Q_ASSERT_X(!m_devSoundBuffer, Q_FUNC_INFO, "Buffer already held");
// Will be returned to DevSoundWrapper by bufferProcessed().
m_devSoundBuffer = static_cast<CMMFDataBuffer*>(bufferBase);
#ifndef PRE_S60_52_PLATFORM
if (m_externalState == QAudio::SuspendedState) {
// This condition occurs when buffertobefilled callback is received after
// pause command is processed.
return;
}
#endif
if (!m_devSoundBufferSize)
m_devSoundBufferSize = m_devSoundBuffer->Data().MaxLength();
writePaddingData();
if (m_pullMode && isDataReady() && !m_bytesPadding)
pullData();
}
void QAudioOutputPrivate::devsoundPlayError(int err)
{
switch (err) {
case KErrUnderflow:
m_underflow = true;
if (m_pullMode && !m_lastBuffer)
setError(QAudio::UnderrunError);
else
setState(SymbianAudio::IdleState);
break;
case KErrOverflow:
// Silently consume this error when in playback mode
break;
default:
setError(QAudio::IOError);
break;
}
}
void QAudioOutputPrivate::open()
{
Q_ASSERT_X(SymbianAudio::ClosedState == m_internalState,
Q_FUNC_INFO, "DevSound already opened");
Q_ASSERT(!m_devSound);
m_devSound = new SymbianAudio::DevSoundWrapper(QAudio::AudioOutput, this);
connect(m_devSound, SIGNAL(initializeComplete(int)),
this, SLOT(devsoundInitializeComplete(int)));
connect(m_devSound, SIGNAL(bufferToBeProcessed(CMMFBuffer *)),
this, SLOT(devsoundBufferToBeFilled(CMMFBuffer *)));
connect(m_devSound, SIGNAL(processingError(int)),
this, SLOT(devsoundPlayError(int)));
setState(SymbianAudio::InitializingState);
m_devSound->initialize(m_format.codec());
}
void QAudioOutputPrivate::startPlayback()
{
bool ok = m_devSound->setFormat(m_format);
if (ok)
ok = m_devSound->start();
if (ok) {
if (isDataReady())
setState(SymbianAudio::ActiveState);
else
setState(SymbianAudio::IdleState);
if (m_notifyInterval)
m_notifyTimer->start(m_notifyInterval);
m_underflow = false;
Q_ASSERT(m_devSound->samplesProcessed() == 0);
writePaddingData();
if (m_pullMode && m_source->bytesAvailable() && !m_bytesPadding)
dataReady();
} else {
setError(QAudio::OpenError);
close();
}
}
void QAudioOutputPrivate::writePaddingData()
{
// See comments in suspend()
while (m_devSoundBuffer && m_bytesPadding) {
if (SymbianAudio::IdleState == m_internalState)
setState(SymbianAudio::ActiveState);
TDes8 &outputBuffer = m_devSoundBuffer->Data();
const qint64 outputBytes = bytesFree();
const qint64 paddingBytes = outputBytes < m_bytesPadding ?
outputBytes : m_bytesPadding;
unsigned char *ptr = const_cast<unsigned char*>(outputBuffer.Ptr());
Mem::FillZ(ptr, paddingBytes);
outputBuffer.SetLength(outputBuffer.Length() + paddingBytes);
m_bytesPadding -= paddingBytes;
Q_ASSERT(m_bytesPadding >= 0);
if (m_pullMode && m_source->atEnd())
lastBufferFilled();
if ((paddingBytes == outputBytes) || !m_bytesPadding)
bufferFilled();
}
}
qint64 QAudioOutputPrivate::pushData(const char *data, qint64 len)
{
// Data has been written to SymbianAudioOutputPrivate
Q_ASSERT_X(!m_pullMode, Q_FUNC_INFO,
"pushData called when in pull mode");
const unsigned char *const inputPtr =
reinterpret_cast<const unsigned char*>(data);
qint64 bytesWritten = 0;
if (SymbianAudio::IdleState == m_internalState)
setState(SymbianAudio::ActiveState);
while (m_devSoundBuffer && (bytesWritten < len)) {
// writePaddingData() is called from BufferToBeFilled(), so we should
// never have any padding data left at this point.
Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
"Padding bytes remaining in pushData");
TDes8 &outputBuffer = m_devSoundBuffer->Data();
const qint64 outputBytes = bytesFree();
const qint64 inputBytes = len - bytesWritten;
const qint64 copyBytes = outputBytes < inputBytes ?
outputBytes : inputBytes;
outputBuffer.Append(inputPtr + bytesWritten, copyBytes);
bytesWritten += copyBytes;
bufferFilled();
}
m_pushDataReady = (bytesWritten < len);
// If DevSound is still initializing (m_internalState == InitializingState),
// we cannot transition m_internalState to ActiveState, but we must emit
// an (external) state change from IdleState to ActiveState. The following
// call triggers this signal.
setState(m_internalState);
return bytesWritten;
}
void QAudioOutputPrivate::pullData()
{
Q_ASSERT_X(m_pullMode, Q_FUNC_INFO,
"pullData called when in push mode");
// writePaddingData() is called by BufferToBeFilled() before pullData(),
// so we should never have any padding data left at this point.
Q_ASSERT_X(0 == m_bytesPadding, Q_FUNC_INFO,
"Padding bytes remaining in pullData");
qint64 inputBytes = m_source->bytesAvailable();
while (m_devSoundBuffer && inputBytes) {
if (SymbianAudio::IdleState == m_internalState)
setState(SymbianAudio::ActiveState);
TDes8 &outputBuffer = m_devSoundBuffer->Data();
const qint64 outputBytes = bytesFree();
const qint64 copyBytes = outputBytes < inputBytes ?
outputBytes : inputBytes;
char *outputPtr = (char*)(outputBuffer.Ptr() + outputBuffer.Length());
const qint64 bytesCopied = m_source->read(outputPtr, copyBytes);
//Partial buffers can be sent to DevSound. This assert not required.
//Q_ASSERT(bytesCopied == copyBytes);
outputBuffer.SetLength(outputBuffer.Length() + bytesCopied);
inputBytes -= bytesCopied;
if(bytesCopied == 0)
return;
if (m_source->atEnd())
lastBufferFilled();
else
bufferFilled();
}
}
void QAudioOutputPrivate::bufferFilled()
{
Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to return");
const TDes8 &outputBuffer = m_devSoundBuffer->Data();
m_bytesWritten += outputBuffer.Length();
m_devSoundBuffer = 0;
m_samplesPlayed = getSamplesPlayed();
m_underflowTimer->start();
if (QAudio::UnderrunError == m_error)
m_error = QAudio::NoError;
m_devSound->bufferProcessed();
}
void QAudioOutputPrivate::lastBufferFilled()
{
Q_ASSERT_X(m_devSoundBuffer, Q_FUNC_INFO, "No buffer to fill");
Q_ASSERT_X(!m_lastBuffer, Q_FUNC_INFO, "Last buffer already sent");
m_lastBuffer = true;
m_devSoundBuffer->SetLastBuffer(ETrue);
bufferFilled();
}
void QAudioOutputPrivate::close()
{
m_lastNotifyPosition = 0;
m_underflowTimer->stop();
m_error = QAudio::NoError;
if (m_devSound)
m_devSound->stop();
delete m_devSound;
m_devSound = 0;
m_devSoundBuffer = 0;
m_devSoundBufferSize = 0;
if (!m_pullMode) // m_source is owned
delete m_source;
m_pullMode = false;
m_source = 0;
m_bytesWritten = 0;
m_pushDataReady = false;
m_bytesPadding = 0;
m_underflow = false;
m_lastBuffer = false;
m_samplesPlayed = 0;
m_totalSamplesPlayed = 0;
setState(SymbianAudio::ClosedState);
}
qint64 QAudioOutputPrivate::getSamplesPlayed() const
{
qint64 result = 0;
if (m_devSound) {
const qint64 samplesWritten = SymbianAudio::Utils::bytesToSamples(
m_format, m_bytesWritten);
if (m_underflow) {
result = samplesWritten;
} else {
// This is necessary because some DevSound implementations report
// that they have played more data than has actually been provided to them
// by the client.
const qint64 devSoundSamplesPlayed(m_devSound->samplesProcessed());
result = qMin(devSoundSamplesPlayed, samplesWritten);
}
}
return result;
}
void QAudioOutputPrivate::setError(QAudio::Error error)
{
m_error = error;
// Although no state transition actually occurs here, a stateChanged event
// must be emitted to inform the client that the call to start() was
// unsuccessful.
if (QAudio::OpenError == error) {
emit stateChanged(QAudio::StoppedState);
} else {
if (QAudio::UnderrunError == error)
setState(SymbianAudio::IdleState);
else
// Close the DevSound instance. This causes a transition to
// StoppedState. This must be done asynchronously in case the
// current function was called from a DevSound event handler, in which
// case deleting the DevSound instance may cause an exception.
QMetaObject::invokeMethod(this, "close", Qt::QueuedConnection);
}
}
void QAudioOutputPrivate::setState(SymbianAudio::State newInternalState)
{
const QAudio::State oldExternalState = m_externalState;
m_internalState = newInternalState;
m_externalState = SymbianAudio::Utils::stateNativeToQt(m_internalState);
if (m_externalState != QAudio::ActiveState &&
m_externalState != QAudio::IdleState)
m_notifyTimer->stop();
if (m_externalState != oldExternalState)
emit stateChanged(m_externalState);
}
bool QAudioOutputPrivate::isDataReady() const
{
return (m_source && m_source->bytesAvailable())
|| m_bytesPadding
|| m_pushDataReady;
}
QT_END_NAMESPACE
#include "moc_qaudiooutput_symbian_p.cpp"

View File

@@ -1,201 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
//
// W A R N I N G
// -------------
//
// This file is not part of the Qt API. It exists for the convenience
// of other Qt classes. This header file may change from version to
// version without notice, or even be removed.
//
// We mean it.
//
#ifndef QAUDIOOUTPUT_SYMBIAN_P_H
#define QAUDIOOUTPUT_SYMBIAN_P_H
#include <qaudiosystem.h>
#include <QTime>
#include <QTimer>
#include <sounddevice.h>
#include "qaudio_symbian_p.h"
QT_BEGIN_NAMESPACE
class QAudioOutputPrivate;
class SymbianAudioOutputPrivate : public QIODevice
{
friend class QAudioOutputPrivate;
Q_OBJECT
public:
SymbianAudioOutputPrivate(QAudioOutputPrivate *audio);
~SymbianAudioOutputPrivate();
qint64 readData(char *data, qint64 len);
qint64 writeData(const char *data, qint64 len);
private:
QAudioOutputPrivate *const m_audioDevice;
};
class QAudioOutputPrivate
: public QAbstractAudioOutput
{
friend class SymbianAudioOutputPrivate;
Q_OBJECT
public:
QAudioOutputPrivate(const QByteArray &device);
~QAudioOutputPrivate();
// QAbstractAudioOutput
void start(QIODevice *device);
QIODevice* start();
void stop();
void reset();
void suspend();
void resume();
int bytesFree() const;
int periodSize() const;
void setBufferSize(int value);
int bufferSize() const;
void setNotifyInterval(int milliSeconds);
int notifyInterval() const;
qint64 processedUSecs() const;
qint64 elapsedUSecs() const;
QAudio::Error error() const;
QAudio::State state() const;
QAudioFormat format() const;
void setFormat(const QAudioFormat& fmt);
private slots:
void dataReady();
void notifyTimerExpired();
void underflowTimerExpired();
void devsoundInitializeComplete(int err);
void devsoundBufferToBeFilled(CMMFBuffer *);
void devsoundPlayError(int err);
private:
void open();
void startPlayback();
void writePaddingData();
qint64 pushData(const char *data, qint64 len);
void pullData();
void bufferFilled();
void lastBufferFilled();
Q_INVOKABLE void close();
qint64 getSamplesPlayed() const;
void setError(QAudio::Error error);
void setState(SymbianAudio::State state);
bool isDataReady() const;
private:
const QByteArray m_device;
QAudioFormat m_format;
int m_clientBufferSize;
int m_notifyInterval;
QScopedPointer<QTimer> m_notifyTimer;
qint64 m_lastNotifyPosition;
QTime m_elapsed;
QAudio::Error m_error;
SymbianAudio::State m_internalState;
QAudio::State m_externalState;
bool m_pullMode;
QIODevice *m_source;
SymbianAudio::DevSoundWrapper* m_devSound;
// Buffer provided by DevSound, to be filled with data.
CMMFDataBuffer *m_devSoundBuffer;
int m_devSoundBufferSize;
// Number of bytes transferred from QIODevice to QAudioOutput. It is
// necessary to count this because data is dropped when suspend() is
// called. The difference between the position reported by DevSound and
// this value allows us to calculate m_bytesPadding;
quint32 m_bytesWritten;
// True if client has provided data while the audio subsystem was not
// ready to consume it.
bool m_pushDataReady;
// Number of zero bytes which will be written when client calls resume().
quint32 m_bytesPadding;
// True if PlayError(KErrUnderflow) has been called.
bool m_underflow;
// True if a buffer marked with the "last buffer" flag has been provided
// to DevSound.
bool m_lastBuffer;
// Some DevSound implementations ignore all underflow errors raised by the
// audio driver, unless the last buffer flag has been set by the client.
// In push-mode playback, this flag will never be set, so the underflow
// error will never be reported. In order to work around this, a timer
// is used, which gets reset every time the client provides more data. If
// the timer expires, an underflow error is raised by this object.
QScopedPointer<QTimer> m_underflowTimer;
// Result of previous call to CMMFDevSound::SamplesPlayed(). This value is
// used to determine whether, when m_underflowTimer expires, an
// underflow error has actually occurred.
quint32 m_samplesPlayed;
// Samples played up to the last call to suspend(). It is necessary
// to cache this because suspend() is implemented using
// CMMFDevSound::Stop(), which resets DevSound's SamplesPlayed() counter.
quint32 m_totalSamplesPlayed;
};
QT_END_NAMESPACE
#endif

View File

@@ -1,6 +1,6 @@
INCLUDEPATH += effects
unix:!mac:!symbian {
unix:!mac {
contains(pulseaudio_enabled, yes) {
CONFIG += link_pkgconfig
PKGCONFIG += libpulse

View File

@@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE
\since 1.0
This property holds the volume of the playback, from 0.0 (silent) to 1.0 (maximum volume).
Note: Currently this has no effect on Mac OS X and Symbian.
Note: Currently this has no effect on Mac OS X.
*/
/*!

View File

@@ -8,7 +8,7 @@ QT = core network gui
CONFIG += module
MODULE_PRI += ../../modules/qt_multimediakit.pri
contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2): !symbian {
contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) {
QT += opengl
} else {
DEFINES += QT_NO_OPENGL
@@ -167,14 +167,6 @@ mac {
LIBS += -framework AppKit -framework QuartzCore -framework QTKit
}
maemo5 {
isEqual(QT_ARCH,armv6):QMAKE_CXXFLAGS += -march=armv7a -mcpu=cortex-a8 -mfloat-abi=softfp -mfpu=neon
HEADERS += qxvideosurface_maemo5_p.h
SOURCES += qxvideosurface_maemo5.cpp
SOURCES += qgraphicsvideoitem_maemo5.cpp
LIBS += -lXv -lX11 -lXext
}
maemo6 {
isEqual(QT_ARCH,armv6) {
HEADERS += qeglimagetexturesurface_p.h
@@ -188,30 +180,9 @@ maemo6 {
}
}
symbian {
contains(surfaces_s60_enabled, yes) {
SOURCES += qgraphicsvideoitem_symbian.cpp
} else {
SOURCES += qgraphicsvideoitem_overlay.cpp
}
}
!maemo*:!symbian {
!maemo* {
SOURCES += qgraphicsvideoitem.cpp
}
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
symbian {
contains(S60_VERSION, 5.1) |contains (S60_VERSION, 3.2) | contains(S60_VERSION, 3.1): DEFINES += PRE_S60_52_PLATFORM
load(data_caging_paths)
QtMediaDeployment.sources = QtMultimediaKit.dll
QtMediaDeployment.path = /sys/bin
DEPLOYMENT += QtMediaDeployment
TARGET.UID3=0x2002AC77
TARGET.CAPABILITY = ALL -TCB
LIBS += -lefsrv
}
# CONFIG += middleware
# include(../../features/deploy.pri)

View File

@@ -1,647 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qpointer.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qbasictimer.h>
#include <QtCore/qcoreevent.h>
#include <QtGui/qgraphicsscene.h>
#include <QtGui/qgraphicsview.h>
#include <QtGui/qscrollbar.h>
#include <QtGui/qx11info_x11.h>
#include "qgraphicsvideoitem.h"
#include <qmediaobject.h>
#include <qmediaservice.h>
#include <qpaintervideosurface_p.h>
#include <qvideorenderercontrol.h>
#include <qvideosurfaceformat.h>
#include "qxvideosurface_maemo5_p.h"
QT_BEGIN_NAMESPACE
//#define DEBUG_GFX_VIDEO_ITEM
//update overlay geometry slightly later,
//to ensure color key is alredy replaced with static frame
#define GEOMETRY_UPDATE_DELAY 20
//this is necessary to prevent flickering, see maemo bug 8798
//on geometry changes, the color key is replaced with static image frame
//until the overlay is re-initialized
#define SOFTWARE_RENDERING_DURATION 150
#ifdef __ARM_NEON__
/*
* ARM NEON optimized implementation of UYVY -> RGB16 convertor
*/
static void uyvy422_to_rgb16_line_neon (uint8_t * dst, const uint8_t * src, int n)
{
/* and this is the NEON code itself */
static __attribute__ ((aligned (16))) uint16_t acc_r[8] = {
22840, 22840, 22840, 22840, 22840, 22840, 22840, 22840,
};
static __attribute__ ((aligned (16))) uint16_t acc_g[8] = {
17312, 17312, 17312, 17312, 17312, 17312, 17312, 17312,
};
static __attribute__ ((aligned (16))) uint16_t acc_b[8] = {
28832, 28832, 28832, 28832, 28832, 28832, 28832, 28832,
};
/*
* Registers:
* q0, q1 : d0, d1, d2, d3 - are used for initial loading of YUV data
* q2 : d4, d5 - are used for storing converted RGB data
* q3 : d6, d7 - are used for temporary storage
*
* q6 : d12, d13 - are used for converting to RGB16
* q7 : d14, d15 - are used for storing RGB16 data
* q4-q5 - reserved
*
* q8, q9 : d16, d17, d18, d19 - are used for expanded Y data
* q10 : d20, d21
* q11 : d22, d23
* q12 : d24, d25
* q13 : d26, d27
* q13, q14, q15 - various constants (#16, #149, #204, #50, #104, #154)
*/
asm volatile (".macro convert_macroblock size\n"
/* load up to 16 source pixels in UYVY format */
".if \\size == 16\n"
"pld [%[src], #128]\n"
"vld1.32 {d0, d1, d2, d3}, [%[src]]!\n"
".elseif \\size == 8\n"
"vld1.32 {d0, d1}, [%[src]]!\n"
".elseif \\size == 4\n"
"vld1.32 {d0}, [%[src]]!\n"
".elseif \\size == 2\n"
"vld1.32 {d0[0]}, [%[src]]!\n"
".else\n" ".error \"unsupported macroblock size\"\n" ".endif\n"
/* convert from 'packed' to 'planar' representation */
"vuzp.8 d0, d1\n" /* d1 - separated Y data (first 8 bytes) */
"vuzp.8 d2, d3\n" /* d3 - separated Y data (next 8 bytes) */
"vuzp.8 d0, d2\n" /* d0 - separated U data, d2 - separated V data */
/* split even and odd Y color components */
"vuzp.8 d1, d3\n" /* d1 - evenY, d3 - oddY */
/* clip upper and lower boundaries */
"vqadd.u8 q0, q0, q4\n"
"vqadd.u8 q1, q1, q4\n"
"vqsub.u8 q0, q0, q5\n"
"vqsub.u8 q1, q1, q5\n"
"vshr.u8 d4, d2, #1\n" /* d4 = V >> 1 */
"vmull.u8 q8, d1, d27\n" /* q8 = evenY * 149 */
"vmull.u8 q9, d3, d27\n" /* q9 = oddY * 149 */
"vld1.16 {d20, d21}, [%[acc_r], :128]\n" /* q10 - initialize accumulator for red */
"vsubw.u8 q10, q10, d4\n" /* red acc -= (V >> 1) */
"vmlsl.u8 q10, d2, d28\n" /* red acc -= V * 204 */
"vld1.16 {d22, d23}, [%[acc_g], :128]\n" /* q11 - initialize accumulator for green */
"vmlsl.u8 q11, d2, d30\n" /* green acc -= V * 104 */
"vmlsl.u8 q11, d0, d29\n" /* green acc -= U * 50 */
"vld1.16 {d24, d25}, [%[acc_b], :128]\n" /* q12 - initialize accumulator for blue */
"vmlsl.u8 q12, d0, d30\n" /* blue acc -= U * 104 */
"vmlsl.u8 q12, d0, d31\n" /* blue acc -= U * 154 */
"vhsub.s16 q3, q8, q10\n" /* calculate even red components */
"vhsub.s16 q10, q9, q10\n" /* calculate odd red components */
"vqshrun.s16 d0, q3, #6\n" /* right shift, narrow and saturate even red components */
"vqshrun.s16 d3, q10, #6\n" /* right shift, narrow and saturate odd red components */
"vhadd.s16 q3, q8, q11\n" /* calculate even green components */
"vhadd.s16 q11, q9, q11\n" /* calculate odd green components */
"vqshrun.s16 d1, q3, #6\n" /* right shift, narrow and saturate even green components */
"vqshrun.s16 d4, q11, #6\n" /* right shift, narrow and saturate odd green components */
"vhsub.s16 q3, q8, q12\n" /* calculate even blue components */
"vhsub.s16 q12, q9, q12\n" /* calculate odd blue components */
"vqshrun.s16 d2, q3, #6\n" /* right shift, narrow and saturate even blue components */
"vqshrun.s16 d5, q12, #6\n" /* right shift, narrow and saturate odd blue components */
"vzip.8 d0, d3\n" /* join even and odd red components */
"vzip.8 d1, d4\n" /* join even and odd green components */
"vzip.8 d2, d5\n" /* join even and odd blue components */
"vshll.u8 q7, d0, #8\n" //red
"vshll.u8 q6, d1, #8\n" //greed
"vsri.u16 q7, q6, #5\n"
"vshll.u8 q6, d2, #8\n" //blue
"vsri.u16 q7, q6, #11\n" //now there is rgb16 in q7
".if \\size == 16\n"
"vst1.16 {d14, d15}, [%[dst]]!\n"
//"vst3.8 {d0, d1, d2}, [%[dst]]!\n"
"vshll.u8 q7, d3, #8\n" //red
"vshll.u8 q6, d4, #8\n" //greed
"vsri.u16 q7, q6, #5\n"
"vshll.u8 q6, d5, #8\n" //blue
"vsri.u16 q7, q6, #11\n" //now there is rgb16 in q7
//"vst3.8 {d3, d4, d5}, [%[dst]]!\n"
"vst1.16 {d14, d15}, [%[dst]]!\n"
".elseif \\size == 8\n"
"vst1.16 {d14, d15}, [%[dst]]!\n"
//"vst3.8 {d0, d1, d2}, [%[dst]]!\n"
".elseif \\size == 4\n"
"vst1.8 {d14}, [%[dst]]!\n"
".elseif \\size == 2\n"
"vst1.8 {d14[0]}, [%[dst]]!\n"
"vst1.8 {d14[1]}, [%[dst]]!\n"
".else\n"
".error \"unsupported macroblock size\"\n"
".endif\n"
".endm\n"
"vmov.u8 d8, #15\n" /* add this to U/V to saturate upper boundary */
"vmov.u8 d9, #20\n" /* add this to Y to saturate upper boundary */
"vmov.u8 d10, #31\n" /* sub this from U/V to saturate lower boundary */
"vmov.u8 d11, #36\n" /* sub this from Y to saturate lower boundary */
"vmov.u8 d26, #16\n"
"vmov.u8 d27, #149\n"
"vmov.u8 d28, #204\n"
"vmov.u8 d29, #50\n"
"vmov.u8 d30, #104\n"
"vmov.u8 d31, #154\n"
"subs %[n], %[n], #16\n"
"blt 2f\n"
"1:\n"
"convert_macroblock 16\n"
"subs %[n], %[n], #16\n"
"bge 1b\n"
"2:\n"
"tst %[n], #8\n"
"beq 3f\n"
"convert_macroblock 8\n"
"3:\n"
"tst %[n], #4\n"
"beq 4f\n"
"convert_macroblock 4\n"
"4:\n"
"tst %[n], #2\n"
"beq 5f\n"
"convert_macroblock 2\n"
"5:\n"
".purgem convert_macroblock\n":[src] "+&r" (src),[dst] "+&r" (dst),
[n] "+&r" (n)
:[acc_r] "r" (&acc_r[0]),[acc_g] "r" (&acc_g[0]),[acc_b] "r" (&acc_b[0])
:"cc", "memory", "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15",
"d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
"d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31");
}
#endif
class QGraphicsVideoItemPrivate
{
public:
QGraphicsVideoItemPrivate()
: q_ptr(0)
, surface(0)
, mediaObject(0)
, service(0)
, rendererControl(0)
, savedViewportUpdateMode(QGraphicsView::FullViewportUpdate)
, aspectRatioMode(Qt::KeepAspectRatio)
, rect(0.0, 0.0, 320, 240)
, softwareRenderingEnabled(false)
{
}
QGraphicsVideoItem *q_ptr;
QXVideoSurface *surface;
QMediaObject *mediaObject;
QMediaService *service;
QVideoRendererControl *rendererControl;
QPointer<QGraphicsView> currentView;
QGraphicsView::ViewportUpdateMode savedViewportUpdateMode;
Qt::AspectRatioMode aspectRatioMode;
QRectF rect;
QRectF boundingRect;
QRectF sourceRect;
QSizeF nativeSize;
QPixmap lastFrame;
QBasicTimer softwareRenderingTimer;
QBasicTimer geometryUpdateTimer;
bool softwareRenderingEnabled;
QRect overlayRect;
void clearService();
void updateRects();
void updateLastFrame();
void _q_present();
void _q_updateNativeSize();
void _q_serviceDestroyed();
void _q_mediaObjectDestroyed();
};
void QGraphicsVideoItemPrivate::clearService()
{
if (rendererControl) {
surface->stop();
rendererControl->setSurface(0);
service->releaseControl(rendererControl);
rendererControl = 0;
}
if (service) {
QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed()));
service = 0;
}
}
void QGraphicsVideoItemPrivate::updateRects()
{
q_ptr->prepareGeometryChange();
if (nativeSize.isEmpty()) {
boundingRect = QRectF();
} else if (aspectRatioMode == Qt::IgnoreAspectRatio) {
boundingRect = rect;
sourceRect = QRectF(0, 0, 1, 1);
} else if (aspectRatioMode == Qt::KeepAspectRatio) {
QSizeF size = nativeSize;
size.scale(rect.size(), Qt::KeepAspectRatio);
boundingRect = QRectF(0, 0, size.width(), size.height());
boundingRect.moveCenter(rect.center());
sourceRect = QRectF(0, 0, 1, 1);
} else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
boundingRect = rect;
QSizeF size = rect.size();
size.scale(nativeSize, Qt::KeepAspectRatio);
sourceRect = QRectF(
0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height());
sourceRect.moveCenter(QPointF(0.5, 0.5));
}
}
void QGraphicsVideoItemPrivate::updateLastFrame()
{
lastFrame = QPixmap();
if (!softwareRenderingEnabled)
return;
QVideoFrame lastVideoFrame = surface->lastFrame();
if (!lastVideoFrame.isValid())
return;
if (lastVideoFrame.map(QAbstractVideoBuffer::ReadOnly)) {
#ifdef __ARM_NEON__
if (lastVideoFrame.pixelFormat() == QVideoFrame::Format_UYVY) {
QImage lastImage(lastVideoFrame.size(), QImage::Format_RGB16);
const uchar *src = lastVideoFrame.bits();
uchar *dst = lastImage.bits();
const int srcLineStep = lastVideoFrame.bytesPerLine();
const int dstLineStep = lastImage.bytesPerLine();
const int h = lastVideoFrame.height();
const int w = lastVideoFrame.width();
for (int y=0; y<h; y++) {
uyvy422_to_rgb16_line_neon(dst, src, w);
src += srcLineStep;
dst += dstLineStep;
}
lastFrame = QPixmap::fromImage(
lastImage.scaled(boundingRect.size().toSize(), Qt::IgnoreAspectRatio, Qt::FastTransformation));
} else
#endif
{
QImage::Format imgFormat = QVideoFrame::imageFormatFromPixelFormat(lastVideoFrame.pixelFormat());
if (imgFormat != QImage::Format_Invalid) {
QImage lastImage(lastVideoFrame.bits(),
lastVideoFrame.width(),
lastVideoFrame.height(),
lastVideoFrame.bytesPerLine(),
imgFormat);
lastFrame = QPixmap::fromImage(
lastImage.scaled(boundingRect.size().toSize(), Qt::IgnoreAspectRatio, Qt::FastTransformation));
}
}
lastVideoFrame.unmap();
}
}
void QGraphicsVideoItemPrivate::_q_present()
{
q_ptr->update(boundingRect);
}
void QGraphicsVideoItemPrivate::_q_updateNativeSize()
{
const QSize &size = surface->surfaceFormat().sizeHint();
if (nativeSize != size) {
lastFrame = QPixmap();
nativeSize = size;
updateRects();
emit q_ptr->nativeSizeChanged(nativeSize);
}
}
void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
{
rendererControl = 0;
service = 0;
surface->stop();
}
void QGraphicsVideoItemPrivate::_q_mediaObjectDestroyed()
{
mediaObject = 0;
clearService();
}
QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent)
: QGraphicsObject(parent)
, d_ptr(new QGraphicsVideoItemPrivate)
{
d_ptr->q_ptr = this;
d_ptr->surface = new QXVideoSurface;
setCacheMode(NoCache);
setFlag(QGraphicsItem::ItemIgnoresParentOpacity);
setFlag(QGraphicsItem::ItemSendsGeometryChanges);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
this, SLOT(_q_updateNativeSize()));
connect(d_ptr->surface, SIGNAL(activeChanged(bool)), this, SLOT(_q_present()));
}
QGraphicsVideoItem::~QGraphicsVideoItem()
{
if (d_ptr->rendererControl) {
d_ptr->rendererControl->setSurface(0);
d_ptr->service->releaseControl(d_ptr->rendererControl);
}
if (d_ptr->currentView)
d_ptr->currentView->setViewportUpdateMode(d_ptr->savedViewportUpdateMode);
delete d_ptr->surface;
delete d_ptr;
}
QMediaObject *QGraphicsVideoItem::mediaObject() const
{
return d_func()->mediaObject;
}
bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
{
Q_D(QGraphicsVideoItem);
if (object == d->mediaObject)
return true;
d->clearService();
d->mediaObject = object;
if (d->mediaObject) {
d->service = d->mediaObject->service();
if (d->service) {
d->rendererControl = qobject_cast<QVideoRendererControl *>(
d->service->requestControl(QVideoRendererControl_iid));
if (d->rendererControl != 0) {
connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
d->rendererControl->setSurface(d->surface);
return true;
}
}
}
return false;
}
Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const
{
return d_func()->aspectRatioMode;
}
void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode)
{
Q_D(QGraphicsVideoItem);
d->aspectRatioMode = mode;
d->updateRects();
}
QPointF QGraphicsVideoItem::offset() const
{
return d_func()->rect.topLeft();
}
void QGraphicsVideoItem::setOffset(const QPointF &offset)
{
Q_D(QGraphicsVideoItem);
d->rect.moveTo(offset);
d->updateRects();
}
QSizeF QGraphicsVideoItem::size() const
{
return d_func()->rect.size();
}
void QGraphicsVideoItem::setSize(const QSizeF &size)
{
Q_D(QGraphicsVideoItem);
d->rect.setSize(size.isValid() ? size : QSizeF(0, 0));
d->updateRects();
}
QSizeF QGraphicsVideoItem::nativeSize() const
{
return d_func()->nativeSize;
}
QRectF QGraphicsVideoItem::boundingRect() const
{
return d_func()->boundingRect;
}
void QGraphicsVideoItem::paint(
QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
#ifdef DEBUG_GFX_VIDEO_ITEM
qDebug() << "QGraphicsVideoItem::paint";
#endif
Q_UNUSED(option);
Q_D(QGraphicsVideoItem);
QGraphicsView *view = 0;
if (scene() && !scene()->views().isEmpty())
view = scene()->views().first();
//it's necessary to switch vieport update mode to FullViewportUpdate
//otherwise the video item area can be just scrolled without notifying overlay
//about geometry changes
if (view != d->currentView) {
if (d->currentView) {
d->currentView->setViewportUpdateMode(d->savedViewportUpdateMode);
}
d->currentView = view;
if (view) {
d->savedViewportUpdateMode = view->viewportUpdateMode();
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
}
QColor colorKey = Qt::black;
bool geometryChanged = false;
if (d->surface) {
if (widget)
d->surface->setWinId(widget->winId());
QTransform transform = painter->combinedTransform();
QRect overlayRect = transform.mapRect(boundingRect()).toRect();
QRect currentSurfaceRect = d->surface->displayRect();
if (widget) {
//workaround for xvideo issue with U/V planes swapped
QPoint topLeft = widget->mapToGlobal(overlayRect.topLeft());
if ((topLeft.x() & 1) == 0 && topLeft.x() != 0)
overlayRect.moveLeft(overlayRect.left()-1);
}
d->overlayRect = overlayRect;
if (currentSurfaceRect != overlayRect) {
if (!d->surface->displayRect().isEmpty()) {
if (d->softwareRenderingEnabled) {
//recalculate scaled frame pixmap if area is resized
if (currentSurfaceRect.size() != overlayRect.size()) {
d->updateLastFrame();
d->surface->setDisplayRect( overlayRect );
}
} else {
d->softwareRenderingEnabled = true;
d->updateLastFrame();
//don't set new geometry right now,
//but with small delay, to ensure the frame is already
//rendered on top of color key
if (!d->geometryUpdateTimer.isActive())
d->geometryUpdateTimer.start(GEOMETRY_UPDATE_DELAY, this);
}
} else
d->surface->setDisplayRect( overlayRect );
geometryChanged = true;
d->softwareRenderingTimer.start(SOFTWARE_RENDERING_DURATION, this);
#ifdef DEBUG_GFX_VIDEO_ITEM
qDebug() << "set video display rect:" << overlayRect;
#endif
}
colorKey = d->surface->colorKey();
}
if (!d->softwareRenderingEnabled) {
painter->fillRect(d->boundingRect, colorKey);
} else {
if (!d->lastFrame.isNull()) {
painter->drawPixmap(d->boundingRect.topLeft(), d->lastFrame );
} else
painter->fillRect(d->boundingRect, Qt::black);
}
}
QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
Q_D(QGraphicsVideoItem);
if (change == ItemScenePositionHasChanged) {
update(boundingRect());
} else {
return QGraphicsItem::itemChange(change, value);
}
return value;
}
void QGraphicsVideoItem::timerEvent(QTimerEvent *event)
{
Q_D(QGraphicsVideoItem);
if (event->timerId() == d->softwareRenderingTimer.timerId() && d->softwareRenderingEnabled) {
d->softwareRenderingTimer.stop();
d->softwareRenderingEnabled = false;
d->updateLastFrame();
// repaint last frame, to ensure geometry change is applyed in paused state
d->surface->repaintLastFrame();
d->_q_present();
} else if ((event->timerId() == d->geometryUpdateTimer.timerId())) {
d->geometryUpdateTimer.stop();
//slightly delayed geometry update,
//to avoid flicker at the first geometry change
d->surface->setDisplayRect( d->overlayRect );
}
QGraphicsObject::timerEvent(event);
}
#include "moc_qgraphicsvideoitem.cpp"
QT_END_NAMESPACE

View File

@@ -1,436 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qpointer.h>
#include <QtCore/qdatetime.h>
#include <QtCore/qbasictimer.h>
#include <QtCore/qcoreevent.h>
#include <QtCore/qdebug.h>
#include <QtGui/qgraphicsscene.h>
#include <QtGui/qgraphicsview.h>
#include <QtGui/qscrollbar.h>
#include <QtGui/qx11info_x11.h>
#include "qgraphicsvideoitem.h"
#ifdef Q_OS_SYMBIAN
#define QGRAPHICSVIDEOITEM_ROTATION_SUPPORT
#endif
#include <qmediaobject.h>
#include <qmediaservice.h>
#include <qvideowindowcontrol.h>
QT_BEGIN_NAMESPACE
#define DEBUG_GFX_VIDEO_ITEM
class QGraphicsVideoItemPrivate : public QObject
{
public:
QGraphicsVideoItemPrivate()
: q_ptr(0)
, mediaObject(0)
, service(0)
, windowControl(0)
, savedViewportUpdateMode(QGraphicsView::FullViewportUpdate)
, aspectRatioMode(Qt::KeepAspectRatio)
, rect(0.0, 0.0, 320, 240)
, videoWidget(0)
{
}
QGraphicsVideoItem *q_ptr;
QMediaObject *mediaObject;
QMediaService *service;
QVideoWindowControl *windowControl;
QPointer<QGraphicsView> currentView;
QList<QPointer<QObject> > eventFilterTargets;
QGraphicsView::ViewportUpdateMode savedViewportUpdateMode;
Qt::AspectRatioMode aspectRatioMode;
QRectF rect;
QRectF boundingRect;
QRectF displayRect;
QSizeF nativeSize;
QWidget *videoWidget;
bool eventFilter(QObject *object, QEvent *event);
void updateEventFilters();
void setWidget(QWidget *widget);
void clearService();
void updateRects();
void updateLastFrame();
void _q_present();
void _q_updateNativeSize();
void _q_serviceDestroyed();
void _q_mediaObjectDestroyed();
};
void QGraphicsVideoItemPrivate::_q_present()
{
}
bool QGraphicsVideoItemPrivate::eventFilter(QObject *object, QEvent *event)
{
if (windowControl && object == videoWidget && QEvent::WinIdChange == event->type()) {
windowControl->setWinId(videoWidget->effectiveWinId());
} else {
bool updateEventFiltersRequired = false;
bool refreshDisplayRequired = false;
foreach (QPointer<QObject> target, eventFilterTargets) {
if (object == target.data()) {
switch (event->type()) {
case QEvent::ParentChange:
updateEventFiltersRequired = true;
refreshDisplayRequired = true;
break;
case QEvent::Move:
case QEvent::Resize:
refreshDisplayRequired = true;
break;
}
}
}
if (updateEventFiltersRequired)
updateEventFilters();
#ifdef Q_OS_SYMBIAN
if (refreshDisplayRequired && windowControl)
QMetaObject::invokeMethod(windowControl, "refreshDisplay");
#endif
}
return false;
}
void QGraphicsVideoItemPrivate::setWidget(QWidget *widget)
{
if (videoWidget != widget) {
videoWidget = widget;
if (widget) {
windowControl->setWinId(widget->winId());
widget->installEventFilter(this);
}
}
}
void QGraphicsVideoItemPrivate::clearService()
{
if (windowControl) {
QObject::disconnect(windowControl, SIGNAL(nativeSizeChanged()), q_ptr, SLOT(_q_updateNativeSize()));
service->releaseControl(windowControl);
windowControl = 0;
}
if (service) {
QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed()));
service = 0;
}
}
void QGraphicsVideoItemPrivate::updateRects()
{
q_ptr->prepareGeometryChange();
QSizeF videoSize;
if (nativeSize.isEmpty()) {
videoSize = rect.size();
} else if (aspectRatioMode == Qt::IgnoreAspectRatio) {
videoSize = rect.size();
} else {
// KeepAspectRatio or KeepAspectRatioByExpanding
videoSize = nativeSize;
videoSize.scale(rect.size(), aspectRatioMode);
}
displayRect = QRectF(QPointF(0, 0), videoSize);
displayRect.moveCenter(rect.center());
boundingRect = displayRect.intersected(rect);
}
void QGraphicsVideoItemPrivate::updateLastFrame()
{
}
void QGraphicsVideoItemPrivate::updateEventFilters()
{
// In order to determine when the absolute screen position of the item
// changes, we need to receive move events sent to m_currentView
// or any of its ancestors.
foreach (QPointer<QObject> target, eventFilterTargets)
if (target)
target->removeEventFilter(this);
eventFilterTargets.clear();
QObject *target = currentView;
while (target) {
target->installEventFilter(this);
eventFilterTargets.append(target);
target = target->parent();
}
}
void QGraphicsVideoItemPrivate::_q_updateNativeSize()
{
const QSize size = windowControl->nativeSize();
if (nativeSize != size) {
nativeSize = size;
updateRects();
emit q_ptr->nativeSizeChanged(nativeSize);
}
}
void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
{
windowControl = 0;
service = 0;
}
void QGraphicsVideoItemPrivate::_q_mediaObjectDestroyed()
{
mediaObject = 0;
clearService();
}
QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent)
: QGraphicsObject(parent)
, d_ptr(new QGraphicsVideoItemPrivate)
{
d_ptr->q_ptr = this;
setCacheMode(NoCache);
setFlag(QGraphicsItem::ItemIgnoresParentOpacity);
setFlag(QGraphicsItem::ItemSendsGeometryChanges);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
}
QGraphicsVideoItem::~QGraphicsVideoItem()
{
if (d_ptr->windowControl) {
d_ptr->service->releaseControl(d_ptr->windowControl);
}
if (d_ptr->currentView)
d_ptr->currentView->setViewportUpdateMode(d_ptr->savedViewportUpdateMode);
delete d_ptr;
}
QMediaObject *QGraphicsVideoItem::mediaObject() const
{
return d_func()->mediaObject;
}
bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
{
Q_D(QGraphicsVideoItem);
if (object == d->mediaObject)
return true;
d->clearService();
d->mediaObject = object;
if (d->mediaObject) {
d->service = d->mediaObject->service();
if (d->service) {
d->windowControl = qobject_cast<QVideoWindowControl *>(
d->service->requestControl(QVideoWindowControl_iid));
if (d->windowControl != 0) {
connect(d->service, SIGNAL(destroyed()), SLOT(_q_serviceDestroyed()));
connect(d->windowControl, SIGNAL(nativeSizeChanged()), SLOT(_q_updateNativeSize()));
d->windowControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
//d->windowControl->setProperty("colorKey", QVariant(QColor(16,7,2)));
d->windowControl->setProperty("autopaintColorKey", QVariant(false));
d->updateRects();
return true;
} else {
qWarning() << "Service doesn't support QVideoWindowControl, overlay item failed";
}
}
}
d->mediaObject = 0;
return false;
}
Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const
{
return d_func()->aspectRatioMode;
}
void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode)
{
Q_D(QGraphicsVideoItem);
d->aspectRatioMode = mode;
d->updateRects();
}
QPointF QGraphicsVideoItem::offset() const
{
return d_func()->rect.topLeft();
}
void QGraphicsVideoItem::setOffset(const QPointF &offset)
{
Q_D(QGraphicsVideoItem);
d->rect.moveTo(offset);
d->updateRects();
}
QSizeF QGraphicsVideoItem::size() const
{
return d_func()->rect.size();
}
void QGraphicsVideoItem::setSize(const QSizeF &size)
{
Q_D(QGraphicsVideoItem);
d->rect.setSize(size.isValid() ? size : QSizeF(0, 0));
d->updateRects();
}
QSizeF QGraphicsVideoItem::nativeSize() const
{
return d_func()->nativeSize;
}
QRectF QGraphicsVideoItem::boundingRect() const
{
return d_func()->boundingRect;
}
void QGraphicsVideoItem::paint(
QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
#ifdef DEBUG_GFX_VIDEO_ITEM
qDebug() << "QGraphicsVideoItem::paint";
#endif
Q_UNUSED(option);
Q_D(QGraphicsVideoItem);
QGraphicsView *view = 0;
if (scene() && !scene()->views().isEmpty())
view = scene()->views().first();
//it's necessary to switch vieport update mode to FullViewportUpdate
//otherwise the video item area can be just scrolled without notifying overlay
//about geometry changes
if (view != d->currentView) {
if (d->currentView) {
d->currentView->setViewportUpdateMode(d->savedViewportUpdateMode);
}
d->currentView = view;
if (view) {
d->savedViewportUpdateMode = view->viewportUpdateMode();
view->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
}
d->updateEventFilters();
}
QColor colorKey = Qt::black;
if (d->windowControl != 0 && widget != 0) {
d->setWidget(widget);
QTransform transform = painter->combinedTransform();
QRect overlayRect = transform.mapRect(d->displayRect).toRect();
QRect currentSurfaceRect = d->windowControl->displayRect();
if (currentSurfaceRect != overlayRect) {
#ifdef DEBUG_GFX_VIDEO_ITEM
qDebug() << "set video display rect:" << overlayRect;
#endif
d->windowControl->setDisplayRect(overlayRect);
}
colorKey = d->windowControl->property("colorKey").value<QColor>();
#ifdef QGRAPHICSVIDEOITEM_ROTATION_SUPPORT
const qreal angle = transform.map(QLineF(0, 0, 1, 0)).angle();
d->windowControl->setProperty("rotation", QVariant::fromValue<qreal>(angle));
#endif
}
if (colorKey.alpha() != 255)
painter->setCompositionMode(QPainter::CompositionMode_Source);
painter->fillRect(d->boundingRect, colorKey);
}
QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
Q_D(QGraphicsVideoItem);
switch (change) {
case ItemScenePositionHasChanged:
update(boundingRect());
break;
case ItemVisibleChange:
//move overlay out of the screen if video item becomes invisible
if (d->windowControl != 0 && !value.toBool())
d->windowControl->setDisplayRect(QRect(-1,-1,1,1));
break;
default:
break;
}
return QGraphicsItem::itemChange(change, value);
}
void QGraphicsVideoItem::timerEvent(QTimerEvent *event)
{
QGraphicsObject::timerEvent(event);
}
#include "moc_qgraphicsvideoitem.cpp"
QT_END_NAMESPACE

View File

@@ -1,604 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qglobal.h>
#include <QtCore/QDebug>
#include <QtCore/QEvent>
#include <QtCore/QPointer>
#include <QtGui/QApplication>
#include <QtGui/QGraphicsScene>
#include <QtGui/QGraphicsView>
#include "qgraphicsvideoitem.h"
#include <qmediaobject.h>
#include <qmediaservice.h>
#include <qvideowidgetcontrol.h>
Q_DECLARE_METATYPE(WId)
static const QEvent::Type UpdateViewportTransparencyEvent =
static_cast<QEvent::Type>(QEvent::registerEventType());
QT_BEGIN_NAMESPACE
class QGraphicsVideoItemPrivate : public QObject
{
Q_OBJECT
public:
QGraphicsVideoItemPrivate(QGraphicsVideoItem *parent);
~QGraphicsVideoItemPrivate();
QMediaObject *mediaObject() const;
bool setMediaObject(QMediaObject *mediaObject);
Qt::AspectRatioMode aspectRatioMode() const;
void setAspectRatioMode(Qt::AspectRatioMode mode);
QPointF offset() const;
void setOffset(const QPointF &offset);
QSizeF size() const;
void setSize(const QSizeF &size);
QRectF rect() const;
QRectF boundingRect() const;
QSize nativeSize() const;
void setCurrentView(QGraphicsView *view);
void setVisible(bool visible);
void setZValue(int zValue);
void setTransform(const QTransform &transform);
void setWithinViewBounds(bool within);
bool eventFilter(QObject *watched, QEvent *event);
void customEvent(QEvent *event);
void _q_present();
void _q_updateNativeSize();
void _q_serviceDestroyed();
void _q_mediaObjectDestroyed();
public slots:
void updateWidgetOrdinalPosition();
void updateItemAncestors();
private:
void clearService();
QWidget *videoWidget() const;
void updateGeometry();
void updateViewportAncestorEventFilters();
void updateWidgetVisibility();
void updateTopWinId();
private:
QGraphicsVideoItem *q_ptr;
QMediaService *m_service;
QMediaObject *m_mediaObject;
QVideoWidgetControl *m_widgetControl;
QPointer<QGraphicsView> m_currentView;
QList<QPointer<QObject> > m_viewportAncestors;
QList<QPointer<QObject> > m_itemAncestors;
QGraphicsView::ViewportUpdateMode m_savedViewportUpdateMode;
Qt::AspectRatioMode m_aspectRatioMode;
QRectF m_rect;
QRectF m_boundingRect;
QSize m_nativeSize;
QPointF m_offset;
QTransform m_transform;
bool m_visible;
bool m_withinViewBounds;
};
QGraphicsVideoItemPrivate::QGraphicsVideoItemPrivate(QGraphicsVideoItem *parent)
: q_ptr(parent)
, m_service(0)
, m_mediaObject(0)
, m_widgetControl(0)
, m_savedViewportUpdateMode(QGraphicsView::FullViewportUpdate)
, m_aspectRatioMode(Qt::KeepAspectRatio)
, m_rect(0.0, 0.0, 320.0, 240.0)
, m_visible(false)
, m_withinViewBounds(false)
{
qRegisterMetaType<WId>("WId");
updateItemAncestors();
}
QGraphicsVideoItemPrivate::~QGraphicsVideoItemPrivate()
{
if (m_widgetControl)
m_service->releaseControl(m_widgetControl);
setCurrentView(0);
}
QMediaObject *QGraphicsVideoItemPrivate::mediaObject() const
{
return m_mediaObject;
}
bool QGraphicsVideoItemPrivate::setMediaObject(QMediaObject *mediaObject)
{
bool bound = false;
if (m_mediaObject != mediaObject) {
clearService();
m_mediaObject = mediaObject;
if (m_mediaObject) {
m_service = m_mediaObject->service();
if (m_service) {
connect(m_service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed()));
m_widgetControl = qobject_cast<QVideoWidgetControl *>(
m_service->requestControl(QVideoWidgetControl_iid));
if (m_widgetControl) {
connect(m_widgetControl, SIGNAL(nativeSizeChanged()), q_ptr, SLOT(_q_updateNativeSize()));
m_widgetControl->setAspectRatioMode(Qt::IgnoreAspectRatio);
updateGeometry();
updateTopWinId();
updateWidgetOrdinalPosition();
updateWidgetVisibility();
bound = true;
}
}
}
}
return bound;
}
Qt::AspectRatioMode QGraphicsVideoItemPrivate::aspectRatioMode() const
{
return m_aspectRatioMode;
}
void QGraphicsVideoItemPrivate::setAspectRatioMode(Qt::AspectRatioMode mode)
{
if (mode != m_aspectRatioMode) {
m_aspectRatioMode = mode;
updateGeometry();
}
}
QPointF QGraphicsVideoItemPrivate::offset() const
{
return m_rect.topLeft();
}
void QGraphicsVideoItemPrivate::setOffset(const QPointF &offset)
{
if (m_offset != offset) {
m_offset = offset;
updateGeometry();
}
}
QSizeF QGraphicsVideoItemPrivate::size() const
{
return m_rect.size();
}
void QGraphicsVideoItemPrivate::setSize(const QSizeF &size)
{
if (m_rect.size() != size) {
m_rect.setSize(size.isValid() ? size : QSizeF(0, 0));
updateGeometry();
}
}
QRectF QGraphicsVideoItemPrivate::rect() const
{
return m_rect;
}
QRectF QGraphicsVideoItemPrivate::boundingRect() const
{
return m_boundingRect;
}
QSize QGraphicsVideoItemPrivate::nativeSize() const
{
return m_nativeSize;
}
void QGraphicsVideoItemPrivate::setCurrentView(QGraphicsView *view)
{
if (m_currentView != view) {
if (m_currentView)
m_currentView->setViewportUpdateMode(m_savedViewportUpdateMode);
m_currentView = view;
updateTopWinId();
if (m_currentView) {
m_savedViewportUpdateMode = m_currentView->viewportUpdateMode();
m_currentView->setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
updateWidgetOrdinalPosition();
updateGeometry();
}
updateViewportAncestorEventFilters();
}
}
void QGraphicsVideoItemPrivate::setVisible(bool visible)
{
if (m_visible != visible) {
m_visible = visible;
updateWidgetVisibility();
}
}
void QGraphicsVideoItemPrivate::setTransform(const QTransform &transform)
{
if (m_transform != transform) {
m_transform = transform;
updateGeometry();
}
}
void QGraphicsVideoItemPrivate::setWithinViewBounds(bool within)
{
if (m_withinViewBounds != within) {
m_withinViewBounds = within;
updateWidgetVisibility();
}
}
bool QGraphicsVideoItemPrivate::eventFilter(QObject *watched, QEvent *event)
{
bool updateViewportAncestorEventFiltersRequired = false;
bool updateGeometryRequired = false;
foreach (QPointer<QObject> target, m_viewportAncestors) {
if (watched == target.data()) {
switch (event->type()) {
case QEvent::ParentChange:
updateViewportAncestorEventFiltersRequired = true;
break;
case QEvent::WinIdChange:
updateViewportAncestorEventFiltersRequired = true;
updateTopWinId();
break;
case QEvent::Move:
case QEvent::Resize:
updateGeometryRequired = true;
break;
}
}
}
if (updateViewportAncestorEventFiltersRequired)
updateViewportAncestorEventFilters();
if (updateGeometryRequired)
updateGeometry();
if (watched == m_currentView) {
switch (event->type()) {
case QEvent::Show:
setVisible(true);
break;
case QEvent::Hide:
setVisible(false);
break;
}
}
return QObject::eventFilter(watched, event);
}
void QGraphicsVideoItemPrivate::customEvent(QEvent *event)
{
if (event->type() == UpdateViewportTransparencyEvent && m_currentView) {
m_currentView->window()->setAttribute(Qt::WA_TranslucentBackground);
m_currentView->window()->update();
}
QObject::customEvent(event);
}
void QGraphicsVideoItemPrivate::clearService()
{
if (m_widgetControl) {
m_service->releaseControl(m_widgetControl);
m_widgetControl = 0;
}
if (m_service) {
m_service->disconnect(q_ptr);
m_service = 0;
}
}
QWidget *QGraphicsVideoItemPrivate::videoWidget() const
{
return m_widgetControl ? m_widgetControl->videoWidget() : 0;
}
void QGraphicsVideoItemPrivate::updateViewportAncestorEventFilters()
{
// In order to determine when the absolute screen position of the item
// changes, we need to receive move events sent to m_currentView
// or any of its ancestors.
foreach (QPointer<QObject> target, m_viewportAncestors)
if (target)
target->removeEventFilter(this);
m_viewportAncestors.clear();
QObject *target = m_currentView;
while (target) {
target->installEventFilter(this);
m_viewportAncestors.append(target);
target = target->parent();
}
}
void QGraphicsVideoItemPrivate::updateItemAncestors()
{
// We need to monitor the ancestors of this item to check for zOrder
// changes and reparenting, both of which influence the stacking order
// of this item and so require changes to the backend window ordinal position.
foreach (QPointer<QObject> target, m_itemAncestors) {
if (target) {
disconnect(target, SIGNAL(zChanged()), this, SLOT(updateWidgetOrdinalPosition()));
disconnect(target, SIGNAL(parentChanged()), this, SLOT(updateItemAncestors()));
disconnect(target, SIGNAL(parentChanged()), this, SLOT(updateWidgetOrdinalPosition()));
}
}
m_itemAncestors.clear();
QGraphicsItem *item = q_ptr;
while (item) {
if (QGraphicsObject *object = item->toGraphicsObject()) {
connect(object, SIGNAL(zChanged()), this, SLOT(updateWidgetOrdinalPosition()));
connect(object, SIGNAL(parentChanged()), this, SLOT(updateItemAncestors()));
connect(object, SIGNAL(parentChanged()), this, SLOT(updateWidgetOrdinalPosition()));
m_itemAncestors.append(object);
}
item = item->parentItem();
}
}
void QGraphicsVideoItemPrivate::updateGeometry()
{
q_ptr->prepareGeometryChange();
QSizeF videoSize;
if (m_nativeSize.isEmpty()) {
videoSize = m_rect.size();
} else if (m_aspectRatioMode == Qt::IgnoreAspectRatio) {
videoSize = m_rect.size();
} else {
// KeepAspectRatio or KeepAspectRatioByExpanding
videoSize = m_nativeSize;
videoSize.scale(m_rect.size(), m_aspectRatioMode);
}
QRectF displayRect(QPointF(0, 0), videoSize);
displayRect.moveCenter(m_rect.center());
m_boundingRect = displayRect.intersected(m_rect);
if (QWidget *widget = videoWidget()) {
QRect widgetGeometry;
QRect extent;
if (m_currentView) {
const QRectF viewRectF = m_transform.mapRect(displayRect);
const QRect viewRect(viewRectF.topLeft().toPoint(), viewRectF.size().toSize());
// Without this, a line of transparent pixels is visible round the edge of the
// item. This is probably down to an error in conversion between scene and
// screen coordinates, but the root cause has not yet been tracked down.
static const QPoint positionFudgeFactor(-1, -1);
static const QSize sizeFudgeFactor(4, 4);
const QRect videoGeometry(m_currentView->mapToGlobal(viewRect.topLeft()) + positionFudgeFactor,
viewRect.size() + sizeFudgeFactor);
QRect viewportGeometry = QRect(m_currentView->viewport()->mapToGlobal(QPoint(0, 0)),
m_currentView->viewport()->size());
widgetGeometry = videoGeometry.intersected(viewportGeometry);
extent = QRect(videoGeometry.topLeft() - widgetGeometry.topLeft(),
videoGeometry.size());
}
setWithinViewBounds(!widgetGeometry.size().isEmpty());
widget->setGeometry(widgetGeometry);
m_widgetControl->setProperty("extentRect", QVariant::fromValue<QRect>(extent));
const qreal angle = m_transform.map(QLineF(0, 0, 1, 0)).angle();
m_widgetControl->setProperty("rotation", QVariant::fromValue<qreal>(angle));
}
}
void QGraphicsVideoItemPrivate::updateWidgetVisibility()
{
if (QWidget *widget = videoWidget())
widget->setVisible(m_visible && m_withinViewBounds);
}
void QGraphicsVideoItemPrivate::updateTopWinId()
{
if (m_widgetControl) {
WId topWinId = m_currentView ? m_currentView->effectiveWinId() : 0;
// Set custom property
m_widgetControl->setProperty("topWinId", QVariant::fromValue<WId>(topWinId));
}
}
void QGraphicsVideoItemPrivate::updateWidgetOrdinalPosition()
{
if (m_currentView) {
QGraphicsScene *scene = m_currentView->scene();
const QGraphicsScene::ItemIndexMethod indexMethod = scene->itemIndexMethod();
scene->setItemIndexMethod(QGraphicsScene::BspTreeIndex);
const QList<QGraphicsItem*> items = m_currentView->items();
QList<QGraphicsVideoItem*> graphicsVideoItems;
foreach (QGraphicsItem *item, items)
if (QGraphicsVideoItem *x = qobject_cast<QGraphicsVideoItem *>(item->toGraphicsObject()))
graphicsVideoItems.append(x);
int ordinalPosition = 1;
foreach (QGraphicsVideoItem *item, graphicsVideoItems)
if (QVideoWidgetControl *widgetControl = item->d_ptr->m_widgetControl)
widgetControl->setProperty("ordinalPosition", ordinalPosition++);
scene->setItemIndexMethod(indexMethod);
}
}
void QGraphicsVideoItemPrivate::_q_present()
{
// Not required for this implementation of QGraphicsVideoItem
}
void QGraphicsVideoItemPrivate::_q_updateNativeSize()
{
const QSize size = m_widgetControl ? m_widgetControl->property("nativeSize").value<QSize>() : QSize();
if (!size.isEmpty() && m_nativeSize != size) {
m_nativeSize = size;
updateGeometry();
emit q_ptr->nativeSizeChanged(m_nativeSize);
}
}
void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
{
m_widgetControl = 0;
m_service = 0;
}
void QGraphicsVideoItemPrivate::_q_mediaObjectDestroyed()
{
m_mediaObject = 0;
clearService();
}
QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent)
: QGraphicsObject(parent)
, d_ptr(new QGraphicsVideoItemPrivate(this))
{
setCacheMode(NoCache);
setFlag(QGraphicsItem::ItemIgnoresParentOpacity);
setFlag(QGraphicsItem::ItemSendsGeometryChanges);
setFlag(QGraphicsItem::ItemSendsScenePositionChanges);
}
QGraphicsVideoItem::~QGraphicsVideoItem()
{
delete d_ptr;
}
QMediaObject *QGraphicsVideoItem::mediaObject() const
{
return d_func()->mediaObject();
}
bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
{
return d_func()->setMediaObject(object);
}
Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const
{
return d_func()->aspectRatioMode();
}
void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode)
{
d_func()->setAspectRatioMode(mode);
}
QPointF QGraphicsVideoItem::offset() const
{
return d_func()->offset();
}
void QGraphicsVideoItem::setOffset(const QPointF &offset)
{
d_func()->setOffset(offset);
}
QSizeF QGraphicsVideoItem::size() const
{
return d_func()->size();
}
void QGraphicsVideoItem::setSize(const QSizeF &size)
{
d_func()->setSize(size);
}
QSizeF QGraphicsVideoItem::nativeSize() const
{
return d_func()->nativeSize();
}
QRectF QGraphicsVideoItem::boundingRect() const
{
return d_func()->boundingRect();
}
void QGraphicsVideoItem::paint(
QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
{
Q_UNUSED(option);
Q_D(QGraphicsVideoItem);
QGraphicsView *view = 0;
if (scene() && !scene()->views().isEmpty())
view = scene()->views().first();
d->setCurrentView(view);
d->setTransform(painter->combinedTransform());
if (widget && !widget->window()->testAttribute(Qt::WA_TranslucentBackground)) {
// On Symbian, setting Qt::WA_TranslucentBackground can cause the
// current window surface to be replaced. Because of this, it cannot
// safely be changed from the context of the viewport paintEvent(), so we
// queue a custom event to set the attribute.
QEvent *event = new QEvent(UpdateViewportTransparencyEvent);
QCoreApplication::instance()->postEvent(d, event);
}
const QPainter::CompositionMode oldCompositionMode = painter->compositionMode();
painter->setCompositionMode(QPainter::CompositionMode_Source);
painter->fillRect(d->boundingRect(), Qt::transparent);
painter->setCompositionMode(oldCompositionMode);
}
QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value)
{
Q_D(QGraphicsVideoItem);
switch (change) {
case ItemScenePositionHasChanged:
update(boundingRect());
break;
case ItemVisibleChange:
d->setVisible(value.toBool());
break;
case ItemZValueHasChanged:
d->updateWidgetOrdinalPosition();
break;
default:
break;
}
return QGraphicsItem::itemChange(change, value);
}
void QGraphicsVideoItem::timerEvent(QTimerEvent *event)
{
QGraphicsObject::timerEvent(event);
}
#include "qgraphicsvideoitem_symbian.moc"
#include "moc_qgraphicsvideoitem.cpp"
QT_END_NAMESPACE

View File

@@ -47,10 +47,6 @@
#include "qmediaserviceproviderplugin.h"
#if defined(Q_OS_SYMBIAN)
# include <f32file.h>
#endif
#if defined(Q_OS_MAC)
# include <CoreFoundation/CoreFoundation.h>
#endif
@@ -61,51 +57,6 @@ typedef QMap<QString,QObjectList> ObjectListMap;
Q_GLOBAL_STATIC(ObjectListMap, staticMediaPlugins);
#if defined(Q_OS_SYMBIAN)
// XXX: Copied over from Mobility, hopefully to be removed at some point
class DirChecker
{
public:
DirChecker();
~DirChecker();
bool checkDir(const QDir& dir);
private:
RFs rfs;
};
DirChecker::DirChecker()
{
qt_symbian_throwIfError(rfs.Connect());
}
bool DirChecker::checkDir(const QDir& dir)
{
bool pathFound = false;
// In Symbian, going cdUp() in a c:/private/<uid3>/ will result in *platsec* error at fileserver (requires AllFiles capability)
// Also, trying to cd() to a nonexistent directory causes *platsec* error. This does not cause functional harm, but should
// nevertheless be changed to use native Symbian methods to avoid unnecessary platsec warnings (as per qpluginloader.cpp).
// Use native Symbian code to check for directory existence, because checking
// for files from under non-existent protected dir like E:/private/<uid> using
// QDir::exists causes platform security violations on most apps.
QString nativePath = QDir::toNativeSeparators(dir.absolutePath());
TPtrC ptr = TPtrC16(static_cast<const TUint16*>(nativePath.utf16()), nativePath.length());
TUint attributes;
TInt err = rfs.Att(ptr, attributes);
if (err == KErrNone) {
// yes, the directory exists.
pathFound = true;
}
return pathFound;
}
DirChecker::~DirChecker()
{
rfs.Close();
}
#endif
QMediaPluginLoader::QMediaPluginLoader(const char *iid, const QString &location, Qt::CaseSensitivity):
m_iid(iid)
{
@@ -139,10 +90,6 @@ QStringList QMediaPluginLoader::availablePlugins() const
QStringList paths;
QStringList plugins;
#if defined(Q_OS_SYMBIAN)
DirChecker dirChecker;
#endif
#if defined(Q_OS_MAC)
QString imageSuffix(qgetenv("DYLD_IMAGE_SUFFIX"));
@@ -174,31 +121,26 @@ QStringList QMediaPluginLoader::availablePlugins() const
foreach (const QString &path, paths) {
QDir typeDir(path + m_location);
#if defined(Q_OS_SYMBIAN)
if (dirChecker.checkDir(typeDir))
#endif
{
foreach (const QString &file, typeDir.entryList(QDir::Files)) {
foreach (const QString &file, typeDir.entryList(QDir::Files)) {
#if defined(Q_OS_MAC)
if (!imageSuffix.isEmpty()) { // Only add appropriate images
if (file.lastIndexOf(imageSuffix, -6) == -1)
continue;
} else { // Ignore any images with common suffixes
if (file.endsWith(QLatin1String("_debug.dylib")) ||
file.endsWith(QLatin1String("_profile.dylib")))
continue;
}
#elif defined(Q_OS_UNIX)
// Ignore separate debug files
if (file.endsWith(QLatin1String(".debug")))
if (!imageSuffix.isEmpty()) { // Only add appropriate images
if (file.lastIndexOf(imageSuffix, -6) == -1)
continue;
#elif defined(Q_OS_WIN)
// Ignore non-dlls
if (!file.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive))
} else { // Ignore any images with common suffixes
if (file.endsWith(QLatin1String("_debug.dylib")) ||
file.endsWith(QLatin1String("_profile.dylib")))
continue;
#endif
plugins << typeDir.absoluteFilePath(file);
}
#elif defined(Q_OS_UNIX)
// Ignore separate debug files
if (file.endsWith(QLatin1String(".debug")))
continue;
#elif defined(Q_OS_WIN)
// Ignore non-dlls
if (!file.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive))
continue;
#endif
plugins << typeDir.absoluteFilePath(file);
}
}

View File

@@ -57,18 +57,18 @@
#define QTM_PACKAGE_TAG ""
#include <QtCore/qglobal.h>
#if defined(QTM_BUILD_UNITTESTS) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_MAKEDLL)
#if defined(QTM_BUILD_UNITTESTS) && (defined(Q_OS_WIN)) && defined(QT_MAKEDLL)
# define QM_AUTOTEST_EXPORT Q_DECL_EXPORT
#elif defined(QTM_BUILD_UNITTESTS) && (defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_DLL)
#elif defined(QTM_BUILD_UNITTESTS) && (defined(Q_OS_WIN)) && defined(QT_DLL)
# define QM_AUTOTEST_EXPORT Q_DECL_IMPORT
#elif defined(QTM_BUILD_UNITTESTS) && !(defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)) && defined(QT_SHARED)
#elif defined(QTM_BUILD_UNITTESTS) && !(defined(Q_OS_WIN)) && defined(QT_SHARED)
# define QM_AUTOTEST_EXPORT Q_DECL_EXPORT
#else
# define QM_AUTOTEST_EXPORT
#endif
#if defined(Q_OS_WIN) || defined(Q_OS_SYMBIAN)
#if defined(Q_OS_WIN)
# if defined(QT_NODLL)
# undef QT_MAKEDLL
# undef QT_DLL
@@ -160,11 +160,6 @@
# define Q_LOCATION_EXPORT Q_DECL_IMPORT
# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
# define Q_MESSAGING_EXPORT Q_DECL_IMPORT
# if QTM_SERVICEFW_SYMBIAN_DATABASEMANAGER_SERVER
# define Q_SERVICEFW_EXPORT
# else
# define Q_SERVICEFW_EXPORT Q_DECL_IMPORT
# endif
# define Q_SYSINFO_EXPORT Q_DECL_IMPORT
# define Q_SENSORS_EXPORT Q_DECL_IMPORT
# define Q_FEEDBACK_EXPORT Q_DECL_IMPORT
@@ -211,17 +206,6 @@
#endif
#ifdef QTM_SERVICEFW_SYMBIAN_DATABASEMANAGER_SERVER
# ifdef Q_SERVICEFW_EXPORT
# undef Q_SERVICEFW_EXPORT
# endif
# define Q_SERVICEFW_EXPORT
# ifdef QM_AUTOTEST_EXPORT
# undef QM_AUTOTEST_EXPORT
# endif
# define QM_AUTOTEST_EXPORT
#endif
// The namespace is hardcoded as moc has issues resolving
// macros which would be a prerequisite for a dynmamic namespace
#define QTM_NAMESPACE QtMobility

View File

@@ -76,12 +76,6 @@ QVideoWidgetControlBackend::QVideoWidgetControlBackend(
layout->setMargin(0);
layout->setSpacing(0);
#ifdef Q_OS_SYMBIAN
// On some cases the flag is not reset automatically
// This would lead to viewfinder not being visible on Symbian
control->videoWidget()->setAttribute(Qt::WA_WState_ExplicitShowHide, false);
#endif // Q_OS_SYMBIAN
layout->addWidget(control->videoWidget());
widget->setLayout(layout);

View File

@@ -1,497 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtGui/qx11info_x11.h>
#include <QtCore/qdebug.h>
#include <QtCore/qvariant.h>
#include <qvideosurfaceformat.h>
#include "qxvideosurface_maemo5_p.h"
//#define DEBUG_XV_SURFACE
struct XvFormatRgb
{
QVideoFrame::PixelFormat pixelFormat;
int bits_per_pixel;
int format;
int num_planes;
int depth;
unsigned int red_mask;
unsigned int green_mask;
unsigned int blue_mask;
};
bool operator ==(const XvImageFormatValues &format, const XvFormatRgb &rgb)
{
return format.type == XvRGB
&& format.bits_per_pixel == rgb.bits_per_pixel
&& format.format == rgb.format
&& format.num_planes == rgb.num_planes
&& format.depth == rgb.depth
&& format.red_mask == rgb.red_mask
&& format.blue_mask == rgb.blue_mask;
}
static const XvFormatRgb qt_xvRgbLookup[] =
{
{ QVideoFrame::Format_ARGB32, 32, XvPacked, 1, 32, 0x00FF0000, 0x0000FF00, 0x000000FF },
{ QVideoFrame::Format_RGB32 , 32, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
{ QVideoFrame::Format_RGB24 , 24, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
{ QVideoFrame::Format_RGB565, 16, XvPacked, 1, 16, 0x0000F800, 0x000007E0, 0x0000001F },
{ QVideoFrame::Format_BGRA32, 32, XvPacked, 1, 32, 0xFF000000, 0x00FF0000, 0x0000FF00 },
{ QVideoFrame::Format_BGR32 , 32, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
{ QVideoFrame::Format_BGR24 , 24, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
{ QVideoFrame::Format_BGR565, 16, XvPacked, 1, 16, 0x0000F800, 0x000007E0, 0x0000001F }
};
struct XvFormatYuv
{
QVideoFrame::PixelFormat pixelFormat;
int bits_per_pixel;
int format;
int num_planes;
unsigned int y_sample_bits;
unsigned int u_sample_bits;
unsigned int v_sample_bits;
unsigned int horz_y_period;
unsigned int horz_u_period;
unsigned int horz_v_period;
unsigned int vert_y_period;
unsigned int vert_u_period;
unsigned int vert_v_period;
char component_order[32];
};
bool operator ==(const XvImageFormatValues &format, const XvFormatYuv &yuv)
{
return format.type == XvYUV
&& format.bits_per_pixel == yuv.bits_per_pixel
&& format.format == yuv.format
&& format.num_planes == yuv.num_planes
&& format.y_sample_bits == yuv.y_sample_bits
&& format.u_sample_bits == yuv.u_sample_bits
&& format.v_sample_bits == yuv.v_sample_bits
&& format.horz_y_period == yuv.horz_y_period
&& format.horz_u_period == yuv.horz_u_period
&& format.horz_v_period == yuv.horz_v_period
&& format.horz_y_period == yuv.vert_y_period
&& format.vert_u_period == yuv.vert_u_period
&& format.vert_v_period == yuv.vert_v_period
&& qstrncmp(format.component_order, yuv.component_order, 32) == 0;
}
static const XvFormatYuv qt_xvYuvLookup[] =
{
{ QVideoFrame::Format_YUV444 , 24, XvPacked, 1, 8, 8, 8, 1, 1, 1, 1, 1, 1, "YUV" },
{ QVideoFrame::Format_YUV420P, 12, XvPlanar, 3, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YUV" },
{ QVideoFrame::Format_YV12 , 12, XvPlanar, 3, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU" },
{ QVideoFrame::Format_UYVY , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "UYVY" },
{ QVideoFrame::Format_YUYV , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUY2" },
{ QVideoFrame::Format_YUYV , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUYV" },
{ QVideoFrame::Format_NV12 , 12, XvPlanar, 2, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YUV" },
{ QVideoFrame::Format_NV12 , 12, XvPlanar, 2, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU" },
{ QVideoFrame::Format_Y8 , 8 , XvPlanar, 1, 8, 0, 0, 1, 0, 0, 1, 0, 0, "Y" }
};
QXVideoSurface::QXVideoSurface(QObject *parent)
: QAbstractVideoSurface(parent)
, m_winId(0)
, m_portId(0)
, m_gc(0)
, m_image(0)
, m_colorKey(24,0,24)
{
}
QXVideoSurface::~QXVideoSurface()
{
if (m_gc)
XFreeGC(QX11Info::display(), m_gc);
if (m_portId != 0)
XvUngrabPort(QX11Info::display(), m_portId, 0);
}
WId QXVideoSurface::winId() const
{
return m_winId;
}
void QXVideoSurface::setWinId(WId id)
{
if (id == m_winId)
return;
#ifdef DEBUG_XV_SURFACE
qDebug() << "QXVideoSurface::setWinId" << id;
#endif
if (m_image)
XFree(m_image);
if (m_gc) {
XFreeGC(QX11Info::display(), m_gc);
m_gc = 0;
}
if (m_portId != 0)
XvUngrabPort(QX11Info::display(), m_portId, 0);
QList<QVideoFrame::PixelFormat> prevFormats = m_supportedPixelFormats;
m_supportedPixelFormats.clear();
m_formatIds.clear();
m_winId = id;
if (m_winId && findPort()) {
querySupportedFormats();
m_gc = XCreateGC(QX11Info::display(), m_winId, 0, 0);
if (m_image) {
m_image = 0;
if (!start(surfaceFormat()))
QAbstractVideoSurface::stop();
}
} else if (m_image) {
m_image = 0;
QAbstractVideoSurface::stop();
}
if (m_supportedPixelFormats != prevFormats) {
#ifdef DEBUG_XV_SURFACE
qDebug() << "QXVideoSurface: supportedFormatsChanged";
#endif
emit supportedFormatsChanged();
}
}
QRect QXVideoSurface::displayRect() const
{
return m_displayRect;
}
void QXVideoSurface::setDisplayRect(const QRect &rect)
{
m_displayRect = rect;
}
QColor QXVideoSurface::colorKey() const
{
return m_colorKey;
}
void QXVideoSurface::setColorKey(QColor key)
{
m_colorKey = key;
}
int QXVideoSurface::getAttribute(const char *attribute) const
{
if (m_portId != 0) {
Display *display = QX11Info::display();
Atom atom = XInternAtom(display, attribute, True);
int value = 0;
XvGetPortAttribute(display, m_portId, atom, &value);
return value;
} else {
return 0;
}
}
void QXVideoSurface::setAttribute(const char *attribute, int value)
{
if (m_portId != 0) {
Display *display = QX11Info::display();
Atom atom = XInternAtom(display, attribute, True);
XvSetPortAttribute(display, m_portId, atom, value);
}
}
QList<QVideoFrame::PixelFormat> QXVideoSurface::supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType) const
{
if ( handleType == QAbstractVideoBuffer::NoHandle ||
handleType == QAbstractVideoBuffer::XvShmImageHandle )
return m_supportedPixelFormats;
else
return QList<QVideoFrame::PixelFormat>();
}
bool QXVideoSurface::start(const QVideoSurfaceFormat &format)
{
#ifdef DEBUG_XV_SURFACE
qDebug() << "QXVideoSurface::start" << format;
#endif
m_lastFrame = QVideoFrame();
if (m_image)
XFree(m_image);
m_xvFormatId = 0;
for (int i = 0; i < m_supportedPixelFormats.count(); ++i) {
if (m_supportedPixelFormats.at(i) == format.pixelFormat()) {
m_xvFormatId = m_formatIds.at(i);
break;
}
}
if (m_xvFormatId == 0) {
setError(UnsupportedFormatError);
} else {
XvImage *image = XvShmCreateImage(
QX11Info::display(),
m_portId,
m_xvFormatId,
0,
format.frameWidth(),
format.frameHeight(),
&m_shminfo
);
if (!image) {
setError(ResourceError);
return false;
}
m_shminfo.shmid = shmget(IPC_PRIVATE, image->data_size, IPC_CREAT | 0777);
m_shminfo.shmaddr = image->data = (char*)shmat(m_shminfo.shmid, 0, 0);
m_shminfo.readOnly = False;
if (!XShmAttach(QX11Info::display(), &m_shminfo)) {
qWarning() << "XShmAttach failed" << format;
return false;
}
if (!image) {
setError(ResourceError);
} else {
m_viewport = format.viewport();
m_image = image;
quint32 c = m_colorKey.rgb();
quint16 colorKey16 = ((c >> 3) & 0x001f)
| ((c >> 5) & 0x07e0)
| ((c >> 8) & 0xf800);
setAttribute("XV_AUTOPAINT_COLORKEY", 0);
setAttribute("XV_COLORKEY", colorKey16);
setAttribute("XV_OMAP_VSYNC", 1);
setAttribute("XV_DOUBLE_BUFFER", 0);
QVideoSurfaceFormat newFormat = format;
newFormat.setProperty("portId", QVariant(quint64(m_portId)));
newFormat.setProperty("xvFormatId", m_xvFormatId);
newFormat.setProperty("dataSize", image->data_size);
return QAbstractVideoSurface::start(newFormat);
}
}
if (m_image) {
m_image = 0;
QAbstractVideoSurface::stop();
}
return false;
}
void QXVideoSurface::stop()
{
if (m_image) {
XFree(m_image);
m_image = 0;
m_lastFrame = QVideoFrame();
QAbstractVideoSurface::stop();
}
}
bool QXVideoSurface::present(const QVideoFrame &frame)
{
if (!m_image) {
setError(StoppedError);
return false;
} else if (m_image->width != frame.width() || m_image->height != frame.height()) {
setError(IncorrectFormatError);
return false;
} else {
m_lastFrame = frame;
if (!m_lastFrame.map(QAbstractVideoBuffer::ReadOnly)) {
qWarning() << "Failed to map video frame";
setError(IncorrectFormatError);
return false;
} else {
bool presented = false;
if (frame.handleType() != QAbstractVideoBuffer::XvShmImageHandle &&
m_image->data_size > m_lastFrame.mappedBytes()) {
qWarning("Insufficient frame buffer size");
setError(IncorrectFormatError);
} else if (frame.handleType() != QAbstractVideoBuffer::XvShmImageHandle &&
m_image->num_planes > 0 &&
m_image->pitches[0] != m_lastFrame.bytesPerLine()) {
qWarning("Incompatible frame pitches");
setError(IncorrectFormatError);
} else {
XvImage *img = 0;
if (frame.handleType() == QAbstractVideoBuffer::XvShmImageHandle) {
img = frame.handle().value<XvImage*>();
} else {
img = m_image;
memcpy(m_image->data, m_lastFrame.bits(), qMin(m_lastFrame.mappedBytes(), m_image->data_size));
}
if (img)
XvShmPutImage(
QX11Info::display(),
m_portId,
m_winId,
m_gc,
img,
m_viewport.x(),
m_viewport.y(),
m_viewport.width(),
m_viewport.height(),
m_displayRect.x(),
m_displayRect.y(),
m_displayRect.width(),
m_displayRect.height(),
false);
presented = true;
}
m_lastFrame.unmap();
return presented;
}
}
}
void QXVideoSurface::repaintLastFrame()
{
if (m_lastFrame.isValid())
present(QVideoFrame(m_lastFrame));
}
bool QXVideoSurface::findPort()
{
unsigned int count = 0;
XvAdaptorInfo *adaptors = 0;
bool portFound = false;
if (XvQueryAdaptors(QX11Info::display(), m_winId, &count, &adaptors) == Success) {
for (unsigned int i = 0; i < count && !portFound; ++i) {
if (adaptors[i].type & XvImageMask) {
m_portId = adaptors[i].base_id;
for (unsigned int j = 0; j < adaptors[i].num_ports && !portFound; ++j, ++m_portId)
portFound = XvGrabPort(QX11Info::display(), m_portId, 0) == Success;
}
}
XvFreeAdaptorInfo(adaptors);
}
if (!portFound)
qWarning() << "QXVideoSurface::findPort: failed to find XVideo port";
return portFound;
}
void QXVideoSurface::querySupportedFormats()
{
int count = 0;
if (XvImageFormatValues *imageFormats = XvListImageFormats(
QX11Info::display(), m_portId, &count)) {
const int rgbCount = sizeof(qt_xvRgbLookup) / sizeof(XvFormatRgb);
const int yuvCount = sizeof(qt_xvYuvLookup) / sizeof(XvFormatYuv);
for (int i = 0; i < count; ++i) {
switch (imageFormats[i].type) {
case XvRGB:
for (int j = 0; j < rgbCount; ++j) {
if (imageFormats[i] == qt_xvRgbLookup[j]) {
m_supportedPixelFormats.append(qt_xvRgbLookup[j].pixelFormat);
m_formatIds.append(imageFormats[i].id);
break;
}
}
break;
case XvYUV:
for (int j = 0; j < yuvCount; ++j) {
//skip YUV420P and YV12 formats, they don't work correctly and slow,
//YUV2 == YUYV is just slow
if (imageFormats[i] == qt_xvYuvLookup[j] &&
qt_xvYuvLookup[j].pixelFormat != QVideoFrame::Format_YUV420P &&
qt_xvYuvLookup[j].pixelFormat != QVideoFrame::Format_YV12) {
m_supportedPixelFormats.append(qt_xvYuvLookup[j].pixelFormat);
m_formatIds.append(imageFormats[i].id);
break;
}
}
break;
}
}
XFree(imageFormats);
}
#ifdef DEBUG_XV_SURFACE
qDebug() << "Supported pixel formats:" << m_supportedPixelFormats;
#endif
}

View File

@@ -1,111 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QXVIDEOSURFACE_MAEMO5_H
#define QXVIDEOSURFACE_MAEMO5_H
#include <QtCore/qhash.h>
#include <QtGui/qwidget.h>
#include <qabstractvideosurface.h>
#include <X11/Xlib.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <X11/extensions/XShm.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xv.h>
#include <X11/extensions/Xvlib.h>
QT_USE_NAMESPACE
class QXVideoSurface : public QAbstractVideoSurface
{
Q_OBJECT
public:
QXVideoSurface(QObject *parent = 0);
~QXVideoSurface();
WId winId() const;
void setWinId(WId id);
QRect displayRect() const;
void setDisplayRect(const QRect &rect);
QColor colorKey() const;
void setColorKey(QColor key);
QList<QVideoFrame::PixelFormat> supportedPixelFormats(
QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
QVideoFrame lastFrame() const { return m_lastFrame; }
public slots:
bool start(const QVideoSurfaceFormat &format);
void stop();
bool present(const QVideoFrame &frame);
void repaintLastFrame();
private:
WId m_winId;
XvPortID m_portId;
int m_xvFormatId;
GC m_gc;
XvImage *m_image;
XShmSegmentInfo m_shminfo;
QList<QVideoFrame::PixelFormat> m_supportedPixelFormats;
QVector<int> m_formatIds;
QRect m_viewport;
QRect m_displayRect;
QColor m_colorKey;
QVideoFrame m_lastFrame;
bool findPort();
void querySupportedFormats();
int getAttribute(const char *attribute) const;
void setAttribute(const char *attribute, int value);
};
Q_DECLARE_METATYPE(XvImage*)
#endif

View File

@@ -200,7 +200,7 @@ QDir AudioCaptureSession::defaultDir() const
{
QStringList dirCandidates;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
dirCandidates << QLatin1String("/home/user/MyDocs");
#endif

View File

@@ -49,7 +49,7 @@ CameraBinAudioEncoder::CameraBinAudioEncoder(QObject *parent)
{
QList<QByteArray> codecCandidates;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
codecCandidates << "audio/AAC" << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/speex"
<< "audio/ADPCM" << "audio/iLBC" << "audio/vorbis" << "audio/mpeg" << "audio/FLAC";

View File

@@ -129,12 +129,6 @@ void CameraBinControl::setCaptureMode(QCamera::CaptureMode mode)
bool CameraBinControl::isCaptureModeSupported(QCamera::CaptureMode mode) const
{
#ifdef Q_WS_MAEMO_5
//Front camera on N900 supports only video capture
if (m_session->cameraRole() == CameraBinSession::FrontCamera)
return mode == QCamera::CaptureVideo;
#endif
return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo;
}

View File

@@ -101,26 +101,16 @@ qreal CameraBinFocus::opticalZoom() const
qreal CameraBinFocus::digitalZoom() const
{
#ifdef Q_WS_MAEMO_5
gint zoomFactor = 0;
g_object_get(GST_BIN(m_session->cameraBin()), "zoom", &zoomFactor, NULL);
return zoomFactor/100.0;
#else
gfloat zoomFactor = 1.0;
g_object_get(GST_BIN(m_session->cameraBin()), "zoom", &zoomFactor, NULL);
return zoomFactor;
#endif
}
void CameraBinFocus::zoomTo(qreal optical, qreal digital)
{
Q_UNUSED(optical);
digital = qBound(qreal(1.0), digital, qreal(10.0));
#ifdef Q_WS_MAEMO_5
g_object_set(GST_BIN(m_session->cameraBin()), "zoom", qRound(digital*100.0), NULL);
#else
g_object_set(GST_BIN(m_session->cameraBin()), "zoom", digital, NULL);
#endif
emit digitalZoomChanged(digital);
}
@@ -223,13 +213,6 @@ void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state)
void CameraBinFocus::_q_handleCapturedImage()
{
#ifdef Q_WS_MAEMO_5
//N900 lost focus after image capture
if (m_focusStatus != QCamera::Unlocked) {
m_focusStatus = QCamera::Unlocked;
emit _q_focusStatusChanged(QCamera::Unlocked, QCamera::LockLost);
}
#endif
}
void CameraBinFocus::_q_startFocusing()

View File

@@ -52,12 +52,7 @@
//#define DEBUG_CAPTURE
#ifdef Q_WS_MAEMO_5
#define IMAGE_DONE_SIGNAL "img-done"
#else
#define IMAGE_DONE_SIGNAL "image-done"
#endif
Q_DECLARE_METATYPE(QVideoFrame)
Q_DECLARE_METATYPE(QtMultimediaKit::MetaData)

View File

@@ -76,10 +76,6 @@
#include <QtCore/qdebug.h>
#include <QtCore/qprocess.h>
#if defined(Q_WS_MAEMO_5)
#include "camerabuttonlistener_maemo.h"
#endif
#if defined(Q_WS_MAEMO_6)
#include "camerabuttonlistener_meego.h"
#endif
@@ -145,22 +141,13 @@ CameraBinService::CameraBinService(const QString &service, QObject *parent):
connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
new CameraButtonListener(this);
#endif
#if defined(Q_WS_MAEMO_5)
//disable the system camera application
QProcess::execute("/usr/sbin/dsmetool -k /usr/bin/camera-ui");
#endif
}
CameraBinService::~CameraBinService()
{
#if defined(Q_WS_MAEMO_5)
//restore the system camera application
QProcess::execute("/usr/sbin/dsmetool -U user -o /usr/bin/camera-ui");
#endif
}
QMediaControl *CameraBinService::requestControl(const char *name)

View File

@@ -68,33 +68,6 @@
//#define CAMERABIN_DEBUG 1
#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
#ifdef Q_WS_MAEMO_5
#define FILENAME_PROPERTY "filename"
#define MODE_PROPERTY "mode"
#define MUTE_PROPERTY "mute"
#define ZOOM_PROPERTY "zoom"
#define IMAGE_PP_PROPERTY "imagepp"
#define IMAGE_ENCODER_PROPERTY "imageenc"
#define VIDEO_PP_PROPERTY "videopp"
#define VIDEO_ENCODER_PROPERTY "videoenc"
#define AUDIO_ENCODER_PROPERTY "audioenc"
#define VIDEO_MUXER_PROPERTY "videomux"
#define VIEWFINDER_SINK_PROPERTY "vfsink"
#define VIDEO_SOURCE_PROPERTY "videosrc"
#define AUDIO_SOURCE_PROPERTY "audiosrc"
#define VIDEO_SOURCE_CAPS_PROPERTY "inputcaps"
#define FILTER_CAPS_PROPERTY "filter-caps"
#define PREVIEW_CAPS_PROPERTY "preview-caps"
#define IMAGE_DONE_SIGNAL "img-done"
#define CAPTURE_START "user-start"
#define CAPTURE_STOP "user-stop"
#define CAPTURE_PAUSE "user-pause"
#define SET_VIDEO_RESOLUTION_FPS "user-res-fps"
#define SET_IMAGE_RESOLUTION "user-image-res"
#else
#define FILENAME_PROPERTY "filename"
#define MODE_PROPERTY "mode"
#define MUTE_PROPERTY "mute"
@@ -118,7 +91,6 @@
#define CAPTURE_PAUSE "capture-pause"
#define SET_VIDEO_RESOLUTION_FPS "set-video-resolution-fps"
#define SET_IMAGE_RESOLUTION "set-image-resolution"
#endif
#define CAMERABIN_IMAGE_MODE 0
#define CAMERABIN_VIDEO_MODE 1
@@ -135,7 +107,7 @@
//using GST_STATE_READY for QCamera::LoadedState
//doesn't work reliably at least with some webcams.
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
#define USE_READY_STATE_ON_LOADED
#endif
@@ -228,11 +200,6 @@ GstPhotography *CameraBinSession::photography()
CameraBinSession::CameraRole CameraBinSession::cameraRole() const
{
#ifdef Q_WS_MAEMO_5
return m_inputDevice == QLatin1String("/dev/video1") ?
FrontCamera : BackCamera;
#endif
return BackCamera;
}
@@ -475,7 +442,7 @@ QDir CameraBinSession::defaultDir(QCamera::CaptureMode mode) const
{
QStringList dirCandidates;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
dirCandidates << QLatin1String("/home/user/MyDocs/DCIM");
dirCandidates << QLatin1String("/home/user/MyDocs/");
#endif
@@ -1218,12 +1185,7 @@ QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
QSize minSize = res.first();
QSize maxSize = res.last();
#ifdef Q_WS_MAEMO_5
if (mode == QCamera::CaptureVideo && cameraRole() == BackCamera)
maxSize = QSize(848, 480);
if (mode == QCamera::CaptureStillImage)
minSize = QSize(640, 480);
#elif defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
if (cameraRole() == FrontCamera && maxSize.width() > 640)
maxSize = QSize(640, 480);
else if (mode == QCamera::CaptureVideo && maxSize.width() > 1280)

View File

@@ -49,22 +49,7 @@ CameraBinVideoEncoder::CameraBinVideoEncoder(CameraBinSession *session)
:QVideoEncoderControl(session), m_session(session)
{
QList<QByteArray> codecCandidates;
#if defined(Q_WS_MAEMO_5)
codecCandidates << "video/mpeg4" << "video/h264" << "video/h263" << "video/theora"
<< "video/mpeg2" << "video/mpeg1" << "video/mjpeg" << "video/VP8" << "video/h261";
m_elementNames["video/h264"] = "dsph264enc";
m_elementNames["video/mpeg4"] = "dspmp4venc";
m_elementNames["video/h263"] = "dsph263enc";
m_elementNames["video/theora"] = "theoraenc";
m_elementNames["video/mpeg2"] = "ffenc_mpeg2video";
m_elementNames["video/mpeg1"] = "ffenc_mpeg1video";
m_elementNames["video/mjpeg"] = "ffenc_mjpeg";
m_elementNames["video/VP8"] = "vp8enc";
m_elementNames["video/h261"] = "ffenc_h261";
m_codecOptions["video/mpeg4"] = QStringList() << "mode" << "keyframe-interval";
#elif defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
codecCandidates << "video/mpeg4" << "video/h264" << "video/h263";
m_elementNames["video/h264"] = "dsph264enc";

View File

@@ -1,121 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "camerabuttonlistener_maemo.h"
#include <QtDBus/qdbusconnection.h>
#include <QtDBus/qdbusinterface.h>
#include <QtGui/qapplication.h>
#include <QtGui/qevent.h>
#include <QtGui/qwidget.h>
CameraButtonListener::CameraButtonListener(QObject *parent) :
QObject(parent),
m_focusPressed(false),
m_shutterPressed(false)
{
QDBusConnection::systemBus().connect(
QString(),
"/org/freedesktop/Hal/devices/platform_cam_launch",
"org.freedesktop.Hal.Device",
"PropertyModified",
this,
SLOT(updateShuterButtonState()));
QDBusConnection::systemBus().connect(
QString(),
"/org/freedesktop/Hal/devices/platform_cam_focus",
"org.freedesktop.Hal.Device",
"PropertyModified",
this,
SLOT(updateFocusButtonState()));
}
CameraButtonListener::~CameraButtonListener()
{
}
void CameraButtonListener::updateFocusButtonState()
{
QDBusInterface propertyInterface("org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/platform_cam_focus",
"org.freedesktop.Hal.Device",
QDBusConnection::systemBus());
bool pressed = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool();
if (m_focusPressed != pressed) {
m_focusPressed = pressed;
QWidget *window = QApplication::focusWidget();
if (window) {
QApplication::postEvent(window,
new QKeyEvent(pressed ? QEvent::KeyPress : QEvent::KeyRelease,
0x01100021, //Qt::Key_CameraFocus since Qt 4.7.0
Qt::NoModifier));
}
}
}
void CameraButtonListener::updateShuterButtonState()
{
QDBusInterface propertyInterface("org.freedesktop.Hal",
"/org/freedesktop/Hal/devices/platform_cam_launch",
"org.freedesktop.Hal.Device",
QDBusConnection::systemBus());
bool pressed = propertyInterface.call("GetProperty", "button.state.value").arguments().at(0).toBool();
if (m_shutterPressed != pressed) {
m_shutterPressed = pressed;
QWidget *window = QApplication::focusWidget();
if (window) {
QApplication::postEvent(window,
new QKeyEvent(pressed ? QEvent::KeyPress : QEvent::KeyRelease,
0x01100020, //Qt::Key_Camera since Qt 4.7.0
Qt::NoModifier));
}
}
}

View File

@@ -1,64 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef CAMERABUTTONLISTENER_MAEMO_H
#define CAMERABUTTONLISTENER_MAEMO_H
#include <QObject>
class CameraButtonListener : public QObject
{
Q_OBJECT
public:
CameraButtonListener(QObject *parent = 0);
virtual ~CameraButtonListener();
private slots:
void updateFocusButtonState();
void updateShuterButtonState();
private:
bool m_focusPressed;
bool m_shutterPressed;
};
#endif // CAMERABUTTONLISTENER_MAEMO_H

View File

@@ -26,13 +26,6 @@ PKGCONFIG += \
maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10
contains(gstreamer-appsrc_enabled, yes): PKGCONFIG += gstreamer-app-0.10
maemo5 {
HEADERS += camerabuttonlistener_maemo.h
SOURCES += camerabuttonlistener_maemo.cpp
QT += dbus
}
maemo6 {
HEADERS += camerabuttonlistener_meego.h
SOURCES += camerabuttonlistener_meego.cpp
@@ -76,7 +69,7 @@ SOURCES += \
qgstutils.cpp
!win32:!contains(QT_CONFIG,embedded):!mac:!symbian:!simulator:!contains(QT_CONFIG, qpa) {
!win32:!contains(QT_CONFIG,embedded):!mac:!simulator:!contains(QT_CONFIG, qpa) {
LIBS += -lXv -lX11 -lXext
HEADERS += \

View File

@@ -52,9 +52,7 @@ QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
{
QList<QByteArray> codecCandidates;
#if defined(Q_WS_MAEMO_5)
codecCandidates << "audio/PCM"; //<< "audio/AMR" << "audio/AMR-WB" << "audio/speex";
#elif defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
codecCandidates << "audio/AAC" << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
<< "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
#else
@@ -62,7 +60,7 @@ QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
<< "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
#endif
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
m_elementNames["audio/AMR"] = "nokiaamrnbenc";
m_elementNames["audio/AMR-WB"] = "nokiaamrwbenc";
m_elementNames["audio/AAC"] = "nokiaaacenc";

View File

@@ -202,12 +202,7 @@ GstElement *QGstreamerCaptureSession::buildAudioSrc()
if (m_audioInputFactory)
audioSrc = m_audioInputFactory->buildElement();
else {
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
audioSrc = gst_element_factory_make("pulsesrc", "audio_src");
#elif defined(QT_QWS_N810)
audioSrc = gst_element_factory_make("dsppcmsrc", "audio_src");
#else
QString elementName = "alsasrc";
QString device;
@@ -225,7 +220,6 @@ GstElement *QGstreamerCaptureSession::buildAudioSrc()
audioSrc = gst_element_factory_make(elementName.toAscii().constData(), "audio_src");
if (audioSrc && !device.isEmpty())
g_object_set(G_OBJECT(audioSrc), "device", device.toLocal8Bit().constData(), NULL);
#endif
}
if (!audioSrc) {

View File

@@ -252,7 +252,7 @@ QDir QGstreamerRecorderControl::defaultDir() const
{
QStringList dirCandidates;
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
#if defined(Q_WS_MAEMO_6)
dirCandidates << QLatin1String("/home/user/MyDocs");
#endif

View File

@@ -76,11 +76,7 @@ QGstreamerV4L2Input::~QGstreamerV4L2Input()
GstElement *QGstreamerV4L2Input::buildElement()
{
#ifndef Q_WS_MAEMO_5
GstElement *camera = gst_element_factory_make("v4l2src", "camera_source");
#else
GstElement *camera = gst_element_factory_make("v4l2camsrc", "camera_source");
#endif
if (camera && !m_device.isEmpty() )
g_object_set(G_OBJECT(camera), "device", m_device.constData(), NULL);

View File

@@ -57,7 +57,7 @@
#include <QtCore/qdir.h>
#include <QtGui/qdesktopservices.h>
#if defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) || (GST_VERSION_MICRO > 20)
#if defined(Q_WS_MAEMO_6) || (GST_VERSION_MICRO > 20)
#define USE_PLAYBIN2
#endif

View File

@@ -104,10 +104,8 @@ void QGstreamerAudioInputEndpointSelector::update()
{
m_names.clear();
m_descriptions.clear();
#ifndef Q_WS_MAEMO_5
updateAlsaDevices();
updateOssDevices();
#endif
updatePulseDevices();
if (m_names.size() > 0)
m_audioInput = m_names.at(0);
@@ -151,16 +149,11 @@ void QGstreamerAudioInputEndpointSelector::updateOssDevices()
{
QDir devDir("/dev");
devDir.setFilter(QDir::System);
#ifndef QT_QWS_N810
QFileInfoList entries = devDir.entryInfoList(QStringList() << "dsp*");
foreach(const QFileInfo& entryInfo, entries) {
m_names.append(QLatin1String("oss:")+entryInfo.filePath());
m_descriptions.append(QString("OSS device %1").arg(entryInfo.fileName()));
}
#else
m_names.append("dsppcm");
m_descriptions.append("PCM audio input");
#endif
}
void QGstreamerAudioInputEndpointSelector::updatePulseDevices()

View File

@@ -178,12 +178,6 @@ void QGstreamerServicePlugin::updateDevices() const
m_cameraDevices.clear();
m_cameraDescriptions.clear();
#ifdef Q_WS_MAEMO_5
m_cameraDevices << "/dev/video0" << "/dev/video1";
m_cameraDescriptions << tr("Main Camera") << tr("Front Camera");
return;
#endif
#ifdef Q_WS_MAEMO_6
m_cameraDevices << "primary" << "secondary";
m_cameraDescriptions << tr("Main camera") << tr("Front camera");

View File

@@ -132,11 +132,6 @@ void QGstreamerVideoWidgetControl::createVideoWidget()
gst_element_set_state(m_videoSink, GST_STATE_NULL);
g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
#ifdef Q_WS_MAEMO_5
//the overlay xvideo adapter fails to switch winId,
//use "SGX Textured Video" adapter instead
g_object_set(G_OBJECT(m_videoSink), "device", "1", NULL);
#endif
}
}

View File

@@ -457,13 +457,7 @@ bool QX11VideoSurface::findPort()
bool portFound = false;
if (XvQueryAdaptors(QX11Info::display(), m_winId, &count, &adaptors) == Success) {
#ifdef Q_WS_MAEMO_5
//the overlay xvideo adapter fails to switch winId,
//prefer the "SGX Textured Video" adapter instead
for (int i = count-1; i >= 0 && !portFound; --i) {
#else
for (unsigned int i = 0; i < count && !portFound; ++i) {
#endif
if (adaptors[i].type & XvImageMask) {
m_portId = adaptors[i].base_id;

View File

@@ -11,13 +11,3 @@ DESTDIR = $$QT.multimediakit.plugins/$${PLUGIN_TYPE}
HEADERS += qm3uhandler.h
SOURCES += main.cpp \
qm3uhandler.cpp
symbian {
TARGET.UID3 = 0x2002BFC7
TARGET.CAPABILITY = ALL -TCB
TARGET.EPOCALLOWDLLDATA = 1
#make a sis package from plugin + stub (plugin)
pluginDep.sources = $${TARGET}.dll
pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE}
DEPLOYMENT += pluginDep
}

View File

@@ -12,13 +12,13 @@ win32 {
SUBDIRS += audiocapture
}
win32:!wince* {
win32 {
contains(directshow_enabled, yes): SUBDIRS += directshow
}
simulator: SUBDIRS += simulator
unix:!mac:!symbian {
unix:!mac {
TMP_GST_LIBS = \
gstreamer-0.10 >= 0.10.19 \
gstreamer-base-0.10 >= 0.10.19 \
@@ -42,5 +42,3 @@ unix:!mac:!symbian {
mac:!simulator {
SUBDIRS += audiocapture qt7
}
symbian:SUBDIRS += symbian

View File

@@ -1,157 +0,0 @@
INCLUDEPATH += $$PWD
include (../videooutput/videooutput.pri)
# Camera Service
DEFINES += QMEDIA_SYMBIAN_CAMERA
# S60 3.1 platform
contains(S60_VERSION, 3.1) {
DEFINES += S60_31_PLATFORM
DEFINES *= S60_3X_PLATFORM
}
# S60 3.2 platform
contains(S60_VERSION, 3.2) {
DEFINES += S60_32_PLATFORM
DEFINES *= S60_3X_PLATFORM
}
# S60 5.0 platform
!contains(DEFINES, S60_31_PLATFORM) {
!contains(DEFINES, S60_32_PLATFORM) {
!contains(DEFINES, SYMBIAN_3_PLATFORM) {
DEFINES += S60_50_PLATFORM
}
}
}
# Symbian 3 platform
contains(DEFINES, VIDEOOUTPUT_GRAPHICS_SURFACES) {
DEFINES += SYMBIAN_3_PLATFORM
}
# AutoFocusing (CamAutoFocus) from ForumNokia example
contains(symbian_camera_camautofocus_enabled, yes) {
exists($${EPOCROOT}epoc32\\include\\CCamAutoFocus.h) {
message ("CameraBE: Using S60 3.1 autofocusing")
MMP_RULES += \
"$${LITERAL_HASH}ifdef WINSCW" \
"LIBRARY camautofocus.lib" \
"$${LITERAL_HASH}else" \
"STATICLIBRARY camautofocus_s.lib" \
"$${LITERAL_HASH}endif // WINS" \
"MACRO S60_CAM_AUTOFOCUS_SUPPORT"
}
}
# ECam AdvancedSettings
contains(symbian_camera_ecamadvsettings_enabled, yes) {
exists($${EPOCROOT}epoc32\\include\\ecamadvancedsettings.h) {
MMP_RULES += \
"$${LITERAL_HASH}ifndef WINSCW" \
"LIBRARY ecamadvsettings.lib" \
"MACRO USE_S60_32_ECAM_ADVANCED_SETTINGS_HEADER" \
"$${LITERAL_HASH}endif"
message("CameraBE: Using from S60 3.2 CCameraAdvancedSettings header")
}
exists($${EPOCROOT}epoc32\\include\\ecamadvsettings.h) {
symbian:LIBS += -lecamadvsettings
DEFINES += USE_S60_50_ECAM_ADVANCED_SETTINGS_HEADER
message("CameraBE: Using CCameraAdvancedSettings header from S60 5.0 or later")
}
}
# DevVideo API Check (Requires both, DevVideoPlay and DevVideoRecord plugins):
# DevVideoConstants has been problematic since not being included in SDK plugins
# For S60 5.0 this has changed with plugin extension 1.1
# But for S60 3.2 this is still a problem
contains(symbian_camera_devvideorecord_enabled, yes) {
exists($${EPOCROOT}epoc32\\include\\mmf\\devvideo\\devvideorecord.h) {
exists($${EPOCROOT}epoc32\\include\\mmf\\devvideo\\devvideobase.h) {
exists($${EPOCROOT}epoc32\\include\\mmf\\devvideo\\devvideoconstants.h) {
symbian:LIBS += -ldevvideo
DEFINES += S60_DEVVIDEO_RECORDING_SUPPORTED
message("CameraBE: Devvideo API supported")
}
}
}
}
# ECam Snapshot API:
contains(symbian_camera_snapshot_enabled, yes) {
exists($${EPOCROOT}epoc32\\include\\platform\\ecam\\camerasnapshot.h) {
DEFINES += ECAM_PREVIEW_API
message("CameraBE: Using CCameraSnapshot API")
symbian:LIBS += -lecamsnapshot
} else {
message("CameraBE: Using custom snapshot proving methods")
}
} else {
message("CameraBE: Using custom snapshot proving methods")
}
# Libraries:
symbian:LIBS += -lfbscli \
-lmediaclientvideo \
-lecam \
-lbafl \
-lPlatformEnv \
-lcharconv \
-lconvnames \
-lgb2312_shared \
-ljisx0201 \
-ljisx0208 \
-lmmfcontrollerframework \
-lfbscli \
-lefsrv \
-lcone \
-lws32 \
-limageconversion
# Source:
HEADERS += $$PWD/s60cameraconstants.h \
$$PWD/s60cameralockscontrol.h \
$$PWD/s60camerafocuscontrol.h \
$$PWD/s60cameraexposurecontrol.h \
$$PWD/s60cameraflashcontrol.h \
$$PWD/s60cameracontrol.h \
$$PWD/s60mediarecordercontrol.h \
$$PWD/s60videocapturesession.h \
$$PWD/s60imagecapturesession.h \
$$PWD/s60mediacontainercontrol.h \
$$PWD/s60videoencodercontrol.h \
$$PWD/s60audioencodercontrol.h \
$$PWD/s60cameraservice.h \
$$PWD/s60cameraimageprocessingcontrol.h \
$$PWD/s60cameraimagecapturecontrol.h \
$$PWD/s60videodevicecontrol.h \
$$PWD/s60imageencodercontrol.h \
$$PWD/s60camerasettings.h \
$$PWD/s60cameraengine.h \
$$PWD/s60cameraviewfinderengine.h \
$$PWD/s60cameraengineobserver.h \
$$PWD/s60videorenderercontrol.h
SOURCES += $$PWD/s60cameralockscontrol.cpp \
$$PWD/s60camerafocuscontrol.cpp \
$$PWD/s60cameraexposurecontrol.cpp \
$$PWD/s60cameraflashcontrol.cpp \
$$PWD/s60cameracontrol.cpp \
$$PWD/s60mediarecordercontrol.cpp \
$$PWD/s60videocapturesession.cpp \
$$PWD/s60imagecapturesession.cpp \
$$PWD/s60mediacontainercontrol.cpp \
$$PWD/s60videoencodercontrol.cpp \
$$PWD/s60audioencodercontrol.cpp \
$$PWD/s60cameraservice.cpp \
$$PWD/s60cameraimageprocessingcontrol.cpp \
$$PWD/s60cameraimagecapturecontrol.cpp \
$$PWD/s60videodevicecontrol.cpp \
$$PWD/s60imageencodercontrol.cpp \
$$PWD/s60camerasettings.cpp \
$$PWD/s60cameraengine.cpp \
$$PWD/s60cameraviewfinderengine.cpp \
$$PWD/s60videorenderercontrol.cpp
# End of file

View File

@@ -1,40 +0,0 @@
######################################################################
#
# Mobility API project - Symbian Camera backend
#
######################################################################
TEMPLATE = lib
CONFIG += plugin
TARGET = $$qtLibraryTarget(qtmultimediakit_ecamengine)
PLUGIN_TYPE = mediaservice
include (../../../../common.pri)
CONFIG += mobility
MOBILITY += multimedia
# Include here so that all defines are added here also
include(camera_s60.pri)
DEPENDPATH += .
INCLUDEPATH += . \
$${SOURCE_DIR}/include \
$${SOURCE_DIR}/src/multimedia \
$${SOURCE_DIR}/src/multimedia/audio \
$${SOURCE_DIR}/src/multimedia/video \
$${SOURCE_DIR}
HEADERS += s60cameraserviceplugin.h
SOURCES += s60cameraserviceplugin.cpp
load(data_caging_paths)
TARGET.EPOCALLOWDLLDATA = 1
TARGET.UID3 = 0x2002BFC2
TARGET.CAPABILITY = ALL -TCB
# Make a sis package from plugin + api + stub (plugin)
pluginDep.sources = $${TARGET}.dll
pluginDep.path = $${QT_PLUGINS_BASE_DIR}/$${PLUGIN_TYPE}
DEPLOYMENT += pluginDep

View File

@@ -1,159 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "s60audioencodercontrol.h"
#include "s60videocapturesession.h"
S60AudioEncoderControl::S60AudioEncoderControl(QObject *parent) :
QAudioEncoderControl(parent)
{
}
S60AudioEncoderControl::S60AudioEncoderControl(S60VideoCaptureSession *session, QObject *parent) :
QAudioEncoderControl(parent)
{
m_session = session;
}
S60AudioEncoderControl::~S60AudioEncoderControl()
{
}
QStringList S60AudioEncoderControl::supportedAudioCodecs() const
{
return m_session->supportedAudioCaptureCodecs();
}
QString S60AudioEncoderControl::codecDescription(const QString &codecName) const
{
// According to ForumNokia MMF camcorder plugin supports AAC, AMR and QCELP
// QCELP is speech codec and can be discarded
if (qstrcmp(codecName.toLocal8Bit().constData(), "audio/aac") == 0)
return QLatin1String("Advanced Audio Coding");
else if (qstrcmp(codecName.toLocal8Bit().constData(), "audio/amr") == 0)
return QLatin1String("Adaptive Multi-Rate Audio Codec");
return QString();
}
QStringList S60AudioEncoderControl::supportedEncodingOptions(const QString &codec) const
{
// Possible settings: EncodingMode, Codec, BitRate, ChannelCount, SampleRate, Quality
// Possible (codec specific) Options: None
Q_UNUSED(codec);
return QStringList();
}
QVariant S60AudioEncoderControl::encodingOption(const QString &codec, const QString &name) const
{
// Possible settings: EncodingMode, Codec, BitRate, ChannelCount, SampleRate, Quality
// Possible (codec specific) Options: None
Q_UNUSED(codec);
Q_UNUSED(name);
return QVariant();
}
void S60AudioEncoderControl::setEncodingOption(
const QString &codec, const QString &name, const QVariant &value)
{
m_session->setError(KErrNotSupported, tr("Audio encoding option is not supported"));
// The audio settings can currently be set only using setAudioSettings() function
Q_UNUSED(value)
Q_UNUSED(codec)
Q_UNUSED(name)
}
QList<int> S60AudioEncoderControl::supportedSampleRates(
const QAudioEncoderSettings &settings, bool *continuous) const
{
return m_session->supportedSampleRates(settings, continuous);
}
QAudioEncoderSettings S60AudioEncoderControl::audioSettings() const
{
QAudioEncoderSettings settings;
m_session->audioEncoderSettings(settings);
return settings;
}
void S60AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
{
// Notify that settings have been implicitly set and there's no need to
// initialize them in case camera is changed
m_session->notifySettingsSet();
// Quality defines SampleRate/BitRate combination if either or both are missing
if (settings.codec().isEmpty()) { // Empty settings
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EOnlyAudioQuality);
} else if (settings.bitRate() == -1 && settings.sampleRate() != -1) { // Only SampleRate set
m_session->setAudioCaptureCodec(settings.codec());
m_session->setAudioChannelCount(settings.channelCount());
m_session->setAudioSampleRate(settings.sampleRate());
m_session->setAudioEncodingMode(settings.encodingMode());
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EAudioQualityAndSampleRate);
} else if (settings.bitRate() != -1 && settings.sampleRate() == -1) { // Only BitRate set
m_session->setAudioCaptureCodec(settings.codec());
m_session->setAudioChannelCount(settings.channelCount());
m_session->setAudioBitRate(settings.bitRate());
m_session->setAudioEncodingMode(settings.encodingMode());
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EAudioQualityAndBitRate);
} else if (settings.bitRate() == -1 && settings.sampleRate() == -1) { // No BitRate or SampleRate set
m_session->setAudioCaptureCodec(settings.codec());
m_session->setAudioChannelCount(settings.channelCount());
m_session->setAudioEncodingMode(settings.encodingMode());
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::EOnlyAudioQuality);
} else { // Both SampleRate and BitRate set
m_session->setAudioCaptureCodec(settings.codec());
m_session->setAudioChannelCount(settings.channelCount());
m_session->setAudioSampleRate(settings.sampleRate());
m_session->setAudioBitRate(settings.bitRate());
m_session->setAudioEncodingMode(settings.encodingMode());
m_session->setAudioCaptureQuality(settings.quality(), S60VideoCaptureSession::ENoAudioQuality);
}
}
// End of file

View File

@@ -1,90 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60AUDIOENCODERCONTROL_H
#define S60AUDIOENCODERCONTROL_H
#include <QtCore/qstringlist.h>
#include <QtCore/qmap.h>
#include <qaudioencodercontrol.h>
QT_USE_NAMESPACE
class S60VideoCaptureSession;
/*
* Control for audio settings when recording video using QMediaRecorder.
*/
class S60AudioEncoderControl : public QAudioEncoderControl
{
Q_OBJECT
public: // Constructor & Destructor
S60AudioEncoderControl(QObject *parent = 0);
S60AudioEncoderControl(S60VideoCaptureSession *session, QObject *parent = 0);
virtual ~S60AudioEncoderControl();
public: // QAudioEncoderControl
// Audio Codec
QStringList supportedAudioCodecs() const;
QString codecDescription(const QString &codecName) const;
// Sample Rate
QList<int> supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous = 0) const;
// Audio Settings
QAudioEncoderSettings audioSettings() const;
void setAudioSettings(const QAudioEncoderSettings &settings);
// Encoding Option
QStringList supportedEncodingOptions(const QString &codec) const;
QVariant encodingOption(const QString &codec, const QString &name) const;
void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
private: // Data
S60VideoCaptureSession* m_session;
};
#endif // S60AUDIOENCODERCONTROL_H

View File

@@ -1,257 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERACONSTANTS_H
#define S60CAMERACONSTANTS_H
//=============================================================================
// GENERAL SETTINGS
#define KDefaultCameraDevice 0
#define KECamCameraPriority 0
#define KInactivityTimerTimeout 30000 // msec
#define KSymbianFineResolutionFactor 100.0
#define KDefaultOpticalZoom 1.0
#define KDefaultDigitalZoom 1.0
#define KSmoothZoomStep 1
#define KDefaultFocusMode QCameraFocus::AutoFocus
#define KDefaultViewfinderSize QSize(320,240)
#define KDefaultSizePreview_Normal TSize(640,480)
#define KDefaultSizePreview_Wide TSize(640,360)
#define KDefaultSizePreview_CIF TSize(352,288)
#define KDefaultSizePreview_PAL TSize(640,512)
#define KDefaultSizePreview_NTSC TSize(640,426)
#define KDefaultFormatPreview CCamera::EFormatFbsBitmapColor16MU
#define KViewfinderFrameRate 30
#define KMaxVFErrorsSignalled 3
//=============================================================================
// IMAGE SETTINGS
#define KDefaultImagePath QLatin1String("c:\\Data\\Images")
#define KDefaultImageFileName QLatin1String("image.jpg")
#define KDefaultImageCodec QLatin1String("image/jpeg")
#define KDefaultImageFormatPrimaryCam CCamera::EFormatExif
#ifdef SYMBIAN_3_PLATFORM
#define KDefaultImageFormatSecondaryCam CCamera::EFormatExif
#define KDefaultImageResolution QSize(3264, 2448)
#else // Pre-Symbian3 Platforms
#define KDefaultImageFormatSecondaryCam CCamera::EFormatFbsBitmapColor64K
#define KDefaultImageResolution QSize(2048, 1536)
#endif // SYMBIAN_3_PLATFORM
#define KSymbianImageQualityCoefficient 25
// This must be divisible by 4 and creater or equal to 8
#define KSnapshotDownScaleFactor 8
#define KSnapshotMinWidth 640
#define KSnapshotMinHeight 360
#define KJpegQualityVeryLow 40
#define KJpegQualityLow 50
#define KJpegQualityNormal 75
#define KJpegQualityHigh 85
#define KJpegQualityVeryHigh 95
#define KDefaultImageQuality KJpegQualityHigh
//=============================================================================
// VIDEO SETTINGS
// ================
// General settings
// ================
// Dummy file name to execute CVideoRecorderUtility::OpenFileL() without
// knowing the actual outputLocation. This is needed to be able to query/set
// supported video settings.
_LIT(KDummyVideoFile, "c:\\data\\temp");
// Default container MIME type
#define KMimeTypeDefaultContainer QLatin1String("video/mp4")
#define KDefaultVideoPath QLatin1String("c:\\Data\\Videos")
#define KDefaultVideoFileName QLatin1String("video.mp4")
#define KDurationChangedInterval 1000 // 1 second
// ==============
// Audio Settings
// ==============
// Default audio codec MIME type
#define KMimeTypeDefaultAudioCodec QLatin1String("audio/aac")
// Default audio settings for video recording
#define KDefaultChannelCount -1 // Not Supported on Symbian
#define KDefaultBitRate 32000 // 32kbps
#define KDefaultSampleRate -1 // Not Supported on Symbian
// ==============
// Video Settings
// ==============
// Default video codec MIME type
#ifdef SYMBIAN_3_PLATFORM
// H.264: BaselineProfile Level 3.1, Max resolution: 1280x720
#define KMimeTypeDefaultVideoCodec QLatin1String("video/H264; profile-level-id=42801F")
#else
// MPEG-4: Simple Profile, Level 4, Max resolution: 640x480
#define KMimeTypeDefaultVideoCodec QLatin1String("video/mp4v-es; profile-level-id=4")
#endif
// Maximum resolutions for encoder MIME Types
// H.263
#define KResH263 QSize(176,144);
#define KResH263_Profile0 QSize(176,144);
#define KResH263_Profile0_Level10 QSize(176,144);
#define KResH263_Profile0_Level20 QSize(352,288);
#define KResH263_Profile0_Level30 QSize(352,288);
#define KResH263_Profile0_Level40 QSize(352,288);
#define KResH263_Profile0_Level45 QSize(176,144);
#define KResH263_Profile0_Level50 QSize(352,288);
#define KResH263_Profile3 QSize(176,144);
// MPEG-4
#define KResMPEG4 QSize(176,144);
#define KResMPEG4_PLID_1 QSize(176,144);
#define KResMPEG4_PLID_2 QSize(352,288);
#define KResMPEG4_PLID_3 QSize(352,288);
#define KResMPEG4_PLID_4 QSize(640,480);
#define KResMPEG4_PLID_5 QSize(720,576);
#define KResMPEG4_PLID_6 QSize(1280,720);
#define KResMPEG4_PLID_8 QSize(176,144);
#define KResMPEG4_PLID_9 QSize(176,144);
// H.264 (Baseline Profile, same resolutions apply to Main and High Profile)
#define KResH264 QSize(176,144);
#define KResH264_PLID_42800A QSize(176,144);
#define KResH264_PLID_42900B QSize(176,144);
#define KResH264_PLID_42800B QSize(352,288);
#define KResH264_PLID_42800C QSize(352,288);
#define KResH264_PLID_42800D QSize(352,288);
#define KResH264_PLID_428014 QSize(352,288);
#define KResH264_PLID_428015 QSize(352,288);
#define KResH264_PLID_428016 QSize(640,480);
#define KResH264_PLID_42801E QSize(640,480);
#define KResH264_PLID_42801F QSize(1280,720);
#define KResH264_PLID_428020 QSize(1280,720);
#define KResH264_PLID_428028 QSize(1920,1080);
// Maximum framerates for encoder MIME Types
// H.263
#define KFrR_H263 qreal(15);
#define KFrR_H263_Profile0 qreal(15);
#define KFrR_H263_Profile0_Level10 qreal(15);
#define KFrR_H263_Profile0_Level20 qreal(15);
#define KFrR_H263_Profile0_Level30 qreal(30);
#define KFrR_H263_Profile0_Level40 qreal(30);
#define KFrR_H263_Profile0_Level45 qreal(15);
#define KFrR_H263_Profile0_Level50 qreal(15);
#define KFrR_H263_Profile3 qreal(15);
// MPEG-4
#define KFrR_MPEG4 qreal(15);
#define KFrR_MPEG4_PLID_1 qreal(15);
#define KFrR_MPEG4_PLID_2 qreal(15);
#define KFrR_MPEG4_PLID_3 qreal(30);
// This is a workaround for a known platform bug
#if (defined(S60_31_PLATFORM) | defined(S60_32_PLATFORM))
#define KFrR_MPEG4_PLID_4 qreal(15);
#else // All other platforms
#define KFrR_MPEG4_PLID_4 qreal(30);
#endif // S60 3.1 or 3.2
#define KFrR_MPEG4_PLID_5 qreal(30);
#define KFrR_MPEG4_PLID_6 qreal(30);
#define KFrR_MPEG4_PLID_8 qreal(15);
#define KFrR_MPEG4_PLID_9 qreal(15);
// H.264 (Baseline Profile, same framerates apply to Main and High Profile)
#define KFrR_H264 qreal(15);
#define KFrR_H264_PLID_42800A qreal(15);
#define KFrR_H264_PLID_42900B qreal(15);
#define KFrR_H264_PLID_42800B qreal(7.5);
#define KFrR_H264_PLID_42800C qreal(15);
#define KFrR_H264_PLID_42800D qreal(30);
#define KFrR_H264_PLID_428014 qreal(30);
#define KFrR_H264_PLID_428015 qreal(50);
#define KFrR_H264_PLID_428016 qreal(16.9);
#define KFrR_H264_PLID_42801E qreal(33.8);
#define KFrR_H264_PLID_42801F qreal(30);
#define KFrR_H264_PLID_428020 qreal(60);
#define KFrR_H264_PLID_428028 qreal(30);
// Maximum bitrates for encoder MIME Types
// H.263
#define KBiR_H263 int(64000);
#define KBiR_H263_Profile0 int(64000);
#define KBiR_H263_Profile0_Level10 int(64000);
#define KBiR_H263_Profile0_Level20 int(128000);
#define KBiR_H263_Profile0_Level30 int(384000);
#define KBiR_H263_Profile0_Level40 int(2048000);
#define KBiR_H263_Profile0_Level45 int(128000);
#define KBiR_H263_Profile0_Level50 int(4096000);
#define KBiR_H263_Profile3 int(64000);
// MPEG-4
#define KBiR_MPEG4 int(64000);
#define KBiR_MPEG4_PLID_1 int(64000);
#define KBiR_MPEG4_PLID_2 int(128000);
#define KBiR_MPEG4_PLID_3 int(384000);
// This is a workaround for a known platform bug
#if (defined(S60_31_PLATFORM) | defined(S60_32_PLATFORM))
#define KBiR_MPEG4_PLID_4 int(2000000);
#else // All other platforms
#define KBiR_MPEG4_PLID_4 int(4000000);
#endif // S60 3.1 or 3.2
#define KBiR_MPEG4_PLID_5 int(8000000);
#define KBiR_MPEG4_PLID_6 int(12000000);
#define KBiR_MPEG4_PLID_8 int(64000);
#define KBiR_MPEG4_PLID_9 int(128000);
// H.264 (Baseline Profile, same bitrates apply to Main and High Profile)
#define KBiR_H264 int(64000);
#define KBiR_H264_PLID_42800A int(64000);
#define KBiR_H264_PLID_42900B int(128000);
#define KBiR_H264_PLID_42800B int(192000);
#define KBiR_H264_PLID_42800C int(384000);
#define KBiR_H264_PLID_42800D int(768000);
#define KBiR_H264_PLID_428014 int(2000000);
#define KBiR_H264_PLID_428015 int(4000000);
#define KBiR_H264_PLID_428016 int(4000000);
#define KBiR_H264_PLID_42801E int(10000000);
#define KBiR_H264_PLID_42801F int(14000000);
#define KBiR_H264_PLID_428020 int(20000000);
#define KBiR_H264_PLID_428028 int(20000000);
#endif // S60CAMERACONSTANTS_H

View File

@@ -1,983 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include <QTimer>
#include "s60cameraservice.h"
#include "s60cameraengine.h"
#include "s60cameracontrol.h"
#include "s60imagecapturesession.h"
#include "s60videowidgetcontrol.h"
#include "s60cameraviewfinderengine.h"
#include "s60cameraconstants.h"
S60CameraControl::S60CameraControl(QObject *parent) :
QCameraControl(parent)
{
}
S60CameraControl::S60CameraControl(S60VideoCaptureSession *videosession,
S60ImageCaptureSession *imagesession,
QObject *parent):
QCameraControl(parent),
m_cameraEngine(0),
m_viewfinderEngine(0),
m_imageSession(0),
m_videoSession(0),
m_advancedSettings(0),
m_videoOutput(0),
m_inactivityTimer(0),
m_captureMode(QCamera::CaptureStillImage), // Default CaptureMode
m_requestedCaptureMode(QCamera::CaptureStillImage),
m_settingCaptureModeInternally(false),
m_internalState(QCamera::UnloadedStatus), // Default Status
m_requestedState(QCamera::UnloadedState), // Default State
m_deviceIndex(KDefaultCameraDevice),
m_error(KErrNone),
m_changeCaptureModeWhenReady(false),
m_rotateCameraWhenReady(false),
m_videoCaptureState(S60VideoCaptureSession::ENotInitialized)
{
m_videoSession = videosession;
m_imageSession = imagesession;
m_inactivityTimer = new QTimer;
if (m_inactivityTimer)
m_inactivityTimer->setSingleShot(true);
TRAPD(err, m_cameraEngine = CCameraEngine::NewL(m_deviceIndex, KECamCameraPriority, this));
if (err) {
m_error = err;
if (err == KErrPermissionDenied)
qWarning("Failed to create camera. Possibly missing capabilities.");
else
qWarning("Failed to create camera.");
return;
}
m_viewfinderEngine = new S60CameraViewfinderEngine(this, m_cameraEngine, this);
if (m_viewfinderEngine == 0) {
m_error = KErrNoMemory;
qWarning("Failed to create viewfinder engine.");
return;
}
// Connect signals
connect(m_inactivityTimer, SIGNAL(timeout()), this, SLOT(toStandByStatus()));
connect(this, SIGNAL(statusChanged(QCamera::Status)),
m_imageSession, SLOT(cameraStatusChanged(QCamera::Status)));
connect(this, SIGNAL(statusChanged(QCamera::Status)),
m_videoSession, SLOT(cameraStatusChanged(QCamera::Status)));
connect(m_videoSession, SIGNAL(stateChanged(S60VideoCaptureSession::TVideoCaptureState)),
this, SLOT(videoStateChanged(S60VideoCaptureSession::TVideoCaptureState)));
connect(m_imageSession, SIGNAL(advancedSettingChanged()), this, SLOT(advancedSettingsCreated()));
connect(this, SIGNAL(cameraReadyChanged(bool)), m_imageSession, SIGNAL(readyForCaptureChanged(bool)));
connect(m_viewfinderEngine, SIGNAL(error(int, const QString&)), this, SIGNAL(error(int,const QString&)));
connect(m_imageSession, SIGNAL(cameraError(int, const QString&)), this, SIGNAL(error(int, const QString&)));
connect(m_imageSession, SIGNAL(captureSizeChanged(const QSize&)),
m_viewfinderEngine, SLOT(handleContentAspectRatioChange(const QSize&)));
connect(m_videoSession, SIGNAL(captureSizeChanged(const QSize&)),
m_viewfinderEngine, SLOT(handleContentAspectRatioChange(const QSize&)));
setCameraHandles();
}
S60CameraControl::~S60CameraControl()
{
unloadCamera();
if (m_viewfinderEngine) {
delete m_viewfinderEngine;
m_viewfinderEngine = 0;
}
// Make sure AdvancedSettings are destructed
m_imageSession->deleteAdvancedSettings();
if (m_cameraEngine) {
delete m_cameraEngine;
m_cameraEngine = 0;
}
if (m_inactivityTimer) {
delete m_inactivityTimer;
m_inactivityTimer = 0;
}
}
void S60CameraControl::setState(QCamera::State state)
{
if (m_error) { // Most probably failure in contructor
setError(m_error, tr("Unexpected camera error."));
return;
}
if (m_requestedState == state)
return;
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
// Save the target state
m_requestedState = state;
emit stateChanged(m_requestedState);
switch (state) {
case QCamera::UnloadedState: // To UnloadedState - Release resources
switch (m_internalState) {
case QCamera::UnloadedStatus:
// Do nothing
break;
case QCamera::LoadingStatus:
case QCamera::StartingStatus:
// Release resources when ready (setting state handles this)
return;
case QCamera::LoadedStatus:
case QCamera::StandbyStatus:
// Unload
unloadCamera();
break;
case QCamera::ActiveStatus:
// Stop and Unload
stopCamera();
unloadCamera();
break;
default:
// Unrecognized internal state (Status)
setError(KErrGeneral, tr("Unexpected camera error."));
return;
}
break;
case QCamera::LoadedState: // To LoadedState - Reserve resources OR Stop ViewFinder and Cancel Capture
switch (m_internalState) {
case QCamera::UnloadedStatus:
case QCamera::StandbyStatus:
// Load
loadCamera();
break;
case QCamera::LoadingStatus:
// Discard, already moving to LoadedStatus
return;
case QCamera::StartingStatus:
// Stop when ready (setting state handles this)
return;
case QCamera::LoadedStatus:
m_inactivityTimer->start(KInactivityTimerTimeout);
break;
case QCamera::ActiveStatus:
// Stop
stopCamera();
break;
default:
// Unregocnized internal state (Status)
setError(KErrGeneral, tr("Unexpected camera error."));
return;
}
break;
case QCamera::ActiveState: // To ActiveState - (Reserve Resources and) Start ViewFinder
switch (m_internalState) {
case QCamera::UnloadedStatus:
case QCamera::StandbyStatus:
// Load and Start (setting state handles starting)
loadCamera();
break;
case QCamera::LoadingStatus:
// Start when loaded (setting state handles this)
break;
case QCamera::StartingStatus:
// Discard, already moving to ActiveStatus
return;
case QCamera::LoadedStatus:
// Start
startCamera();
break;
case QCamera::ActiveStatus:
// Do nothing
break;
default:
// Unregocnized internal state (Status)
setError(KErrGeneral, tr("Unexpected camera error."));
return;
}
break;
default:
setError(KErrNotSupported, tr("Requested state is not supported."));
return;
}
}
QCamera::State S60CameraControl::state() const
{
return m_requestedState;
}
QCamera::Status S60CameraControl::status() const
{
return m_internalState;
}
QCamera::CaptureMode S60CameraControl::captureMode() const
{
return m_captureMode;
}
void S60CameraControl::setCaptureMode(QCamera::CaptureMode mode)
{
if (m_error) { // Most probably failure in contructor
setError(m_error, tr("Unexpected camera error."));
return;
}
if (m_captureMode == mode)
return;
// Setting CaptureMode Internally or Externally (Client)
if (!m_settingCaptureModeInternally) {
// Save the requested mode
m_requestedCaptureMode = mode;
// CaptureMode change pending (backend busy), wait
if (m_changeCaptureModeWhenReady)
return;
} else {
m_changeCaptureModeWhenReady = false; // Reset
}
m_settingCaptureModeInternally = false; // Reset
if (!isCaptureModeSupported(mode)) {
setError(KErrNotSupported, tr("Requested capture mode is not supported."));
return;
}
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
switch (m_internalState) {
case QCamera::UnloadedStatus:
case QCamera::LoadedStatus:
case QCamera::StandbyStatus:
switch (mode) {
case QCamera::CaptureStillImage:
m_videoSession->releaseVideoRecording();
m_captureMode = QCamera::CaptureStillImage;
if (m_internalState == QCamera::LoadedStatus)
m_inactivityTimer->start(KInactivityTimerTimeout);
else if (m_internalState == QCamera::StandbyStatus)
loadCamera();
break;
case QCamera::CaptureVideo:
m_imageSession->releaseImageCapture();
m_captureMode = QCamera::CaptureVideo;
if (m_internalState == QCamera::LoadedStatus) {
// Revet InternalState as we need to wait for the video
// side initialization to complete
m_internalState = QCamera::LoadingStatus;
emit statusChanged(m_internalState);
int prepareSuccess = m_videoSession->initializeVideoRecording();
setError(prepareSuccess, tr("Loading video capture failed."));
} else if (m_internalState == QCamera::StandbyStatus)
loadCamera();
break;
}
break;
case QCamera::LoadingStatus:
case QCamera::StartingStatus:
m_changeCaptureModeWhenReady = true;
return;
case QCamera::ActiveStatus:
// Stop, Change Mode and Start again
stopCamera();
switch (mode) {
case QCamera::CaptureStillImage:
m_videoSession->releaseVideoRecording();
m_captureMode = QCamera::CaptureStillImage;
startCamera();
break;
case QCamera::CaptureVideo:
m_imageSession->releaseImageCapture();
m_captureMode = QCamera::CaptureVideo;
// Revet InternalState as we need to wait for the video
// side initialization to complete
m_internalState = QCamera::LoadingStatus;
emit statusChanged(m_internalState);
int prepareSuccess = m_videoSession->initializeVideoRecording();
setError(prepareSuccess, tr("Loading video recorder failed."));
break;
}
break;
default:
// Unregocnized internal state (Status)
setError(KErrNotSupported, tr("Requested capture mode is not supported."));
break;
}
emit captureModeChanged(mode);
}
bool S60CameraControl::isCaptureModeSupported(QCamera::CaptureMode mode) const
{
switch (mode) {
case QCamera::CaptureStillImage:
return true;
case QCamera::CaptureVideo:
return true;
default:
return false;
}
}
bool S60CameraControl::canChangeProperty(QCameraControl::PropertyChangeType changeType, QCamera::Status status) const
{
Q_UNUSED(status);
bool returnValue = false;
switch (changeType) {
case QCameraControl::CaptureMode:
case QCameraControl::VideoEncodingSettings:
case QCameraControl::ImageEncodingSettings:
returnValue = true;
break;
case QCameraControl::Viewfinder:
returnValue = false;
break;
default:
// Safer to revert state before the unknown operation
returnValue = false;
break;
}
return returnValue;
}
void S60CameraControl::setVideoOutput(QObject *output,
S60CameraViewfinderEngine::ViewfinderOutputType type)
{
if (!m_viewfinderEngine) {
setError(KErrGeneral, tr("Failed to set viewfinder"));
return;
}
switch (type) {
case S60CameraViewfinderEngine::OutputTypeVideoWidget:
m_viewfinderEngine->setVideoWidgetControl(output);
break;
case S60CameraViewfinderEngine::OutputTypeRenderer:
m_viewfinderEngine->setVideoRendererControl(output);
break;
case S60CameraViewfinderEngine::OutputTypeVideoWindow:
m_viewfinderEngine->setVideoWindowControl(output);
break;
default:
break;
}
}
void S60CameraControl::releaseVideoOutput(const S60CameraViewfinderEngine::ViewfinderOutputType type)
{
m_viewfinderEngine->releaseControl(type);
}
void S60CameraControl::loadCamera()
{
if (m_internalState < QCamera::LoadingStatus) {
m_internalState = QCamera::LoadingStatus;
emit statusChanged(m_internalState);
} else if (m_internalState == QCamera::LoadedStatus
|| m_internalState >= QCamera::StartingStatus) {
// Nothing to load (already loaded)
return;
}
// Status = Loading or Standby
m_cameraEngine->ReserveAndPowerOn();
// Completion notified in MceoCameraReady()
}
void S60CameraControl::unloadCamera()
{
if (m_internalState > QCamera::LoadingStatus) {
m_internalState = QCamera::LoadingStatus;
emit statusChanged(m_internalState);
} else if (m_internalState < QCamera::LoadingStatus) {
// Nothing to unload
return;
}
// Status = Loading
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
m_cameraEngine->ReleaseAndPowerOff();
m_internalState = QCamera::UnloadedStatus;
emit statusChanged(m_internalState);
}
void S60CameraControl::startCamera()
{
if (m_internalState < QCamera::StartingStatus) {
m_internalState = QCamera::StartingStatus;
emit statusChanged(m_internalState);
} else if (m_internalState > QCamera::StartingStatus) {
// Nothing to start (already started)
return;
}
// Status = Starting
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
if (m_viewfinderEngine)
m_viewfinderEngine->startViewfinder();
else
setError(KErrGeneral, tr("Failed to start viewfinder."));
m_internalState = QCamera::ActiveStatus;
emit statusChanged(m_internalState);
emit cameraReadyChanged(true);
#ifdef Q_CC_NOKIAX86 // Emulator
MceoCameraReady(); // Signal that we are ready
#endif
}
void S60CameraControl::stopCamera()
{
if (m_internalState > QCamera::StartingStatus) {
m_internalState = QCamera::StartingStatus;
emit statusChanged(m_internalState);
} else if (m_internalState < QCamera::StartingStatus) {
// Nothing to stop
return;
}
// Status = Starting
// Cancel ongoing operations if any
m_imageSession->cancelCapture();
m_videoSession->stopRecording();
emit cameraReadyChanged(false);
if (m_viewfinderEngine)
m_viewfinderEngine->stopViewfinder();
else
setError(KErrGeneral, tr("Failed to stop viewfinder."));
m_internalState = QCamera::LoadedStatus;
emit statusChanged(m_internalState);
m_inactivityTimer->start(KInactivityTimerTimeout);
}
void S60CameraControl::videoStateChanged(const S60VideoCaptureSession::TVideoCaptureState state)
{
// Save video state
m_videoCaptureState = state;
if (m_rotateCameraWhenReady) {
if (m_videoCaptureState != S60VideoCaptureSession::ERecording &&
m_videoCaptureState != S60VideoCaptureSession::EPaused)
resetCameraOrientation();
}
// If video recording was stopped, video state reverts back to
// Initializing. In that case revert also Camera status to notify that
// video initialization needs to be completed.
if (state == S60VideoCaptureSession::EInitializing) {
if (m_internalState > QCamera::LoadingStatus) {
m_internalState = QCamera::LoadingStatus;
emit statusChanged(m_internalState);
}
// Handle video initialization completion
} else if (state == S60VideoCaptureSession::EInitialized) {
// Make sure state is not downgraded
if (m_internalState == QCamera::LoadedStatus
|| m_internalState == QCamera::ActiveStatus) {
// Do nothing (already in target state)
} else if (m_internalState == QCamera::StartingStatus) {
m_internalState = QCamera::ActiveStatus;
emit statusChanged(m_internalState);
} else {
m_internalState = QCamera::LoadedStatus;
emit statusChanged(m_internalState);
}
switch (m_requestedState) {
case QCamera::UnloadedState:
stopCamera();
unloadCamera();
if (m_changeCaptureModeWhenReady) {
m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
}
break;
case QCamera::LoadedState:
stopCamera();
if (m_changeCaptureModeWhenReady) {
m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
}
m_inactivityTimer->start(KInactivityTimerTimeout);
break;
case QCamera::ActiveState:
if (m_changeCaptureModeWhenReady) {
m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
}
startCamera();
break;
default:
setError(KErrGeneral, tr("Unexpected camera error."));
return;
}
}
}
void S60CameraControl::imageCaptured(const int imageId, const QImage& preview)
{
Q_UNUSED(imageId);
Q_UNUSED(preview);
// Unsubscribe the readyForCaptureChanged notification
disconnect(m_imageSession, SIGNAL(imageCaptured(const int, const QImage&)),
this, SLOT(imageCaptured(const int, const QImage&)));
if (m_rotateCameraWhenReady)
resetCameraOrientation();
}
void S60CameraControl::advancedSettingsCreated()
{
m_advancedSettings = m_imageSession->advancedSettings();
if (m_advancedSettings)
connect(m_advancedSettings, SIGNAL(error(int, const QString&)), this, SIGNAL(error(int, const QString&)));
}
void S60CameraControl::MceoCameraReady()
{
// Rotate camera if requested
if (m_rotateCameraWhenReady) {
resetCameraOrientation();
return;
}
if (m_internalState != QCamera::LoadedStatus) {
switch (m_requestedState) {
case QCamera::UnloadedState:
m_internalState = QCamera::LoadedStatus;
emit statusChanged(QCamera::LoadedStatus);
stopCamera();
unloadCamera();
if (m_changeCaptureModeWhenReady) {
m_settingCaptureModeInternally = true;
setCaptureMode(m_requestedCaptureMode);
}
break;
case QCamera::LoadedState:
if (m_captureMode == QCamera::CaptureVideo) {
int prepareSuccess = m_videoSession->initializeVideoRecording();
setError(prepareSuccess, tr("Loading video capture failed."));
// State change signalled when reservation is complete (in videoStateChanged())
return;
}
m_internalState = QCamera::LoadedStatus;
emit statusChanged(QCamera::LoadedStatus);
if (m_changeCaptureModeWhenReady) {
setCaptureMode(m_requestedCaptureMode);
m_changeCaptureModeWhenReady = false; // Reset
}
if (m_requestedState == QCamera::LoadedStatus &&
m_internalState == QCamera::LoadedStatus)
m_inactivityTimer->start(KInactivityTimerTimeout);
break;
case QCamera::ActiveState:
if (m_captureMode == QCamera::CaptureVideo) {
int prepareSuccess = m_videoSession->initializeVideoRecording();
setError(prepareSuccess, tr("Loading video capture failed."));
// State change signalled when reservation is complete (in videoStateChanged())
return;
}
m_internalState = QCamera::LoadedStatus;
emit statusChanged(QCamera::LoadedStatus);
if (m_changeCaptureModeWhenReady) {
setCaptureMode(m_requestedCaptureMode);
m_changeCaptureModeWhenReady = false; // Reset
}
startCamera();
break;
default:
setError(KErrGeneral, tr("Unexpected camera error."));
return;
}
}
}
void S60CameraControl::MceoHandleError(TCameraEngineError aErrorType, TInt aError)
{
Q_UNUSED(aErrorType);
if (aError == KErrAccessDenied) {
setError(KErrGeneral, tr("Access to camera device was rejected."));
} else if (aError == KErrHardwareNotAvailable) {
setError(aError, tr("Camera resources were lost."));
toStandByStatus();
}
else
setError(aError, tr("Unexpected camera error."));
}
void S60CameraControl::setError(const TInt error, const QString &description)
{
if (error == KErrNone)
return;
m_error = error;
QCamera::Error cameraError = fromSymbianErrorToQtMultimediaError(m_error);
emit this->error(int(cameraError), description);
// Reset everything, if other than not supported error or resource loss
if (error != KErrNotSupported && error != KErrHardwareNotAvailable)
resetCamera(true); // Try to recover from error
else
m_error = KErrNone; // Reset error
}
QCamera::Error S60CameraControl::fromSymbianErrorToQtMultimediaError(int aError)
{
switch(aError) {
case KErrNone:
return QCamera::NoError; // No errors have occurred
case KErrNotSupported:
return QCamera::NotSupportedFeatureError; // The feature is not supported
case KErrNotFound:
case KErrBadHandle:
return QCamera::ServiceMissingError; // No camera service available
case KErrArgument:
case KErrNotReady:
return QCamera::InvalidRequestError; // Invalid parameter or state
default:
return QCamera::CameraError; // An error has occurred (i.e. General Error)
}
}
// For S60CameraVideoDeviceControl
int S60CameraControl::deviceCount()
{
#ifdef Q_CC_NOKIAX86 // Emulator
return 1;
#endif
return CCameraEngine::CamerasAvailable();
}
int S60CameraControl::defaultDevice() const
{
return KDefaultCameraDevice;
}
int S60CameraControl::selectedDevice() const
{
return m_deviceIndex;
}
void S60CameraControl::setSelectedDevice(const int index)
{
if (m_deviceIndex != index) {
if (index >= 0 && index < deviceCount()) {
m_deviceIndex = index;
resetCamera();
} else {
setError(KErrNotSupported, tr("Requested camera is not available."));
}
}
}
QString S60CameraControl::name(const int index)
{
QString cameraName;
switch (index) {
case 0:
cameraName = tr("Primary camera");
break;
case 1:
cameraName = tr("Secondary camera");
break;
case 2:
cameraName = tr("Tertiary camera");
break;
default:
cameraName = tr("Unidentified Camera");
break;
}
return cameraName;
}
QString S60CameraControl::description(const int index)
{
QString cameraDesc;
switch (index) {
case 0:
cameraDesc = tr("Device primary camera");
break;
case 1:
cameraDesc = tr("Device secondary camera");
break;
case 2:
cameraDesc = tr("Device tertiary camera");
break;
default:
cameraDesc = tr("Unidentified Camera");
break;
}
return cameraDesc;
}
void S60CameraControl::resetCamera(bool errorHandling)
{
if (m_inactivityTimer->isActive())
m_inactivityTimer->stop();
// Cancel ongoing activity
m_imageSession->cancelCapture();
m_videoSession->stopRecording(false); // Don't re-initialize video
// Advanced settings must be destructed before the camera
m_imageSession->deleteAdvancedSettings();
// Release resources
stopCamera();
unloadCamera();
disconnect(m_viewfinderEngine, SIGNAL(error(int, const QString&)), this, SIGNAL(error(int,const QString&)));
if (m_viewfinderEngine) {
delete m_viewfinderEngine;
m_viewfinderEngine = 0;
}
if (m_cameraEngine) {
delete m_cameraEngine;
m_cameraEngine = 0;
}
TRAPD(err, m_cameraEngine = CCameraEngine::NewL(m_deviceIndex, 0, this));
if (err) {
m_cameraEngine = 0;
if (errorHandling) {
qWarning("Failed to recover from error.");
if (err == KErrPermissionDenied)
emit error(int(QCamera::ServiceMissingError), tr("Recovering from error failed. Possibly missing capabilities."));
else
emit error(int(QCamera::CameraError), tr("Recovering from error failed."));
} else {
if (err == KErrPermissionDenied)
setError(err, tr("Camera device creation failed. Possibly missing capabilities."));
else
setError(err, tr("Camera device creation failed."));
}
return;
}
// Notify list of available camera devices has been updated
emit devicesChanged();
m_viewfinderEngine = new S60CameraViewfinderEngine(this, m_cameraEngine, this);
if (m_viewfinderEngine == 0)
setError(KErrNoMemory, tr("Viewfinder device creation failed."));
connect(m_viewfinderEngine, SIGNAL(error(int, const QString&)), this, SIGNAL(error(int,const QString&)));
setCameraHandles();
// Reset state
//setState(QCamera::UnloadedState);
if (m_internalState != QCamera::UnloadedStatus) {
m_internalState = QCamera::UnloadedStatus;
emit statusChanged(m_internalState);
}
if (m_requestedState != QCamera::UnloadedState) {
m_requestedState = QCamera::UnloadedState;
emit stateChanged(m_requestedState);
}
// Reset error
m_error = KErrNone;
}
/*
* Reset everything else than viewfinder engine and errors.
*/
void S60CameraControl::resetCameraOrientation()
{
// If camera has not been created, it will be created automatically to correct orientation
if (!m_cameraEngine)
return;
// Check Image/VideoCapture allow rotation
if ((!m_cameraEngine->IsCameraReady() && m_internalState != QCamera::UnloadedStatus) ||
m_videoCaptureState == S60VideoCaptureSession::ERecording ||
m_videoCaptureState == S60VideoCaptureSession::EPaused) {
// If image capture is ongoing, request notification about the
// completion (imageCaptured() is used because that comes asynchronously
// after the image is captured)
// Obs! If preview creation is changed to be synchnonously done during
// the image capture this implementation needs to be changed)
if (m_videoCaptureState != S60VideoCaptureSession::ERecording &&
m_videoCaptureState != S60VideoCaptureSession::EPaused &&
m_internalState == QCamera::ActiveStatus)
connect(m_imageSession, SIGNAL(imageCaptured(const int, const QImage&)),
this, SLOT(imageCaptured(const int, const QImage&)));
m_rotateCameraWhenReady = true;
return;
}
m_rotateCameraWhenReady = false; // Reset
QCamera::State originalState = m_requestedState;
// Cancel ongoing activity
m_imageSession->cancelCapture();
m_videoSession->stopRecording(false); // Don't re-initialize video
// Advanced settings must be destructed before the camera
m_imageSession->deleteAdvancedSettings();
// Release resources
stopCamera();
unloadCamera();
// Unset CameraEngine to ViewfinderEngine
m_viewfinderEngine->setNewCameraEngine(0);
if (m_cameraEngine) {
delete m_cameraEngine;
m_cameraEngine = 0;
}
TRAPD(err, m_cameraEngine = CCameraEngine::NewL(m_deviceIndex, 0, this));
if (err) {
setError(err, tr("Camera device creation failed."));
return;
}
// Reset CameraEngine to ViewfinderEngine
m_viewfinderEngine->setNewCameraEngine(m_cameraEngine);
// Notify list of available camera devices has been updated
emit devicesChanged();
setCameraHandles();
// Reset state
if (m_internalState != QCamera::UnloadedStatus) {
m_internalState = QCamera::UnloadedStatus;
emit statusChanged(m_internalState);
}
if (m_requestedState != QCamera::UnloadedState) {
m_requestedState = QCamera::UnloadedState;
emit stateChanged(m_requestedState);
}
setState(originalState);
}
void S60CameraControl::setCameraHandles()
{
m_imageSession->setCurrentDevice(m_deviceIndex);
m_imageSession->setCameraHandle(m_cameraEngine);
m_cameraEngine->SetImageCaptureObserver(m_imageSession);
m_videoSession->setCameraHandle(m_cameraEngine);
}
void S60CameraControl::toStandByStatus()
{
// Cancel ongoing operations if any
m_imageSession->cancelCapture();
m_videoSession->stopRecording(false); // Don't re-initialize video
emit cameraReadyChanged(false);
if (m_viewfinderEngine)
m_viewfinderEngine->stopViewfinder();
else
setError(KErrGeneral, tr("Failed to stop viewfinder."));
m_cameraEngine->ReleaseAndPowerOff();
m_internalState = QCamera::StandbyStatus;
emit statusChanged(m_internalState);
}
// End of file

View File

@@ -1,178 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERACONTROL_H
#define S60CAMERACONTROL_H
#include <qcameracontrol.h>
#include "s60cameraengineobserver.h" // MCameraEngineObserver
#include "s60videocapturesession.h" // TVideoCaptureState
#include "s60cameraviewfinderengine.h" // ViewfinderOutputType
#include <e32base.h>
#include <fbs.h>
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
class S60VideoCaptureSession;
class S60CameraSettings;
class CCameraEngine;
class S60CameraViewfinderEngine;
class QTimer;
/*
* Control for controlling camera base operations (e.g. start/stop and capture
* mode).
*/
class S60CameraControl : public QCameraControl, public MCameraEngineObserver
{
Q_OBJECT
public: // Constructors & Destructor
S60CameraControl(QObject *parent = 0);
S60CameraControl(S60VideoCaptureSession *videosession,
S60ImageCaptureSession *imagesession,
QObject *parent = 0);
~S60CameraControl();
public: // QCameraControl
// State
QCamera::State state() const;
void setState(QCamera::State state);
// Status
QCamera::Status status() const;
// Capture Mode
QCamera::CaptureMode captureMode() const;
void setCaptureMode(QCamera::CaptureMode);
bool isCaptureModeSupported(QCamera::CaptureMode mode) const;
// Property Setting
bool canChangeProperty(QCameraControl::PropertyChangeType changeType, QCamera::Status status) const;
/*
Q_SIGNALS:
void stateChanged(QCamera::State);
void statusChanged(QCamera::Status);
void error(int error, const QString &errorString);
void captureModeChanged(QCamera::CaptureMode);
*/
public: // Internal
void setError(const TInt error, const QString &description);
void resetCameraOrientation();
// To provide QVideoDeviceControl info
static int deviceCount();
static QString name(const int index);
static QString description(const int index);
int defaultDevice() const;
int selectedDevice() const;
void setSelectedDevice(const int index);
void setVideoOutput(QObject *output,
const S60CameraViewfinderEngine::ViewfinderOutputType type);
void releaseVideoOutput(const S60CameraViewfinderEngine::ViewfinderOutputType type);
private slots: // Internal Slots
void videoStateChanged(const S60VideoCaptureSession::TVideoCaptureState state);
// Needed to detect image capture completion when trying to rotate the camera
void imageCaptured(const int imageId, const QImage& preview);
/*
* This method moves the camera to the StandBy status:
* - If camera access was lost
* - If camera has been inactive in LoadedStatus for a long time
*/
void toStandByStatus();
void advancedSettingsCreated();
protected: // MCameraEngineObserver
void MceoCameraReady();
void MceoHandleError(TCameraEngineError aErrorType, TInt aError);
private: // Internal
QCamera::Error fromSymbianErrorToQtMultimediaError(int aError);
void loadCamera();
void unloadCamera();
void startCamera();
void stopCamera();
void resetCamera(bool errorHandling = false);
void setCameraHandles();
signals: // Internal Signals
void cameraReadyChanged(bool);
void devicesChanged();
private: // Data
CCameraEngine *m_cameraEngine;
S60CameraViewfinderEngine *m_viewfinderEngine;
S60ImageCaptureSession *m_imageSession;
S60VideoCaptureSession *m_videoSession;
S60CameraSettings *m_advancedSettings;
QObject *m_videoOutput;
QTimer *m_inactivityTimer;
QCamera::CaptureMode m_captureMode;
QCamera::CaptureMode m_requestedCaptureMode;
bool m_settingCaptureModeInternally;
QCamera::Status m_internalState;
QCamera::State m_requestedState;
int m_deviceIndex;
mutable int m_error;
bool m_changeCaptureModeWhenReady;
bool m_rotateCameraWhenReady;
S60VideoCaptureSession::TVideoCaptureState m_videoCaptureState;
};
#endif // S60CAMERACONTROL_H

View File

@@ -1,824 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "s60cameraengine.h"
#include "s60cameraengineobserver.h"
#include "s60cameraconstants.h"
#include <QtCore/qglobal.h>
#include <fbs.h> // CFbsBitmap
#ifdef ECAM_PREVIEW_API
#include <platform/ecam/camerasnapshot.h>
#endif // ECAM_PREVIEW_API
CCameraEngine::CCameraEngine()
{
}
CCameraEngine::CCameraEngine(TInt aCameraHandle,
TInt aPriority,
MCameraEngineObserver* aObserver) :
// CBase initializes member variables to NULL
iObserver(aObserver),
iCameraIndex(aCameraHandle),
iPriority(aPriority),
iEngineState(EEngineNotReady),
iCaptureResolution(TSize(0,0)),
iNew2LImplementation(false),
iLatestImageBufferIndex(1) // Thus we start from index 0
{
// Observer is mandatory
ASSERT(aObserver != NULL);
}
CCameraEngine::~CCameraEngine()
{
StopViewFinder();
ReleaseViewFinderBuffer(); // Releases iViewFinderBuffer
ReleaseImageBuffer(); // Releases iImageBuffer + iImageBitmap
iAdvancedSettingsObserver = NULL;
iImageCaptureObserver = NULL;
iViewfinderObserver = NULL;
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
delete iAutoFocus;
#endif // S60_CAM_AUTOFOCUS_SUPPORT
if (iCamera) {
iCamera->Release();
delete iCamera;
iCamera = NULL;
}
}
TInt CCameraEngine::CamerasAvailable()
{
return CCamera::CamerasAvailable();
}
CCameraEngine* CCameraEngine::NewL(TInt aCameraHandle,
TInt aPriority,
MCameraEngineObserver* aObserver)
{
CCameraEngine* self = new (ELeave) CCameraEngine(aCameraHandle, aPriority, aObserver);
CleanupStack::PushL(self);
self->ConstructL();
CleanupStack::Pop(self);
return self;
}
void CCameraEngine::ConstructL()
{
if (!CCamera::CamerasAvailable())
User::Leave(KErrHardwareNotAvailable);
#ifndef Q_CC_NOKIAX86 // Not Emulator
TInt err(KErrNone);
#else // Emulator
TInt err(KErrNotFound);
#endif // !(Q_CC_NOKIAX86)
#ifdef S60_31_PLATFORM
// Construct CCamera object for S60 3.1 (NewL)
iNew2LImplementation = false;
TRAP(err, iCamera = CCamera::NewL(*this, iCameraIndex));
if (err)
User::Leave(err);
#else // For S60 3.2 onwards - use this constructor (New2L)
iNew2LImplementation = true;
TRAP(err, iCamera = CCamera::New2L(*this, iCameraIndex, iPriority));
if (err)
User::Leave(err);
#endif // S60_31_PLATFORM
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
// Might not be supported for secondary camera, discard errors
TRAP(err, iAutoFocus = CCamAutoFocus::NewL(iCamera));
#endif // S60_CAM_AUTOFOCUS_SUPPORT
if (iCamera == NULL)
User::Leave(KErrNoMemory);
iCamera->CameraInfo(iCameraInfo);
}
void CCameraEngine::SetAdvancedObserver(MAdvancedSettingsObserver* aAdvancedSettingsObserver)
{
iAdvancedSettingsObserver = aAdvancedSettingsObserver;
}
void CCameraEngine::SetImageCaptureObserver(MCameraEngineImageCaptureObserver* aImageCaptureObserver)
{
iImageCaptureObserver = aImageCaptureObserver;
}
void CCameraEngine::SetViewfinderObserver(MCameraViewfinderObserver* aViewfinderObserver)
{
iViewfinderObserver = aViewfinderObserver;
}
void CCameraEngine::ReserveAndPowerOn()
{
if (!iCamera || iEngineState > EEngineNotReady) {
iObserver->MceoHandleError(EErrReserve, KErrNotReady);
return;
}
iCamera->Reserve();
}
void CCameraEngine::ReleaseAndPowerOff()
{
if (iEngineState >= EEngineIdle) {
CancelCapture();
StopViewFinder();
FocusCancel();
iCamera->PowerOff();
iCamera->Release();
}
iEngineState = EEngineNotReady;
}
void CCameraEngine::StartViewFinderL(TSize& aSize)
{
if (iEngineState < EEngineIdle)
User::Leave(KErrNotReady);
if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderBitmapsSupported))
User::Leave(KErrNotSupported);
if (!iCamera->ViewFinderActive()) {
if (iCameraIndex != 0)
iCamera->SetViewFinderMirrorL(true);
iCamera->StartViewFinderBitmapsL(aSize);
}
}
void CCameraEngine::StopViewFinder()
{
if (iCamera && iCamera->ViewFinderActive())
iCamera->StopViewFinder();
}
void CCameraEngine::StartDirectViewFinderL(RWsSession& aSession,
CWsScreenDevice& aScreenDevice,
RWindowBase& aWindow,
TRect& aScreenRect,
TRect& aClipRect)
{
if (iEngineState < EEngineIdle)
User::Leave(KErrNotReady);
if (0 == (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderDirectSupported))
User::Leave(KErrNotSupported);
if (!iCamera->ViewFinderActive()) {
// Viewfinder extent needs to be clipped according to the clip rect.
// This is because the native camera framework does not support
// clipping and starting viewfinder with bigger than the display(S60
// 5.0 and older)/window(Symbian^3 and later) would cause viewfinder
// starting to fail entirely. This causes shrinking effect in some
// cases, but is better than not having the viewfinder at all.
if (aScreenRect.Intersects(aClipRect))
aScreenRect.Intersection(aClipRect);
if (iCameraIndex != 0)
iCamera->SetViewFinderMirrorL(true);
if (aScreenRect.Width() > 0 && aScreenRect.Height() > 0) {
iCamera->StartViewFinderDirectL(aSession, aScreenDevice, aWindow, aScreenRect);
} else {
if (iObserver)
iObserver->MceoHandleError(EErrViewFinderReady, KErrArgument);
}
}
}
void CCameraEngine::PrepareL(TSize& aCaptureSize, CCamera::TFormat aFormat)
{
iImageCaptureFormat = aFormat;
TInt closestVar = KMaxTInt, selected = 0;
TSize size;
// Scan through supported capture sizes and select the closest match
for (TInt index = 0; index < iCameraInfo.iNumImageSizesSupported; index++) {
iCamera->EnumerateCaptureSizes(size, index, aFormat);
if (size == aCaptureSize) {
selected = index;
break;
}
TSize varSz = size - aCaptureSize;
TInt variation = varSz.iWidth * varSz.iHeight;
if (variation < closestVar) {
closestVar = variation;
selected = index;
}
}
iCamera->EnumerateCaptureSizes(aCaptureSize, selected, aFormat);
iCaptureResolution = aCaptureSize;
iCamera->PrepareImageCaptureL(aFormat, selected);
}
void CCameraEngine::CaptureL()
{
if (iEngineState < EEngineIdle)
User::Leave(KErrNotReady);
iCamera->CaptureImage();
iEngineState = EEngineCapturing;
}
void CCameraEngine::CancelCapture()
{
if (iEngineState == EEngineCapturing) {
iCamera->CancelCaptureImage();
iEngineState = EEngineIdle;
}
}
void CCameraEngine::HandleEvent(const TECAMEvent &aEvent)
{
if (aEvent.iEventType == KUidECamEventReserveComplete) {
ReserveComplete(aEvent.iErrorCode);
return;
}
if (aEvent.iEventType == KUidECamEventPowerOnComplete) {
PowerOnComplete(aEvent.iErrorCode);
return;
}
if (aEvent.iEventType == KUidECamEventCameraNoLongerReserved) {
// All camera related operations need to be stopped
iObserver->MceoHandleError(EErrReserve, KErrHardwareNotAvailable);
return;
}
#ifdef ECAM_PREVIEW_API
if (aEvent.iEventType == KUidECamEventCameraSnapshot) {
HandlePreview();
return;
}
#endif // ECAM_PREVIEW_API
#if !defined(Q_CC_NOKIAX86) // Not Emulator
// Other events; Exposure, Zoom, etc. (See ecamadvancedsettings.h)
if (iAdvancedSettingsObserver)
iAdvancedSettingsObserver->HandleAdvancedEvent(aEvent);
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleOtherEvent(aEvent);
#endif // !Q_CC_NOKIAX86
}
void CCameraEngine::ReserveComplete(TInt aError)
{
if (aError == KErrNone) {
iCamera->PowerOn();
#ifdef S60_31_PLATFORM
} else if (aError == KErrAlreadyExists) { // Known Issue on some S60 3.1 devices
User::After(500000); // Wait for 0,5 second and try again
iCamera->Reserve();
#endif // S60_31_PLATFORM
} else {
iObserver->MceoHandleError(EErrReserve, aError);
}
}
void CCameraEngine::PowerOnComplete(TInt aError)
{
if (aError) {
iObserver->MceoHandleError(EErrPowerOn, aError);
iEngineState = EEngineNotReady;
return;
}
// Init AutoFocus
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.1
if( iAutoFocus ) {
TRAPD(afErr, iAutoFocus->InitL( *this ));
if (afErr) {
delete iAutoFocus;
iAutoFocus = 0;
}
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#endif // !Q_CC_NOKIAX86
iEngineState = EEngineIdle;
iObserver->MceoCameraReady();
}
#ifdef ECAM_PREVIEW_API
/**
* This method creates the CCameraPreview object and requests the previews to
* be provided during the image or video capture
*/
void CCameraEngine::EnablePreviewProvider(MCameraPreviewObserver *aPreviewObserver)
{
// Delete old one if exists
if (iCameraSnapshot)
delete iCameraSnapshot;
iPreviewObserver = aPreviewObserver;
TInt error = KErrNone;
if (iCamera) {
TRAP(error, iCameraSnapshot = CCamera::CCameraSnapshot::NewL(*iCamera));
if (error) {
if (iObserver)
iObserver->MceoHandleError(EErrPreview, error);
return;
}
TRAP(error, iCameraSnapshot->PrepareSnapshotL(KDefaultFormatPreview, SelectPreviewResolution(), EFalse));
if (error) {
if (iObserver)
iObserver->MceoHandleError(EErrPreview, error);
return;
}
iCameraSnapshot->StartSnapshot();
} else {
if (iObserver)
iObserver->MceoHandleError(EErrPreview, KErrNotReady);
}
}
/**
* This method disables and destroys the CCameraPreview object. Thus previews
* will not be provided during the image or video capture.
*/
void CCameraEngine::DisablePreviewProvider()
{
if (!iCameraSnapshot)
return;
iCameraSnapshot->StopSnapshot();
delete iCameraSnapshot;
iCameraSnapshot = 0;
iPreviewObserver = 0;
}
#endif // ECAM_PREVIEW_API
/*
* MCameraObserver2:
* New viewfinder frame available
*/
void CCameraEngine::ViewFinderReady(MCameraBuffer &aCameraBuffer, TInt aError)
{
iViewFinderBuffer = &aCameraBuffer;
if (aError == KErrNone) {
if (iViewfinderObserver) {
TRAPD(err, iViewfinderObserver->MceoViewFinderFrameReady(aCameraBuffer.BitmapL(0)));
if (err)
iObserver->MceoHandleError(EErrViewFinderReady, err);
} else {
iObserver->MceoHandleError(EErrViewFinderReady, KErrNotReady);
}
}
else {
iObserver->MceoHandleError(EErrViewFinderReady, aError);
}
}
/*
* MCameraObserver:
* New viewfinder frame available
*/
void CCameraEngine::ViewFinderFrameReady(CFbsBitmap& aFrame)
{
if (iViewfinderObserver)
iViewfinderObserver->MceoViewFinderFrameReady(aFrame);
else
iObserver->MceoHandleError(EErrViewFinderReady, KErrNotReady);
}
void CCameraEngine::ReleaseViewFinderBuffer()
{
if (iNew2LImplementation) { // NewL Implementation does not use MCameraBuffer
if (iViewFinderBuffer) {
iViewFinderBuffer->Release();
iViewFinderBuffer = NULL;
}
}
}
void CCameraEngine::ReleaseImageBuffer()
{
// Reset Bitmap
if (iLatestImageBufferIndex == 1 || iImageBitmap2 == NULL) {
if (iImageBitmap1) {
if (!iNew2LImplementation) { // NewL - Ownership transferred
iImageBitmap1->Reset(); // Reset/Delete Bitmap
delete iImageBitmap1;
}
iImageBitmap1 = NULL;
}
} else {
if (iImageBitmap2) {
if (!iNew2LImplementation) { // NewL - Ownership transferred
iImageBitmap2->Reset(); // Reset/Delete Bitmap
delete iImageBitmap2;
}
iImageBitmap2 = NULL;
}
}
// Reset Data pointers
if (iLatestImageBufferIndex == 1 || iImageData2 == NULL) {
if (!iNew2LImplementation) // NewL - Ownership transfers with buffer
delete iImageData1;
iImageData1 = NULL;
} else {
if (!iNew2LImplementation) // NewL - Ownership transfers with buffer
delete iImageData2;
iImageData2 = NULL;
}
// Reset ImageBuffer - New2L Implementation only
if (iLatestImageBufferIndex == 1 || iImageBuffer2 == NULL) {
if (iImageBuffer1) {
iImageBuffer1->Release();
iImageBuffer1 = NULL;
}
} else {
if (iImageBuffer2) {
iImageBuffer2->Release();
iImageBuffer2 = NULL;
}
}
}
/*
* MCameraObserver2
* Captured image is ready (New2L version)
*/
void CCameraEngine::ImageBufferReady(MCameraBuffer &aCameraBuffer, TInt aError)
{
// Use the buffer that is available
if (!iImageBuffer1) {
iLatestImageBufferIndex = 0;
iImageBuffer1 = &aCameraBuffer;
} else {
iLatestImageBufferIndex = 1;
iImageBuffer2 = &aCameraBuffer;
}
bool isBitmap = true;
TInt err = KErrNone;
switch (iImageCaptureFormat) {
case CCamera::EFormatFbsBitmapColor4K:
case CCamera::EFormatFbsBitmapColor64K:
case CCamera::EFormatFbsBitmapColor16M:
case CCamera::EFormatFbsBitmapColor16MU:
if (iLatestImageBufferIndex == 0) {
TRAP(err, iImageBitmap1 = &iImageBuffer1->BitmapL(0));
if (err) {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, err);
}
} else {
TRAP(err, iImageBitmap2 = &iImageBuffer2->BitmapL(0));
if (err) {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, err);
}
}
isBitmap = true;
break;
case CCamera::EFormatExif:
if (iLatestImageBufferIndex == 0) {
TRAP(err, iImageData1 = iImageBuffer1->DataL(0));
if (err) {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, err);
}
} else {
TRAP(err, iImageData2 = iImageBuffer2->DataL(0));
if (err) {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, err);
}
}
isBitmap = false;
break;
default:
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, KErrNotSupported);
return;
}
// Handle captured image
HandleImageReady(aError, isBitmap);
}
/*
* MCameraObserver
* Captured image is ready (NewL version)
*/
void CCameraEngine::ImageReady(CFbsBitmap* aBitmap, HBufC8* aData, TInt aError)
{
bool isBitmap = true;
// Toggle between the 2 buffers
if (iLatestImageBufferIndex == 1) {
iLatestImageBufferIndex = 0;
} else {
iLatestImageBufferIndex = 1;
}
switch (iImageCaptureFormat) {
case CCamera::EFormatFbsBitmapColor4K:
case CCamera::EFormatFbsBitmapColor64K:
case CCamera::EFormatFbsBitmapColor16M:
case CCamera::EFormatFbsBitmapColor16MU:
if (iLatestImageBufferIndex == 0)
iImageBitmap1 = aBitmap;
else
iImageBitmap2 = aBitmap;
isBitmap = true;
break;
case CCamera::EFormatExif:
if (iLatestImageBufferIndex == 0)
iImageData1 = aData;
else
iImageData2 = aData;
isBitmap = false;
break;
default:
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, KErrNotSupported);
return;
}
// Handle captured image
HandleImageReady(aError, isBitmap);
}
void CCameraEngine::HandleImageReady(const TInt aError, const bool isBitmap)
{
iEngineState = EEngineIdle;
if (aError == KErrNone) {
if (isBitmap)
if (iImageCaptureObserver) {
if (iLatestImageBufferIndex == 0)
iImageCaptureObserver->MceoCapturedBitmapReady(iImageBitmap1);
else
iImageCaptureObserver->MceoCapturedBitmapReady(iImageBitmap2);
}
else
ReleaseImageBuffer();
else {
if (iImageCaptureObserver) {
if (iLatestImageBufferIndex == 0)
iImageCaptureObserver->MceoCapturedDataReady(iImageData1);
else
iImageCaptureObserver->MceoCapturedDataReady(iImageData2);
}
else
ReleaseImageBuffer();
}
} else {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrImageReady, aError);
}
}
#ifdef ECAM_PREVIEW_API
void CCameraEngine::HandlePreview()
{
if (!iCameraSnapshot) {
if (iObserver)
iObserver->MceoHandleError(EErrPreview, KErrGeneral);
return;
}
RArray<TInt> previewIndices;
CleanupClosePushL(previewIndices);
MCameraBuffer &newPreview = iCameraSnapshot->SnapshotDataL(previewIndices);
for (TInt i = 0; i < previewIndices.Count(); ++i)
iPreviewObserver->MceoPreviewReady(newPreview.BitmapL(0));
CleanupStack::PopAndDestroy(); // RArray<TInt> previewIndices
}
TSize CCameraEngine::SelectPreviewResolution()
{
TSize currentResolution(iCaptureResolution);
TSize previewResolution(0, 0);
if (currentResolution == TSize(4000,2248) ||
currentResolution == TSize(3264,1832) ||
currentResolution == TSize(2592,1456) ||
currentResolution == TSize(1920,1080) ||
currentResolution == TSize(1280,720)) {
previewResolution = KDefaultSizePreview_Wide;
} else if (currentResolution == TSize(352,288) ||
currentResolution == TSize(176,144)) {
previewResolution = KDefaultSizePreview_CIF;
} else if (currentResolution == TSize(720,576)) {
previewResolution = KDefaultSizePreview_PAL;
} else if (currentResolution == TSize(720,480)) {
previewResolution = KDefaultSizePreview_NTSC;
} else {
previewResolution = KDefaultSizePreview_Normal;
}
return previewResolution;
}
#endif // ECAM_PREVIEW_API
//=============================================================================
// S60 3.1 - AutoFocus support (Other platforms, see S60CameraSettings class)
//=============================================================================
void CCameraEngine::InitComplete(TInt aError)
{
if (aError) {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrAutoFocusInit, aError);
}
}
void CCameraEngine::OptimisedFocusComplete(TInt aError)
{
iEngineState = EEngineIdle;
if (aError == KErrNone)
if (iImageCaptureObserver)
iImageCaptureObserver->MceoFocusComplete();
else {
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrOptimisedFocusComplete, aError);
}
}
TBool CCameraEngine::IsCameraReady() const
{
// If reserved and powered on, but not focusing or capturing
if (iEngineState == EEngineIdle)
return ETrue;
return EFalse;
}
TBool CCameraEngine::IsDirectViewFinderSupported() const
{
if (iCameraInfo.iOptionsSupported & TCameraInfo::EViewFinderDirectSupported)
return true;
else
return false;
}
TCameraInfo *CCameraEngine::CameraInfo()
{
return &iCameraInfo;
}
TBool CCameraEngine::IsAutoFocusSupported() const
{
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.1
return (iAutoFocus) ? ETrue : EFalse;
#else // !S60_CAM_AUTOFOCUS_SUPPORT
return EFalse;
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#else // Q_CC_NOKIAX86 - Emulator
return EFalse;
#endif // !Q_CC_NOKIAX86
}
/*
* This function is used for focusing in S60 3.1 platform. Platforms from S60
* 3.2 onwards should use the focusing provided by the S60CameraSettings class.
*/
void CCameraEngine::StartFocusL()
{
if (iEngineState != EEngineIdle)
return;
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.1
if (iAutoFocus) {
if (!iAFRange) {
iAFRange = CCamAutoFocus::ERangeNormal;
iAutoFocus->SetFocusRangeL(iAFRange);
}
iAutoFocus->AttemptOptimisedFocusL();
iEngineState = EEngineFocusing;
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#endif // !Q_CC_NOKIAX86
}
/*
* This function is used for cancelling focusing in S60 3.1 platform. Platforms
* from S60 3.2 onwards should use the focusing provided by the
* S60CameraSettings class.
*/
void CCameraEngine::FocusCancel()
{
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
if (iAutoFocus) {
iAutoFocus->Cancel();
iEngineState = EEngineIdle;
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#endif // !Q_CC_NOKIAX86
}
void CCameraEngine::SupportedFocusRanges(TInt& aSupportedRanges) const
{
aSupportedRanges = 0;
#ifndef Q_CC_NOKIAX86 // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
if (iAutoFocus) {
// CCamAutoFocus doesn't provide a method for getting supported ranges!
// Assume everything is supported (rather optimistic)
aSupportedRanges = CCamAutoFocus::ERangeMacro |
CCamAutoFocus::ERangePortrait |
CCamAutoFocus::ERangeNormal |
CCamAutoFocus::ERangeInfinite;
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#endif // !Q_CC_NOKIAX86
}
void CCameraEngine::SetFocusRange(TInt aFocusRange)
{
#if !defined(Q_CC_NOKIAX86) // Not Emulator
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
if (iAutoFocus) {
TRAPD(focusErr, iAutoFocus->SetFocusRangeL((CCamAutoFocus::TAutoFocusRange)aFocusRange));
if (focusErr)
iObserver->MceoHandleError(EErrAutoFocusRange, focusErr);
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
#else // Q_CC_NOKIAX86 // Emulator
Q_UNUSED(aFocusRange);
if (iImageCaptureObserver)
iImageCaptureObserver->MceoHandleError(EErrAutoFocusRange, KErrNotSupported);
#endif // !Q_CC_NOKIAX86
}
// End of file

View File

@@ -1,407 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CCAMERAENGINE_H
#define S60CCAMERAENGINE_H
// INCLUDES
#include <e32base.h>
#include <ecam.h> // for MCameraObserver(2)
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
#include <ccamautofocus.h> // for CCamAutoFocus, MCamAutoFocusObserver
#endif
// FORWARD DECLARATIONS
class MCameraEngineObserver;
class MCameraEngineImageCaptureObserver;
class MAdvancedSettingsObserver;
class MCameraViewfinderObserver;
class MCameraPreviewObserver;
/*
* CameraEngine handling ECam operations needed.
*/
NONSHARABLE_CLASS( CCameraEngine ) : public CBase,
public MCameraObserver,
public MCameraObserver2
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
,public MCamAutoFocusObserver
#endif
{
public: // Enums
enum TCameraEngineState
{
EEngineNotReady = 0, // 0 - No resources reserved
EEngineInitializing, // 1 - Reserving and Powering On
EEngineIdle, // 2 - Reseved and Powered On
EEngineCapturing, // 3 - Capturing Still Image
EEngineFocusing // 4 - Focusing
};
public: // Constructor & Destructor
static CCameraEngine* NewL( TInt aCameraHandle,
TInt aPriority,
MCameraEngineObserver* aObserver );
~CCameraEngine();
public:
/**
* External Advanced Settings callback observer.
*/
void SetAdvancedObserver(MAdvancedSettingsObserver *aAdvancedSettingsObserver);
/**
* External Image Capture callback observer.
*/
void SetImageCaptureObserver(MCameraEngineImageCaptureObserver *aImageCaptureObserver);
/**
* External Viewfinder callback observer.
*/
void SetViewfinderObserver(MCameraViewfinderObserver *aViewfinderObserver);
/**
* Static function that returns the number of cameras on the device.
*/
static TInt CamerasAvailable();
/**
* Returns the index of the currently active camera device
*/
TInt CurrentCameraIndex() const { return iCameraIndex; }
/**
* Returns the current state (TCameraEngineState)
* of the camera engine.
*/
TCameraEngineState State() const { return iEngineState; }
/**
* Returns true if the camera has been reserved and
* powered on, and not recording or capturing image
*/
TBool IsCameraReady() const;
/**
* Returns whether DirectScreen ViewFinder is supported by the platform
*/
TBool IsDirectViewFinderSupported() const;
/**
* Returns true if the camera supports AutoFocus.
*/
TBool IsAutoFocusSupported() const;
/**
* Returns camera info
*/
TCameraInfo *CameraInfo();
/**
* Captures an image. When complete, observer will receive
* MceoCapturedDataReady() or MceoCapturedBitmapReady() callback,
* depending on which image format was used in PrepareL().
* @leave May leave with KErrNotReady if camera is not
* reserved or prepared for capture.
*/
void CaptureL();
/**
* Cancels ongoing image capture
*/
void CancelCapture();
/**
* Reserves and powers on the camera. When complete,
* observer will receive MceoCameraReady() callback
*
*/
void ReserveAndPowerOn();
/**
* Releases and powers off the camera
*
*/
void ReleaseAndPowerOff();
/**
* Prepares for image capture.
* @param aCaptureSize requested capture size. On return,
* contains the selected size (closest match)
* @param aFormat Image format to use. Default is JPEG with
* EXIF information as provided by the camera module
* @leave KErrNotSupported, KErrNoMemory, KErrNotReady
*/
void PrepareL( TSize& aCaptureSize,
CCamera::TFormat aFormat = CCamera::EFormatExif );
/**
* Starts the viewfinder. Observer will receive
* MceoViewFinderFrameReady() callbacks periodically.
* @param aSize requested viewfinder size. On return,
* contains the selected size.
*
* @leave KErrNotSupported is viewfinding with bitmaps is not
* supported, KErrNotReady
*/
void StartViewFinderL( TSize& aSize );
/**
* Stops the viewfinder if active.
*/
void StopViewFinder();
void StartDirectViewFinderL(RWsSession& aSession,
CWsScreenDevice& aScreenDevice,
RWindowBase& aWindow,
TRect& aScreenRect,
TRect& aClipRect);
/**
* Releases memory for the last received viewfinder frame.
* Client must call this in response to MceoViewFinderFrameReady()
* callback, after drawing the viewfinder frame is complete.
*/
void ReleaseViewFinderBuffer();
/**
* Releases memory for the last captured image.
* Client must call this in response to MceoCapturedDataReady()
* or MceoCapturedBitmapReady()callback, after processing the
* data/bitmap is complete.
*/
void ReleaseImageBuffer();
/**
* Starts focusing. Does nothing if AutoFocus is not supported.
* When complete, observer will receive MceoFocusComplete()
* callback.
* @leave KErrInUse, KErrNotReady
*/
void StartFocusL();
/**
* Cancels the ongoing focusing operation.
*/
void FocusCancel();
/**
* Gets a bitfield of supported focus ranges.
* @param aSupportedRanges a bitfield of either TAutoFocusRange
* (S60 3.0/3.1 devices) or TFocusRange (S60 3.2 and onwards) values
*/
void SupportedFocusRanges( TInt& aSupportedRanges ) const;
/**
* Sets the focus range
* @param aFocusRange one of the values returned by
* SupportedFocusRanges().
*/
void SetFocusRange( TInt aFocusRange );
/**
* Returns a pointer to CCamera object used by the engine.
* Allows getting access to additional functionality
* from CCamera - do not use for functionality already provided
* by CCameraEngine methods.
*/
CCamera* Camera() { return iCamera; }
#ifdef ECAM_PREVIEW_API
/**
* This enables the preview creation during the capture (image or video).
*/
void EnablePreviewProvider(MCameraPreviewObserver *aPreviewObserver);
/**
* This disabled the preview creation during the capture (image or video)
*/
void DisablePreviewProvider();
#endif // ECAM_PREVIEW_API
protected: // Protected constructors
CCameraEngine();
CCameraEngine( TInt aCameraHandle,
TInt aPriority,
MCameraEngineObserver* aObserver );
void ConstructL();
protected: // MCameraObserver
/**
* From MCameraObserver
* Gets called when CCamera::Reserve() is completed.
* (V2: Called internally from HandleEvent)
*/
virtual void ReserveComplete(TInt aError);
/**
* From MCameraObserver.
* Gets called when CCamera::PowerOn() is completed.
* (V2: Called internally from HandleEvent)
*/
virtual void PowerOnComplete(TInt aError);
/**
* From MCameraObserver.
* Gets called when CCamera::StartViewFinderBitmapsL() is completed.
* (V2: Called internally from ViewFinderReady)
*/
virtual void ViewFinderFrameReady( CFbsBitmap& aFrame );
/**
* From MCameraObserver.
* Gets called when CCamera::CaptureImage() is completed.
*/
virtual void ImageReady( CFbsBitmap* aBitmap, HBufC8* aData, TInt aError );
/**
* From MCameraObserver.
* Video capture not implemented.
*/
virtual void FrameBufferReady( MFrameBuffer* /*aFrameBuffer*/, TInt /*aError*/ ) {}
protected: // MCameraObserver2
/**
* From MCameraObserver2
* Camera event handler
*/
virtual void HandleEvent(const TECAMEvent &aEvent);
/**
* From MCameraObserver2
* Notifies the client of new viewfinder data
*/
virtual void ViewFinderReady(MCameraBuffer &aCameraBuffer, TInt aError);
/**
* From MCameraObserver2
* Notifies the client of a new captured image
*/
virtual void ImageBufferReady(MCameraBuffer &aCameraBuffer, TInt aError);
/**
* From MCameraObserver2
* Video capture not implemented.
*/
virtual void VideoBufferReady(MCameraBuffer& /*aCameraBuffer*/, TInt /*aError*/) {}
protected: // MCamAutoFocusObserver
/**
* From MCamAutoFocusObserver.
* Delivers notification of completion of auto focus initialisation to
* an interested party.
* @param aError Reason for completion of focus request.
*/
virtual void InitComplete( TInt aError );
/**
* From MCamAutoFocusObserver.
* Gets called when CCamAutoFocus::AttemptOptimisedFocusL() is
* completed.
* (V2: Called internally from HandleEvent)
*/
virtual void OptimisedFocusComplete( TInt aError );
private: // Internal functions
/**
* Internal function to handle ImageReady callbacks from
* both observer (V1 & V2) interfaces
*/
void HandleImageReady(const TInt aError, const bool isBitmap);
#ifdef ECAM_PREVIEW_API
/**
* Handle preview. Retrieve preview data and notify observer about the
* preview availability.
*/
void HandlePreview();
/**
* Calculate proper resolution for the SnapShot (Preview) image.
*/
TSize SelectPreviewResolution();
#endif // ECAM_PREVIEW_API
private: // Data
CCamera *iCamera;
MCameraEngineObserver *iObserver;
MCameraEngineImageCaptureObserver *iImageCaptureObserver;
MAdvancedSettingsObserver *iAdvancedSettingsObserver;
MCameraViewfinderObserver *iViewfinderObserver;
MCameraPreviewObserver *iPreviewObserver;
MCameraBuffer *iViewFinderBuffer;
/*
* Following pointers are for the image buffers:
* * Makes buffering of 2 concurrent image buffers possible
*/
MCameraBuffer *iImageBuffer1;
MCameraBuffer *iImageBuffer2;
TDesC8 *iImageData1;
TDesC8 *iImageData2;
CFbsBitmap *iImageBitmap1;
CFbsBitmap *iImageBitmap2;
TInt iCameraIndex;
TInt iPriority;
TCameraEngineState iEngineState;
TCameraInfo iCameraInfo;
CCamera::TFormat iImageCaptureFormat;
TSize iCaptureResolution;
bool iNew2LImplementation;
int iLatestImageBufferIndex; // 0 = Buffer1, 1 = Buffer2
#ifdef ECAM_PREVIEW_API
CCamera::CCameraSnapshot *iCameraSnapshot;
#endif // ECAM_PREVIEW_API
#ifdef S60_CAM_AUTOFOCUS_SUPPORT
CCamAutoFocus* iAutoFocus;
CCamAutoFocus::TAutoFocusRange iAFRange;
#endif // S60_CAM_AUTOFOCUS_SUPPORT
};
#endif // S60CCAMERAENGINE_H

View File

@@ -1,178 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CCAMERAENGINEOBSERVER_H
#define S60CCAMERAENGINEOBSERVER_H
// FORWARD DECLARATIONS
class CFbsBitmap;
class TECAMEvent;
enum TCameraEngineError
{
EErrReserve,
EErrPowerOn,
EErrViewFinderReady,
EErrImageReady,
EErrPreview,
EErrAutoFocusInit,
EErrAutoFocusMode,
EErrAutoFocusArea,
EErrAutoFocusRange,
EErrAutoFocusType,
EErrOptimisedFocusComplete,
};
/*
* CameraEngine Observer class towards Camera AdvancedSettings
*/
class MAdvancedSettingsObserver
{
public:
virtual void HandleAdvancedEvent( const TECAMEvent &aEvent ) = 0;
};
//=============================================================================
/*
* CameraEngine Observer class towards Camera Control
*/
class MCameraEngineObserver
{
public:
/**
* Camera is ready to use for capturing images.
*/
virtual void MceoCameraReady() = 0;
/**
* Notifies clients about errors in camera engine
* @param aErrorType type of error (see TCameraEngineError)
* @param aError Symbian system-wide error code
*/
virtual void MceoHandleError( TCameraEngineError aErrorType, TInt aError ) = 0;
};
//=============================================================================
/*
* CameraEngine Observer class towards Camera ImageCaptureSession
*/
class MCameraEngineImageCaptureObserver
{
public:
/**
* Camera AF lens has attained optimal focus
*/
virtual void MceoFocusComplete() = 0;
/**
* Captured data is ready - call CCameraEngine::ReleaseImageBuffer()
* after processing/saving the data (typically, JPG-encoded image)
* @param aData Pointer to a descriptor containing a frame of camera data.
*/
virtual void MceoCapturedDataReady( TDesC8* aData ) = 0;
/**
* Captured bitmap is ready.
* after processing/saving the image, call
* CCameraEngine::ReleaseImageBuffer() to free the bitmap.
* @param aBitmap Pointer to an FBS bitmap containing a captured image.
*/
virtual void MceoCapturedBitmapReady( CFbsBitmap* aBitmap ) = 0;
/**
* Notifies clients about errors in camera engine
* @param aErrorType type of error (see TCameraEngineError)
* @param aError Symbian system-wide error code
*/
virtual void MceoHandleError( TCameraEngineError aErrorType, TInt aError ) = 0;
/**
* Notifies client about other events not recognized by camera engine.
* The default implementation is empty.
* @param aEvent camera event (see MCameraObserver2::HandleEvent())
*/
virtual void MceoHandleOtherEvent( const TECAMEvent& /*aEvent*/ ) {}
};
//=============================================================================
/*
* CameraEngine Observer class towards Camera ViewFinderEngine
*/
class MCameraViewfinderObserver
{
public:
/**
* A new viewfinder frame is ready.
* after displaying the frame, call
* CCameraEngine::ReleaseViewFinderBuffer()
* to free the bitmap.
* @param aFrame Pointer to an FBS bitmap containing a viewfinder frame.
*/
virtual void MceoViewFinderFrameReady( CFbsBitmap& aFrame ) = 0;
};
//=============================================================================
#ifdef ECAM_PREVIEW_API
/*
* CameraEngine Observer class towards Camera ViewFinderEngine
*/
class MCameraPreviewObserver
{
public:
/**
* A new preview is available.
* @param aPreview Pointer to an FBS bitmap containing a preview.
*/
virtual void MceoPreviewReady( CFbsBitmap& aPreview ) = 0;
};
#endif // ECAM_PREVIEW_API
#endif // CCAMERAENGINEOBSERVER_H
// End of file

View File

@@ -1,584 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60cameraexposurecontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
S60CameraExposureControl::S60CameraExposureControl(QObject *parent) :
QCameraExposureControl(parent)
{
}
S60CameraExposureControl::S60CameraExposureControl(S60ImageCaptureSession *session, QObject *parent) :
QCameraExposureControl(parent),
m_session(0),
m_service(0),
m_advancedSettings(0),
m_exposureMode(QCameraExposure::ExposureAuto),
m_meteringMode(QCameraExposure::MeteringMatrix)
{
m_session = session;
connect(m_session, SIGNAL(advancedSettingChanged()), this, SLOT(resetAdvancedSetting()));
m_advancedSettings = m_session->advancedSettings();
if (m_advancedSettings) {
connect(m_advancedSettings, SIGNAL(apertureChanged()), this, SLOT(apertureChanged()));
connect(m_advancedSettings, SIGNAL(apertureRangeChanged()), this, SLOT(apertureRangeChanged()));
connect(m_advancedSettings, SIGNAL(shutterSpeedChanged()), this, SLOT(shutterSpeedChanged()));
connect(m_advancedSettings, SIGNAL(isoSensitivityChanged()), this, SLOT(isoSensitivityChanged()));
connect(m_advancedSettings, SIGNAL(evChanged()), this, SLOT(evChanged()));
}
}
S60CameraExposureControl::~S60CameraExposureControl()
{
m_advancedSettings = 0;
}
void S60CameraExposureControl::resetAdvancedSetting()
{
m_advancedSettings = m_session->advancedSettings();
if (m_advancedSettings) {
connect(m_advancedSettings, SIGNAL(apertureChanged()), this, SLOT(apertureChanged()));
connect(m_advancedSettings, SIGNAL(apertureRangeChanged()), this, SLOT(apertureRangeChanged()));
connect(m_advancedSettings, SIGNAL(shutterSpeedChanged()), this, SLOT(shutterSpeedChanged()));
connect(m_advancedSettings, SIGNAL(isoSensitivityChanged()), this, SLOT(isoSensitivityChanged()));
connect(m_advancedSettings, SIGNAL(evChanged()), this, SLOT(evChanged()));
}
}
void S60CameraExposureControl::apertureChanged()
{
emit exposureParameterChanged(QCameraExposureControl::Aperture);
}
void S60CameraExposureControl::apertureRangeChanged()
{
emit exposureParameterRangeChanged(QCameraExposureControl::Aperture);
}
void S60CameraExposureControl::shutterSpeedChanged()
{
emit exposureParameterChanged(QCameraExposureControl::ShutterSpeed);
}
void S60CameraExposureControl::isoSensitivityChanged()
{
emit exposureParameterChanged(QCameraExposureControl::ISO);
}
void S60CameraExposureControl::evChanged()
{
emit exposureParameterChanged(QCameraExposureControl::ExposureCompensation);
}
QCameraExposure::ExposureMode S60CameraExposureControl::exposureMode() const
{
return m_session->exposureMode();
}
void S60CameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mode)
{
if (isExposureModeSupported(mode)) {
m_exposureMode = mode;
m_session->setExposureMode(m_exposureMode);
return;
}
m_session->setError(KErrNotSupported, tr("Requested exposure mode is not supported."));
}
bool S60CameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
{
if (m_session->isExposureModeSupported(mode))
return true;
return false;
}
QCameraExposure::MeteringMode S60CameraExposureControl::meteringMode() const
{
if (m_advancedSettings)
return m_advancedSettings->meteringMode();
return QCameraExposure::MeteringMode();
}
void S60CameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mode)
{
if (m_advancedSettings) {
if (isMeteringModeSupported(mode)) {
m_meteringMode = mode;
m_advancedSettings->setMeteringMode(mode);
return;
}
}
m_session->setError(KErrNotSupported, tr("Requested metering mode is not supported."));
}
bool S60CameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
{
if (m_advancedSettings)
return m_advancedSettings->isMeteringModeSupported(mode);
return false;
}
bool S60CameraExposureControl::isParameterSupported(ExposureParameter parameter) const
{
// Settings supported only if advanced settings available
if (m_advancedSettings) {
switch (parameter) {
case QCameraExposureControl::ISO:
if (m_advancedSettings->supportedIsoSensitivities().count() > 0)
return true;
else
return false;
case QCameraExposureControl::Aperture:
if (m_advancedSettings->supportedApertures().count() > 0)
return true;
else
return false;
case QCameraExposureControl::ShutterSpeed:
if (m_advancedSettings->supportedShutterSpeeds().count() > 0)
return true;
else
return false;
case QCameraExposureControl::ExposureCompensation:
if (m_advancedSettings->supportedExposureCompensationValues().count() > 0)
return true;
else
return false;
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
return false;
default:
return false;
}
}
return false;
}
QVariant S60CameraExposureControl::exposureParameter(ExposureParameter parameter) const
{
switch (parameter) {
case QCameraExposureControl::ISO:
return QVariant(isoSensitivity());
case QCameraExposureControl::Aperture:
return QVariant(aperture());
case QCameraExposureControl::ShutterSpeed:
return QVariant(shutterSpeed());
case QCameraExposureControl::ExposureCompensation:
return QVariant(exposureCompensation());
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
// Not supported in Symbian
return QVariant();
default:
// Not supported in Symbian
return QVariant();
}
}
QCameraExposureControl::ParameterFlags S60CameraExposureControl::exposureParameterFlags(ExposureParameter parameter) const
{
QCameraExposureControl::ParameterFlags flags;
/*
* ISO, ExposureCompensation:
* - Automatic/Manual
* - Read/Write
* - Discrete range
*
* Aperture, ShutterSpeed, FlashPower, FlashCompensation:
* - Not supported
*/
switch (parameter) {
case QCameraExposureControl::ISO:
case QCameraExposureControl::ExposureCompensation:
flags |= QCameraExposureControl::AutomaticValue;
break;
case QCameraExposureControl::Aperture:
case QCameraExposureControl::ShutterSpeed:
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
// Do nothing - no flags
break;
default:
// Do nothing - no flags
break;
}
return flags;
}
QVariantList S60CameraExposureControl::supportedParameterRange(ExposureParameter parameter) const
{
QVariantList valueList;
if (m_advancedSettings) {
switch (parameter) {
case QCameraExposureControl::ISO: {
foreach (int iso, m_advancedSettings->supportedIsoSensitivities())
valueList << QVariant(iso);
break;
}
case QCameraExposureControl::Aperture: {
foreach (qreal aperture, m_advancedSettings->supportedApertures())
valueList << QVariant(aperture);
break;
}
case QCameraExposureControl::ShutterSpeed: {
foreach (qreal shutterSpeed, m_advancedSettings->supportedShutterSpeeds())
valueList << QVariant(shutterSpeed);
break;
}
case QCameraExposureControl::ExposureCompensation: {
foreach (qreal ev, m_advancedSettings->supportedExposureCompensationValues())
valueList << QVariant(ev);
break;
}
case QCameraExposureControl::FlashPower:
case QCameraExposureControl::FlashCompensation:
// Not supported in Symbian
break;
default:
// Not supported in Symbian
break;
}
}
return valueList;
}
bool S60CameraExposureControl::setExposureParameter(ExposureParameter parameter, const QVariant& value)
{
bool useDefaultValue = false;
if (value.isNull())
useDefaultValue = true;
switch (parameter) {
case QCameraExposureControl::ISO:
if (useDefaultValue) {
setAutoIsoSensitivity();
return false;
}
else
return setManualIsoSensitivity(value.toInt());
case QCameraExposureControl::Aperture:
if (useDefaultValue) {
setAutoAperture();
return false;
}
else
return setManualAperture(value.toFloat());
case QCameraExposureControl::ShutterSpeed:
if (useDefaultValue) {
setAutoShutterSpeed();
return false;
}
else
return setManualShutterSpeed(value.toFloat());
case QCameraExposureControl::ExposureCompensation:
if (useDefaultValue) {
setAutoExposureCompensation();
return false;
}
else
return setManualExposureCompensation(value.toFloat());
case QCameraExposureControl::FlashPower:
return false;
case QCameraExposureControl::FlashCompensation:
return false;
default:
// Not supported in Symbian
return false;
}
}
QString S60CameraExposureControl::extendedParameterName(ExposureParameter parameter)
{
switch (parameter) {
case QCameraExposureControl::ISO:
return QLatin1String("ISO Sensitivity");
case QCameraExposureControl::Aperture:
return QLatin1String("Aperture");
case QCameraExposureControl::ShutterSpeed:
return QLatin1String("Shutter Speed");
case QCameraExposureControl::ExposureCompensation:
return QLatin1String("Exposure Compensation");
case QCameraExposureControl::FlashPower:
return QLatin1String("Flash Power");
case QCameraExposureControl::FlashCompensation:
return QLatin1String("Flash Compensation");
default:
return QString();
}
}
int S60CameraExposureControl::isoSensitivity() const
{
if (m_advancedSettings)
return m_advancedSettings->isoSensitivity();
return 0;
}
bool S60CameraExposureControl::isIsoSensitivitySupported(const int iso) const
{
if (m_advancedSettings &&
m_advancedSettings->supportedIsoSensitivities().contains(iso))
return true;
else
return false;
}
bool S60CameraExposureControl::setManualIsoSensitivity(int iso)
{
if (m_advancedSettings) {
if (isIsoSensitivitySupported(iso)) {
m_advancedSettings->setManualIsoSensitivity(iso);
return true;
}
}
return false;
}
void S60CameraExposureControl::setAutoIsoSensitivity()
{
if (m_advancedSettings)
m_advancedSettings->setAutoIsoSensitivity();
}
qreal S60CameraExposureControl::aperture() const
{
if (m_advancedSettings)
return m_advancedSettings->aperture();
return 0.0;
}
bool S60CameraExposureControl::isApertureSupported(const qreal aperture) const
{
if (m_advancedSettings) {
QList<qreal> supportedValues = m_advancedSettings->supportedApertures();
if(supportedValues.indexOf(aperture) != -1)
return true;
}
return false;
}
bool S60CameraExposureControl::setManualAperture(qreal aperture)
{
if (m_advancedSettings) {
if (isApertureSupported(aperture)) {
m_advancedSettings->setManualAperture(aperture);
return true;
} else {
QList<qreal> supportedApertureValues = m_advancedSettings->supportedApertures();
int minAperture = supportedApertureValues.first();
int maxAperture = supportedApertureValues.last();
if (aperture < minAperture) { // Smaller than minimum
aperture = minAperture;
} else if (aperture > maxAperture) { // Bigger than maximum
aperture = maxAperture;
} else { // Find closest
int indexOfClosest = 0;
int smallestDiff = 100000000; // Sensible max diff
for(int i = 0; i < supportedApertureValues.count(); ++i) {
if((abs((aperture*100) - (supportedApertureValues[i]*100))) < smallestDiff) {
smallestDiff = abs((aperture*100) - (supportedApertureValues[i]*100));
indexOfClosest = i;
}
}
aperture = supportedApertureValues[indexOfClosest];
}
m_advancedSettings->setManualAperture(aperture);
}
}
return false;
}
void S60CameraExposureControl::setAutoAperture()
{
// Not supported in Symbian
}
qreal S60CameraExposureControl::shutterSpeed() const
{
if (m_advancedSettings)
return m_advancedSettings->shutterSpeed();
return 0.0;
}
bool S60CameraExposureControl::isShutterSpeedSupported(const qreal seconds) const
{
if (m_advancedSettings) {
QList<qreal> supportedValues = m_advancedSettings->supportedShutterSpeeds();
if(supportedValues.indexOf(seconds) != -1)
return true;
}
return false;
}
bool S60CameraExposureControl::setManualShutterSpeed(qreal seconds)
{
if (m_advancedSettings) {
if (isShutterSpeedSupported(seconds)) {
m_advancedSettings->setManualShutterSpeed(seconds);
return true;
} else {
QList<qreal> supportedShutterSpeeds = m_advancedSettings->supportedShutterSpeeds();
if (supportedShutterSpeeds.count() == 0)
return false;
int minShutterSpeed = supportedShutterSpeeds.first();
int maxShutterSpeed = supportedShutterSpeeds.last();
if (seconds < minShutterSpeed) { // Smaller than minimum
seconds = minShutterSpeed;
} else if (seconds > maxShutterSpeed) { // Bigger than maximum
seconds = maxShutterSpeed;
} else { // Find closest
int indexOfClosest = 0;
int smallestDiff = 100000000; // Sensible max diff
for(int i = 0; i < supportedShutterSpeeds.count(); ++i) {
if((abs((seconds*100) - (supportedShutterSpeeds[i]*100))) < smallestDiff) {
smallestDiff = abs((seconds*100) - (supportedShutterSpeeds[i]*100));
indexOfClosest = i;
}
}
seconds = supportedShutterSpeeds[indexOfClosest];
}
m_advancedSettings->setManualShutterSpeed(seconds);
}
}
return false;
}
void S60CameraExposureControl::setAutoShutterSpeed()
{
// Not supported in Symbian
}
qreal S60CameraExposureControl::exposureCompensation() const
{
if (m_advancedSettings)
return m_advancedSettings->exposureCompensation();
return 0.0;
}
bool S60CameraExposureControl::isExposureCompensationSupported(const qreal ev) const
{
if (m_advancedSettings) {
QList<qreal> supportedValues = m_advancedSettings->supportedExposureCompensationValues();
if(supportedValues.indexOf(ev) != -1)
return true;
}
return false;
}
bool S60CameraExposureControl::setManualExposureCompensation(qreal ev)
{
if (m_advancedSettings) {
if (isExposureCompensationSupported(ev)) {
m_advancedSettings->setExposureCompensation(ev);
return true;
} else {
QList<qreal> supportedEVs = m_advancedSettings->supportedExposureCompensationValues();
if (supportedEVs.count() == 0)
return false;
int minEV = supportedEVs.first();
int maxEV = supportedEVs.last();
if (ev < minEV) { // Smaller than minimum
ev = minEV;
} else if (ev > maxEV) { // Bigger than maximum
ev = maxEV;
} else { // Find closest
int indexOfClosest = 0;
int smallestDiff = 100000000; // Sensible max diff
for(int i = 0; i < supportedEVs.count(); ++i) {
if((abs((ev*100) - (supportedEVs[i]*100))) < smallestDiff) {
smallestDiff = abs((ev*100) - (supportedEVs[i]*100));
indexOfClosest = i;
}
}
ev = supportedEVs[indexOfClosest];
}
m_advancedSettings->setExposureCompensation(ev);
}
}
return false;
}
void S60CameraExposureControl::setAutoExposureCompensation()
{
// Not supported in Symbian
}
// End of file

View File

@@ -1,138 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERAEXPOSURECONTROL_H
#define S60CAMERAEXPOSURECONTROL_H
#include <qcameraexposurecontrol.h>
#include "s60camerasettings.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
/*
* Control for exposure related camera operation.
*/
class S60CameraExposureControl : public QCameraExposureControl
{
Q_OBJECT
public: // Constructors & Destructor
S60CameraExposureControl(QObject *parent = 0);
S60CameraExposureControl(S60ImageCaptureSession *session, QObject *parent = 0);
~S60CameraExposureControl();
public: // QCameraExposureControl
// Exposure Mode
QCameraExposure::ExposureMode exposureMode() const;
void setExposureMode(QCameraExposure::ExposureMode mode);
bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const;
// Metering Mode
QCameraExposure::MeteringMode meteringMode() const;
void setMeteringMode(QCameraExposure::MeteringMode mode);
bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const;
// Exposure Parameter
bool isParameterSupported(ExposureParameter parameter) const;
QVariant exposureParameter(ExposureParameter parameter) const;
QCameraExposureControl::ParameterFlags exposureParameterFlags(ExposureParameter parameter) const;
QVariantList supportedParameterRange(ExposureParameter parameter) const;
bool setExposureParameter(ExposureParameter parameter, const QVariant& value);
QString extendedParameterName(ExposureParameter parameter);
/*
Q_SIGNALS: // QCameraExposureControl
void exposureParameterChanged(int parameter);
void exposureParameterRangeChanged(int parameter);
*/
private slots: // Internal Slots
void resetAdvancedSetting();
void apertureChanged();
void apertureRangeChanged();
void shutterSpeedChanged();
void isoSensitivityChanged();
void evChanged();
private: // Internal - Implementing ExposureParameter
// ISO Sensitivity
int isoSensitivity() const;
bool setManualIsoSensitivity(int iso);
void setAutoIsoSensitivity();
bool isIsoSensitivitySupported(const int iso) const;
// Aperture
qreal aperture() const;
bool setManualAperture(qreal aperture);
void setAutoAperture();
bool isApertureSupported(const qreal aperture) const;
// Shutter Speed
qreal shutterSpeed() const;
bool setManualShutterSpeed(qreal seconds);
void setAutoShutterSpeed();
bool isShutterSpeedSupported(const qreal seconds) const;
// Exposure Compensation
qreal exposureCompensation() const;
bool setManualExposureCompensation(qreal ev);
void setAutoExposureCompensation();
bool isExposureCompensationSupported(const qreal ev) const;
private: // Data
S60ImageCaptureSession *m_session;
S60CameraService *m_service;
S60CameraSettings *m_advancedSettings;
QCameraExposure::ExposureMode m_exposureMode;
QCameraExposure::MeteringMode m_meteringMode;
};
#endif // S60CAMERAEXPOSURECONTROL_H

View File

@@ -1,109 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60cameraflashcontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
S60CameraFlashControl::S60CameraFlashControl(QObject *parent) :
QCameraFlashControl(parent)
{
}
S60CameraFlashControl::S60CameraFlashControl(S60ImageCaptureSession *session, QObject *parent) :
QCameraFlashControl(parent),
m_session(0),
m_service(0),
m_advancedSettings(0),
m_flashMode(QCameraExposure::FlashOff)
{
m_session = session;
connect(m_session, SIGNAL(advancedSettingChanged()), this, SLOT(resetAdvancedSetting()));
m_advancedSettings = m_session->advancedSettings();
if (m_advancedSettings)
connect(m_advancedSettings, SIGNAL(flashReady(bool)), this, SIGNAL(flashReady(bool)));
}
S60CameraFlashControl::~S60CameraFlashControl()
{
m_advancedSettings = 0;
}
void S60CameraFlashControl::resetAdvancedSetting()
{
m_advancedSettings = m_session->advancedSettings();
if (m_advancedSettings)
connect(m_advancedSettings, SIGNAL(flashReady(bool)), this, SIGNAL(flashReady(bool)));
}
QCameraExposure::FlashModes S60CameraFlashControl::flashMode() const
{
return m_session->flashMode();
}
void S60CameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode)
{
if (isFlashModeSupported(mode)) {
m_flashMode = mode;
m_session->setFlashMode(m_flashMode);
}
else
m_session->setError(KErrNotSupported, tr("Requested flash mode is not supported."));
}
bool S60CameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const
{
return m_session->supportedFlashModes() & mode;
}
bool S60CameraFlashControl::isFlashReady() const
{
if (m_advancedSettings)
return m_advancedSettings->isFlashReady();
return false;
}
// End of file

View File

@@ -1,93 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERAFLASHCONTROL_H
#define S60CAMERAFLASHCONTROL_H
#include <qcameraflashcontrol.h>
#include "s60camerasettings.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
/*
* Control to setup Flash related camera settings.
*/
class S60CameraFlashControl : public QCameraFlashControl
{
Q_OBJECT
public: // Constructors & Destructor
S60CameraFlashControl(QObject *parent = 0);
S60CameraFlashControl(S60ImageCaptureSession *session, QObject *parent = 0);
~S60CameraFlashControl();
public: // QCameraExposureControl
// Flash Mode
QCameraExposure::FlashModes flashMode() const;
void setFlashMode(QCameraExposure::FlashModes mode);
bool isFlashModeSupported(QCameraExposure::FlashModes mode) const;
bool isFlashReady() const;
/*
Q_SIGNALS: // QCameraExposureControl
void flashReady(bool);
*/
private slots: // Internal Slots
void resetAdvancedSetting();
private: // Data
S60ImageCaptureSession *m_session;
S60CameraService *m_service;
S60CameraSettings *m_advancedSettings;
QCameraExposure::FlashModes m_flashMode;
};
#endif // S60CAMERAFLASHCONTROL_H

View File

@@ -1,193 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60camerafocuscontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
#include "s60cameraconstants.h"
S60CameraFocusControl::S60CameraFocusControl(QObject *parent) :
QCameraFocusControl(parent)
{
}
S60CameraFocusControl::S60CameraFocusControl(S60ImageCaptureSession *session, QObject *parent) :
QCameraFocusControl(parent),
m_session(0),
m_service(0),
m_advancedSettings(0),
m_isFocusLocked(false),
m_opticalZoomValue(KDefaultOpticalZoom),
m_digitalZoomValue(KDefaultDigitalZoom),
m_focusMode(KDefaultFocusMode)
{
m_session = session;
connect(m_session, SIGNAL(advancedSettingChanged()), this, SLOT(resetAdvancedSetting()));
m_advancedSettings = m_session->advancedSettings();
TRAPD(err, m_session->doSetZoomFactorL(m_opticalZoomValue, m_digitalZoomValue));
if (err)
m_session->setError(KErrNotSupported, tr("Setting default zoom factors failed."));
}
S60CameraFocusControl::~S60CameraFocusControl()
{
}
QCameraFocus::FocusMode S60CameraFocusControl::focusMode() const
{
return m_focusMode;
}
void S60CameraFocusControl::setFocusMode(QCameraFocus::FocusMode mode)
{
if (isFocusModeSupported(mode)) {
// FocusMode and FocusRange are set. Focusing is triggered by setting
// the corresponding FocusType active by calling searchAndLock in LocksControl.
m_focusMode = mode;
if (m_advancedSettings)
m_advancedSettings->setFocusMode(m_focusMode);
else
m_session->setError(KErrGeneral, tr("Unable to set focus mode before camera is started."));
} else {
m_session->setError(KErrNotSupported, tr("Requested focus mode is not supported."));
}
}
bool S60CameraFocusControl::isFocusModeSupported(QCameraFocus::FocusMode mode) const
{
if (m_advancedSettings) {
return m_advancedSettings->supportedFocusModes() & mode;
} else {
if (mode == QCameraFocus::AutoFocus)
return m_session->isFocusSupported();
}
return false;
}
qreal S60CameraFocusControl::maximumOpticalZoom() const
{
return m_session->maximumZoom();
}
qreal S60CameraFocusControl::maximumDigitalZoom() const
{
return m_session->maxDigitalZoom();
}
qreal S60CameraFocusControl::opticalZoom() const
{
return m_session->opticalZoomFactor();
}
qreal S60CameraFocusControl::digitalZoom() const
{
return m_session->digitalZoomFactor();
}
void S60CameraFocusControl::zoomTo(qreal optical, qreal digital)
{
TRAPD(err, m_session->doSetZoomFactorL(optical, digital));
if (err)
m_session->setError(KErrNotSupported, tr("Requested zoom factor is not supported."));
// Query new values
if (m_opticalZoomValue != m_session->opticalZoomFactor()) {
m_opticalZoomValue = m_session->opticalZoomFactor();
emit opticalZoomChanged(m_opticalZoomValue);
}
if (m_digitalZoomValue != m_session->digitalZoomFactor()) {
m_digitalZoomValue = m_session->digitalZoomFactor();
emit digitalZoomChanged(m_digitalZoomValue);
}
}
void S60CameraFocusControl::resetAdvancedSetting()
{
m_advancedSettings = m_session->advancedSettings();
}
QCameraFocus::FocusPointMode S60CameraFocusControl::focusPointMode() const
{
// Not supported in Symbian
return QCameraFocus::FocusPointAuto;
}
void S60CameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode)
{
if (mode != QCameraFocus::FocusPointAuto)
m_session->setError(KErrNotSupported, tr("Requested focus point mode is not supported."));
}
bool S60CameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
{
// Not supported in Symbian
if (mode == QCameraFocus::FocusPointAuto)
return true;
else
return false;
}
QPointF S60CameraFocusControl::customFocusPoint() const
{
// Not supported in Symbian, return image center
return QPointF(0.5, 0.5);
}
void S60CameraFocusControl::setCustomFocusPoint(const QPointF &point)
{
// Not supported in Symbian
Q_UNUSED(point);
m_session->setError(KErrNotSupported, tr("Setting custom focus point is not supported."));
}
QCameraFocusZoneList S60CameraFocusControl::focusZones() const
{
// Not supported in Symbian
return QCameraFocusZoneList(); // Return empty list
}
// End of file

View File

@@ -1,112 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERAFOCUSCONTROL_H
#define S60CAMERAFOCUSCONTROL_H
#include <qcamerafocuscontrol.h>
#include "s60camerasettings.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
/*
* Control for focusing related operations (inc. zooming)
*/
class S60CameraFocusControl : public QCameraFocusControl
{
Q_OBJECT
public: // Constructors & Destructor
S60CameraFocusControl(QObject *parent = 0);
S60CameraFocusControl(S60ImageCaptureSession *session, QObject *parent = 0);
~S60CameraFocusControl();
public: // QCameraFocusControl
// Focus Mode
QCameraFocus::FocusMode focusMode() const;
void setFocusMode(QCameraFocus::FocusMode mode);
bool isFocusModeSupported(QCameraFocus::FocusMode) const;
// Zoom
qreal maximumOpticalZoom() const;
qreal maximumDigitalZoom() const;
qreal opticalZoom() const;
qreal digitalZoom() const;
void zoomTo(qreal optical, qreal digital);
// Focus Point
QCameraFocus::FocusPointMode focusPointMode() const;
void setFocusPointMode(QCameraFocus::FocusPointMode mode);
bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const;
QPointF customFocusPoint() const;
void setCustomFocusPoint(const QPointF &point);
QCameraFocusZoneList focusZones() const;
/*
Q_SIGNALS: // QCameraFocusControl
void opticalZoomChanged(qreal opticalZoom);
void digitalZoomChanged(qreal digitalZoom);
void focusZonesChanged();
*/
private slots: // Internal Slots
void resetAdvancedSetting();
private: // Data
S60ImageCaptureSession *m_session;
S60CameraService *m_service;
S60CameraSettings *m_advancedSettings;
bool m_isFocusLocked;
qreal m_opticalZoomValue;
qreal m_digitalZoomValue;
QCameraFocus::FocusMode m_focusMode;
};
#endif // S60CAMERAFOCUSCONTROL_H

View File

@@ -1,124 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60cameraimagecapturecontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
#include "s60cameracontrol.h"
S60CameraImageCaptureControl::S60CameraImageCaptureControl(QObject *parent) :
QCameraImageCaptureControl(parent)
{
}
S60CameraImageCaptureControl::S60CameraImageCaptureControl(S60CameraService *service,
S60ImageCaptureSession *session,
QObject *parent) :
QCameraImageCaptureControl(parent),
m_driveMode(QCameraImageCapture::SingleImageCapture) // Default DriveMode
{
m_session = session;
m_service = service;
m_cameraControl = qobject_cast<S60CameraControl *>(m_service->requestControl(QCameraControl_iid));
if (!m_cameraControl)
m_session->setError(KErrGeneral, tr("Unexpected camera error."));
// Chain these signals from session class
connect(m_session, SIGNAL(imageCaptured(const int, QImage)),
this, SIGNAL(imageCaptured(const int, QImage)));
connect(m_session, SIGNAL(readyForCaptureChanged(bool)),
this, SIGNAL(readyForCaptureChanged(bool)), Qt::QueuedConnection);
connect(m_session, SIGNAL(imageSaved(const int, const QString&)),
this, SIGNAL(imageSaved(const int, const QString&)));
connect(m_session, SIGNAL(imageExposed(int)),
this, SIGNAL(imageExposed(int)));
connect(m_session, SIGNAL(captureError(int, int, const QString&)),
this, SIGNAL(error(int, int, const QString&)));
}
S60CameraImageCaptureControl::~S60CameraImageCaptureControl()
{
}
bool S60CameraImageCaptureControl::isReadyForCapture() const
{
if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage)
return false;
return m_session->isDeviceReady();
}
QCameraImageCapture::DriveMode S60CameraImageCaptureControl::driveMode() const
{
return m_driveMode;
}
void S60CameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode)
{
if (mode != QCameraImageCapture::SingleImageCapture) {
emit error((m_session->currentImageId() + 1), QCamera::NotSupportedFeatureError, tr("DriveMode not supported."));
return;
}
m_driveMode = mode;
}
int S60CameraImageCaptureControl::capture(const QString &fileName)
{
if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
emit error((m_session->currentImageId() + 1), QCameraImageCapture::NotReadyError, tr("Incorrect CaptureMode."));
return 0;
}
int imageId = m_session->capture(fileName);
return imageId;
}
void S60CameraImageCaptureControl::cancelCapture()
{
m_session->cancelCapture();
}
// End of file

View File

@@ -1,99 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERAIMAGECAPTURECONTROL_H
#define S60CAMERAIMAGECAPTURECONTROL_H
#include "qcameraimagecapturecontrol.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
class S60CameraControl;
/*
* Control for image capture operations.
*/
class S60CameraImageCaptureControl : public QCameraImageCaptureControl
{
Q_OBJECT
public: // Contructors & Destrcutor
S60CameraImageCaptureControl(QObject *parent = 0);
S60CameraImageCaptureControl(S60CameraService *service,
S60ImageCaptureSession *session,
QObject *parent = 0);
~S60CameraImageCaptureControl();
public: // QCameraImageCaptureControl
bool isReadyForCapture() const;
// Drive Mode
QCameraImageCapture::DriveMode driveMode() const;
void setDriveMode(QCameraImageCapture::DriveMode mode);
// Capture
int capture(const QString &fileName);
void cancelCapture();
/*
Q_SIGNALS: // QCameraImageCaptureControl
void readyForCaptureChanged(bool);
void imageExposed(int id);
void imageCaptured(int id, const QImage &preview);
void imageSaved(int id, const QString &fileName);
void error(int id, int error, const QString &errorString);
*/
private: // Data
S60ImageCaptureSession *m_session;
S60CameraService *m_service;
S60CameraControl *m_cameraControl;
QCameraImageCapture::DriveMode m_driveMode;
};
#endif // S60CAMERAIMAGECAPTURECONTROL_H

View File

@@ -1,254 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60cameraimageprocessingcontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
S60CameraImageProcessingControl::S60CameraImageProcessingControl(QObject *parent) :
QCameraImageProcessingControl(parent)
{
}
S60CameraImageProcessingControl::S60CameraImageProcessingControl(S60ImageCaptureSession *session, QObject *parent) :
QCameraImageProcessingControl(parent),
m_session(0),
m_advancedSettings(0)
{
m_session = session;
m_advancedSettings = m_session->advancedSettings();
}
S60CameraImageProcessingControl::~S60CameraImageProcessingControl()
{
m_advancedSettings = 0;
}
void S60CameraImageProcessingControl::resetAdvancedSetting()
{
m_advancedSettings = m_session->advancedSettings();
}
QCameraImageProcessing::WhiteBalanceMode S60CameraImageProcessingControl::whiteBalanceMode() const
{
return m_session->whiteBalanceMode();
}
void S60CameraImageProcessingControl::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
{
if (isWhiteBalanceModeSupported(mode))
m_session->setWhiteBalanceMode(mode);
else
m_session->setError(KErrNotSupported, tr("Requested white balance mode is not supported."));
}
bool S60CameraImageProcessingControl::isWhiteBalanceModeSupported(
QCameraImageProcessing::WhiteBalanceMode mode) const
{
return m_session->isWhiteBalanceModeSupported(mode);
}
int S60CameraImageProcessingControl::manualWhiteBalance() const
{
return 0;
}
void S60CameraImageProcessingControl::setManualWhiteBalance(int colorTemperature)
{
m_session->setError(KErrNotSupported, tr("Setting manual white balance is not supported."));
Q_UNUSED(colorTemperature)
}
bool S60CameraImageProcessingControl::isProcessingParameterSupported(ProcessingParameter parameter) const
{
// First check settings requiring Adv. Settings
if (m_advancedSettings) {
switch (parameter) {
case QCameraImageProcessingControl::Saturation:
return true;
case QCameraImageProcessingControl::Sharpening:
return isSharpeningSupported();
case QCameraImageProcessingControl::Denoising:
return isDenoisingSupported();
case QCameraImageProcessingControl::ColorTemperature:
return false;
}
}
// Then the rest
switch (parameter) {
case QCameraImageProcessingControl::Contrast:
case QCameraImageProcessingControl::Brightness:
return true;
default:
return false;
}
}
QVariant S60CameraImageProcessingControl::processingParameter(
QCameraImageProcessingControl::ProcessingParameter parameter) const
{
switch (parameter) {
case QCameraImageProcessingControl::Contrast:
return QVariant(contrast());
case QCameraImageProcessingControl::Saturation:
return QVariant(saturation());
case QCameraImageProcessingControl::Brightness:
return QVariant(brightness());
case QCameraImageProcessingControl::Sharpening:
return QVariant(sharpeningLevel());
case QCameraImageProcessingControl::Denoising:
return QVariant(denoisingLevel());
case QCameraImageProcessingControl::ColorTemperature:
return QVariant(manualWhiteBalance());
default:
return QVariant();
}
}
void S60CameraImageProcessingControl::setProcessingParameter(
QCameraImageProcessingControl::ProcessingParameter parameter, QVariant value)
{
switch (parameter) {
case QCameraImageProcessingControl::Contrast:
setContrast(value.toInt());
break;
case QCameraImageProcessingControl::Saturation:
setSaturation(value.toInt());
break;
case QCameraImageProcessingControl::Brightness:
setBrightness(value.toInt());
break;
case QCameraImageProcessingControl::Sharpening:
if (isSharpeningSupported())
setSharpeningLevel(value.toInt());
break;
case QCameraImageProcessingControl::Denoising:
if (isDenoisingSupported())
setDenoisingLevel(value.toInt());
break;
case QCameraImageProcessingControl::ColorTemperature:
setManualWhiteBalance(value.toInt());
break;
default:
break;
}
}
void S60CameraImageProcessingControl::setContrast(int value)
{
m_session->setContrast(value);
}
int S60CameraImageProcessingControl::contrast() const
{
return m_session->contrast();
}
void S60CameraImageProcessingControl::setBrightness(int value)
{
m_session->setBrightness(value);
}
int S60CameraImageProcessingControl::brightness() const
{
return m_session->brightness();
}
void S60CameraImageProcessingControl::setSaturation(int value)
{
if (m_advancedSettings)
m_advancedSettings->setSaturation(value);
else
m_session->setError(KErrNotSupported, tr("Setting saturation is not supported."));
}
int S60CameraImageProcessingControl::saturation() const
{
if (m_advancedSettings)
return m_advancedSettings->saturation();
return 0;
}
void S60CameraImageProcessingControl::setDenoisingLevel(int value)
{
m_session->setError(KErrNotSupported, tr("Setting denoising level is not supported."));
Q_UNUSED(value); // Not supported for Symbian
}
bool S60CameraImageProcessingControl::isDenoisingSupported() const
{
return false; // Not supported for Symbian
}
int S60CameraImageProcessingControl::denoisingLevel() const
{
return 0; // Not supported for Symbian
}
void S60CameraImageProcessingControl::setSharpeningLevel(int value)
{
if (m_advancedSettings)
m_advancedSettings->setSharpeningLevel(value);
else
m_session->setError(KErrNotSupported, tr("Setting sharpening level is not supported."));
}
bool S60CameraImageProcessingControl::isSharpeningSupported() const
{
if (m_advancedSettings)
return m_advancedSettings->isSharpeningSupported();
return false;
}
int S60CameraImageProcessingControl::sharpeningLevel() const
{
if (m_advancedSettings)
return m_advancedSettings->sharpeningLevel();
return 0;
}
// End of file

View File

@@ -1,118 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERAIMAGEPROCESSINGCONTROL_H
#define S60CAMERAIMAGEPROCESSINGCONTROL_H
#include <qcameraimageprocessing.h>
#include <qcameraimageprocessingcontrol.h>
#include "s60camerasettings.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
/*
* Control for image processing related camera operations (inc. white balance).
*/
class S60CameraImageProcessingControl : public QCameraImageProcessingControl
{
Q_OBJECT
public: // Constructors & Destructor
S60CameraImageProcessingControl(QObject *parent = 0);
S60CameraImageProcessingControl(S60ImageCaptureSession *session, QObject *parent = 0);
~S60CameraImageProcessingControl();
public: // QCameraImageProcessingControl
// White Balance
QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const;
void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode);
bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const;
// Processing Parameter
bool isProcessingParameterSupported(ProcessingParameter parameter) const;
QVariant processingParameter(QCameraImageProcessingControl::ProcessingParameter parameter) const;
void setProcessingParameter(QCameraImageProcessingControl::ProcessingParameter parameter, QVariant value);
private slots: // Internal Slots
void resetAdvancedSetting();
private: // Internal operations - Implementing ProcessingParameter
// Manual White Balance (Color Temperature)
int manualWhiteBalance() const;
void setManualWhiteBalance(int colorTemperature);
// Contrast
int contrast() const;
void setContrast(int value);
// Brightness
int brightness() const;
void setBrightness(int value);
// Saturation
int saturation() const;
void setSaturation(int value);
// Sharpening
bool isSharpeningSupported() const;
int sharpeningLevel() const;
void setSharpeningLevel(int value);
// Denoising
bool isDenoisingSupported() const;
int denoisingLevel() const;
void setDenoisingLevel(int value);
private: // Data
S60ImageCaptureSession *m_session;
S60CameraSettings *m_advancedSettings;
};
#endif // S60CAMERAIMAGEPROCESSINGCONTROL_H

View File

@@ -1,263 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include <qcamerafocus.h> // FocusMode
#include "s60cameralockscontrol.h"
#include "s60cameraservice.h"
#include "s60imagecapturesession.h"
#include "s60camerasettings.h"
#include "s60camerafocuscontrol.h"
S60CameraLocksControl::S60CameraLocksControl(QObject *parent) :
QCameraLocksControl(parent)
{
}
S60CameraLocksControl::S60CameraLocksControl(S60CameraService *service,
S60ImageCaptureSession *session,
QObject *parent) :
QCameraLocksControl(parent),
m_session(0),
m_service(0),
m_advancedSettings(0),
m_focusControl(0),
m_focusStatus(QCamera::Unlocked),
m_exposureStatus(QCamera::Unlocked),
m_whiteBalanceStatus(QCamera::Unlocked)
{
m_session = session;
m_service = service;
m_focusControl = qobject_cast<S60CameraFocusControl *>(m_service->requestControl(QCameraFocusControl_iid));
connect(m_session, SIGNAL(advancedSettingChanged()), this, SLOT(resetAdvancedSetting()));
m_advancedSettings = m_session->advancedSettings();
// Exposure Lock Signals
if (m_advancedSettings)
connect(m_advancedSettings, SIGNAL(exposureStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(exposureStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
// Focus Lock Signal
// * S60 3.2 and later (through Adv. Settings)
if (m_advancedSettings)
connect(m_advancedSettings, SIGNAL(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
// * S60 3.1 (through ImageSession)
connect(m_session, SIGNAL(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
}
S60CameraLocksControl::~S60CameraLocksControl()
{
m_advancedSettings = 0;
}
QCamera::LockTypes S60CameraLocksControl::supportedLocks() const
{
QCamera::LockTypes supportedLocks = 0;
#ifdef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.1
if (m_session)
if (m_session->isFocusSupported())
supportedLocks |= QCamera::LockFocus;
#else // S60 3.2 and later
if (m_advancedSettings) {
QCameraFocus::FocusModes supportedFocusModes = m_advancedSettings->supportedFocusModes();
if (supportedFocusModes & QCameraFocus::AutoFocus)
supportedLocks |= QCamera::LockFocus;
// Exposure/WhiteBalance Locking not implemented in Symbian
// supportedLocks |= QCamera::LockExposure;
// supportedLocks |= QCamera::LockWhiteBalance;
}
#endif // S60_CAM_AUTOFOCUS_SUPPORT
return supportedLocks;
}
QCamera::LockStatus S60CameraLocksControl::lockStatus(QCamera::LockType lock) const
{
switch (lock) {
case QCamera::LockExposure:
return m_exposureStatus;
case QCamera::LockWhiteBalance:
return m_whiteBalanceStatus;
case QCamera::LockFocus:
return m_focusStatus;
default:
// Unsupported lock
return QCamera::Unlocked;
}
}
void S60CameraLocksControl::searchAndLock(QCamera::LockTypes locks)
{
if (locks & QCamera::LockExposure) {
// Not implemented in Symbian
//startExposureLocking();
}
if (locks & QCamera::LockWhiteBalance) {
// Not implemented in Symbian
}
if (locks & QCamera::LockFocus)
startFocusing();
}
void S60CameraLocksControl::unlock(QCamera::LockTypes locks)
{
if (locks & QCamera::LockExposure) {
// Not implemented in Symbian
//cancelExposureLocking();
}
if (locks & QCamera::LockFocus)
cancelFocusing();
}
void S60CameraLocksControl::resetAdvancedSetting()
{
m_advancedSettings = m_session->advancedSettings();
// Reconnect Lock Signals
if (m_advancedSettings) {
connect(m_advancedSettings, SIGNAL(exposureStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(exposureStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
connect(m_advancedSettings, SIGNAL(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)));
}
}
void S60CameraLocksControl::exposureStatusChanged(QCamera::LockStatus status,
QCamera::LockChangeReason reason)
{
if(status != m_exposureStatus) {
m_exposureStatus = status;
emit lockStatusChanged(QCamera::LockExposure, status, reason);
}
}
void S60CameraLocksControl::focusStatusChanged(QCamera::LockStatus status,
QCamera::LockChangeReason reason)
{
if(status != m_focusStatus) {
m_focusStatus = status;
emit lockStatusChanged(QCamera::LockFocus, status, reason);
}
}
void S60CameraLocksControl::startFocusing()
{
#ifndef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.2 or later
// Focusing is triggered on Symbian by setting the FocusType corresponding
// to the FocusMode set to FocusControl
if (m_focusControl) {
if (m_advancedSettings) {
m_advancedSettings->startFocusing();
m_focusStatus = QCamera::Searching;
emit lockStatusChanged(QCamera::LockFocus, QCamera::Searching, QCamera::UserRequest);
}
else
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed);
}
else
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed);
#else // S60 3.1
if (m_focusControl && m_focusControl->focusMode() == QCameraFocus::AutoFocus) {
m_session->startFocus();
m_focusStatus = QCamera::Searching;
emit lockStatusChanged(QCamera::LockFocus, QCamera::Searching, QCamera::UserRequest);
}
else
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed);
#endif // S60_CAM_AUTOFOCUS_SUPPORT
}
void S60CameraLocksControl::cancelFocusing()
{
if (m_focusStatus == QCamera::Unlocked)
return;
#ifndef S60_CAM_AUTOFOCUS_SUPPORT // S60 3.2 or later
if (m_advancedSettings) {
m_advancedSettings->cancelFocusing();
m_focusStatus = QCamera::Unlocked;
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::UserRequest);
}
else
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed);
#else // S60 3.1
m_session->cancelFocus();
m_focusStatus = QCamera::Unlocked;
emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::UserRequest);
#endif // S60_CAM_AUTOFOCUS_SUPPORT
}
void S60CameraLocksControl::startExposureLocking()
{
if (m_advancedSettings) {
m_advancedSettings->lockExposure(true);
m_exposureStatus = QCamera::Searching;
emit lockStatusChanged(QCamera::LockExposure, QCamera::Searching, QCamera::UserRequest);
}
else
emit lockStatusChanged(QCamera::LockExposure, QCamera::Unlocked, QCamera::LockFailed);
}
void S60CameraLocksControl::cancelExposureLocking()
{
if (m_exposureStatus == QCamera::Unlocked)
return;
if (m_advancedSettings) {
m_advancedSettings->lockExposure(false);
m_exposureStatus = QCamera::Unlocked;
emit lockStatusChanged(QCamera::LockExposure, QCamera::Unlocked, QCamera::UserRequest);
}
else
emit lockStatusChanged(QCamera::LockExposure, QCamera::Unlocked, QCamera::LockFailed);
}
// End of file

View File

@@ -1,115 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERALOCKSCONTROL_H
#define S60CAMERALOCKSCONTROL_H
#include <QtCore/qobject.h>
#include "qcameralockscontrol.h"
QT_USE_NAMESPACE
class S60CameraService;
class S60ImageCaptureSession;
class S60CameraSettings;
class S60CameraFocusControl;
/*
* Control for searching and locking 3A algorithms (AutoFocus, AutoExposure
* and AutoWhitebalance).
*/
class S60CameraLocksControl : public QCameraLocksControl
{
Q_OBJECT
public: // Contructors & Destrcutor
S60CameraLocksControl(QObject *parent = 0);
S60CameraLocksControl(S60CameraService *service,
S60ImageCaptureSession *session,
QObject *parent = 0);
~S60CameraLocksControl();
public: // QCameraLocksControl
QCamera::LockTypes supportedLocks() const;
QCamera::LockStatus lockStatus(QCamera::LockType lock) const;
void searchAndLock(QCamera::LockTypes locks);
void unlock(QCamera::LockTypes locks);
/*
Q_SIGNALS: // QCameraLocksControl
void lockStatusChanged(QCamera::LockType type,
QCamera::LockStatus status,
QCamera::LockChangeReason reason);
*/
private slots: // Internal Slots
void exposureStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
void focusStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
void resetAdvancedSetting();
private: // Internal
// Focus
void startFocusing();
void cancelFocusing();
// Exposure
void startExposureLocking();
void cancelExposureLocking();
private: // Data
S60ImageCaptureSession *m_session;
S60CameraService *m_service;
S60CameraSettings *m_advancedSettings;
S60CameraFocusControl *m_focusControl;
QCamera::LockStatus m_focusStatus;
QCamera::LockStatus m_exposureStatus;
QCamera::LockStatus m_whiteBalanceStatus;
};
#endif // S60CAMERALOCKSCONTROL_H

View File

@@ -1,259 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qvariant.h>
#include <QtGui/qwidget.h>
#include <QtCore/qlist.h>
#include "s60cameraservice.h"
#include "s60cameracontrol.h"
#include "s60videodevicecontrol.h"
#include "s60camerafocuscontrol.h"
#include "s60cameraexposurecontrol.h"
#include "s60cameraflashcontrol.h"
#include "s60cameraimageprocessingcontrol.h"
#include "s60cameraimagecapturecontrol.h"
#include "s60mediarecordercontrol.h"
#include "s60videocapturesession.h"
#include "s60imagecapturesession.h"
#include "s60videowidgetcontrol.h"
#include "s60mediacontainercontrol.h"
#include "s60videoencodercontrol.h"
#include "s60audioencodercontrol.h"
#include "s60imageencodercontrol.h"
#include "s60cameralockscontrol.h"
#include "s60videorenderercontrol.h"
#include "s60videowindowcontrol.h"
#include "s60cameraviewfinderengine.h" // ViewfinderOutputType
S60CameraService::S60CameraService(QObject *parent) :
QMediaService(parent)
{
// Session classes for video and image capturing
m_imagesession = new S60ImageCaptureSession(this);
m_videosession = new S60VideoCaptureSession(this);
if (m_imagesession && m_videosession) {
// Different control classes implementing the Camera API
m_control = new S60CameraControl(m_videosession, m_imagesession, this);
m_videoDeviceControl = new S60VideoDeviceControl(m_control, this);
m_focusControl = new S60CameraFocusControl(m_imagesession, this);
m_exposureControl = new S60CameraExposureControl(m_imagesession, this);
m_flashControl = new S60CameraFlashControl(m_imagesession, this);
m_imageProcessingControl = new S60CameraImageProcessingControl(m_imagesession, this);
m_imageCaptureControl = new S60CameraImageCaptureControl(this, m_imagesession, this);
m_media = new S60MediaRecorderControl(this, m_videosession, this);
m_mediaFormat = new S60MediaContainerControl(m_videosession, this);
m_videoEncoder = new S60VideoEncoderControl(m_videosession, this);
m_audioEncoder = new S60AudioEncoderControl(m_videosession, this);
m_viewFinderWidget = new S60VideoWidgetControl(this);
m_imageEncoderControl = new S60ImageEncoderControl(m_imagesession, this);
m_locksControl = new S60CameraLocksControl(this, m_imagesession, this);
m_rendererControl = new S60VideoRendererControl(this);
m_windowControl = new S60VideoWindowControl(this);
}
}
S60CameraService::~S60CameraService()
{
// Delete controls
if (m_videoDeviceControl)
delete m_videoDeviceControl;
if (m_focusControl)
delete m_focusControl;
if (m_exposureControl)
delete m_exposureControl;
if (m_flashControl)
delete m_flashControl;
if (m_imageProcessingControl)
delete m_imageProcessingControl;
if (m_imageCaptureControl)
delete m_imageCaptureControl;
if (m_media)
delete m_media;
if (m_mediaFormat)
delete m_mediaFormat;
if (m_videoEncoder)
delete m_videoEncoder;
if (m_audioEncoder)
delete m_audioEncoder;
if (m_imageEncoderControl)
delete m_imageEncoderControl;
if (m_locksControl)
delete m_locksControl;
// CameraControl destroys:
// * ViewfinderEngine
// * CameraEngine
if (m_control)
delete m_control;
// Delete viewfinder controls after CameraControl to be sure that
// ViewFinder gets stopped before widget (and window) is destroyed
if (m_viewFinderWidget)
delete m_viewFinderWidget;
if (m_rendererControl)
delete m_rendererControl;
if (m_windowControl)
delete m_windowControl;
// Delete sessions
if (m_videosession)
delete m_videosession;
if (m_imagesession)
delete m_imagesession;
}
QMediaControl *S60CameraService::requestControl(const char *name)
{
if (qstrcmp(name, QMediaRecorderControl_iid) == 0)
return m_media;
if (qstrcmp(name, QCameraControl_iid) == 0)
return m_control;
if (qstrcmp(name, QVideoEncoderControl_iid) == 0)
return m_videoEncoder;
if (qstrcmp(name, QAudioEncoderControl_iid) == 0)
return m_audioEncoder;
if (qstrcmp(name, QMediaContainerControl_iid) == 0)
return m_mediaFormat;
if (qstrcmp(name, QCameraExposureControl_iid) == 0)
return m_exposureControl;
if (qstrcmp(name, QCameraFlashControl_iid) == 0)
return m_flashControl;
if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
if (m_viewFinderWidget) {
m_control->setVideoOutput(m_viewFinderWidget,
S60CameraViewfinderEngine::OutputTypeVideoWidget);
return m_viewFinderWidget;
}
else
return 0;
}
if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
if (m_rendererControl) {
m_control->setVideoOutput(m_rendererControl,
S60CameraViewfinderEngine::OutputTypeRenderer);
return m_rendererControl;
}
else
return 0;
}
if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
if (m_windowControl) {
m_control->setVideoOutput(m_windowControl,
S60CameraViewfinderEngine::OutputTypeVideoWindow);
return m_windowControl;
}
else
return 0;
}
if (qstrcmp(name, QCameraFocusControl_iid) == 0)
return m_focusControl;
if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0)
return m_imageProcessingControl;
if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
return m_imageCaptureControl;
if (qstrcmp(name, QVideoDeviceControl_iid) == 0)
return m_videoDeviceControl;
if (qstrcmp(name, QImageEncoderControl_iid) == 0)
return m_imageEncoderControl;
if (qstrcmp(name, QCameraLocksControl_iid) == 0)
return m_locksControl;
return 0;
}
void S60CameraService::releaseControl(QMediaControl *control)
{
if (control == 0)
return;
// Release viewfinder output
if (control == m_viewFinderWidget) {
if (m_viewFinderWidget)
m_control->releaseVideoOutput(S60CameraViewfinderEngine::OutputTypeVideoWidget);
}
if (control == m_rendererControl) {
if (m_rendererControl)
m_control->releaseVideoOutput(S60CameraViewfinderEngine::OutputTypeRenderer);
}
if (control == m_windowControl) {
if (m_windowControl)
m_control->releaseVideoOutput(S60CameraViewfinderEngine::OutputTypeVideoWindow);
}
}
int S60CameraService::deviceCount()
{
return S60CameraControl::deviceCount();
}
QString S60CameraService::deviceDescription(const int index)
{
return S60CameraControl::description(index);
}
QString S60CameraService::deviceName(const int index)
{
return S60CameraControl::name(index);
}
// End of file

View File

@@ -1,111 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERASERVICE_H
#define S60CAMERASERVICE_H
#include <QtCore/qobject.h>
#include <qmediaservice.h>
QT_USE_NAMESPACE
class S60MediaContainerControl;
class S60VideoEncoderControl;
class S60AudioEncoderControl;
class S60CameraControl;
class S60VideoDeviceControl;
class S60MediaRecorderControl;
class S60ImageCaptureSession;
class S60VideoCaptureSession;
class S60CameraFocusControl;
class S60CameraExposureControl;
class S60CameraFlashControl;
class S60CameraImageProcessingControl;
class S60CameraImageCaptureControl;
class S60VideoWidgetControl;
class S60ImageEncoderControl;
class S60CameraLocksControl;
class S60VideoRendererControl;
class S60VideoWindowControl;
class S60CameraService : public QMediaService
{
Q_OBJECT
public: // Contructor & Destructor
S60CameraService(QObject *parent = 0);
~S60CameraService();
public: // QMediaService
QMediaControl *requestControl(const char *name);
void releaseControl(QMediaControl *control);
public: // Static Device Info
static int deviceCount();
static QString deviceName(const int index);
static QString deviceDescription(const int index);
private: // Data
S60ImageCaptureSession *m_imagesession;
S60VideoCaptureSession *m_videosession;
S60MediaContainerControl *m_mediaFormat;
S60VideoEncoderControl *m_videoEncoder;
S60AudioEncoderControl *m_audioEncoder;
S60CameraControl *m_control;
S60VideoDeviceControl *m_videoDeviceControl;
S60CameraFocusControl *m_focusControl;
S60CameraExposureControl *m_exposureControl;
S60CameraFlashControl *m_flashControl;
S60CameraImageProcessingControl *m_imageProcessingControl;
S60CameraImageCaptureControl *m_imageCaptureControl;
S60MediaRecorderControl *m_media;
S60VideoWidgetControl *m_viewFinderWidget;
S60ImageEncoderControl *m_imageEncoderControl;
S60CameraLocksControl *m_locksControl;
S60VideoRendererControl *m_rendererControl;
S60VideoWindowControl *m_windowControl;
};
#endif // S60CAMERASERVICE_H

View File

@@ -1,115 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include <QtCore/qstring.h>
#include "s60cameraserviceplugin.h"
#ifdef QMEDIA_SYMBIAN_CAMERA
#include "s60cameraservice.h"
#endif
QStringList S60CameraServicePlugin::keys() const
{
QStringList list;
#ifdef QMEDIA_SYMBIAN_CAMERA
list << QLatin1String(Q_MEDIASERVICE_CAMERA);
#endif
return list;
}
QMediaService* S60CameraServicePlugin::create(QString const& key)
{
#ifdef QMEDIA_SYMBIAN_CAMERA
if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
return new S60CameraService;
#endif
return 0;
}
void S60CameraServicePlugin::release(QMediaService *service)
{
delete service;
}
QList<QByteArray> S60CameraServicePlugin::devices(const QByteArray &service) const
{
#ifdef QMEDIA_SYMBIAN_CAMERA
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
return m_cameraDevices;
}
#endif
return QList<QByteArray>();
}
QString S60CameraServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
{
#ifdef QMEDIA_SYMBIAN_CAMERA
if (service == Q_MEDIASERVICE_CAMERA) {
if (m_cameraDevices.isEmpty())
updateDevices();
for (int i=0; i<m_cameraDevices.count(); i++)
if (m_cameraDevices[i] == device)
return m_cameraDescriptions[i];
}
#endif
return QString();
}
void S60CameraServicePlugin::updateDevices() const
{
#ifdef QMEDIA_SYMBIAN_CAMERA
m_cameraDevices.clear();
m_cameraDescriptions.clear();
for (int i=0; i < S60CameraService::deviceCount(); i ++) {
m_cameraDevices.append(S60CameraService::deviceName(i).toUtf8());
m_cameraDescriptions.append(S60CameraService::deviceDescription(i));
}
#endif
}
Q_EXPORT_PLUGIN2(qtmultimedia_ecamngine, S60CameraServicePlugin);
// End of file

View File

@@ -1,81 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERASERVICEPLUGIN_H
#define S60CAMERASERVICEPLUGIN_H
#include <qmediaservice.h>
#include <qmediaserviceproviderplugin.h>
QT_USE_NAMESPACE
/*
* Plugin implementation for the Camera Service
*/
class S60CameraServicePlugin : public QMediaServiceProviderPlugin,
public QMediaServiceSupportedDevicesInterface
{
Q_OBJECT
Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
public: // QMediaServiceProviderPlugin
QStringList keys() const;
QMediaService* create(QString const& key);
void release(QMediaService *service);
public: // QMediaServiceSupportedDevicesInterface
QList<QByteArray> devices(const QByteArray &service) const;
QString deviceDescription(const QByteArray &service, const QByteArray &device);
private: // Internal
void updateDevices() const;
private: // Data
mutable QList<QByteArray> m_cameraDevices;
mutable QStringList m_cameraDescriptions;
};
#endif // S60CAMERASERVICEPLUGIN_H

View File

@@ -1,986 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "s60camerasettings.h"
#include "s60cameraconstants.h"
// S60 3.2 Platform
#ifdef USE_S60_32_ECAM_ADVANCED_SETTINGS_HEADER
#define POST_31_PLATFORM
#include <ecamadvancedsettings.h> // CCameraAdvancedSettings (inc. TValueInfo)
#endif // S60 3.2
// S60 5.0 or later
#ifdef USE_S60_50_ECAM_ADVANCED_SETTINGS_HEADER
#define POST_31_PLATFORM
#include <ecamadvsettings.h> // CCameraAdvancedSettings
#include <ecam/ecamconstants.h> // TValueInfo
#endif // S60 5.0 or later
S60CameraSettings::S60CameraSettings(QObject *parent, CCameraEngine *engine) :
QObject(parent),
#ifndef S60_31_PLATFORM // Post S60 3.1 Platforms
m_advancedSettings(0),
m_imageProcessingSettings(0),
#endif // S60_31_PLATFORM
m_cameraEngine(engine),
m_continuousFocusing(false)
{
}
S60CameraSettings::~S60CameraSettings()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
delete m_advancedSettings;
m_advancedSettings = 0;
}
if (m_imageProcessingSettings) {
delete m_imageProcessingSettings;
m_imageProcessingSettings = 0;
}
#endif // POST_31_PLATFORM
}
/*
* This is Symbian NewL kind of consructor, but unlike Symbian version this
* constructor will not leave, but instead it will return possible errors in
* the error variable. This is to be able to write the class without deriving
* it form CBase. Also CleanupStack is cleaned here if the ConstructL leaves.
*/
S60CameraSettings* S60CameraSettings::New(int &error, QObject *parent, CCameraEngine *engine)
{
S60CameraSettings* self = new S60CameraSettings(parent, engine);
if (!self) {
error = KErrNoMemory;
return 0;
}
TRAPD(err, self->ConstructL());
if (err) {
// Clean created object
delete self;
self = 0;
error = err;
return 0;
}
error = KErrNone;
return self;
}
void S60CameraSettings::ConstructL()
{
#ifdef POST_31_PLATFORM
if (!m_cameraEngine)
User::Leave(KErrGeneral);
// From now on it is safe to assume engine exists
// If no AdvancedSettings is available, there's no benefit of S60CameraSettings
// Leave if creation fails
m_advancedSettings = CCamera::CCameraAdvancedSettings::NewL(*m_cameraEngine->Camera());
CleanupStack::PushL(m_advancedSettings);
// ImageProcessing module may not be supported, don't Leave
TRAPD(err, m_imageProcessingSettings = CCamera::CCameraImageProcessing::NewL(*m_cameraEngine->Camera()));
if (err == KErrNone && m_imageProcessingSettings) {
CleanupStack::PushL(m_imageProcessingSettings);
} else {
if (err == KErrNotSupported)
m_imageProcessingSettings = 0;
else {
// Leave with error
if (!m_imageProcessingSettings)
User::Leave(KErrNoMemory);
else
User::Leave(err);
}
}
if (m_advancedSettings) {
RArray<TInt> digitalZoomFactors;
CleanupClosePushL(digitalZoomFactors);
TValueInfo info = ENotActive;
m_advancedSettings->GetDigitalZoomStepsL(digitalZoomFactors, info);
for (int i = 0; i < digitalZoomFactors.Count(); ++i)
m_supportedSymbianDigitalZoomFactors << digitalZoomFactors[i];
CleanupStack::PopAndDestroy(); // RArray<TInt> digitalZoomFactors
}
// Pop objects from CleanupStack
if (m_imageProcessingSettings)
CleanupStack::Pop(m_imageProcessingSettings);
CleanupStack::Pop(m_advancedSettings);
#else // S60 3.1
// AdvancedSettings are not suppoted on S60 3.1 (There's no use for S60CameraSettings)
User::Leave(KErrNotSupported);
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setFocusMode(QCameraFocus::FocusMode mode)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
switch (mode) {
case QCameraFocus::ManualFocus: // Manual focus mode
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeManual);
m_continuousFocusing = false;
break;
case QCameraFocus::AutoFocus: // Single-shot AutoFocus mode
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeAuto);
m_advancedSettings->SetFocusRange(CCamera::CCameraAdvancedSettings::EFocusRangeAuto);
m_continuousFocusing = false;
break;
case QCameraFocus::HyperfocalFocus:
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeAuto);
m_advancedSettings->SetFocusRange(CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal);
m_continuousFocusing = false;
break;
case QCameraFocus::InfinityFocus:
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeAuto);
m_advancedSettings->SetFocusRange(CCamera::CCameraAdvancedSettings::EFocusRangeInfinite);
m_continuousFocusing = false;
break;
case QCameraFocus::ContinuousFocus:
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeAuto);
m_advancedSettings->SetFocusRange(CCamera::CCameraAdvancedSettings::EFocusRangeAuto);
m_continuousFocusing = true;
break;
case QCameraFocus::MacroFocus:
m_advancedSettings->SetFocusMode(CCamera::CCameraAdvancedSettings::EFocusModeAuto);
m_advancedSettings->SetFocusRange(CCamera::CCameraAdvancedSettings::EFocusRangeMacro);
m_continuousFocusing = false;
break;
default:
emit error(QCamera::NotSupportedFeatureError, tr("Requested focus mode is not supported."));
break;
}
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#else // S60 3.1
Q_UNUSED(mode);
emit error(QCamera::NotSupportedFeatureError, tr("Settings focus mode is not supported."));
#endif // POST_31_PLATFORM
}
void S60CameraSettings::startFocusing()
{
#ifdef POST_31_PLATFORM
// Setting AutoFocusType triggers the focusing on Symbian
if (m_advancedSettings) {
if (m_continuousFocusing)
m_advancedSettings->SetAutoFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeContinuous);
else
m_advancedSettings->SetAutoFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle);
} else {
emit error(QCamera::CameraError, tr("Unable to focus."));
}
#endif // POST_31_PLATFORM
}
void S60CameraSettings::cancelFocusing()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings)
m_advancedSettings->SetAutoFocusType(CCamera::CCameraAdvancedSettings::EAutoFocusTypeOff);
else
emit error(QCamera::CameraError, tr("Unable to cancel focusing."));
#endif // POST_31_PLATFORM
}
QCameraFocus::FocusMode S60CameraSettings::focusMode()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
// First request needed info
CCamera::CCameraAdvancedSettings::TFocusMode mode = m_advancedSettings->FocusMode();
CCamera::CCameraAdvancedSettings::TFocusRange range = m_advancedSettings->FocusRange();
CCamera::CCameraAdvancedSettings::TAutoFocusType autoType = m_advancedSettings->AutoFocusType();
switch (mode) {
case CCamera::CCameraAdvancedSettings::EFocusModeManual:
case CCamera::CCameraAdvancedSettings::EFocusModeFixed:
return QCameraFocus::ManualFocus;
case CCamera::CCameraAdvancedSettings::EFocusModeAuto:
if (autoType == CCamera::CCameraAdvancedSettings::EAutoFocusTypeContinuous) {
return QCameraFocus::ContinuousFocus;
} else {
// Single-shot focusing
switch (range) {
case CCamera::CCameraAdvancedSettings::EFocusRangeMacro:
case CCamera::CCameraAdvancedSettings::EFocusRangeSuperMacro:
return QCameraFocus::MacroFocus;
case CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal:
return QCameraFocus::HyperfocalFocus;
case CCamera::CCameraAdvancedSettings::EFocusRangeInfinite:
return QCameraFocus::InfinityFocus;
case CCamera::CCameraAdvancedSettings::EFocusRangeAuto:
case CCamera::CCameraAdvancedSettings::EFocusRangeNormal:
return QCameraFocus::AutoFocus;
default:
return QCameraFocus::AutoFocus;
}
}
default:
return QCameraFocus::AutoFocus; // Return automatic focusing
}
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#endif // POST_31_PLATFORM
return QCameraFocus::AutoFocus; // Return automatic focusing
}
QCameraFocus::FocusModes S60CameraSettings::supportedFocusModes()
{
QCameraFocus::FocusModes modes = 0;
#ifdef POST_31_PLATFORM
TInt supportedModes = 0;
TInt autoFocusTypes = 0;
TInt supportedRanges = 0;
if (m_advancedSettings) {
supportedModes = m_advancedSettings->SupportedFocusModes();
autoFocusTypes = m_advancedSettings->SupportedAutoFocusTypes();
supportedRanges = m_advancedSettings->SupportedFocusRanges();
if (supportedModes == 0 || autoFocusTypes == 0 || supportedRanges == 0)
return modes;
// EFocusModeAuto is the only supported on Symbian
if (supportedModes & CCamera::CCameraAdvancedSettings::EFocusModeAuto) {
// Check supported types (Single-shot Auto vs. Continuous)
if (autoFocusTypes & CCamera::CCameraAdvancedSettings::EAutoFocusTypeSingle)
modes |= QCameraFocus::AutoFocus;
if (autoFocusTypes & CCamera::CCameraAdvancedSettings::EAutoFocusTypeContinuous)
modes |= QCameraFocus::ContinuousFocus;
// Check supported ranges (Note! Some are actually fixed focuses
// even though the mode is Auto on Symbian)
if (supportedRanges & CCamera::CCameraAdvancedSettings::EFocusRangeMacro)
modes |= QCameraFocus::MacroFocus;
if (supportedRanges & CCamera::CCameraAdvancedSettings::EFocusRangeHyperfocal)
modes |= QCameraFocus::HyperfocalFocus;
if (supportedRanges & CCamera::CCameraAdvancedSettings::EFocusRangeInfinite)
modes |= QCameraFocus::InfinityFocus;
}
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#endif // POST_31_PLATFORM
return modes;
}
qreal S60CameraSettings::opticalZoomFactorL() const
{
// Not supported on Symbian
return 1.0;
}
void S60CameraSettings::setOpticalZoomFactorL(const qreal zoomFactor)
{
// Not supported on Symbian
Q_UNUSED(zoomFactor);
}
QList<qreal> S60CameraSettings::supportedDigitalZoomFactors() const
{
QList<qreal> zoomFactors;
foreach (int factor, m_supportedSymbianDigitalZoomFactors)
zoomFactors << qreal(factor) / KSymbianFineResolutionFactor;
return zoomFactors;
}
qreal S60CameraSettings::digitalZoomFactorL() const
{
qreal factor = 1.0;
#ifdef POST_31_PLATFORM
int symbianFactor = 0;
if (m_advancedSettings)
symbianFactor = m_advancedSettings->DigitalZoom();
else
User::Leave(KErrNotSupported);
if (symbianFactor != 0)
factor = qreal(symbianFactor) / KSymbianFineResolutionFactor;
#endif // POST_31_PLATFORM
return factor;
}
void S60CameraSettings::setDigitalZoomFactorL(const qreal zoomFactor)
{
#ifdef POST_31_PLATFORM
int symbianFactor = zoomFactor * KSymbianFineResolutionFactor;
// Find closest supported Symbian ZoomFactor if needed
if (!m_supportedSymbianDigitalZoomFactors.contains(symbianFactor)) {
int closestIndex = -1;
int closestDiff = 1000000; // Sensible maximum
for (int i = 0; i < m_supportedSymbianDigitalZoomFactors.count(); ++i) {
int diff = abs(m_supportedSymbianDigitalZoomFactors.at(i) - symbianFactor);
if (diff < closestDiff) {
closestDiff = diff;
closestIndex = i;
}
}
if (closestIndex != -1)
symbianFactor = m_supportedSymbianDigitalZoomFactors.at(closestIndex);
else
User::Leave(KErrGeneral);
}
if (m_advancedSettings)
m_advancedSettings->SetDigitalZoom(symbianFactor);
else
User::Leave(KErrNotSupported);
#else // S60 3.1 Platform
Q_UNUSED(zoomFactor);
emit error(QCamera::NotSupportedFeatureError, tr("Settings digital zoom factor is not supported."));
#endif // POST_31_PLATFORM
}
// MCameraObserver2
void S60CameraSettings::HandleAdvancedEvent(const TECAMEvent& aEvent)
{
#ifdef POST_31_PLATFORM
if (aEvent.iErrorCode != KErrNone) {
switch (aEvent.iErrorCode) {
case KErrECamCameraDisabled:
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return;
case KErrECamSettingDisabled:
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return;
case KErrECamParameterNotInRange:
emit error(QCamera::NotSupportedFeatureError, tr("Requested value is not in supported range."));
return;
case KErrECamSettingNotSupported:
emit error(QCamera::NotSupportedFeatureError, tr("Requested setting is not supported."));
return;
case KErrECamNotOptimalFocus:
if (m_continuousFocusing)
emit focusStatusChanged(QCamera::Searching, QCamera::LockTemporaryLost);
else
emit focusStatusChanged(QCamera::Unlocked, QCamera::LockFailed);
return;
}
if (aEvent.iEventType == KUidECamEventCameraSettingFocusRange ||
aEvent.iEventType == KUidECamEventCameraSettingAutoFocusType2) {
emit focusStatusChanged(QCamera::Unlocked, QCamera::LockFailed);
return;
} else if (aEvent.iEventType == KUidECamEventCameraSettingIsoRate) {
if (aEvent.iErrorCode == KErrNotSupported)
emit error(QCamera::NotSupportedFeatureError, tr("Requested ISO value is not supported."));
else
emit error(QCamera::CameraError, tr("Setting ISO value failed."));
return;
} else if (aEvent.iEventType == KUidECamEventCameraSettingAperture) {
if (aEvent.iErrorCode == KErrNotSupported)
emit error(QCamera::NotSupportedFeatureError, tr("Requested aperture value is not supported."));
else
emit error(QCamera::CameraError, tr("Setting aperture value failed."));
return;
} else if (aEvent.iEventType == KUidECamEventCameraSettingExposureCompensation) {
if (aEvent.iErrorCode == KErrNotSupported)
emit error(QCamera::NotSupportedFeatureError, tr("Requested exposure compensation is not supported."));
else
emit error(QCamera::CameraError, tr("Setting exposure compensation failed."));
return;
} else if (aEvent.iEventType == KUidECamEventCameraSettingOpticalZoom ||
aEvent.iEventType == KUidECamEventCameraSettingDigitalZoom) {
if (aEvent.iErrorCode == KErrNotSupported)
return; // Discard
else {
emit error(QCamera::CameraError, tr("Setting zoom factor failed."));
return;
}
} else if (aEvent.iEventType == KUidECamEventCameraSettingFocusMode) {
if (aEvent.iErrorCode == KErrNotSupported)
if (m_cameraEngine && m_cameraEngine->CurrentCameraIndex() != 0)
emit error(QCamera::NotSupportedFeatureError, tr("Focusing is not supported with this camera."));
else
emit error(QCamera::NotSupportedFeatureError, tr("Requested focus mode is not supported."));
else
emit error(QCamera::CameraError, tr("Setting focus mode failed."));
return;
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return;
}
}
if (aEvent.iEventType == KUidECamEventCameraSettingExposureLock) {
if (m_advancedSettings) {
if (m_advancedSettings->ExposureLockOn())
emit exposureStatusChanged(QCamera::Locked, QCamera::LockAcquired);
else
emit exposureStatusChanged(QCamera::Unlocked, QCamera::LockLost);
}
else
emit exposureStatusChanged(QCamera::Unlocked, QCamera::LockLost);
}
else if (aEvent.iEventType == KUidECamEventCameraSettingAperture)
emit apertureChanged();
else if (aEvent.iEventType == KUidECamEventCameraSettingApertureRange)
emit apertureRangeChanged();
else if (aEvent.iEventType == KUidECamEventCameraSettingIsoRateType)
emit isoSensitivityChanged();
else if (aEvent.iEventType == KUidECamEventCameraSettingShutterSpeed)
emit shutterSpeedChanged();
else if (aEvent.iEventType == KUidECamEventCameraSettingExposureCompensationStep)
emit evChanged();
else if (aEvent.iEventType == KUidECamEventFlashReady)
emit flashReady(true);
else if (aEvent.iEventType == KUidECamEventFlashNotReady)
emit flashReady(false);
else if (aEvent.iEventType.iUid == KUidECamEventCameraSettingsOptimalFocusUidValue)
emit focusStatusChanged(QCamera::Locked, QCamera::LockAcquired);
#else // S60 3.1 Platform
Q_UNUSED(aEvent);
#endif // POST_31_PLATFORM
}
bool S60CameraSettings::isFlashReady()
{
TBool isReady = false;
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
int flashErr = m_advancedSettings->IsFlashReady(isReady);
if(flashErr != KErrNone) {
if (flashErr != KErrNotSupported)
emit error(QCamera::CameraError, tr("Unexpected error with flash."));
return false;
}
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#endif
return isReady;
}
QCameraExposure::MeteringMode S60CameraSettings::meteringMode()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
CCamera::CCameraAdvancedSettings::TMeteringMode mode = m_advancedSettings->MeteringMode();
switch (mode) {
case CCamera::CCameraAdvancedSettings::EMeteringModeCenterWeighted:
return QCameraExposure::MeteringAverage;
case CCamera::CCameraAdvancedSettings::EMeteringModeEvaluative:
return QCameraExposure::MeteringMatrix;
case CCamera::CCameraAdvancedSettings::EMeteringModeSpot:
return QCameraExposure::MeteringSpot;
default:
return QCameraExposure::MeteringAverage;
}
}else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return QCameraExposure::MeteringAverage;
}
#else // S60 3.1 Platform
return QCameraExposure::MeteringAverage;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setMeteringMode(QCameraExposure::MeteringMode mode)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
switch(mode) {
case QCameraExposure::MeteringAverage:
m_advancedSettings->SetMeteringMode(CCamera::CCameraAdvancedSettings::EMeteringModeCenterWeighted);
break;
case QCameraExposure::MeteringMatrix:
m_advancedSettings->SetMeteringMode(CCamera::CCameraAdvancedSettings::EMeteringModeEvaluative);
break;
case QCameraExposure::MeteringSpot:
m_advancedSettings->SetMeteringMode(CCamera::CCameraAdvancedSettings::EMeteringModeSpot);
break;
default:
break;
}
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#else // S60 3.1
Q_UNUSED(mode);
emit error(QCamera::NotSupportedFeatureError, tr("Setting metering mode is not supported."));
#endif // POST_31_PLATFORM
}
bool S60CameraSettings::isMeteringModeSupported(QCameraExposure::MeteringMode mode)
{
#ifdef POST_31_PLATFORM
TInt supportedModes = 0;
if (m_advancedSettings) {
supportedModes = m_advancedSettings->SupportedMeteringModes();
if (supportedModes == 0)
return false;
switch (mode) {
case QCameraExposure::MeteringMatrix:
if (supportedModes & CCamera::CCameraAdvancedSettings::EMeteringModeEvaluative)
return true;
else
return false;
case QCameraExposure::MeteringAverage:
if (supportedModes & CCamera::CCameraAdvancedSettings::EMeteringModeCenterWeighted)
return true;
else
return false;
case QCameraExposure::MeteringSpot:
if (supportedModes & CCamera::CCameraAdvancedSettings::EMeteringModeSpot)
return true;
else
return false;
default:
return false;
}
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#else // S60 3.1
Q_UNUSED(mode);
#endif // POST_31_PLATFORM
return false;
}
int S60CameraSettings::isoSensitivity()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
CCamera::CCameraAdvancedSettings::TISORateType isoRateType;
TInt param = 0;
TInt isoRate = 0;
TRAPD(err, m_advancedSettings->GetISORateL(isoRateType, param, isoRate));
if (err)
return 0;
if (isoRate != KErrNotFound)
return isoRate;
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#endif // POST_31_PLATFORM
return 0;
}
QList<int> S60CameraSettings::supportedIsoSensitivities()
{
QList<int> isoSentitivities;
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
RArray<TInt> supportedIsoRates;
CleanupClosePushL(supportedIsoRates);
TRAPD(err, m_advancedSettings->GetSupportedIsoRatesL(supportedIsoRates));
if (err != KErrNone) {
if (err != KErrNotSupported) // Don's emit error if ISO is not supported
emit error(QCamera::CameraError, tr("Failure while querying supported iso sensitivities."));
} else {
for (int i = 0; i < supportedIsoRates.Count(); ++i)
isoSentitivities << supportedIsoRates[i];
}
CleanupStack::PopAndDestroy(); // RArray<TInt> supportedIsoRates
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
return isoSentitivities;
#else // S60 3.1 Platform
return isoSentitivities;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setManualIsoSensitivity(int iso)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TRAPD(err, m_advancedSettings->SetISORateL(CCamera::CCameraAdvancedSettings::EISOManual, iso));
if (err)
emit error(QCamera::CameraError, tr("Setting manual iso sensitivity failed."));
return;
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#else // S60 3.1 Platform
Q_UNUSED(iso);
emit error(QCamera::NotSupportedFeatureError, tr("Setting manual iso sensitivity is not supported."));
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setAutoIsoSensitivity()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TRAPD(err, m_advancedSettings->SetISORateL(CCamera::CCameraAdvancedSettings::EISOAutoUnPrioritised, 0));
if (err)
emit error(QCamera::CameraError, tr("Setting auto iso sensitivity failed."));
return;
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#else // S60 3.1 Platform
emit error(QCamera::NotSupportedFeatureError, tr("Setting auto iso sensitivity is not supported."));
#endif // POST_31_PLATFORM
}
qreal S60CameraSettings::aperture()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings)
return qreal(m_advancedSettings->Aperture()) / KSymbianFineResolutionFactor;
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return 0;
#else // S60 3.1 Platform
return 0;
#endif // POST_31_PLATFORM
}
QList<qreal> S60CameraSettings::supportedApertures()
{
QList<qreal> apertures;
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
RArray<TInt> supportedApertures;
TValueInfo info = ENotActive;
TRAPD(err, m_advancedSettings->GetAperturesL(supportedApertures, info));
if (err != KErrNone)
if (err != KErrNotSupported)
emit error(QCamera::CameraError, tr("Failure while querying supported apertures."));
else {
for (int i = 0; i < supportedApertures.Count(); i++) {
qreal q = qreal(supportedApertures[i]) / KSymbianFineResolutionFactor;
apertures.append(q);
}
}
supportedApertures.Close();
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return apertures;
#else // S60 3.1 Platform
return apertures;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setManualAperture(qreal aperture)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
int symbianAperture = (aperture * KSymbianFineResolutionFactor); // KSymbianFineResolutionFactor = 100
m_advancedSettings->SetAperture(symbianAperture);
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#else // S60 3.1
Q_UNUSED(aperture);
emit error(QCamera::NotSupportedFeatureError, tr("Setting manual aperture is not supported."));
#endif // POST_31_PLATFORM
}
void S60CameraSettings::lockExposure(bool lock)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
m_advancedSettings->SetExposureLockOn(lock);
return;
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#else // S60 3.1
Q_UNUSED(lock);
emit error(QCamera::NotSupportedFeatureError, tr("Locking exposure is not supported."));
#endif // POST_31_PLATFORM
}
bool S60CameraSettings::isExposureLocked()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings)
return m_advancedSettings->ExposureLockOn();
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
#endif // POST_31_PLATFORM
return false;
}
qreal S60CameraSettings::shutterSpeed()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
qreal shutterSpeed = qreal(m_advancedSettings->ShutterSpeed()) / 1000000.0;
return shutterSpeed; // In seconds
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
return 0;
#else // S60 3.1 Platform
return 0;
#endif // POST_31_PLATFORM
}
QList<qreal> S60CameraSettings::supportedShutterSpeeds()
{
QList<qreal> speeds;
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
RArray<TInt> supportedSpeeds;
TValueInfo info = ENotActive;
TRAPD(err, m_advancedSettings->GetShutterSpeedsL(supportedSpeeds, info));
if (err != KErrNone)
if (err != KErrNotSupported)
emit error(QCamera::CameraError, tr("Failure while querying supported shutter speeds."));
else {
for (int i = 0; i < supportedSpeeds.Count(); i++) {
qreal q = qreal(supportedSpeeds[i]) / 1000000.0;
speeds.append(q); // In seconds
}
}
supportedSpeeds.Close();
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return speeds;
#else // S60 3.1 Platform
return speeds;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setManualShutterSpeed(qreal speed)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TInt shutterSpeed = speed * 1000000; // From seconds to microseconds
m_advancedSettings->SetShutterSpeed(shutterSpeed);
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#else // S60 3.1
emit error(QCamera::NotSupportedFeatureError, tr("Setting manual shutter speed is not supported."));
Q_UNUSED(speed);
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setExposureCompensation(qreal ev)
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TInt evStep = ev * KSymbianFineResolutionFactor;
m_advancedSettings->SetExposureCompensationStep(evStep);
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
#else // S60 3.1 Platform
Q_UNUSED(ev);
emit error(QCamera::NotSupportedFeatureError, tr("Setting exposure compensation is not supported."));
#endif // POST_31_PLATFORM
}
qreal S60CameraSettings::exposureCompensation()
{
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
TInt evStepSymbian = 0;
m_advancedSettings->GetExposureCompensationStep(evStepSymbian);
qreal evStep = evStepSymbian;
evStep /= KSymbianFineResolutionFactor;
return evStep;
} else {
emit error(QCamera::CameraError, tr("Unexpected camera error."));
}
return 0;
#else // S60 3.1 Platform
return 0;
#endif // POST_31_PLATFORM
}
QList<qreal> S60CameraSettings::supportedExposureCompensationValues()
{
QList<qreal> valueList;
#ifdef POST_31_PLATFORM
if (m_advancedSettings) {
RArray<TInt> evSteps;
TValueInfo info;
TRAPD(err, m_advancedSettings->GetExposureCompensationStepsL(evSteps, info));
if (err) {
if (err != KErrNotSupported)
emit error(QCamera::CameraError, tr("Failure while querying supported exposure compensation values."));
return valueList;
}
if (info == ENotActive || evSteps.Count() == 0) {
// EV not supported, return empty list
return valueList;
}
for (int i = 0; i < evSteps.Count(); ++i) {
qreal appendValue = evSteps[i];
appendValue /= KSymbianFineResolutionFactor;
valueList.append(appendValue);
}
}
else
emit error(QCamera::CameraError, tr("Unexpected camera error."));
return valueList;
#else // S60 3.1 Platform
return valueList;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setSharpeningLevel(int value)
{
#ifdef POST_31_PLATFORM
if (m_imageProcessingSettings && isSharpeningSupported())
m_imageProcessingSettings->SetTransformationValue(KUidECamEventImageProcessingAdjustSharpness, value);
else
emit error(QCamera::NotSupportedFeatureError, tr("Setting sharpening level is not supported."));
#else // S60 3.1
Q_UNUSED(value);
emit error(QCamera::NotSupportedFeatureError, tr("Setting sharpening level is not supported."));
#endif // POST_31_PLATFORM
}
bool S60CameraSettings::isSharpeningSupported() const
{
#ifdef POST_31_PLATFORM
if (m_imageProcessingSettings) {
RArray<TUid> suppTransforms;
TRAPD(err, m_imageProcessingSettings->GetSupportedTransformationsL(suppTransforms));
if (err)
return false;
if (suppTransforms.Find(KUidECamEventImageProcessingAdjustSharpness))
return true;
}
return false;
#else // S60 3.1 Platform
return false;
#endif // POST_31_PLATFORM
}
int S60CameraSettings::sharpeningLevel() const
{
#ifdef POST_31_PLATFORM
if (m_imageProcessingSettings && isSharpeningSupported())
return m_imageProcessingSettings->TransformationValue(KUidECamEventImageProcessingAdjustSharpness);
else
return 0;
#else // S60 3.1 Platform
return 0;
#endif // POST_31_PLATFORM
}
void S60CameraSettings::setSaturation(int value)
{
#ifdef POST_31_PLATFORM
if (m_imageProcessingSettings) {
RArray<TUid> suppTransforms;
TRAPD(err, m_imageProcessingSettings->GetSupportedTransformationsL(suppTransforms));
if (err)
if (err != KErrNotSupported)
emit error(QCamera::CameraError, tr("Failure while querying supported transformations."));
if (suppTransforms.Find(KUidECamEventtImageProcessingAdjustSaturation))
m_imageProcessingSettings->SetTransformationValue(KUidECamEventtImageProcessingAdjustSaturation, value == -1 ? 0 : value*2-100);
else
emit error(QCamera::NotSupportedFeatureError, tr("Setting saturation is not supported."));
}
else
emit error(QCamera::NotSupportedFeatureError, tr("Setting saturation is not supported."));
#else // S60 3.1
Q_UNUSED(value);
emit error(QCamera::NotSupportedFeatureError, tr("Setting saturation is not supported."));
#endif // POST_31_PLATFORM
}
int S60CameraSettings::saturation()
{
#ifdef POST_31_PLATFORM
if (m_imageProcessingSettings) {
RArray<TUid> suppTransforms;
TRAPD(err, m_imageProcessingSettings->GetSupportedTransformationsL(suppTransforms));
if (err)
if (err != KErrNotSupported)
emit error(QCamera::CameraError, tr("Failure while querying supported transformations."));
if (suppTransforms.Find(KUidECamEventtImageProcessingAdjustSaturation))
return m_imageProcessingSettings->TransformationValue(KUidECamEventtImageProcessingAdjustSaturation);
}
return 0;
#else // S60 3.1 Platform
return 0;
#endif // POST_31_PLATFORM
}
// End of file

View File

@@ -1,177 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the Qt Mobility Components.
**
** $QT_BEGIN_LICENSE:LGPL$
** GNU Lesser General Public License Usage
** 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, Nokia gives you certain additional
** rights. These rights are described in the Nokia 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.
**
** Other Usage
** Alternatively, this file may be used in accordance with the terms and
** conditions contained in a signed written agreement between you and Nokia.
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef S60CAMERASETTINGS_H
#define S60CAMERASETTINGS_H
#include "qcamera.h"
#include "s60cameraengine.h"
#include "s60cameraengineobserver.h"
#include <e32base.h>
QT_USE_NAMESPACE
/*
* Class handling CCamera AdvancedSettings and ImageProcessing operations.
*/
class S60CameraSettings : public QObject,
public MAdvancedSettingsObserver
{
Q_OBJECT
public: // Static Contructor & Destructor
static S60CameraSettings* New(int &error, QObject *parent = 0, CCameraEngine *engine = 0);
~S60CameraSettings();
public: // Methods
// Focus
QCameraFocus::FocusMode focusMode();
void setFocusMode(QCameraFocus::FocusMode mode);
QCameraFocus::FocusModes supportedFocusModes();
void startFocusing();
void cancelFocusing();
// Zoom
qreal opticalZoomFactorL() const;
void setOpticalZoomFactorL(const qreal zoomFactor);
QList<qreal> supportedDigitalZoomFactors() const;
qreal digitalZoomFactorL() const;
void setDigitalZoomFactorL(const qreal zoomFactor);
// Flash
bool isFlashReady();
// Exposure
void setExposureMode(QCameraExposure::ExposureMode mode);
void lockExposure(bool lock);
bool isExposureLocked();
// Metering Mode
QCameraExposure::MeteringMode meteringMode();
void setMeteringMode(QCameraExposure::MeteringMode mode);
bool isMeteringModeSupported(QCameraExposure::MeteringMode mode);
// ISO Sensitivity
int isoSensitivity();
void setManualIsoSensitivity(int iso);
void setAutoIsoSensitivity();
QList<int> supportedIsoSensitivities();
// Aperture
qreal aperture();
void setManualAperture(qreal aperture);
QList<qreal> supportedApertures();
// Shutter Speed
qreal shutterSpeed();
void setManualShutterSpeed(qreal speed);
QList<qreal> supportedShutterSpeeds();
// ExposureCompensation
qreal exposureCompensation();
void setExposureCompensation(qreal ev);
QList<qreal> supportedExposureCompensationValues();
// Sharpening Level
int sharpeningLevel() const;
void setSharpeningLevel(int value);
bool isSharpeningSupported() const;
// Saturation
int saturation();
void setSaturation(int value);
signals: // Notifications
// For QCameraExposureControl
void flashReady(bool ready);
void apertureChanged();
void apertureRangeChanged();
void shutterSpeedChanged();
void isoSensitivityChanged();
void evChanged();
// For QCameraLocksControl
void exposureStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason);
void focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason);
// Errors
void error(int, const QString&);
protected: // Protected constructors
S60CameraSettings(QObject *parent, CCameraEngine *engine);
void ConstructL();
protected: // MAdvancedSettingsObserver
void HandleAdvancedEvent(const TECAMEvent& aEvent);
private: // Internal
bool queryAdvancedSettingsInfo();
private: // Enums
enum EcamErrors {
KErrECamCameraDisabled = -12100, // The camera has been disabled, hence calls do not succeed
KErrECamSettingDisabled = -12101, // This parameter or operation is supported, but presently is disabled.
KErrECamParameterNotInRange = -12102, // This value is out of range.
KErrECamSettingNotSupported = -12103, // This parameter or operation is not supported.
KErrECamNotOptimalFocus = -12104 // The optimum focus is lost
};
private: // Data
#ifndef S60_31_PLATFORM // Post S60 3.1 Platforms
CCamera::CCameraAdvancedSettings *m_advancedSettings;
CCamera::CCameraImageProcessing *m_imageProcessingSettings;
#endif // S60_31_PLATFORM
CCameraEngine *m_cameraEngine;
QList<int> m_supportedSymbianDigitalZoomFactors;
bool m_continuousFocusing;
};
#endif // S60CAMERASETTINGS_H

Some files were not shown because too many files have changed in this diff Show More