summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@digia.com>2013-03-19 09:55:03 +0100
committerSergio Ahumada <sergio.ahumada@digia.com>2013-03-19 09:55:42 +0100
commitfa8ee64dd6c20ba6f18a70084ddac16655895df4 (patch)
treeabfe07c1537f0e4ff15fde30ca4135377948c21c
parent697abcc532805fa1d10d56256a5f387fbad8c11b (diff)
parent954bb7b9603e6049ef3b22ddd5fad2b324d937c3 (diff)
Merge branch 'dev' into stable
This starts Qt 5.1 release cycle Change-Id: I0f78796735fc37e092b6747bdc89cc0f41164472
-rw-r--r--examples/multimediawidgets/camera/camera.cpp10
-rw-r--r--examples/multimediawidgets/camera/camera.h1
-rw-r--r--examples/multimediawidgets/camera/camera.ui5
-rw-r--r--src/imports/audioengine/qaudioengine_openal_p.h4
-rw-r--r--src/imports/audioengine/qaudioengine_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_attenuationmodel_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_audiocategory_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_audioengine_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_audiolistener_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_audiosample_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_playvariation_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_sound_p.h4
-rw-r--r--src/imports/audioengine/qdeclarative_soundinstance_p.h4
-rw-r--r--src/imports/audioengine/qsoundbuffer_p.h4
-rw-r--r--src/imports/audioengine/qsoundinstance_p.h4
-rw-r--r--src/imports/audioengine/qsoundsource_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativeaudio_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecamera_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecameracapture_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecameraflash_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecamerafocus_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativecamerarecorder_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativemediametadata_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativeradio_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativeradiodata_p.h4
-rw-r--r--src/imports/multimedia/qdeclarativetorch_p.h4
-rw-r--r--src/multimedia/audio/audio.pri4
-rw-r--r--src/multimedia/audio/qaudio.h4
-rw-r--r--src/multimedia/audio/qaudio_mac_p.h4
-rw-r--r--src/multimedia/audio/qaudiobuffer.h4
-rw-r--r--src/multimedia/audio/qaudiobuffer_p.h4
-rw-r--r--src/multimedia/audio/qaudiodecoder.h4
-rw-r--r--src/multimedia/audio/qaudiodevicefactory.cpp14
-rw-r--r--src/multimedia/audio/qaudiodevicefactory_p.h4
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.h4
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.h4
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.h4
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.h4
-rw-r--r--src/multimedia/audio/qaudioformat.h4
-rw-r--r--src/multimedia/audio/qaudioinput.h4
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.h4
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.h4
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp14
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.h8
-rw-r--r--src/multimedia/audio/qaudiooutput.h4
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.h4
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.h4
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp2
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.h6
-rw-r--r--src/multimedia/audio/qaudioprobe.h4
-rw-r--r--src/multimedia/audio/qaudiosystem.h4
-rw-r--r--src/multimedia/audio/qaudiosystemplugin.h4
-rw-r--r--src/multimedia/audio/qsamplecache_p.h4
-rw-r--r--src/multimedia/audio/qsound.h4
-rw-r--r--src/multimedia/audio/qsoundeffect.h4
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h4
-rw-r--r--src/multimedia/audio/qsoundeffect_qaudio_p.h4
-rw-r--r--src/multimedia/audio/qwavedecoder_p.h4
-rw-r--r--src/multimedia/camera/qcamera.h4
-rw-r--r--src/multimedia/camera/qcameraexposure.h4
-rw-r--r--src/multimedia/camera/qcamerafocus.h4
-rw-r--r--src/multimedia/camera/qcameraimagecapture.h4
-rw-r--r--src/multimedia/camera/qcameraimageprocessing.h4
-rw-r--r--src/multimedia/controls/qaudiodecodercontrol.h4
-rw-r--r--src/multimedia/controls/qaudioencodersettingscontrol.h4
-rw-r--r--src/multimedia/controls/qaudioinputselectorcontrol.h4
-rw-r--r--src/multimedia/controls/qaudiooutputselectorcontrol.h4
-rw-r--r--src/multimedia/controls/qcameracapturebufferformatcontrol.h4
-rw-r--r--src/multimedia/controls/qcameracapturedestinationcontrol.h4
-rw-r--r--src/multimedia/controls/qcameracontrol.h4
-rw-r--r--src/multimedia/controls/qcameraexposurecontrol.h4
-rw-r--r--src/multimedia/controls/qcamerafeedbackcontrol.h4
-rw-r--r--src/multimedia/controls/qcameraflashcontrol.h4
-rw-r--r--src/multimedia/controls/qcamerafocuscontrol.h4
-rw-r--r--src/multimedia/controls/qcameraimagecapturecontrol.h4
-rw-r--r--src/multimedia/controls/qcameraimageprocessingcontrol.h4
-rw-r--r--src/multimedia/controls/qcameralockscontrol.h4
-rw-r--r--src/multimedia/controls/qcameraviewfindersettingscontrol.h4
-rw-r--r--src/multimedia/controls/qcamerazoomcontrol.h4
-rw-r--r--src/multimedia/controls/qimageencodercontrol.h4
-rw-r--r--src/multimedia/controls/qmediaaudioprobecontrol.h4
-rw-r--r--src/multimedia/controls/qmediaavailabilitycontrol.h4
-rw-r--r--src/multimedia/controls/qmediacontainercontrol.h4
-rw-r--r--src/multimedia/controls/qmediagaplessplaybackcontrol.h4
-rw-r--r--src/multimedia/controls/qmedianetworkaccesscontrol.h4
-rw-r--r--src/multimedia/controls/qmediaplayercontrol.h4
-rw-r--r--src/multimedia/controls/qmediaplaylistcontrol_p.h4
-rw-r--r--src/multimedia/controls/qmediaplaylistsourcecontrol_p.h4
-rw-r--r--src/multimedia/controls/qmediarecordercontrol.h4
-rw-r--r--src/multimedia/controls/qmediastreamscontrol.h4
-rw-r--r--src/multimedia/controls/qmediavideoprobecontrol.h4
-rw-r--r--src/multimedia/controls/qmetadatareadercontrol.h4
-rw-r--r--src/multimedia/controls/qmetadatawritercontrol.h4
-rw-r--r--src/multimedia/controls/qradiodatacontrol.h4
-rw-r--r--src/multimedia/controls/qradiotunercontrol.h4
-rw-r--r--src/multimedia/controls/qvideodeviceselectorcontrol.h4
-rw-r--r--src/multimedia/controls/qvideoencodersettingscontrol.h4
-rw-r--r--src/multimedia/controls/qvideorenderercontrol.h4
-rw-r--r--src/multimedia/controls/qvideowindowcontrol.h4
-rw-r--r--src/multimedia/doc/qtmultimedia.qdocconf6
-rw-r--r--src/multimedia/doc/src/blackberry.qdoc10
-rw-r--r--src/multimedia/doc/src/qtmultimedia-index.qdoc2
-rw-r--r--src/multimedia/multimedia.pro5
-rw-r--r--src/multimedia/playback/playlistfileparser_p.h4
-rw-r--r--src/multimedia/playback/qmediacontent.h4
-rw-r--r--src/multimedia/playback/qmedianetworkplaylistprovider_p.h4
-rw-r--r--src/multimedia/playback/qmediaplayer.h4
-rw-r--r--src/multimedia/playback/qmediaplaylist.h4
-rw-r--r--src/multimedia/playback/qmediaplaylist_p.h4
-rw-r--r--src/multimedia/playback/qmediaplaylistioplugin_p.h4
-rw-r--r--src/multimedia/playback/qmediaplaylistnavigator_p.h4
-rw-r--r--src/multimedia/playback/qmediaplaylistprovider_p.h4
-rw-r--r--src/multimedia/playback/qmediaresource.h4
-rw-r--r--src/multimedia/qmediabindableinterface.h4
-rw-r--r--src/multimedia/qmediacontrol.h4
-rw-r--r--src/multimedia/qmediacontrol_p.h4
-rw-r--r--src/multimedia/qmediaenumdebug.h2
-rw-r--r--src/multimedia/qmediametadata.h4
-rw-r--r--src/multimedia/qmediaobject.h4
-rw-r--r--src/multimedia/qmediaobject_p.h4
-rw-r--r--src/multimedia/qmediapluginloader_p.h4
-rw-r--r--src/multimedia/qmediaresourcepolicy_p.h4
-rw-r--r--src/multimedia/qmediaresourcepolicyplugin_p.h4
-rw-r--r--src/multimedia/qmediaresourceset_p.h4
-rw-r--r--src/multimedia/qmediaservice.h4
-rw-r--r--src/multimedia/qmediaservice_p.h4
-rw-r--r--src/multimedia/qmediaserviceprovider_p.h4
-rw-r--r--src/multimedia/qmediaserviceproviderplugin.h4
-rw-r--r--src/multimedia/qmediatimerange.h4
-rw-r--r--src/multimedia/qmultimedia.h4
-rw-r--r--src/multimedia/qtmultimediadefs.h3
-rw-r--r--src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h4
-rw-r--r--src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h4
-rw-r--r--src/multimedia/radio/qradiodata.h4
-rw-r--r--src/multimedia/radio/qradiotuner.h4
-rw-r--r--src/multimedia/recording/qaudiorecorder.h4
-rw-r--r--src/multimedia/recording/qmediaencodersettings.h4
-rw-r--r--src/multimedia/recording/qmediarecorder.h4
-rw-r--r--src/multimedia/video/qabstractvideobuffer.h4
-rw-r--r--src/multimedia/video/qabstractvideobuffer_p.h4
-rw-r--r--src/multimedia/video/qabstractvideosurface.h4
-rw-r--r--src/multimedia/video/qimagevideobuffer_p.h4
-rw-r--r--src/multimedia/video/qmemoryvideobuffer_p.h8
-rw-r--r--src/multimedia/video/qvideoframe.h4
-rw-r--r--src/multimedia/video/qvideoprobe.h4
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h4
-rw-r--r--src/multimedia/video/qvideosurfaceoutput_p.h4
-rw-r--r--src/multimediawidgets/doc/qtmultimediawidgets.qdocconf43
-rw-r--r--src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc67
-rw-r--r--src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc47
-rw-r--r--src/multimediawidgets/multimediawidgets.pro5
-rw-r--r--src/multimediawidgets/qcameraviewfinder.h4
-rw-r--r--src/multimediawidgets/qeglimagetexturesurface_p.h4
-rw-r--r--src/multimediawidgets/qgraphicsvideoitem.h4
-rw-r--r--src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp2
-rw-r--r--src/multimediawidgets/qpaintervideosurface_mac_p.h4
-rw-r--r--src/multimediawidgets/qpaintervideosurface_p.h4
-rw-r--r--src/multimediawidgets/qtmultimediawidgetdefs.h2
-rw-r--r--src/multimediawidgets/qvideowidget.h4
-rw-r--r--src/multimediawidgets/qvideowidget_p.h4
-rw-r--r--src/multimediawidgets/qvideowidgetcontrol.h4
-rw-r--r--src/plugins/android/android.pro5
-rw-r--r--src/plugins/android/jar/AndroidManifest.xml6
-rw-r--r--src/plugins/android/jar/jar.pro11
-rw-r--r--src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java445
-rw-r--r--src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java74
-rw-r--r--src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java114
-rw-r--r--src/plugins/android/mediaplayer/mediaplayer.json (renamed from src/plugins/blackberry/mediaservice/blackberry_mediaservice.json)0
-rw-r--r--src/plugins/android/mediaplayer/mediaplayer.pro24
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp496
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h127
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaservice.cpp97
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaservice.h71
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp107
-rw-r--r--src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h72
-rw-r--r--src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp221
-rw-r--r--src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h80
-rw-r--r--src/plugins/android/mediaplayer/qandroidvideooutput.h64
-rw-r--r--src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp375
-rw-r--r--src/plugins/android/mediaplayer/qandroidvideorendercontrol.h95
-rw-r--r--src/plugins/android/wrappers/jmediametadataretriever.cpp126
-rw-r--r--src/plugins/android/wrappers/jmediametadataretriever.h91
-rw-r--r--src/plugins/android/wrappers/jmediaplayer.cpp265
-rw-r--r--src/plugins/android/wrappers/jmediaplayer.h133
-rw-r--r--src/plugins/android/wrappers/jsurfacetexture.cpp118
-rw-r--r--src/plugins/android/wrappers/jsurfacetexture.h75
-rw-r--r--src/plugins/android/wrappers/jsurfacetextureholder.cpp65
-rw-r--r--src/plugins/android/wrappers/jsurfacetextureholder.h59
-rw-r--r--src/plugins/android/wrappers/wrappers.pri15
-rw-r--r--src/plugins/blackberry/bbserviceplugin.cpp112
-rw-r--r--src/plugins/blackberry/bbserviceplugin.h (renamed from src/plugins/blackberry/mediaservice/bbserviceplugin.h)12
-rw-r--r--src/plugins/blackberry/blackberry.pro18
-rw-r--r--src/plugins/blackberry/blackberry_mediaservice.json3
-rw-r--r--src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp89
-rw-r--r--src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h68
-rw-r--r--src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp66
-rw-r--r--src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h61
-rw-r--r--src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp70
-rw-r--r--src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h66
-rw-r--r--src/plugins/blackberry/camera/bbcameracontrol.cpp92
-rw-r--r--src/plugins/blackberry/camera/bbcameracontrol.h73
-rw-r--r--src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp232
-rw-r--r--src/plugins/blackberry/camera/bbcameraexposurecontrol.h73
-rw-r--r--src/plugins/blackberry/camera/bbcameraflashcontrol.cpp113
-rw-r--r--src/plugins/blackberry/camera/bbcameraflashcontrol.h68
-rw-r--r--src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp331
-rw-r--r--src/plugins/blackberry/camera/bbcamerafocuscontrol.h79
-rw-r--r--src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp85
-rw-r--r--src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h70
-rw-r--r--src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp146
-rw-r--r--src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h67
-rw-r--r--src/plugins/blackberry/camera/bbcameralockscontrol.cpp75
-rw-r--r--src/plugins/blackberry/camera/bbcameralockscontrol.h67
-rw-r--r--src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp158
-rw-r--r--src/plugins/blackberry/camera/bbcameramediarecordercontrol.h76
-rw-r--r--src/plugins/blackberry/camera/bbcameraorientationhandler.cpp100
-rw-r--r--src/plugins/blackberry/camera/bbcameraorientationhandler.h69
-rw-r--r--src/plugins/blackberry/camera/bbcameraservice.cpp141
-rw-r--r--src/plugins/blackberry/camera/bbcameraservice.h104
-rw-r--r--src/plugins/blackberry/camera/bbcamerasession.cpp1281
-rw-r--r--src/plugins/blackberry/camera/bbcamerasession.h236
-rw-r--r--src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp90
-rw-r--r--src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h69
-rw-r--r--src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp247
-rw-r--r--src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h66
-rw-r--r--src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp157
-rw-r--r--src/plugins/blackberry/camera/bbcamerazoomcontrol.h79
-rw-r--r--src/plugins/blackberry/camera/bbimageencodercontrol.cpp81
-rw-r--r--src/plugins/blackberry/camera/bbimageencodercontrol.h68
-rw-r--r--src/plugins/blackberry/camera/bbmediastoragelocation.cpp119
-rw-r--r--src/plugins/blackberry/camera/bbmediastoragelocation.h66
-rw-r--r--src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp146
-rw-r--r--src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h79
-rw-r--r--src/plugins/blackberry/camera/bbvideorenderercontrol.cpp (renamed from src/plugins/blackberry/mediaservice/bbserviceplugin.cpp)29
-rw-r--r--src/plugins/blackberry/camera/bbvideorenderercontrol.h65
-rw-r--r--src/plugins/blackberry/camera/camera.pri49
-rw-r--r--src/plugins/blackberry/common/common.pri7
-rw-r--r--src/plugins/blackberry/common/windowgrabber.cpp291
-rw-r--r--src/plugins/blackberry/common/windowgrabber.h106
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp (renamed from src/plugins/blackberry/mediaservice/bbmediaplayercontrol.cpp)51
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h (renamed from src/plugins/blackberry/mediaservice/bbmediaplayercontrol.h)10
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp (renamed from src/plugins/blackberry/mediaservice/bbmediaplayerservice.cpp)49
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h (renamed from src/plugins/blackberry/mediaservice/bbmediaplayerservice.h)7
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmetadata.cpp (renamed from src/plugins/blackberry/mediaservice/bbmetadata.cpp)96
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmetadata.h (renamed from src/plugins/blackberry/mediaservice/bbmetadata.h)23
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp169
-rw-r--r--src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h68
-rw-r--r--src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp152
-rw-r--r--src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h85
-rw-r--r--src/plugins/blackberry/mediaplayer/bbutil.cpp (renamed from src/plugins/blackberry/mediaservice/bbutil.cpp)35
-rw-r--r--src/plugins/blackberry/mediaplayer/bbutil.h (renamed from src/plugins/blackberry/mediaservice/bbutil.h)2
-rw-r--r--src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp (renamed from src/plugins/blackberry/mediaservice/bbvideowindowcontrol.cpp)2
-rw-r--r--src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h (renamed from src/plugins/blackberry/mediaservice/bbvideowindowcontrol.h)0
-rw-r--r--src/plugins/blackberry/mediaplayer/mediaplayer.pri21
-rw-r--r--src/plugins/blackberry/mediaservice/mediaservice.pro26
-rw-r--r--src/plugins/directshow/camera/dscameracontrol.h4
-rw-r--r--src/plugins/directshow/camera/dscameraservice.cpp1
-rw-r--r--src/plugins/directshow/camera/dscameraservice.h4
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp2
-rw-r--r--src/plugins/directshow/camera/dscamerasession.h14
-rw-r--r--src/plugins/directshow/camera/dsimagecapturecontrol.h6
-rw-r--r--src/plugins/directshow/camera/dsvideodevicecontrol.h4
-rw-r--r--src/plugins/directshow/camera/dsvideorenderer.h4
-rw-r--r--src/plugins/directshow/camera/dsvideowidgetcontrol.cpp5
-rw-r--r--src/plugins/directshow/camera/dsvideowidgetcontrol.h4
-rw-r--r--src/plugins/directshow/dsserviceplugin.cpp6
-rw-r--r--src/plugins/directshow/player/directshowiosource.cpp3
-rw-r--r--src/plugins/directshow/player/directshowmediatypelist.cpp2
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp6
-rw-r--r--src/plugins/directshow/player/videosurfacefilter.cpp10
-rw-r--r--src/plugins/plugins.pro15
-rw-r--r--src/plugins/qnx/audio/audio.pro26
-rw-r--r--src/plugins/qnx/audio/qnx_audio.json3
-rw-r--r--src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp150
-rw-r--r--src/plugins/qnx/audio/qnxaudiodeviceinfo.h74
-rw-r--r--src/plugins/qnx/audio/qnxaudioinput.cpp447
-rw-r--r--src/plugins/qnx/audio/qnxaudioinput.h139
-rw-r--r--src/plugins/qnx/audio/qnxaudiooutput.cpp443
-rw-r--r--src/plugins/qnx/audio/qnxaudiooutput.h131
-rw-r--r--src/plugins/qnx/audio/qnxaudioplugin.cpp88
-rw-r--r--src/plugins/qnx/audio/qnxaudioplugin.h66
-rw-r--r--src/plugins/qnx/audio/qnxaudioutils.cpp130
-rw-r--r--src/plugins/qnx/audio/qnxaudioutils.h57
-rw-r--r--src/plugins/qnx/qnx.pro3
-rw-r--r--tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-amd64.txt151
-rw-r--r--tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-ia32.txt151
-rw-r--r--tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-amd64.txt201
-rw-r--r--tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-ia32.txt201
-rw-r--r--tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h4
-rw-r--r--tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp6
293 files changed, 12298 insertions, 1439 deletions
diff --git a/examples/multimediawidgets/camera/camera.cpp b/examples/multimediawidgets/camera/camera.cpp
index 9c1f2902e..2b7a96f82 100644
--- a/examples/multimediawidgets/camera/camera.cpp
+++ b/examples/multimediawidgets/camera/camera.cpp
@@ -136,6 +136,8 @@ void Camera::setCamera(const QByteArray &cameraDevice)
connect(imageCapture, SIGNAL(readyForCaptureChanged(bool)), this, SLOT(readyForCapture(bool)));
connect(imageCapture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(processCapturedImage(int,QImage)));
connect(imageCapture, SIGNAL(imageSaved(int,QString)), this, SLOT(imageSaved(int,QString)));
+ connect(imageCapture, SIGNAL(error(int,QCameraImageCapture::Error,QString)), this,
+ SLOT(displayCaptureError(int,QCameraImageCapture::Error,QString)));
connect(camera, SIGNAL(lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
this, SLOT(updateLockStatus(QCamera::LockStatus, QCamera::LockChangeReason)));
@@ -320,6 +322,14 @@ void Camera::takeImage()
imageCapture->capture();
}
+void Camera::displayCaptureError(int id, const QCameraImageCapture::Error error, const QString &errorString)
+{
+ Q_UNUSED(id);
+ Q_UNUSED(error);
+ QMessageBox::warning(this, tr("Image Capture Error"), errorString);
+ isCapturingImage = false;
+}
+
void Camera::startCamera()
{
camera->start();
diff --git a/examples/multimediawidgets/camera/camera.h b/examples/multimediawidgets/camera/camera.h
index 9203216b3..52f03cbd3 100644
--- a/examples/multimediawidgets/camera/camera.h
+++ b/examples/multimediawidgets/camera/camera.h
@@ -72,6 +72,7 @@ private slots:
void toggleLock();
void takeImage();
+ void displayCaptureError(int, QCameraImageCapture::Error, const QString &errorString);
void configureCaptureSettings();
void configureVideoSettings();
diff --git a/examples/multimediawidgets/camera/camera.ui b/examples/multimediawidgets/camera/camera.ui
index ea790fab0..8a5ee519c 100644
--- a/examples/multimediawidgets/camera/camera.ui
+++ b/examples/multimediawidgets/camera/camera.ui
@@ -138,6 +138,9 @@
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QPushButton" name="takeImageButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
<property name="text">
<string>Capture Photo</string>
</property>
@@ -245,7 +248,7 @@
<x>0</x>
<y>0</y>
<width>668</width>
- <height>29</height>
+ <height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuFile">
diff --git a/src/imports/audioengine/qaudioengine_openal_p.h b/src/imports/audioengine/qaudioengine_openal_p.h
index 31f6d415b..98eab67be 100644
--- a/src/imports/audioengine/qaudioengine_openal_p.h
+++ b/src/imports/audioengine/qaudioengine_openal_p.h
@@ -58,8 +58,6 @@
#include "qsoundsource_p.h"
#include "qsoundbuffer_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundBufferPrivateAL : public QSoundBuffer
@@ -168,6 +166,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qaudioengine_p.h b/src/imports/audioengine/qaudioengine_p.h
index efbe57660..7293807c4 100644
--- a/src/imports/audioengine/qaudioengine_p.h
+++ b/src/imports/audioengine/qaudioengine_p.h
@@ -47,8 +47,6 @@
#include <QtCore/QUrl>
#include <QtGui/qvector3d.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundSource;
@@ -105,6 +103,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_attenuationmodel_p.h b/src/imports/audioengine/qdeclarative_attenuationmodel_p.h
index 341fbc23d..8041e79e7 100644
--- a/src/imports/audioengine/qdeclarative_attenuationmodel_p.h
+++ b/src/imports/audioengine/qdeclarative_attenuationmodel_p.h
@@ -46,8 +46,6 @@
#include <QtQml/qqmlcomponent.h>
#include <QVector3D>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeAttenuationModel : public QObject, public QQmlParserStatus
@@ -133,6 +131,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_audiocategory_p.h b/src/imports/audioengine/qdeclarative_audiocategory_p.h
index 846417696..72e3aff7c 100644
--- a/src/imports/audioengine/qdeclarative_audiocategory_p.h
+++ b/src/imports/audioengine/qdeclarative_audiocategory_p.h
@@ -45,8 +45,6 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlcomponent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeAudioCategory : public QObject, public QQmlParserStatus
@@ -89,6 +87,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_audioengine_p.h b/src/imports/audioengine/qdeclarative_audioengine_p.h
index d6e7dc794..a9f1e236e 100644
--- a/src/imports/audioengine/qdeclarative_audioengine_p.h
+++ b/src/imports/audioengine/qdeclarative_audioengine_p.h
@@ -50,8 +50,6 @@
#include <QTimer>
#include "qaudioengine_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeSoundInstance;
@@ -163,6 +161,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_audiolistener_p.h b/src/imports/audioengine/qdeclarative_audiolistener_p.h
index 8bd1ae71a..d4f65c282 100644
--- a/src/imports/audioengine/qdeclarative_audiolistener_p.h
+++ b/src/imports/audioengine/qdeclarative_audiolistener_p.h
@@ -45,8 +45,6 @@
#include <QtCore/QObject>
#include <QtGui/qvector3d.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeAudioEngine;
@@ -97,6 +95,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_audiosample_p.h b/src/imports/audioengine/qdeclarative_audiosample_p.h
index 586fce749..27579a724 100644
--- a/src/imports/audioengine/qdeclarative_audiosample_p.h
+++ b/src/imports/audioengine/qdeclarative_audiosample_p.h
@@ -45,8 +45,6 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlcomponent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundBuffer;
@@ -106,6 +104,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_playvariation_p.h b/src/imports/audioengine/qdeclarative_playvariation_p.h
index 6dbdac9ce..a23492c25 100644
--- a/src/imports/audioengine/qdeclarative_playvariation_p.h
+++ b/src/imports/audioengine/qdeclarative_playvariation_p.h
@@ -45,8 +45,6 @@
#include <QtQml/qqml.h>
#include <QtQml/qqmlcomponent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeAudioSample;
@@ -106,6 +104,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_sound_p.h b/src/imports/audioengine/qdeclarative_sound_p.h
index e0fc8167d..fd164f43c 100644
--- a/src/imports/audioengine/qdeclarative_sound_p.h
+++ b/src/imports/audioengine/qdeclarative_sound_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qlist.h>
#include "qdeclarative_playvariation_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeAudioCategory;
@@ -171,6 +169,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qdeclarative_soundinstance_p.h b/src/imports/audioengine/qdeclarative_soundinstance_p.h
index 4b194966d..375cc1c96 100644
--- a/src/imports/audioengine/qdeclarative_soundinstance_p.h
+++ b/src/imports/audioengine/qdeclarative_soundinstance_p.h
@@ -46,8 +46,6 @@
#include <QtGui/qvector3d.h>
#include "qsoundinstance_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeSound;
@@ -150,6 +148,4 @@ private Q_SLOTS:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/audioengine/qsoundbuffer_p.h b/src/imports/audioengine/qsoundbuffer_p.h
index 5d23a6000..4ef255ba4 100644
--- a/src/imports/audioengine/qsoundbuffer_p.h
+++ b/src/imports/audioengine/qsoundbuffer_p.h
@@ -44,8 +44,6 @@
#include <QObject>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundBuffer : public QObject
@@ -65,6 +63,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUNDBUFFER_P_H
diff --git a/src/imports/audioengine/qsoundinstance_p.h b/src/imports/audioengine/qsoundinstance_p.h
index 9099f5135..7ba220d29 100644
--- a/src/imports/audioengine/qsoundinstance_p.h
+++ b/src/imports/audioengine/qsoundinstance_p.h
@@ -46,8 +46,6 @@
#include <QObject>
#include "qsoundsource_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeSound;
@@ -134,6 +132,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUNDINSTANCE_P_H
diff --git a/src/imports/audioengine/qsoundsource_p.h b/src/imports/audioengine/qsoundsource_p.h
index 5b8bb58f8..1e0db6da3 100644
--- a/src/imports/audioengine/qsoundsource_p.h
+++ b/src/imports/audioengine/qsoundsource_p.h
@@ -45,8 +45,6 @@
#include <QVector3D>
#include <QObject>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundBuffer;
@@ -93,6 +91,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h
index 79228d70d..b8a75c659 100644
--- a/src/imports/multimedia/qdeclarativeaudio_p.h
+++ b/src/imports/multimedia/qdeclarativeaudio_p.h
@@ -59,8 +59,6 @@
#include <qmediaplayer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QTimerEvent;
@@ -271,6 +269,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h
index c96ba3f98..8638c423d 100644
--- a/src/imports/multimedia/qdeclarativecamera_p.h
+++ b/src/imports/multimedia/qdeclarativecamera_p.h
@@ -65,8 +65,6 @@
#include <QtQml/qqmlparserstatus.h>
#include <QtQml/qqml.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCameraExposure;
@@ -312,6 +310,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCamera))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecameracapture_p.h b/src/imports/multimedia/qdeclarativecameracapture_p.h
index 4ab30ee45..8bab446e5 100644
--- a/src/imports/multimedia/qdeclarativecameracapture_p.h
+++ b/src/imports/multimedia/qdeclarativecameracapture_p.h
@@ -59,8 +59,6 @@
#include <QtQml/qqml.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCamera;
@@ -125,6 +123,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraCapture))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h
index e8ad8fb7c..6908a965c 100644
--- a/src/imports/multimedia/qdeclarativecameraexposure_p.h
+++ b/src/imports/multimedia/qdeclarativecameraexposure_p.h
@@ -57,8 +57,6 @@
#include <qcamera.h>
#include <qcameraexposure.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCamera;
@@ -142,6 +140,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecameraflash_p.h b/src/imports/multimedia/qdeclarativecameraflash_p.h
index 6009d90ca..e3919a41c 100644
--- a/src/imports/multimedia/qdeclarativecameraflash_p.h
+++ b/src/imports/multimedia/qdeclarativecameraflash_p.h
@@ -56,8 +56,6 @@
#include <qcamera.h>
#include <qcameraexposure.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCamera;
@@ -91,6 +89,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFlash))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecamerafocus_p.h b/src/imports/multimedia/qdeclarativecamerafocus_p.h
index a6060e5b6..3287b9309 100644
--- a/src/imports/multimedia/qdeclarativecamerafocus_p.h
+++ b/src/imports/multimedia/qdeclarativecamerafocus_p.h
@@ -58,8 +58,6 @@
#include <qcamerafocus.h>
#include "qdeclarativecamera_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class FocusZonesModel;
@@ -131,6 +129,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFocus))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
index 40655d5c4..f5759f927 100644
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
+++ b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
@@ -56,8 +56,6 @@
#include <qcamera.h>
#include <qcameraimageprocessing.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCamera;
@@ -127,6 +125,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraImageProcessing))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h
index b0b4d53ce..07a37b2b7 100644
--- a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h
+++ b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h
@@ -55,8 +55,6 @@
#include <QtQuick/qquickimageprovider.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCameraPreviewProvider : public QQuickImageProvider
@@ -71,6 +69,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativecamerarecorder_p.h b/src/imports/multimedia/qdeclarativecamerarecorder_p.h
index dce349ad8..3a1bc11b2 100644
--- a/src/imports/multimedia/qdeclarativecamerarecorder_p.h
+++ b/src/imports/multimedia/qdeclarativecamerarecorder_p.h
@@ -57,8 +57,6 @@
#include <qmediarecorder.h>
#include <qmediaencodersettings.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeCamera;
@@ -227,6 +225,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraRecorder))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativemediametadata_p.h b/src/imports/multimedia/qdeclarativemediametadata_p.h
index 4fa00c306..5b7c46993 100644
--- a/src/imports/multimedia/qdeclarativemediametadata_p.h
+++ b/src/imports/multimedia/qdeclarativemediametadata_p.h
@@ -56,8 +56,6 @@
#include <QtQml/qqml.h>
#include "qmediaobject.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeMediaMetaData : public QObject
@@ -179,6 +177,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaMetaData))
-QT_END_HEADER
-
#endif
diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h
index 2f747434e..b5d8fab8d 100644
--- a/src/imports/multimedia/qdeclarativeradio_p.h
+++ b/src/imports/multimedia/qdeclarativeradio_p.h
@@ -56,8 +56,6 @@
#include <qradiotuner.h>
#include <QtQml/qqml.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeRadioData;
@@ -202,6 +200,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadio))
-QT_END_HEADER
-
#endif // QDECLARATIVERADIO_P_H
diff --git a/src/imports/multimedia/qdeclarativeradiodata_p.h b/src/imports/multimedia/qdeclarativeradiodata_p.h
index 51a986722..e4d3dbfaf 100644
--- a/src/imports/multimedia/qdeclarativeradiodata_p.h
+++ b/src/imports/multimedia/qdeclarativeradiodata_p.h
@@ -57,8 +57,6 @@
#include <qradiotuner.h>
#include <QtQml/qqml.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeRadioData : public QObject
@@ -191,6 +189,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadioData))
-QT_END_HEADER
-
#endif // QDECLARATIVERADIODATA_P_H
diff --git a/src/imports/multimedia/qdeclarativetorch_p.h b/src/imports/multimedia/qdeclarativetorch_p.h
index ef9c36108..7866bad8c 100644
--- a/src/imports/multimedia/qdeclarativetorch_p.h
+++ b/src/imports/multimedia/qdeclarativetorch_p.h
@@ -49,8 +49,6 @@
#include <qcameraexposurecontrol.h>
#include <qcameraflashcontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QDeclarativeTorch : public QObject
@@ -88,6 +86,4 @@ QT_END_NAMESPACE
QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeTorch))
-QT_END_HEADER
-
#endif // QDECLARATIVETORCH_P_H
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
index 73a9d6519..f0706e3aa 100644
--- a/src/multimedia/audio/audio.pri
+++ b/src/multimedia/audio/audio.pri
@@ -39,7 +39,8 @@ SOURCES += \
audio/qaudiodecoder.cpp \
audio/qaudiohelpers.cpp
-mac {
+mac:!ios {
+
PRIVATE_HEADERS += audio/qaudioinput_mac_p.h \
audio/qaudiooutput_mac_p.h \
audio/qaudiodeviceinfo_mac_p.h \
@@ -49,7 +50,6 @@ mac {
audio/qaudiooutput_mac_p.cpp \
audio/qaudioinput_mac_p.cpp \
audio/qaudio_mac.cpp
-
LIBS += -framework ApplicationServices -framework CoreAudio -framework AudioUnit -framework AudioToolbox
}
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
index 0b70f1e0a..ae23ea562 100644
--- a/src/multimedia/audio/qaudio.h
+++ b/src/multimedia/audio/qaudio.h
@@ -48,8 +48,6 @@
#include <QtCore/qmetatype.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
//QTM_SYNC_HEADER_EXPORT QAudio
@@ -75,6 +73,4 @@ Q_DECLARE_METATYPE(QAudio::Error)
Q_DECLARE_METATYPE(QAudio::State)
Q_DECLARE_METATYPE(QAudio::Mode)
-QT_END_HEADER
-
#endif // QAUDIO_H
diff --git a/src/multimedia/audio/qaudio_mac_p.h b/src/multimedia/audio/qaudio_mac_p.h
index 06b16b49e..5a22bbf44 100644
--- a/src/multimedia/audio/qaudio_mac_p.h
+++ b/src/multimedia/audio/qaudio_mac_p.h
@@ -61,8 +61,6 @@
#include <qaudioformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
extern QAudioFormat toQAudioFormat(const AudioStreamBasicDescription& streamFormat);
@@ -132,8 +130,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIO_MAC_P_H
diff --git a/src/multimedia/audio/qaudiobuffer.h b/src/multimedia/audio/qaudiobuffer.h
index 881cfb674..5f61da4a2 100644
--- a/src/multimedia/audio/qaudiobuffer.h
+++ b/src/multimedia/audio/qaudiobuffer.h
@@ -50,8 +50,6 @@
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudioformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAbstractAudioBuffer;
@@ -152,6 +150,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAudioBuffer)
-QT_END_HEADER
-
#endif // QAUDIOBUFFER_H
diff --git a/src/multimedia/audio/qaudiobuffer_p.h b/src/multimedia/audio/qaudiobuffer_p.h
index ebae2c70c..fd096fc27 100644
--- a/src/multimedia/audio/qaudiobuffer_p.h
+++ b/src/multimedia/audio/qaudiobuffer_p.h
@@ -47,8 +47,6 @@
#include "qaudioformat.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -86,6 +84,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOBUFFER_P_H
diff --git a/src/multimedia/audio/qaudiodecoder.h b/src/multimedia/audio/qaudiodecoder.h
index 96080b3af..4becf7076 100644
--- a/src/multimedia/audio/qaudiodecoder.h
+++ b/src/multimedia/audio/qaudiodecoder.h
@@ -47,8 +47,6 @@
#include <QtMultimedia/qaudiobuffer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAudioDecoderPrivate;
@@ -142,6 +140,4 @@ Q_DECLARE_METATYPE(QAudioDecoder::Error)
Q_MEDIA_ENUM_DEBUG(QAudioDecoder, State)
Q_MEDIA_ENUM_DEBUG(QAudioDecoder, Error)
-QT_END_HEADER
-
#endif // QAUDIODECODER_H
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp
index 119907326..76f122790 100644
--- a/src/multimedia/audio/qaudiodevicefactory.cpp
+++ b/src/multimedia/audio/qaudiodevicefactory.cpp
@@ -52,7 +52,7 @@
#include "qaudiodeviceinfo_win32_p.h"
#include "qaudiooutput_win32_p.h"
#include "qaudioinput_win32_p.h"
-#elif defined(Q_OS_MAC)
+#elif defined(Q_OS_MAC) && !defined(Q_OS_IOS)
#include "qaudiodeviceinfo_mac_p.h"
#include "qaudiooutput_mac_p.h"
#include "qaudioinput_mac_p.h"
@@ -137,7 +137,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))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
#endif
@@ -170,7 +170,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
#endif
#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
#endif
#endif
@@ -190,7 +190,7 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
#endif
#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
#endif
#endif
@@ -202,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))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
if (realm == QLatin1String("builtin"))
return new QAudioDeviceInfoInternal(handle, mode);
#endif
@@ -234,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))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);
@@ -261,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))
+#if (defined(Q_OS_WIN) || (defined(Q_OS_MAC) && !defined(Q_OS_IOS)) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);
diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h
index bec3bd2b6..823115cd9 100644
--- a/src/multimedia/audio/qaudiodevicefactory_p.h
+++ b/src/multimedia/audio/qaudiodevicefactory_p.h
@@ -61,8 +61,6 @@
#include "qaudiodeviceinfo.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -92,7 +90,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIODEVICEFACTORY_P_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h
index 485c1e56c..6b80f1c4b 100644
--- a/src/multimedia/audio/qaudiodeviceinfo.h
+++ b/src/multimedia/audio/qaudiodeviceinfo.h
@@ -55,8 +55,6 @@
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudioformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -110,6 +108,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAudioDeviceInfo)
-QT_END_HEADER
-
#endif // QAUDIODEVICEINFO_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
index a0fcb835f..466bcdece 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
+++ b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
@@ -65,8 +65,6 @@
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -120,8 +118,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
index 98598dbd4..2afb21285 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
+++ b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
@@ -58,8 +58,6 @@
#include <qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -92,6 +90,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QDEVICEINFO_MAC_P_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
index bb57945fc..6744518c3 100644
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
+++ b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
@@ -63,8 +63,6 @@
#include <qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -112,7 +110,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
index 830113e79..555c5f959 100644
--- a/src/multimedia/audio/qaudioformat.h
+++ b/src/multimedia/audio/qaudioformat.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAudioFormatPrivate;
@@ -117,6 +115,4 @@ Q_DECLARE_METATYPE(QAudioFormat)
Q_DECLARE_METATYPE(QAudioFormat::SampleType)
Q_DECLARE_METATYPE(QAudioFormat::Endian)
-QT_END_HEADER
-
#endif // QAUDIOFORMAT_H
diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h
index a115ef7c4..7234edca0 100644
--- a/src/multimedia/audio/qaudioinput.h
+++ b/src/multimedia/audio/qaudioinput.h
@@ -53,8 +53,6 @@
#include <QtMultimedia/qaudiodeviceinfo.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -110,6 +108,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOINPUT_H
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h
index d1c98feb9..0455ba903 100644
--- a/src/multimedia/audio/qaudioinput_alsa_p.h
+++ b/src/multimedia/audio/qaudioinput_alsa_p.h
@@ -67,8 +67,6 @@
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -186,7 +184,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h
index a746035f6..7faaa6980 100644
--- a/src/multimedia/audio/qaudioinput_mac_p.h
+++ b/src/multimedia/audio/qaudioinput_mac_p.h
@@ -68,8 +68,6 @@
#include <qaudioformat.h>
#include <qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -172,6 +170,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOINPUT_MAC_P_H
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index ef071a694..6db34adf3 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -85,7 +85,7 @@ QAudioInputPrivate::~QAudioInputPrivate()
}
void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
+ DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 )
{
Q_UNUSED(dwParam1)
Q_UNUSED(dwParam2)
@@ -197,7 +197,7 @@ void QAudioInputPrivate::setVolume(qreal volume)
controlDetails.cMultipleItems = 0;
controlDetails.cbDetails = sizeof(MIXERCONTROLDETAILS_UNSIGNED);
controlDetails.paDetails = &controlDetailsUnsigned;
- mixerSetControlDetails((HMIXEROBJ)mixerID, &controlDetails, MIXER_SETCONTROLDETAILSF_VALUE);
+ mixerSetControlDetails(mixerID, &controlDetails, MIXER_SETCONTROLDETAILSF_VALUE);
}
}
}
@@ -221,7 +221,7 @@ qreal QAudioInputPrivate::volume() const
controlDetails.paDetails = &detailsUnsigned;
memset(controlDetails.paDetails, 0, controlDetails.cbDetails);
- MMRESULT result = mixerGetControlDetails((HMIXEROBJ)mixerID, &controlDetails, MIXER_GETCONTROLDETAILSF_VALUE);
+ MMRESULT result = mixerGetControlDetails(mixerID, &controlDetails, MIXER_GETCONTROLDETAILSF_VALUE);
if (result != MMSYSERR_NOERROR)
continue;
if (controlDetails.cbDetails < sizeof(MIXERCONTROLDETAILS_UNSIGNED))
@@ -431,14 +431,16 @@ void QAudioInputPrivate::initMixer()
return;
// Get the Mixer ID from the Sound Device ID
- if (mixerGetID((HMIXEROBJ)inputDevice, &mixerID, MIXER_OBJECTF_WAVEIN) != MMSYSERR_NOERROR)
+ UINT mixerIntID = 0;
+ if (mixerGetID((HMIXEROBJ)(quintptr(inputDevice)), &mixerIntID, MIXER_OBJECTF_WAVEIN) != MMSYSERR_NOERROR)
return;
+ mixerID = (HMIXEROBJ)mixerIntID;
// Get the Destination (Recording) Line Infomation
MIXERLINE mixerLine;
mixerLine.cbStruct = sizeof(MIXERLINE);
mixerLine.dwComponentType = MIXERLINE_COMPONENTTYPE_DST_WAVEIN;
- if (mixerGetLineInfo((HMIXEROBJ)mixerID, &mixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR)
+ if (mixerGetLineInfo(mixerID, &mixerLine, MIXER_GETLINEINFOF_COMPONENTTYPE) != MMSYSERR_NOERROR)
return;
// Set all the Destination (Recording) Line Controls
@@ -448,7 +450,7 @@ void QAudioInputPrivate::initMixer()
mixerLineControls.cControls = mixerLine.cControls;
mixerLineControls.cbmxctrl = sizeof(MIXERCONTROL);
mixerLineControls.pamxctrl = new MIXERCONTROL[mixerLineControls.cControls];
- if (mixerGetLineControls((HMIXEROBJ)mixerID, &mixerLineControls, MIXER_GETLINECONTROLSF_ALL) != MMSYSERR_NOERROR)
+ if (mixerGetLineControls(mixerID, &mixerLineControls, MIXER_GETLINECONTROLSF_ALL) != MMSYSERR_NOERROR)
closeMixer();
}
}
diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h
index 4c4b04475..a51d1bbe7 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.h
+++ b/src/multimedia/audio/qaudioinput_win32_p.h
@@ -69,8 +69,6 @@
#include <qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -141,7 +139,7 @@ private:
QMutex mutex;
static void QT_WIN_CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
+ DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 );
WAVEHDR* allocateBlocks(int size, int count);
void freeBlocks(WAVEHDR* blockArray);
@@ -150,7 +148,7 @@ private:
void initMixer();
void closeMixer();
- UINT mixerID;
+ HMIXEROBJ mixerID;
MIXERLINECONTROLS mixerLineControls;
private slots:
@@ -178,7 +176,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h
index 0991896be..010192f1c 100644
--- a/src/multimedia/audio/qaudiooutput.h
+++ b/src/multimedia/audio/qaudiooutput.h
@@ -53,8 +53,6 @@
#include <QtMultimedia/qaudiodeviceinfo.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -113,6 +111,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOOUTPUT_H
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h
index 24398207e..3bcb94ffc 100644
--- a/src/multimedia/audio/qaudiooutput_alsa_p.h
+++ b/src/multimedia/audio/qaudiooutput_alsa_p.h
@@ -66,8 +66,6 @@
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -171,7 +169,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h
index c871ac559..89e54fd16 100644
--- a/src/multimedia/audio/qaudiooutput_mac_p.h
+++ b/src/multimedia/audio/qaudiooutput_mac_p.h
@@ -68,8 +68,6 @@
#include <qaudioformat.h>
#include <qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -171,6 +169,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp
index d9d0bf6b3..4d13d4349 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp
@@ -131,7 +131,7 @@ QAudioOutputPrivate::~QAudioOutputPrivate()
}
void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
+ DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 )
{
Q_UNUSED(dwParam1)
Q_UNUSED(dwParam2)
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h
index 032bc38d2..cdff12821 100644
--- a/src/multimedia/audio/qaudiooutput_win32_p.h
+++ b/src/multimedia/audio/qaudiooutput_win32_p.h
@@ -76,8 +76,6 @@
# endif
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -134,7 +132,7 @@ private:
int intervalTime;
qreal volumeCache;
static void QT_WIN_CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
+ DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 );
QMutex mutex;
@@ -170,7 +168,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/audio/qaudioprobe.h b/src/multimedia/audio/qaudioprobe.h
index 9a7731730..fc181e9e2 100644
--- a/src/multimedia/audio/qaudioprobe.h
+++ b/src/multimedia/audio/qaudioprobe.h
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtMultimedia/qaudiobuffer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QMediaObject;
@@ -75,6 +73,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOPROBE_H
diff --git a/src/multimedia/audio/qaudiosystem.h b/src/multimedia/audio/qaudiosystem.h
index 7030249c3..e4636ade7 100644
--- a/src/multimedia/audio/qaudiosystem.h
+++ b/src/multimedia/audio/qaudiosystem.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qaudioformat.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -140,6 +138,4 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOSYSTEM_H
diff --git a/src/multimedia/audio/qaudiosystemplugin.h b/src/multimedia/audio/qaudiosystemplugin.h
index a440963b4..e01d16866 100644
--- a/src/multimedia/audio/qaudiosystemplugin.h
+++ b/src/multimedia/audio/qaudiosystemplugin.h
@@ -53,8 +53,6 @@
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -93,6 +91,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOSYSTEMPLUGIN_H
diff --git a/src/multimedia/audio/qsamplecache_p.h b/src/multimedia/audio/qsamplecache_p.h
index 86e7cffe6..679e996a7 100644
--- a/src/multimedia/audio/qsamplecache_p.h
+++ b/src/multimedia/audio/qsamplecache_p.h
@@ -62,8 +62,6 @@
#include <qaudioformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QIODevice;
@@ -165,6 +163,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSAMPLECACHE_P_H
diff --git a/src/multimedia/audio/qsound.h b/src/multimedia/audio/qsound.h
index 16c0c5455..e23c0ae26 100644
--- a/src/multimedia/audio/qsound.h
+++ b/src/multimedia/audio/qsound.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundEffect;
@@ -85,7 +83,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUND_H
diff --git a/src/multimedia/audio/qsoundeffect.h b/src/multimedia/audio/qsoundeffect.h
index 8176fb911..a6ac8b41e 100644
--- a/src/multimedia/audio/qsoundeffect.h
+++ b/src/multimedia/audio/qsoundeffect.h
@@ -48,8 +48,6 @@
#include <QtCore/qstringlist.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -132,7 +130,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUNDEFFECT_H
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 5320c9ce1..e43bd2fdf 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -62,8 +62,6 @@
#include <pulse/pulseaudio.h>
#include "qsamplecache_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundEffectRef;
@@ -169,6 +167,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUNDEFFECT_PULSE_H
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.h b/src/multimedia/audio/qsoundeffect_qaudio_p.h
index c7f3a8daf..8dfd7826a 100644
--- a/src/multimedia/audio/qsoundeffect_qaudio_p.h
+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.h
@@ -59,8 +59,6 @@
#include "qsamplecache_p.h"
#include "qsoundeffect.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSoundEffectPrivate;
@@ -151,6 +149,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSOUNDEFFECT_QAUDIO_H
diff --git a/src/multimedia/audio/qwavedecoder_p.h b/src/multimedia/audio/qwavedecoder_p.h
index 28a92d0b5..c21d8cb5b 100644
--- a/src/multimedia/audio/qwavedecoder_p.h
+++ b/src/multimedia/audio/qwavedecoder_p.h
@@ -57,8 +57,6 @@
#include <qaudioformat.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -134,6 +132,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // WAVEDECODER_H
diff --git a/src/multimedia/camera/qcamera.h b/src/multimedia/camera/qcamera.h
index d55e81e05..6a29b2c86 100644
--- a/src/multimedia/camera/qcamera.h
+++ b/src/multimedia/camera/qcamera.h
@@ -58,8 +58,6 @@
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -234,6 +232,4 @@ Q_MEDIA_ENUM_DEBUG(QCamera, LockType)
Q_MEDIA_ENUM_DEBUG(QCamera, LockStatus)
Q_MEDIA_ENUM_DEBUG(QCamera, LockChangeReason)
-QT_END_HEADER
-
#endif // QCAMERA_H
diff --git a/src/multimedia/camera/qcameraexposure.h b/src/multimedia/camera/qcameraexposure.h
index 4459fb596..ba8e25cb7 100644
--- a/src/multimedia/camera/qcameraexposure.h
+++ b/src/multimedia/camera/qcameraexposure.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediaobject.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -183,6 +181,4 @@ Q_MEDIA_ENUM_DEBUG(QCameraExposure, ExposureMode)
Q_MEDIA_ENUM_DEBUG(QCameraExposure, FlashMode)
Q_MEDIA_ENUM_DEBUG(QCameraExposure, MeteringMode)
-QT_END_HEADER
-
#endif // QCAMERAEXPOSURE_H
diff --git a/src/multimedia/camera/qcamerafocus.h b/src/multimedia/camera/qcamerafocus.h
index a8bfc2617..675ae2ea3 100644
--- a/src/multimedia/camera/qcamerafocus.h
+++ b/src/multimedia/camera/qcamerafocus.h
@@ -52,8 +52,6 @@
#include <QtMultimedia/qmediaobject.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -176,6 +174,4 @@ Q_DECLARE_METATYPE(QCameraFocus::FocusPointMode)
Q_MEDIA_ENUM_DEBUG(QCameraFocus, FocusMode)
Q_MEDIA_ENUM_DEBUG(QCameraFocus, FocusPointMode)
-QT_END_HEADER
-
#endif // QCAMERAFOCUS_H
diff --git a/src/multimedia/camera/qcameraimagecapture.h b/src/multimedia/camera/qcameraimagecapture.h
index 17e2e0f7f..1ebcfec8a 100644
--- a/src/multimedia/camera/qcameraimagecapture.h
+++ b/src/multimedia/camera/qcameraimagecapture.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSize;
@@ -161,7 +159,5 @@ Q_DECLARE_METATYPE(QCameraImageCapture::CaptureDestinations)
Q_MEDIA_ENUM_DEBUG(QCameraImageCapture, Error)
Q_MEDIA_ENUM_DEBUG(QCameraImageCapture, CaptureDestination)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/camera/qcameraimageprocessing.h b/src/multimedia/camera/qcameraimageprocessing.h
index 3768377dd..ffb088f3d 100644
--- a/src/multimedia/camera/qcameraimageprocessing.h
+++ b/src/multimedia/camera/qcameraimageprocessing.h
@@ -53,8 +53,6 @@
#include <QtMultimedia/qmediaservice.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -116,6 +114,4 @@ Q_DECLARE_METATYPE(QCameraImageProcessing::WhiteBalanceMode)
Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, WhiteBalanceMode)
-QT_END_HEADER
-
#endif // QCAMERAIMAGEPROCESSING_H
diff --git a/src/multimedia/controls/qaudiodecodercontrol.h b/src/multimedia/controls/qaudiodecodercontrol.h
index 332a3e5b8..44154ca2a 100644
--- a/src/multimedia/controls/qaudiodecodercontrol.h
+++ b/src/multimedia/controls/qaudiodecodercontrol.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qaudiobuffer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QIODevice;
@@ -104,6 +102,4 @@ Q_MEDIA_DECLARE_CONTROL(QAudioDecoderControl, QAudioDecoderControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIODECODERCONTROL_H
diff --git a/src/multimedia/controls/qaudioencodersettingscontrol.h b/src/multimedia/controls/qaudioencodersettingscontrol.h
index f8bae2bed..ba913f5da 100644
--- a/src/multimedia/controls/qaudioencodersettingscontrol.h
+++ b/src/multimedia/controls/qaudioencodersettingscontrol.h
@@ -47,8 +47,6 @@
#include <QtCore/qlist.h>
#include <QtCore/qpair.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QStringList;
@@ -85,7 +83,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioEncoderSettingsControl, QAudioEncoderSettingsContr
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOENCODERSETTINGSCONTROL_H
diff --git a/src/multimedia/controls/qaudioinputselectorcontrol.h b/src/multimedia/controls/qaudioinputselectorcontrol.h
index b3eeed320..d75e72313 100644
--- a/src/multimedia/controls/qaudioinputselectorcontrol.h
+++ b/src/multimedia/controls/qaudioinputselectorcontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -80,7 +78,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioInputSelectorControl, QAudioInputSelectorControl_i
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOINPUTSELECTORCONTROL_H
diff --git a/src/multimedia/controls/qaudiooutputselectorcontrol.h b/src/multimedia/controls/qaudiooutputselectorcontrol.h
index 61c52cb26..38e2d61fd 100644
--- a/src/multimedia/controls/qaudiooutputselectorcontrol.h
+++ b/src/multimedia/controls/qaudiooutputselectorcontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -80,7 +78,5 @@ Q_MEDIA_DECLARE_CONTROL(QAudioOutputSelectorControl, QAudioOutputSelectorControl
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIOOUTPUTSELECTORCONTROL_H
diff --git a/src/multimedia/controls/qcameracapturebufferformatcontrol.h b/src/multimedia/controls/qcameracapturebufferformatcontrol.h
index 4aa09eb9e..3b0d1f29b 100644
--- a/src/multimedia/controls/qcameracapturebufferformatcontrol.h
+++ b/src/multimedia/controls/qcameracapturebufferformatcontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qcameraimagecapture.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -74,8 +72,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureBufferFormatControl, QCameraCaptureBufferF
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qcameracapturedestinationcontrol.h b/src/multimedia/controls/qcameracapturedestinationcontrol.h
index 7efe846c0..8f5d6835e 100644
--- a/src/multimedia/controls/qcameracapturedestinationcontrol.h
+++ b/src/multimedia/controls/qcameracapturedestinationcontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qcameraimagecapture.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -74,8 +72,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraCaptureDestinationControl, QCameraCaptureDestinat
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qcameracontrol.h b/src/multimedia/controls/qcameracontrol.h
index 15b4f57ca..3bd96fcaa 100644
--- a/src/multimedia/controls/qcameracontrol.h
+++ b/src/multimedia/controls/qcameracontrol.h
@@ -47,8 +47,6 @@
#include <QtMultimedia/qcamera.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -94,8 +92,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraControl, QCameraControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERACONTROL_H
diff --git a/src/multimedia/controls/qcameraexposurecontrol.h b/src/multimedia/controls/qcameraexposurecontrol.h
index 617e65db1..2b6d226cd 100644
--- a/src/multimedia/controls/qcameraexposurecontrol.h
+++ b/src/multimedia/controls/qcameraexposurecontrol.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qcamera.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -103,8 +101,6 @@ Q_DECLARE_METATYPE(QCameraExposureControl::ExposureParameter)
Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter)
-QT_END_HEADER
-
#endif // QCAMERAEXPOSURECONTROL_H
diff --git a/src/multimedia/controls/qcamerafeedbackcontrol.h b/src/multimedia/controls/qcamerafeedbackcontrol.h
index 55dfd5b48..2860a3045 100644
--- a/src/multimedia/controls/qcamerafeedbackcontrol.h
+++ b/src/multimedia/controls/qcamerafeedbackcontrol.h
@@ -50,8 +50,6 @@
#include <QtMultimedia/qcamera.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -96,7 +94,5 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFeedbackControl, QCameraFeedbackControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAFEEDBACKCONTROL_H
diff --git a/src/multimedia/controls/qcameraflashcontrol.h b/src/multimedia/controls/qcameraflashcontrol.h
index aad5318c0..c09c434f0 100644
--- a/src/multimedia/controls/qcameraflashcontrol.h
+++ b/src/multimedia/controls/qcameraflashcontrol.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qcameraexposure.h>
#include <QtMultimedia/qcamera.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -80,8 +78,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFlashControl, QCameraFlashControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAFLASHCONTROL_H
diff --git a/src/multimedia/controls/qcamerafocuscontrol.h b/src/multimedia/controls/qcamerafocuscontrol.h
index 394ca5c83..d06643edc 100644
--- a/src/multimedia/controls/qcamerafocuscontrol.h
+++ b/src/multimedia/controls/qcamerafocuscontrol.h
@@ -47,8 +47,6 @@
#include <QtMultimedia/qcamerafocus.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -89,8 +87,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraFocusControl, QCameraFocusControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAFOCUSCONTROL_H
diff --git a/src/multimedia/controls/qcameraimagecapturecontrol.h b/src/multimedia/controls/qcameraimagecapturecontrol.h
index 6d2e3f290..f13bd2bf9 100644
--- a/src/multimedia/controls/qcameraimagecapturecontrol.h
+++ b/src/multimedia/controls/qcameraimagecapturecontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qcameraimagecapture.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QImage;
@@ -92,8 +90,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraImageCaptureControl, QCameraImageCaptureControl_i
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAIMAGECAPTURECONTROL_H
diff --git a/src/multimedia/controls/qcameraimageprocessingcontrol.h b/src/multimedia/controls/qcameraimageprocessingcontrol.h
index 4ce4e7f0a..befe7dc40 100644
--- a/src/multimedia/controls/qcameraimageprocessingcontrol.h
+++ b/src/multimedia/controls/qcameraimageprocessingcontrol.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qcamera.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -97,7 +95,5 @@ Q_DECLARE_METATYPE(QCameraImageProcessingControl::ProcessingParameter)
Q_MEDIA_ENUM_DEBUG(QCameraImageProcessingControl, ProcessingParameter)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qcameralockscontrol.h b/src/multimedia/controls/qcameralockscontrol.h
index 821470484..33edeb094 100644
--- a/src/multimedia/controls/qcameralockscontrol.h
+++ b/src/multimedia/controls/qcameralockscontrol.h
@@ -47,8 +47,6 @@
#include <QtMultimedia/qcamera.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -79,8 +77,6 @@ Q_MEDIA_DECLARE_CONTROL(QCameraLocksControl, QCameraLocksControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERALOCKSCONTROL_H
diff --git a/src/multimedia/controls/qcameraviewfindersettingscontrol.h b/src/multimedia/controls/qcameraviewfindersettingscontrol.h
index 49edbbbe2..8654d4028 100644
--- a/src/multimedia/controls/qcameraviewfindersettingscontrol.h
+++ b/src/multimedia/controls/qcameraviewfindersettingscontrol.h
@@ -46,8 +46,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -81,6 +79,4 @@ Q_MEDIA_DECLARE_CONTROL(QCameraViewfinderSettingsControl, QCameraViewfinderSetti
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAVIEWFINDERSETTINGSCONTROL_H
diff --git a/src/multimedia/controls/qcamerazoomcontrol.h b/src/multimedia/controls/qcamerazoomcontrol.h
index 4af0ef9b3..56f7d395b 100644
--- a/src/multimedia/controls/qcamerazoomcontrol.h
+++ b/src/multimedia/controls/qcamerazoomcontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qmediaobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -87,6 +85,4 @@ Q_MEDIA_DECLARE_CONTROL(QCameraZoomControl, QCameraZoomControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERAZOOMCONTROL_H
diff --git a/src/multimedia/controls/qimageencodercontrol.h b/src/multimedia/controls/qimageencodercontrol.h
index 649e39dc3..1ed76fb3a 100644
--- a/src/multimedia/controls/qimageencodercontrol.h
+++ b/src/multimedia/controls/qimageencodercontrol.h
@@ -48,8 +48,6 @@
#include <QtCore/qsize.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QByteArray;
@@ -86,7 +84,5 @@ Q_MEDIA_DECLARE_CONTROL(QImageEncoderControl, QImageEncoderControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qmediaaudioprobecontrol.h b/src/multimedia/controls/qmediaaudioprobecontrol.h
index aced90b71..247c97639 100644
--- a/src/multimedia/controls/qmediaaudioprobecontrol.h
+++ b/src/multimedia/controls/qmediaaudioprobecontrol.h
@@ -44,8 +44,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAudioBuffer;
@@ -68,7 +66,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaAudioProbeControl, QMediaAudioProbeControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAAUDIOPROBECONTROL_H
diff --git a/src/multimedia/controls/qmediaavailabilitycontrol.h b/src/multimedia/controls/qmediaavailabilitycontrol.h
index 8889f3428..a396de67d 100644
--- a/src/multimedia/controls/qmediaavailabilitycontrol.h
+++ b/src/multimedia/controls/qmediaavailabilitycontrol.h
@@ -46,8 +46,6 @@
#include <QtMultimedia/qmediaobject.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -74,6 +72,4 @@ Q_MEDIA_DECLARE_CONTROL(QMediaAvailabilityControl, QMediaAvailabilityControl_iid
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAAVAILABILITYCONTROL_H
diff --git a/src/multimedia/controls/qmediacontainercontrol.h b/src/multimedia/controls/qmediacontainercontrol.h
index 7b9d0ba20..4708cc1a4 100644
--- a/src/multimedia/controls/qmediacontainercontrol.h
+++ b/src/multimedia/controls/qmediacontainercontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -74,7 +72,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaContainerControl, QMediaContainerControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIACONTAINERCONTROL_H
diff --git a/src/multimedia/controls/qmediagaplessplaybackcontrol.h b/src/multimedia/controls/qmediagaplessplaybackcontrol.h
index 78a8f2708..577286d17 100644
--- a/src/multimedia/controls/qmediagaplessplaybackcontrol.h
+++ b/src/multimedia/controls/qmediagaplessplaybackcontrol.h
@@ -44,8 +44,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qmediacontent.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -78,6 +76,4 @@ Q_MEDIA_DECLARE_CONTROL(QMediaGaplessPlaybackControl, QMediaGaplessPlaybackContr
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAGAPLESSPLAYBACKCONTROL_H
diff --git a/src/multimedia/controls/qmedianetworkaccesscontrol.h b/src/multimedia/controls/qmedianetworkaccesscontrol.h
index 219d2701b..23a28f18a 100644
--- a/src/multimedia/controls/qmedianetworkaccesscontrol.h
+++ b/src/multimedia/controls/qmedianetworkaccesscontrol.h
@@ -48,8 +48,6 @@
#include <QtCore/qlist.h>
#include <QtNetwork/qnetworkconfiguration.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -77,7 +75,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaNetworkAccessControl, QMediaNetworkAccessControl_i
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qmediaplayercontrol.h b/src/multimedia/controls/qmediaplayercontrol.h
index 4b7dd1053..aed518330 100644
--- a/src/multimedia/controls/qmediaplayercontrol.h
+++ b/src/multimedia/controls/qmediaplayercontrol.h
@@ -48,8 +48,6 @@
#include <QtCore/qpair.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -122,8 +120,6 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlayerControl, QMediaPlayerControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYERCONTROL_H
diff --git a/src/multimedia/controls/qmediaplaylistcontrol_p.h b/src/multimedia/controls/qmediaplaylistcontrol_p.h
index cfaf71224..2bbfa783d 100644
--- a/src/multimedia/controls/qmediaplaylistcontrol_p.h
+++ b/src/multimedia/controls/qmediaplaylistcontrol_p.h
@@ -59,8 +59,6 @@
#include <private/qmediaplaylistnavigator_p.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -102,7 +100,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistControl, QMediaPlaylistControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLISTCONTROL_P_H
diff --git a/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h b/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h
index 1cb4f47bf..ae5f83c23 100644
--- a/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h
+++ b/src/multimedia/controls/qmediaplaylistsourcecontrol_p.h
@@ -56,8 +56,6 @@
#include <qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -85,7 +83,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistSourceControl, QMediaPlaylistSourceControl
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLISTCONTROL_P_H
diff --git a/src/multimedia/controls/qmediarecordercontrol.h b/src/multimedia/controls/qmediarecordercontrol.h
index 7b0478892..3ed161729 100644
--- a/src/multimedia/controls/qmediarecordercontrol.h
+++ b/src/multimedia/controls/qmediarecordercontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qmediarecorder.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QUrl;
@@ -100,7 +98,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaRecorderControl, QMediaRecorderControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qmediastreamscontrol.h b/src/multimedia/controls/qmediastreamscontrol.h
index e10a32b47..4316d1af3 100644
--- a/src/multimedia/controls/qmediastreamscontrol.h
+++ b/src/multimedia/controls/qmediastreamscontrol.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -89,7 +87,5 @@ Q_DECLARE_METATYPE(QMediaStreamsControl::StreamType)
Q_MEDIA_ENUM_DEBUG(QMediaStreamsControl, StreamType)
-QT_END_HEADER
-
#endif // QMEDIASTREAMSCONTROL_H
diff --git a/src/multimedia/controls/qmediavideoprobecontrol.h b/src/multimedia/controls/qmediavideoprobecontrol.h
index 10e1f5eab..1435cdb1f 100644
--- a/src/multimedia/controls/qmediavideoprobecontrol.h
+++ b/src/multimedia/controls/qmediavideoprobecontrol.h
@@ -46,8 +46,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QVideoFrame;
@@ -70,7 +68,5 @@ Q_MEDIA_DECLARE_CONTROL(QMediaVideoProbeControl, QMediaVideoProbeControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAVIDEOPROBECONTROL_H
diff --git a/src/multimedia/controls/qmetadatareadercontrol.h b/src/multimedia/controls/qmetadatareadercontrol.h
index fd9f3163f..6e34b2d57 100644
--- a/src/multimedia/controls/qmetadatareadercontrol.h
+++ b/src/multimedia/controls/qmetadatareadercontrol.h
@@ -50,8 +50,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -83,7 +81,5 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataReaderControl, QMetaDataReaderControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMETADATAPROVIDER_H
diff --git a/src/multimedia/controls/qmetadatawritercontrol.h b/src/multimedia/controls/qmetadatawritercontrol.h
index cb3f8daf8..1c25d892a 100644
--- a/src/multimedia/controls/qmetadatawritercontrol.h
+++ b/src/multimedia/controls/qmetadatawritercontrol.h
@@ -50,8 +50,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -86,7 +84,5 @@ Q_MEDIA_DECLARE_CONTROL(QMetaDataWriterControl, QMetaDataWriterControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qradiodatacontrol.h b/src/multimedia/controls/qradiodatacontrol.h
index 87e9af865..f28254b46 100644
--- a/src/multimedia/controls/qradiodatacontrol.h
+++ b/src/multimedia/controls/qradiodatacontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qradiodata.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -88,7 +86,5 @@ Q_MEDIA_DECLARE_CONTROL(QRadioDataControl, QRadioDataControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRADIODATACONTROL_H
diff --git a/src/multimedia/controls/qradiotunercontrol.h b/src/multimedia/controls/qradiotunercontrol.h
index 43aaf5348..1ec606151 100644
--- a/src/multimedia/controls/qradiotunercontrol.h
+++ b/src/multimedia/controls/qradiotunercontrol.h
@@ -45,8 +45,6 @@
#include <QtMultimedia/qmediacontrol.h>
#include <QtMultimedia/qradiotuner.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -119,7 +117,5 @@ Q_MEDIA_DECLARE_CONTROL(QRadioTunerControl, QRadioTunerControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRADIOTUNERCONTROL_H
diff --git a/src/multimedia/controls/qvideodeviceselectorcontrol.h b/src/multimedia/controls/qvideodeviceselectorcontrol.h
index bdc0455cc..2447cde5a 100644
--- a/src/multimedia/controls/qvideodeviceselectorcontrol.h
+++ b/src/multimedia/controls/qvideodeviceselectorcontrol.h
@@ -44,8 +44,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -83,6 +81,4 @@ Q_MEDIA_DECLARE_CONTROL(QVideoDeviceSelectorControl, QVideoDeviceSelectorControl
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QVIDEODEVICESELECTORCONTROL_H
diff --git a/src/multimedia/controls/qvideoencodersettingscontrol.h b/src/multimedia/controls/qvideoencodersettingscontrol.h
index 4846d8039..ea1ff12b9 100644
--- a/src/multimedia/controls/qvideoencodersettingscontrol.h
+++ b/src/multimedia/controls/qvideoencodersettingscontrol.h
@@ -48,8 +48,6 @@
#include <QtCore/qpair.h>
#include <QtCore/qsize.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QByteArray;
@@ -89,7 +87,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoEncoderSettingsControl, QVideoEncoderSettingsContr
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/controls/qvideorenderercontrol.h b/src/multimedia/controls/qvideorenderercontrol.h
index d88a81143..8f7ea33ea 100644
--- a/src/multimedia/controls/qvideorenderercontrol.h
+++ b/src/multimedia/controls/qvideorenderercontrol.h
@@ -44,8 +44,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAbstractVideoSurface;
@@ -68,7 +66,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoRendererControl, QVideoRendererControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QVIDEORENDERERCONTROL_H
diff --git a/src/multimedia/controls/qvideowindowcontrol.h b/src/multimedia/controls/qvideowindowcontrol.h
index 62981233d..2a867e77a 100644
--- a/src/multimedia/controls/qvideowindowcontrol.h
+++ b/src/multimedia/controls/qvideowindowcontrol.h
@@ -47,8 +47,6 @@
#include <QtCore/qsize.h>
#include <QtGui/qwindowdefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -106,7 +104,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoWindowControl, QVideoWindowControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/doc/qtmultimedia.qdocconf b/src/multimedia/doc/qtmultimedia.qdocconf
index e501deb23..7d26cb5c0 100644
--- a/src/multimedia/doc/qtmultimedia.qdocconf
+++ b/src/multimedia/doc/qtmultimedia.qdocconf
@@ -29,7 +29,7 @@ qhp.qtmultimedia.subprojects.qmltypes.indexTitle = Qt Multimedia QML Types
qhp.qtmultimedia.subprojects.qmltypes.selectors = fake:qmlclass
qhp.qtmultimedia.subprojects.qmltypes.sortPages = true
-exampledirs += ../../../examples \
+exampledirs += ../../../examples/multimedia \
snippets
headerdirs += ../..
@@ -38,6 +38,6 @@ imagedirs += src/images \
sourcedirs += ../..
-excludedirs +=
+excludedirs += ../../multimediawidgets
-depends += qtcore qtdoc qtquick qtqml
+depends += qtcore qtdoc qtquick qtqml qtmultimediawidgets
diff --git a/src/multimedia/doc/src/blackberry.qdoc b/src/multimedia/doc/src/blackberry.qdoc
index ca35745a3..0983aea10 100644
--- a/src/multimedia/doc/src/blackberry.qdoc
+++ b/src/multimedia/doc/src/blackberry.qdoc
@@ -46,6 +46,8 @@ The Qt Multimedia BlackBerry backend uses mmrenderer for media playback.
For the positional audio classes in the \l {Positional Audio} {QtAudioEngine} QML
module, OpenAL is used as on all other platforms.
+For recording videos and taking photos, the camapi library is used.
+
\section1 Supported Features
Playback of audio and video with QMediaPlayer and related classes is supported.
@@ -64,6 +66,12 @@ no effect.
The \l {Positional Audio} {QtAudioEngine} QML module is fully supported, as it is based on OpenAL which is available
in BB10.
+The \l {camera} {QCamera} support includes recording of videos and taking photos. The viewfinder
+is available through QCameraViewfinder and the VideoOutput QML element.
+
+Note: To use the camera on BB10, your application needs the 'access_shared', 'use_camera' and 'record_audio'
+permissions set in the bar-descriptor.xml file.
+
\section1 Unsupported Features
Low-latency output and input of raw audio samples with QAudioOutput, QAudioInput and related classes is
@@ -74,5 +82,5 @@ QMediaPlayer does not support QIODevice-based streaming sources. However, stream
an HTTP URL as the source does work. In addition, QMediaPlayer does not yet provide metadata like
the artist and album of the current track.
-Camera, radio and audio and video recording are not yet supported.
+Radio and audio recording are not yet supported.
*/
diff --git a/src/multimedia/doc/src/qtmultimedia-index.qdoc b/src/multimedia/doc/src/qtmultimedia-index.qdoc
index 60e4cfbb4..7dfa02575 100644
--- a/src/multimedia/doc/src/qtmultimedia-index.qdoc
+++ b/src/multimedia/doc/src/qtmultimedia-index.qdoc
@@ -32,6 +32,8 @@
Qt Multimedia is an essential module that provides a rich set of QML types and C++ classes to handle multimedia content. It also provides necessary APIs to access the camera and radio functionality.
+ The \l{Qt Multimedia Widgets} module provides widget based multimedia classes.
+
\section1 Getting started
The QML types can be imported into your applciation using the following import statement in your \c {.qml} file.
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 9dbea399b..2a1c6afb5 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -51,6 +51,11 @@ include(radio/radio.pri)
include(recording/recording.pri)
include(video/video.pri)
+ANDROID_JAR_DEPENDENCIES = \
+ jar/QtMultimedia.jar:org.qtproject.qt5.android.multimedia.QtAndroidMediaPlayer
+ANDROID_LIB_DEPENDENCIES = \
+ plugins/mediaservice/libandroidmediaplayer.so
+
mac {
LIBS += -framework AppKit -framework QuartzCore -framework QTKit
}
diff --git a/src/multimedia/playback/playlistfileparser_p.h b/src/multimedia/playback/playlistfileparser_p.h
index 6031df7f9..1dcfbf1fc 100644
--- a/src/multimedia/playback/playlistfileparser_p.h
+++ b/src/multimedia/playback/playlistfileparser_p.h
@@ -56,8 +56,6 @@
#include <QtNetwork>
#include "qtmultimediadefs.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QPlaylistFileParserPrivate;
@@ -108,6 +106,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // PLAYLISTFILEPARSER_P_H
diff --git a/src/multimedia/playback/qmediacontent.h b/src/multimedia/playback/qmediacontent.h
index a1a1ba5d9..2c66264a4 100644
--- a/src/multimedia/playback/qmediacontent.h
+++ b/src/multimedia/playback/qmediacontent.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QMediaPlaylist;
@@ -90,6 +88,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QMediaContent)
-QT_END_HEADER
-
#endif // QMEDIACONTENT_H
diff --git a/src/multimedia/playback/qmedianetworkplaylistprovider_p.h b/src/multimedia/playback/qmedianetworkplaylistprovider_p.h
index d8800ce72..58ba1cec4 100644
--- a/src/multimedia/playback/qmedianetworkplaylistprovider_p.h
+++ b/src/multimedia/playback/qmedianetworkplaylistprovider_p.h
@@ -55,8 +55,6 @@
#include "qmediaplaylistprovider_p.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -95,7 +93,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIANETWORKPAYLISTSOURCE_P_H
diff --git a/src/multimedia/playback/qmediaplayer.h b/src/multimedia/playback/qmediaplayer.h
index 3233b1d1f..3195ae061 100644
--- a/src/multimedia/playback/qmediaplayer.h
+++ b/src/multimedia/playback/qmediaplayer.h
@@ -48,8 +48,6 @@
#include <QtNetwork/qnetworkconfiguration.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -226,6 +224,4 @@ Q_MEDIA_ENUM_DEBUG(QMediaPlayer, State)
Q_MEDIA_ENUM_DEBUG(QMediaPlayer, MediaStatus)
Q_MEDIA_ENUM_DEBUG(QMediaPlayer, Error)
-QT_END_HEADER
-
#endif // QMEDIAPLAYER_H
diff --git a/src/multimedia/playback/qmediaplaylist.h b/src/multimedia/playback/qmediaplaylist.h
index aa10c97c3..3cea6ebf2 100644
--- a/src/multimedia/playback/qmediaplaylist.h
+++ b/src/multimedia/playback/qmediaplaylist.h
@@ -50,8 +50,6 @@
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -148,6 +146,4 @@ Q_DECLARE_METATYPE(QMediaPlaylist::Error)
Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, PlaybackMode)
Q_MEDIA_ENUM_DEBUG(QMediaPlaylist, Error)
-QT_END_HEADER
-
#endif // QMEDIAPLAYLIST_H
diff --git a/src/multimedia/playback/qmediaplaylist_p.h b/src/multimedia/playback/qmediaplaylist_p.h
index 7de5383e4..fb9d6bb84 100644
--- a/src/multimedia/playback/qmediaplaylist_p.h
+++ b/src/multimedia/playback/qmediaplaylist_p.h
@@ -66,8 +66,6 @@
# pragma Q_MOC_EXPAND_MACROS
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -169,7 +167,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLIST_P_H
diff --git a/src/multimedia/playback/qmediaplaylistioplugin_p.h b/src/multimedia/playback/qmediaplaylistioplugin_p.h
index eb44ec447..433c82138 100644
--- a/src/multimedia/playback/qmediaplaylistioplugin_p.h
+++ b/src/multimedia/playback/qmediaplaylistioplugin_p.h
@@ -60,8 +60,6 @@
#include "qmediacontent.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QString;
@@ -126,7 +124,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLISTIOPLUGIN_P_H
diff --git a/src/multimedia/playback/qmediaplaylistnavigator_p.h b/src/multimedia/playback/qmediaplaylistnavigator_p.h
index 0da1130da..4d6c9d3cd 100644
--- a/src/multimedia/playback/qmediaplaylistnavigator_p.h
+++ b/src/multimedia/playback/qmediaplaylistnavigator_p.h
@@ -57,8 +57,6 @@
#include "qmediaplaylist.h"
#include <QtCore/qobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -118,7 +116,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLISTNAVIGATOR_P_H
diff --git a/src/multimedia/playback/qmediaplaylistprovider_p.h b/src/multimedia/playback/qmediaplaylistprovider_p.h
index 106c008ab..6a950dfe1 100644
--- a/src/multimedia/playback/qmediaplaylistprovider_p.h
+++ b/src/multimedia/playback/qmediaplaylistprovider_p.h
@@ -56,8 +56,6 @@
#include "qmediacontent.h"
#include "qmediaplaylist.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -120,8 +118,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLAYLISTSOURCE_P_H
diff --git a/src/multimedia/playback/qmediaresource.h b/src/multimedia/playback/qmediaresource.h
index 438056f8c..d271b911f 100644
--- a/src/multimedia/playback/qmediaresource.h
+++ b/src/multimedia/playback/qmediaresource.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Class forward declaration required for QDoc bug
@@ -128,6 +126,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QMediaResource)
Q_DECLARE_METATYPE(QMediaResourceList)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/qmediabindableinterface.h b/src/multimedia/qmediabindableinterface.h
index fc914347c..4e4316eb4 100644
--- a/src/multimedia/qmediabindableinterface.h
+++ b/src/multimedia/qmediabindableinterface.h
@@ -44,8 +44,6 @@
#include <QtMultimedia/qmediaobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -69,7 +67,5 @@ Q_DECLARE_INTERFACE(QMediaBindableInterface, QMediaBindableInterface_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIABINDABLEINTERFACE_H
diff --git a/src/multimedia/qmediacontrol.h b/src/multimedia/qmediacontrol.h
index 3122917f6..a4b3c7d3f 100644
--- a/src/multimedia/qmediacontrol.h
+++ b/src/multimedia/qmediacontrol.h
@@ -49,8 +49,6 @@
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,7 +77,5 @@ template <typename T> const char *qmediacontrol_iid() { return 0; }
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTMEDIACONTROL_H
diff --git a/src/multimedia/qmediacontrol_p.h b/src/multimedia/qmediacontrol_p.h
index fab889998..14eaf1214 100644
--- a/src/multimedia/qmediacontrol_p.h
+++ b/src/multimedia/qmediacontrol_p.h
@@ -55,8 +55,6 @@
#include <qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -72,7 +70,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/qmediaenumdebug.h b/src/multimedia/qmediaenumdebug.h
index 4cb266a03..ee1c87f16 100644
--- a/src/multimedia/qmediaenumdebug.h
+++ b/src/multimedia/qmediaenumdebug.h
@@ -55,7 +55,6 @@
#include <QtCore/qmetaobject.h>
#include <QtCore/qdebug.h>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef QT_NO_DEBUG_STREAM
@@ -75,7 +74,6 @@ inline QDebug operator<<(QDebug dbg, Class::Enum value) \
#endif //QT_NO_DEBUG_STREAM
QT_END_NAMESPACE
-QT_END_HEADER
#endif
diff --git a/src/multimedia/qmediametadata.h b/src/multimedia/qmediametadata.h
index 00e3088e9..b1d7213ac 100644
--- a/src/multimedia/qmediametadata.h
+++ b/src/multimedia/qmediametadata.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Class forward declaration required for QDoc bug
@@ -289,6 +287,4 @@ namespace QMediaMetaData {
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAMETADATA_H
diff --git a/src/multimedia/qmediaobject.h b/src/multimedia/qmediaobject.h
index 64d71b93c..34189a27e 100644
--- a/src/multimedia/qmediaobject.h
+++ b/src/multimedia/qmediaobject.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -110,7 +108,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTMEDIAOBJECT_H
diff --git a/src/multimedia/qmediaobject_p.h b/src/multimedia/qmediaobject_p.h
index 64c3868c5..c36400100 100644
--- a/src/multimedia/qmediaobject_p.h
+++ b/src/multimedia/qmediaobject_p.h
@@ -59,8 +59,6 @@
#include "qmediaobject.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -95,7 +93,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/qmediapluginloader_p.h b/src/multimedia/qmediapluginloader_p.h
index c20642361..e49e11b46 100644
--- a/src/multimedia/qmediapluginloader_p.h
+++ b/src/multimedia/qmediapluginloader_p.h
@@ -61,8 +61,6 @@
#include <QtCore/qjsonobject.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QFactoryLoader;
@@ -92,7 +90,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIAPLUGINLOADER_H
diff --git a/src/multimedia/qmediaresourcepolicy_p.h b/src/multimedia/qmediaresourcepolicy_p.h
index a305b65e3..3b8cc1036 100644
--- a/src/multimedia/qmediaresourcepolicy_p.h
+++ b/src/multimedia/qmediaresourcepolicy_p.h
@@ -45,8 +45,6 @@
#include <QObject>
#include "qtmultimediadefs.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class Q_MULTIMEDIA_EXPORT QMediaResourcePolicy
@@ -68,6 +66,4 @@ T* QMediaResourcePolicy::createResourceSet()
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIARESOURCEPOLICY_H
diff --git a/src/multimedia/qmediaresourcepolicyplugin_p.h b/src/multimedia/qmediaresourcepolicyplugin_p.h
index 5ed80fb8a..0309f9efd 100644
--- a/src/multimedia/qmediaresourcepolicyplugin_p.h
+++ b/src/multimedia/qmediaresourcepolicyplugin_p.h
@@ -45,8 +45,6 @@
#include <QObject>
#include <qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
struct Q_MULTIMEDIA_EXPORT QMediaResourceSetFactoryInterface
@@ -71,6 +69,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QRESOURCEPOLICYPLUGIN_P_H
diff --git a/src/multimedia/qmediaresourceset_p.h b/src/multimedia/qmediaresourceset_p.h
index b217718d4..9d84155c8 100644
--- a/src/multimedia/qmediaresourceset_p.h
+++ b/src/multimedia/qmediaresourceset_p.h
@@ -44,8 +44,6 @@
#include <QObject>
#include <qtmultimediadefs.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
#define QMediaPlayerResourceSetInterface_iid \
@@ -78,6 +76,4 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIARESOURCESET_P_H
diff --git a/src/multimedia/qmediaservice.h b/src/multimedia/qmediaservice.h
index 6d797482c..8230f4984 100644
--- a/src/multimedia/qmediaservice.h
+++ b/src/multimedia/qmediaservice.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qmediacontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -88,8 +86,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QABSTRACTMEDIASERVICE_H
diff --git a/src/multimedia/qmediaservice_p.h b/src/multimedia/qmediaservice_p.h
index c1f405d40..ab2ae4e85 100644
--- a/src/multimedia/qmediaservice_p.h
+++ b/src/multimedia/qmediaservice_p.h
@@ -53,8 +53,6 @@
// We mean it.
//
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -71,8 +69,6 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/qmediaserviceprovider_p.h b/src/multimedia/qmediaserviceprovider_p.h
index aa0bcdc04..df4d5d819 100644
--- a/src/multimedia/qmediaserviceprovider_p.h
+++ b/src/multimedia/qmediaserviceprovider_p.h
@@ -48,8 +48,6 @@
#include "qmultimedia.h"
#include "qmediaserviceproviderplugin.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -78,7 +76,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIASERVICEPROVIDER_H
diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h
index 628e0f8f9..fa3b88235 100644
--- a/src/multimedia/qmediaserviceproviderplugin.h
+++ b/src/multimedia/qmediaserviceproviderplugin.h
@@ -51,8 +51,6 @@
# pragma Q_MOC_EXPAND_MACROS
#endif
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
// Required for QDoc workaround
@@ -227,6 +225,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIASERVICEPROVIDERPLUGIN_H
diff --git a/src/multimedia/qmediatimerange.h b/src/multimedia/qmediatimerange.h
index f32e8da6f..24b653d9a 100644
--- a/src/multimedia/qmediatimerange.h
+++ b/src/multimedia/qmediatimerange.h
@@ -46,8 +46,6 @@
#include <QtMultimedia/qmultimedia.h>
#include <QtCore/qshareddata.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -132,7 +130,5 @@ Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QMediaTimeRange &);
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMEDIATIMERANGE_H
diff --git a/src/multimedia/qmultimedia.h b/src/multimedia/qmultimedia.h
index 474da5e50..22028be6c 100644
--- a/src/multimedia/qmultimedia.h
+++ b/src/multimedia/qmultimedia.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmediametadata.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
namespace QMultimedia
@@ -97,7 +95,5 @@ Q_DECLARE_METATYPE(QMultimedia::SupportEstimate)
Q_DECLARE_METATYPE(QMultimedia::EncodingMode)
Q_DECLARE_METATYPE(QMultimedia::EncodingQuality)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/qtmultimediadefs.h b/src/multimedia/qtmultimediadefs.h
index 41c505aef..a82777c9f 100644
--- a/src/multimedia/qtmultimediadefs.h
+++ b/src/multimedia/qtmultimediadefs.h
@@ -55,7 +55,6 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef QT_STATIC
@@ -69,8 +68,6 @@ QT_BEGIN_NAMESPACE
#endif
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QMULTIMEDIA_P_H
diff --git a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
index f16e811ef..4590e2f96 100644
--- a/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
+++ b/src/multimedia/qtmultimediaquicktools_headers/qsgvideonode_p.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qvideosurfaceformat.h>
#include <QtGui/qopenglfunctions.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
const QLatin1String QSGVideoNodeFactoryPluginKey("sgvideonodes");
@@ -92,6 +90,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QSGVIDEONODE_H
diff --git a/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h b/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h
index 341096084..54ec2edab 100644
--- a/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h
+++ b/src/multimedia/qtmultimediaquicktools_headers/qtmultimediaquickdefs_p.h
@@ -55,8 +55,6 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
-
#ifndef QT_STATIC
# if defined(QT_BUILD_QTMM_QUICK_LIB)
# define Q_MULTIMEDIAQUICK_EXPORT Q_DECL_EXPORT
@@ -67,8 +65,6 @@ QT_BEGIN_HEADER
# define Q_MULTIMEDIAQUICK_EXPORT
#endif
-QT_END_HEADER
-
#endif // QMULTIMEDIAQUICKDEFS_P_H
diff --git a/src/multimedia/radio/qradiodata.h b/src/multimedia/radio/qradiodata.h
index cd41f80b5..1324ee0e6 100644
--- a/src/multimedia/radio/qradiodata.h
+++ b/src/multimedia/radio/qradiodata.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qmediabindableinterface.h>
#include <QtMultimedia/qmediaenumdebug.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -135,6 +133,4 @@ Q_DECLARE_METATYPE(QRadioData::ProgramType)
Q_MEDIA_ENUM_DEBUG(QRadioData, Error)
Q_MEDIA_ENUM_DEBUG(QRadioData, ProgramType)
-QT_END_HEADER
-
#endif // QRADIOPLAYER_H
diff --git a/src/multimedia/radio/qradiotuner.h b/src/multimedia/radio/qradiotuner.h
index 68658f70a..a2f6e9a89 100644
--- a/src/multimedia/radio/qradiotuner.h
+++ b/src/multimedia/radio/qradiotuner.h
@@ -49,8 +49,6 @@
#include <QtCore/qpair.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QRadioData;
@@ -163,6 +161,4 @@ Q_MEDIA_ENUM_DEBUG(QRadioTuner, Error)
Q_MEDIA_ENUM_DEBUG(QRadioTuner, StereoMode)
Q_MEDIA_ENUM_DEBUG(QRadioTuner, SearchMode)
-QT_END_HEADER
-
#endif // QRADIOPLAYER_H
diff --git a/src/multimedia/recording/qaudiorecorder.h b/src/multimedia/recording/qaudiorecorder.h
index 818d5732f..d5ab75d17 100644
--- a/src/multimedia/recording/qaudiorecorder.h
+++ b/src/multimedia/recording/qaudiorecorder.h
@@ -49,8 +49,6 @@
#include <QtCore/qpair.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QString;
@@ -89,6 +87,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIORECORDER_H
diff --git a/src/multimedia/recording/qmediaencodersettings.h b/src/multimedia/recording/qmediaencodersettings.h
index 6820260a6..f76c44573 100644
--- a/src/multimedia/recording/qmediaencodersettings.h
+++ b/src/multimedia/recording/qmediaencodersettings.h
@@ -49,8 +49,6 @@
#include <QtMultimedia/qtmultimediadefs.h>
#include <QtMultimedia/qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -180,7 +178,5 @@ Q_DECLARE_METATYPE(QAudioEncoderSettings)
Q_DECLARE_METATYPE(QVideoEncoderSettings)
Q_DECLARE_METATYPE(QImageEncoderSettings)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/recording/qmediarecorder.h b/src/multimedia/recording/qmediarecorder.h
index 659ef1ee3..9c7ef7004 100644
--- a/src/multimedia/recording/qmediarecorder.h
+++ b/src/multimedia/recording/qmediarecorder.h
@@ -50,8 +50,6 @@
#include <QtCore/qpair.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QUrl;
@@ -224,6 +222,4 @@ Q_MEDIA_ENUM_DEBUG(QMediaRecorder, State)
Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Status)
Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Error)
-QT_END_HEADER
-
#endif // QMEDIARECORDER_H
diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h
index fa1b40556..1be90ff90 100644
--- a/src/multimedia/video/qabstractvideobuffer.h
+++ b/src/multimedia/video/qabstractvideobuffer.h
@@ -48,8 +48,6 @@
#include <QtCore/qmetatype.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -112,6 +110,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAbstractVideoBuffer::HandleType)
Q_DECLARE_METATYPE(QAbstractVideoBuffer::MapMode)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qabstractvideobuffer_p.h b/src/multimedia/video/qabstractvideobuffer_p.h
index 2b9458c3b..8841f75d1 100644
--- a/src/multimedia/video/qabstractvideobuffer_p.h
+++ b/src/multimedia/video/qabstractvideobuffer_p.h
@@ -60,8 +60,6 @@
#include <qmultimedia.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QAbstractVideoBufferPrivate
@@ -76,7 +74,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h
index cb14b105c..be4520d00 100644
--- a/src/multimedia/video/qabstractvideosurface.h
+++ b/src/multimedia/video/qabstractvideosurface.h
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <QtMultimedia/qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QRectF;
@@ -113,6 +111,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QAbstractVideoSurface*)
Q_DECLARE_METATYPE(QAbstractVideoSurface::Error)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qimagevideobuffer_p.h b/src/multimedia/video/qimagevideobuffer_p.h
index 2d3415818..08c393b13 100644
--- a/src/multimedia/video/qimagevideobuffer_p.h
+++ b/src/multimedia/video/qimagevideobuffer_p.h
@@ -55,8 +55,6 @@
#include <qabstractvideobuffer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,7 +77,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qmemoryvideobuffer_p.h b/src/multimedia/video/qmemoryvideobuffer_p.h
index a497c0754..73e0f525a 100644
--- a/src/multimedia/video/qmemoryvideobuffer_p.h
+++ b/src/multimedia/video/qmemoryvideobuffer_p.h
@@ -55,10 +55,6 @@
// We mean it.
//
-QT_BEGIN_HEADER
-
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,9 +75,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
-
-QT_END_HEADER
#endif
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
index f1fd0b282..504a0d548 100644
--- a/src/multimedia/video/qvideoframe.h
+++ b/src/multimedia/video/qvideoframe.h
@@ -48,8 +48,6 @@
#include <QtMultimedia/qabstractvideobuffer.h>
#include <QtCore/qvariant.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QSize;
@@ -177,7 +175,5 @@ Q_DECLARE_METATYPE(QVideoFrame)
Q_DECLARE_METATYPE(QVideoFrame::FieldType)
Q_DECLARE_METATYPE(QVideoFrame::PixelFormat)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qvideoprobe.h b/src/multimedia/video/qvideoprobe.h
index 8c8482d35..8220a1f7f 100644
--- a/src/multimedia/video/qvideoprobe.h
+++ b/src/multimedia/video/qvideoprobe.h
@@ -45,8 +45,6 @@
#include <QObject>
#include <QtMultimedia/qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QMediaObject;
@@ -75,6 +73,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QVIDEOPROBE_H
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
index 57eae4f8e..fe7b6d9de 100644
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ b/src/multimedia/video/qvideosurfaceformat.h
@@ -49,8 +49,6 @@
#include <QtGui/qimage.h>
#include <QtMultimedia/qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -143,7 +141,5 @@ Q_DECLARE_METATYPE(QVideoSurfaceFormat)
Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction)
Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace)
-QT_END_HEADER
-
#endif
diff --git a/src/multimedia/video/qvideosurfaceoutput_p.h b/src/multimedia/video/qvideosurfaceoutput_p.h
index 0657515cb..fd8032817 100644
--- a/src/multimedia/video/qvideosurfaceoutput_p.h
+++ b/src/multimedia/video/qvideosurfaceoutput_p.h
@@ -47,8 +47,6 @@
#include <QtCore/qsharedpointer.h>
#include <QtCore/qpointer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -79,7 +77,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf
new file mode 100644
index 000000000..a25ee1a1d
--- /dev/null
+++ b/src/multimediawidgets/doc/qtmultimediawidgets.qdocconf
@@ -0,0 +1,43 @@
+include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf)
+
+project = qtmultimediawidgets
+description = Qt Multimedia Widgets Documentation
+url = http://qt-project.org/doc/qt-$QT_VER/qtmultimediawidgets
+version = $QT_VERSION
+
+# The following parameters are for creating a qhp file, the qhelpgenerator
+# program can convert the qhp file into a qch file which can be opened in
+# Qt Assistant and/or Qt Creator.
+
+# Defines the name of the project. You cannot use operators (+, =, -) in
+# the name. Properties for this project are set using a qhp.<projectname>.property
+# format.
+qhp.projects = qtmultimediawidgets
+qhp.qtmultimediawidgets.file = qtmultimediawidgets.qhp
+qhp.qtmultimediawidgets.namespace = org.qt-project.qtmultimediawidgets.$QT_VERSION_TAG
+qhp.qtmultimediawidgets.indexTitle = Qt Multimedia
+qhp.qtmultimediawidgets.virtualFolder = qtmultimediawidgets
+
+# For listing child nodes in Qt Creator or Assistant.
+qhp.qtmultimediawidgets.subprojects = classes qmltypes
+qhp.qtmultimediawidgets.subprojects.classes.title = C++ Classes
+qhp.qtmultimediawidgets.subprojects.classes.indexTitle = Qt Multimedia Widgets C++ Classes
+qhp.qtmultimediawidgets.subprojects.classes.selectors = class fake:headerfile
+qhp.qtmultimediawidgets.subprojects.classes.sortPages = true
+qhp.qtmultimediawidgets.subprojects.qmltypes.title = QML Types
+qhp.qtmultimediawidgets.subprojects.qmltypes.indexTitle = Qt Multimedia Widgets QML Types
+qhp.qtmultimediawidgets.subprojects.qmltypes.selectors = fake:qmlclass
+qhp.qtmultimediawidgets.subprojects.qmltypes.sortPages = true
+
+exampledirs += ../../../examples/multimediawidgets \
+ snippets
+
+headerdirs += ../
+
+imagedirs += \
+
+sourcedirs += ../
+
+excludedirs +=
+
+depends += qtcore qtdoc qtquick qtqml qtmultimedia qtwidgets qtgui
diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc
new file mode 100644
index 000000000..07fa63205
--- /dev/null
+++ b/src/multimediawidgets/doc/src/qtmultimediawidgets-index.qdoc
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qtmultimediawidgets-index.html
+\title Qt Multimedia Widgets
+\brief An essential module which provides multimedia-related widgets.
+
+Qt Multimedia Widgets provides additional multimedia-related widgets and
+controls. The classes expand the capabilities of the \l{Qt Multimedia} and
+\l{Qt Widgets} modules.
+
+\section1 Getting Started
+
+To enable Qt Multimedia Widgets in a project, add this directive into the
+C++ files:
+\code
+#include <QtMultimediaWidgets>
+\endcode
+
+To link against the C++ libraries, add the following to your \c qmake project
+file:
+\code
+QT += multimediawidgets
+\endcode
+
+\section1 Related Information
+
+\section2 Reference
+\list
+\li \l{Qt Multimedia Widgets C++ Classes}{C++ Classes}
+\endlist
+
+\section2 Examples
+\list
+\li \l{QML Camera Example}
+\li \l{Camera Example}
+\li \l{Media Player Example}
+\li \l{Video Graphics Item Example}
+\li \l{Video Widget Example}
+\endlist
+
+*/
diff --git a/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc
new file mode 100644
index 000000000..cc64ed173
--- /dev/null
+++ b/src/multimediawidgets/doc/src/qtmultimediawidgets.qdoc
@@ -0,0 +1,47 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\module QtMultimediaWidgets
+\title Qt Multimedia Widgets C++ Classes
+\brief Classes provided by the Qt Multimedia Widgets module.
+
+These classes are part of the \l{Qt Multimedia Widgets} module.
+
+To enable Qt Multimedia Widgets in a project, add this directive into the
+C++ files:
+\code
+#include <QtMultimediaWidgets>
+\endcode
+
+To link against the C++ libraries, add the following to your \c qmake project
+file:
+\code
+QT += multimediawidgets
+\endcode
+
+*/
diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro
index 8637bbff0..c6f214679 100644
--- a/src/multimediawidgets/multimediawidgets.pro
+++ b/src/multimediawidgets/multimediawidgets.pro
@@ -7,6 +7,8 @@ qtHaveModule(opengl):!contains(QT_CONFIG, opengles1) {
DEFINES += QT_NO_OPENGL
}
+QMAKE_DOCS = $$PWD/doc/qtmultimediawidgets.qdocconf
+
load(qt_module)
PRIVATE_HEADERS += \
@@ -26,7 +28,7 @@ SOURCES += \
qvideowidgetcontrol.cpp \
qvideowidget.cpp
-mac {
+mac:!ios {
!simulator {
PRIVATE_HEADERS += qpaintervideosurface_mac_p.h
OBJECTIVE_SOURCES += qpaintervideosurface_mac.mm
@@ -52,4 +54,3 @@ maemo6 {
}
HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
-
diff --git a/src/multimediawidgets/qcameraviewfinder.h b/src/multimediawidgets/qcameraviewfinder.h
index c2eff6f5e..4b3f7d08f 100644
--- a/src/multimediawidgets/qcameraviewfinder.h
+++ b/src/multimediawidgets/qcameraviewfinder.h
@@ -53,8 +53,6 @@
#include <QtMultimedia/qmediaservice.h>
#include <QtMultimediaWidgets/qvideowidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -80,7 +78,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QCAMERA_H
diff --git a/src/multimediawidgets/qeglimagetexturesurface_p.h b/src/multimediawidgets/qeglimagetexturesurface_p.h
index 9a22e14b8..cafd32383 100644
--- a/src/multimediawidgets/qeglimagetexturesurface_p.h
+++ b/src/multimediawidgets/qeglimagetexturesurface_p.h
@@ -65,8 +65,6 @@
#include <qvideosurfaceformat.h>
#include <qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QGLContext;
@@ -142,7 +140,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qgraphicsvideoitem.h b/src/multimediawidgets/qgraphicsvideoitem.h
index c5d993325..6db81a55b 100644
--- a/src/multimediawidgets/qgraphicsvideoitem.h
+++ b/src/multimediawidgets/qgraphicsvideoitem.h
@@ -47,8 +47,6 @@
#include <QtMultimediaWidgets/qvideowidget.h>
#include <QtMultimedia/qmediabindableinterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QVideoSurfaceFormat;
@@ -107,7 +105,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp
index 665ea9714..cdbc9820d 100644
--- a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp
+++ b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp
@@ -203,7 +203,7 @@ void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
\brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
- \inmodule QtMultimedia
+ \inmodule QtMultimediaWidgets
\ingroup multimedia
Attaching a QGraphicsVideoItem to a QMediaObject allows it to display
diff --git a/src/multimediawidgets/qpaintervideosurface_mac_p.h b/src/multimediawidgets/qpaintervideosurface_mac_p.h
index 4840b9cd7..a56a650d5 100644
--- a/src/multimediawidgets/qpaintervideosurface_mac_p.h
+++ b/src/multimediawidgets/qpaintervideosurface_mac_p.h
@@ -57,8 +57,6 @@
#include <qvideosurfaceformat.h>
#include <qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -95,6 +93,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qpaintervideosurface_p.h b/src/multimediawidgets/qpaintervideosurface_p.h
index abc099d20..12113a00f 100644
--- a/src/multimediawidgets/qpaintervideosurface_p.h
+++ b/src/multimediawidgets/qpaintervideosurface_p.h
@@ -61,8 +61,6 @@
#include <qabstractvideosurface.h>
#include <qvideoframe.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class QGLContext;
@@ -181,7 +179,5 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QPainterVideoSurface::ShaderTypes)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qtmultimediawidgetdefs.h b/src/multimediawidgets/qtmultimediawidgetdefs.h
index 32ef34ab0..73b8b50fa 100644
--- a/src/multimediawidgets/qtmultimediawidgetdefs.h
+++ b/src/multimediawidgets/qtmultimediawidgetdefs.h
@@ -55,7 +55,6 @@
#include <QtCore/qglobal.h>
-QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
#ifndef QT_STATIC
@@ -69,7 +68,6 @@ QT_BEGIN_NAMESPACE
#endif
QT_END_NAMESPACE
-QT_END_HEADER
#endif // QMULTIMEDIAWIDGETS_P_H
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
index d126785cf..ec71bb6c7 100644
--- a/src/multimediawidgets/qvideowidget.h
+++ b/src/multimediawidgets/qvideowidget.h
@@ -47,8 +47,6 @@
#include <QtMultimediaWidgets/qtmultimediawidgetdefs.h>
#include <QtMultimedia/qmediabindableinterface.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -131,7 +129,5 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h
index ee2c07bfa..a7412202f 100644
--- a/src/multimediawidgets/qvideowidget_p.h
+++ b/src/multimediawidgets/qvideowidget_p.h
@@ -64,8 +64,6 @@
#include <QtCore/qpointer.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -282,7 +280,5 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/multimediawidgets/qvideowidgetcontrol.h b/src/multimediawidgets/qvideowidgetcontrol.h
index 49d338b70..b5c130633 100644
--- a/src/multimediawidgets/qvideowidgetcontrol.h
+++ b/src/multimediawidgets/qvideowidgetcontrol.h
@@ -47,8 +47,6 @@
#include <QtWidgets/qwidget.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -97,7 +95,5 @@ Q_MEDIA_DECLARE_CONTROL(QVideoWidgetControl, QVideoWidgetControl_iid)
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/plugins/android/android.pro b/src/plugins/android/android.pro
new file mode 100644
index 000000000..2cfc83f0e
--- /dev/null
+++ b/src/plugins/android/android.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS += mediaplayer \
+ jar
+
diff --git a/src/plugins/android/jar/AndroidManifest.xml b/src/plugins/android/jar/AndroidManifest.xml
new file mode 100644
index 000000000..7eae1854d
--- /dev/null
+++ b/src/plugins/android/jar/AndroidManifest.xml
@@ -0,0 +1,6 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="org.qtproject.qt5.android.multimedia"
+ android:versionCode="1"
+ android:versionName="1.0" >
+ <supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>
+</manifest>
diff --git a/src/plugins/android/jar/jar.pro b/src/plugins/android/jar/jar.pro
new file mode 100644
index 000000000..b256412fc
--- /dev/null
+++ b/src/plugins/android/jar/jar.pro
@@ -0,0 +1,11 @@
+load(qt_build_paths)
+CONFIG += java
+TARGET = QtMultimedia
+DESTDIR = $$MODULE_BASE_OUTDIR/jar
+API_VERSION = android-11
+
+JAVACLASSPATH += $$PWD/src
+
+JAVASOURCES += $$PWD/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java \
+ $$PWD/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java \
+ $$PWD/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java
diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java
new file mode 100644
index 000000000..b2115b7d9
--- /dev/null
+++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer.java
@@ -0,0 +1,445 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtMultimedia module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+package org.qtproject.qt5.android.multimedia;
+
+import java.io.IOException;
+import java.lang.String;
+
+// API is level is < 9 unless marked otherwise.
+import android.app.Activity;
+import android.content.Context;
+import android.media.MediaPlayer;
+import android.net.Uri;
+import android.util.Log;
+
+public class QtAndroidMediaPlayer extends MediaPlayer
+{
+ // Native callback functions for MediaPlayer
+ native public void onErrorNative(int what, int extra, long id);
+ native public void onBufferingUpdateNative(int percent, long id);
+ native public void onInfoNative(int what, int extra, long id);
+ native public void onMediaPlayerInfoNative(int what, int extra, long id);
+ native public void onVideoSizeChangedNative(int width, int height, long id);
+
+ private Uri mUri = null;
+ private final long mID;
+ private boolean mMuted = false;
+ private boolean mPreparing = false;
+ private boolean mInitialized = false;
+ private int mVolume = 100;
+ private static final String TAG = "Qt MediaPlayer";
+ private static Context mApplicationContext = null;
+
+ final int MEDIA_PLAYER_INVALID_STATE = 1;
+ final int MEDIA_PLAYER_PREPARING = 2;
+ final int MEDIA_PLAYER_READY = 3;
+ final int MEDIA_PLAYER_DURATION = 4;
+ final int MEDIA_PLAYER_PROGRESS = 5;
+ final int MEDIA_PLAYER_FINISHED = 6;
+
+ // Activity set by Qt on load.
+ static public void setActivity(final Activity activity)
+ {
+ try {
+ mApplicationContext = activity.getApplicationContext();
+ } catch(final Exception e) {
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ private class ProgressWatcher implements Runnable
+ {
+ @Override
+ public void run()
+ {
+ final int duratation = getDuration();
+ int currentPosition = getCurrentPosition();
+
+ try {
+ while (duratation >= currentPosition && isPlaying()) {
+ onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, currentPosition, mID);
+ Thread.sleep(1000);
+ currentPosition = getCurrentPosition();
+ }
+ } catch (final InterruptedException e) {
+ Log.d(TAG, e.getMessage());
+ return;
+ }
+ }
+ }
+
+ /**
+ * MediaPlayer OnErrorListener
+ */
+ private class MediaPlayerErrorListener
+ implements MediaPlayer.OnErrorListener
+ {
+ @Override
+ public boolean onError(final MediaPlayer mp,
+ final int what,
+ final int extra)
+ {
+ reset();
+ onErrorNative(what, extra, mID);
+ return true;
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnBufferingListener
+ */
+ private class MediaPlayerBufferingListener
+ implements MediaPlayer.OnBufferingUpdateListener
+ {
+ private int mBufferPercent = -1;
+ @Override
+ public void onBufferingUpdate(final android.media.MediaPlayer mp,
+ final int percent)
+ {
+ // Avoid updates when percent is unchanged.
+ // E.g., we keep getting updates when percent == 100
+ if (mBufferPercent == percent)
+ return;
+
+ onBufferingUpdateNative((mBufferPercent = percent), mID);
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnCompletionListener
+ */
+ private class MediaPlayerCompletionListener
+ implements MediaPlayer.OnCompletionListener
+ {
+ @Override
+ public void onCompletion(final MediaPlayer mp)
+ {
+ onMediaPlayerInfoNative(MEDIA_PLAYER_FINISHED, 0, mID);
+ reset();
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnInfoListener
+ */
+ private class MediaPlayerInfoListener
+ implements MediaPlayer.OnInfoListener
+ {
+ @Override
+ public boolean onInfo(final MediaPlayer mp,
+ final int what,
+ final int extra)
+ {
+ onInfoNative(what, extra, mID);
+ return true;
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnPreparedListener
+ */
+ private class MediaPlayerPreparedListener
+ implements MediaPlayer.OnPreparedListener
+ {
+
+ @Override
+ public void onPrepared(final MediaPlayer mp)
+ {
+ onMediaPlayerInfoNative(MEDIA_PLAYER_DURATION, getDuration(), mID);
+ onMediaPlayerInfoNative(MEDIA_PLAYER_READY, 0, mID);
+ mPreparing = false;
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnSeekCompleteListener
+ */
+ private class MediaPlayerSeekCompleteListener
+ implements MediaPlayer.OnSeekCompleteListener
+ {
+
+ @Override
+ public void onSeekComplete(final MediaPlayer mp)
+ {
+ onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, getCurrentPosition(), mID);
+ }
+
+ }
+
+ /**
+ * MediaPlayer OnVideoSizeChangedListener
+ */
+ private class MediaPlayerVideoSizeChangedListener
+ implements MediaPlayer.OnVideoSizeChangedListener
+ {
+
+ @Override
+ public void onVideoSizeChanged(final MediaPlayer mp,
+ final int width,
+ final int height)
+ {
+ onVideoSizeChangedNative(width, height, mID);
+ }
+
+ }
+
+ public QtAndroidMediaPlayer(final long id)
+ {
+ super();
+ mID = id;
+ setOnBufferingUpdateListener(new MediaPlayerBufferingListener());
+ setOnCompletionListener(new MediaPlayerCompletionListener());
+ setOnInfoListener(new MediaPlayerInfoListener());
+ setOnSeekCompleteListener(new MediaPlayerSeekCompleteListener());
+ setOnVideoSizeChangedListener(new MediaPlayerVideoSizeChangedListener());
+ setOnErrorListener(new MediaPlayerErrorListener());
+ }
+
+ @Override
+ public void start()
+ {
+ if (!mInitialized) {
+ onMediaPlayerInfoNative(MEDIA_PLAYER_INVALID_STATE, 0, mID);
+ return;
+ }
+
+ if (mApplicationContext == null)
+ return;
+
+ if (mPreparing)
+ return;
+
+ if (isPlaying())
+ return;
+
+ try {
+ super.start();
+ Thread progressThread = new Thread(new ProgressWatcher());
+ progressThread.start();
+ } catch (final IllegalStateException e) {
+ reset();
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public void pause()
+ {
+ if (!isPlaying())
+ return;
+
+ try {
+ super.pause();
+ } catch (final IllegalStateException e) {
+ reset();
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public void stop()
+ {
+ if (!mInitialized)
+ return;
+
+ try {
+ super.stop();
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ } finally {
+ reset();
+ }
+ }
+
+ @Override
+ public void seekTo(final int msec)
+ {
+ if (!mInitialized)
+ return;
+
+ try {
+ super.seekTo(msec);
+ onMediaPlayerInfoNative(MEDIA_PLAYER_PROGRESS, msec, mID);
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public boolean isPlaying()
+ {
+ boolean playing = false;
+
+ if (!mInitialized)
+ return playing;
+
+ try {
+ playing = super.isPlaying();
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ }
+
+ return playing;
+ }
+
+ public void setMediaPath(final String path)
+ {
+ if (mInitialized)
+ reset();
+
+ try {
+ mPreparing = true;
+ onMediaPlayerInfoNative(MEDIA_PLAYER_PREPARING, 0, mID);
+ mUri = Uri.parse(path);
+ setDataSource(mApplicationContext, mUri);
+ mInitialized = true;
+ setOnPreparedListener(new MediaPlayerPreparedListener());
+ prepareAsync();
+ } catch (final IOException e) {
+ mPreparing = false;
+ onErrorNative(MEDIA_ERROR_UNKNOWN,
+ /* MEDIA_ERROR_UNSUPPORTED= */ -1010,
+ mID);
+ } catch (final IllegalArgumentException e) {
+ Log.d(TAG, e.getMessage());
+ } catch (final SecurityException e) {
+ Log.d(TAG, e.getMessage());
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ } catch (final NullPointerException e) {
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ @Override
+ public int getCurrentPosition()
+ {
+ int currentPosition = 0;
+
+ if (!mInitialized)
+ return currentPosition;
+
+ try {
+ currentPosition = super.getCurrentPosition();
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ }
+
+ return currentPosition;
+ }
+
+ @Override
+ public int getDuration()
+ {
+ int duration = 0;
+
+ if (!mInitialized)
+ return duration;
+
+ try {
+ duration = super.getDuration();
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ }
+
+ return duration;
+ }
+
+ private float adjustVolume(final int volume)
+ {
+ if (volume < 1)
+ return 0.0f;
+
+ if (volume > 98)
+ return 1.0f;
+
+ return (float) (1-(Math.log(100-volume)/Math.log(100)));
+ }
+
+ public void setVolume(int volume)
+ {
+ if (volume < 0)
+ volume = 0;
+
+ if (volume > 100)
+ volume = 100;
+
+ float newVolume = adjustVolume(volume);
+
+ try {
+ super.setVolume(newVolume, newVolume);
+ if (!mMuted)
+ mVolume = volume;
+ } catch (final IllegalStateException e) {
+ Log.d(TAG, e.getMessage());
+ }
+ }
+
+ public int getVolume()
+ {
+ return mVolume;
+ }
+
+ public void mute(final boolean mute)
+ {
+ mMuted = mute;
+ setVolume(mute ? 0 : mVolume);
+ }
+
+ public boolean isMuted()
+ {
+ return mMuted;
+ }
+
+ @Override
+ public void reset()
+ {
+ mInitialized = false;
+ super.reset();
+ }
+
+}
diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java
new file mode 100644
index 000000000..b8837d557
--- /dev/null
+++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTexture.java
@@ -0,0 +1,74 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtMultimedia module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+package org.qtproject.qt5.android.multimedia;
+
+import android.graphics.SurfaceTexture;
+
+public class QtSurfaceTexture implements SurfaceTexture.OnFrameAvailableListener
+{
+ public SurfaceTexture surfaceTexture;
+ private int texID;
+
+ public QtSurfaceTexture(int texName)
+ {
+ texID = texName;
+ surfaceTexture = new SurfaceTexture(texName);
+ surfaceTexture.setOnFrameAvailableListener(this);
+ }
+
+ public void getTransformMatrix(float[] mtx)
+ {
+ surfaceTexture.getTransformMatrix(mtx);
+ }
+
+ public void updateTexImage()
+ {
+ surfaceTexture.updateTexImage();
+ }
+
+ public void onFrameAvailable(SurfaceTexture surfaceTexture)
+ {
+ notifyFrameAvailable(texID);
+ }
+
+ private static native void notifyFrameAvailable(int id);
+}
diff --git a/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java
new file mode 100644
index 000000000..15c5f231f
--- /dev/null
+++ b/src/plugins/android/jar/src/org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder.java
@@ -0,0 +1,114 @@
+/****************************************************************************
+ **
+ ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+ ** Contact: http://www.qt-project.org/legal
+ **
+ ** This file is part of the QtMultimedia module of the Qt Toolkit.
+ **
+ ** $QT_BEGIN_LICENSE:LGPL$
+ ** Commercial License Usage
+ ** Licensees holding valid commercial Qt licenses may use this file in
+ ** accordance with the commercial license agreement provided with the
+ ** Software or, alternatively, in accordance with the terms contained in
+ ** a written agreement between you and Digia. For licensing terms and
+ ** conditions see http://qt.digia.com/licensing. For further information
+ ** use the contact form at http://qt.digia.com/contact-us.
+ **
+ ** GNU Lesser General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU Lesser
+ ** General Public License version 2.1 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.LGPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU Lesser General Public License version 2.1 requirements
+ ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+ **
+ ** In addition, as a special exception, Digia gives you certain additional
+ ** rights. These rights are described in the Digia Qt LGPL Exception
+ ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+ **
+ ** GNU General Public License Usage
+ ** Alternatively, this file may be used under the terms of the GNU
+ ** General Public License version 3.0 as published by the Free Software
+ ** Foundation and appearing in the file LICENSE.GPL included in the
+ ** packaging of this file. Please review the following information to
+ ** ensure the GNU General Public License version 3.0 requirements will be
+ ** met: http://www.gnu.org/copyleft/gpl.html.
+ **
+ **
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+
+package org.qtproject.qt5.android.multimedia;
+
+import android.view.SurfaceHolder;
+import android.view.Surface;
+import android.graphics.Rect;
+import android.graphics.Canvas;
+
+public class QtSurfaceTextureHolder implements SurfaceHolder
+{
+ private Surface surfaceTexture;
+
+ public QtSurfaceTextureHolder(Surface surface)
+ {
+ surfaceTexture = surface;
+ }
+
+ public void addCallback(SurfaceHolder.Callback callback)
+ {
+ }
+
+ public Surface getSurface()
+ {
+ return surfaceTexture;
+ }
+
+ public Rect getSurfaceFrame()
+ {
+ return new Rect();
+ }
+
+ public boolean isCreating()
+ {
+ return false;
+ }
+
+ public Canvas lockCanvas(Rect dirty)
+ {
+ return new Canvas();
+ }
+
+ public Canvas lockCanvas()
+ {
+ return new Canvas();
+ }
+
+ public void removeCallback(SurfaceHolder.Callback callback)
+ {
+ }
+
+ public void setFixedSize(int width, int height)
+ {
+ }
+
+ public void setFormat(int format)
+ {
+ }
+
+ public void setKeepScreenOn(boolean screenOn)
+ {
+ }
+
+ public void setSizeFromLayout()
+ {
+ }
+
+ public void setType(int type)
+ {
+ }
+
+ public void unlockCanvasAndPost(Canvas canvas)
+ {
+ }
+}
diff --git a/src/plugins/blackberry/mediaservice/blackberry_mediaservice.json b/src/plugins/android/mediaplayer/mediaplayer.json
index c4a27ea01..c4a27ea01 100644
--- a/src/plugins/blackberry/mediaservice/blackberry_mediaservice.json
+++ b/src/plugins/android/mediaplayer/mediaplayer.json
diff --git a/src/plugins/android/mediaplayer/mediaplayer.pro b/src/plugins/android/mediaplayer/mediaplayer.pro
new file mode 100644
index 000000000..cabe4c666
--- /dev/null
+++ b/src/plugins/android/mediaplayer/mediaplayer.pro
@@ -0,0 +1,24 @@
+TARGET = androidmediaplayer
+QT += multimedia-private gui-private platformsupport-private network
+
+PLUGIN_TYPE = mediaservice
+PLUGIN_CLASS_NAME = QAndroidMediaPlayerServicePlugin
+load(qt_plugin)
+
+HEADERS += \
+ qandroidmediaplayercontrol.h \
+ qandroidmediaservice.h \
+ qandroidmetadatareadercontrol.h \
+ qandroidmediaserviceplugin.h \
+ qandroidvideorendercontrol.h \
+ qandroidvideooutput.h
+SOURCES += \
+ qandroidmediaplayercontrol.cpp \
+ qandroidmediaservice.cpp \
+ qandroidmetadatareadercontrol.cpp \
+ qandroidmediaserviceplugin.cpp \
+ qandroidvideorendercontrol.cpp
+
+OTHER_FILES += mediaplayer.json
+
+include (../wrappers/wrappers.pri)
diff --git a/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp
new file mode 100644
index 000000000..5a9c8b84f
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.cpp
@@ -0,0 +1,496 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidmediaplayercontrol.h"
+#include "jmediaplayer.h"
+#include "qandroidvideooutput.h"
+
+QT_BEGIN_NAMESPACE
+
+QAndroidMediaPlayerControl::QAndroidMediaPlayerControl(QObject *parent)
+ : QMediaPlayerControl(parent),
+ mMediaPlayer(new JMediaPlayer),
+ mCurrentState(QMediaPlayer::StoppedState),
+ mCurrentMediaStatus(QMediaPlayer::NoMedia),
+ mMediaStream(0),
+ mVideoOutput(0),
+ mSeekable(true),
+ mBufferPercent(-1),
+ mAudioAvailable(false),
+ mVideoAvailable(false),
+ mBuffering(false),
+ mMediaPlayerReady(false),
+ mPendingPosition(-1)
+{
+ connect(mMediaPlayer, SIGNAL(bufferingUpdate(qint32)),
+ this, SLOT(onBufferChanged(qint32)));
+ connect(mMediaPlayer, SIGNAL(info(qint32, qint32)),
+ this, SLOT(onInfo(qint32, qint32)));
+ connect(mMediaPlayer, SIGNAL(error(qint32, qint32)),
+ this, SLOT(onError(qint32, qint32)));
+ connect(mMediaPlayer, SIGNAL(mediaPlayerInfo(qint32, qint32)),
+ this, SLOT(onMediaPlayerInfo(qint32, qint32)));
+ connect(mMediaPlayer, SIGNAL(videoSizeChanged(qint32,qint32)),
+ this, SLOT(onVideoSizeChanged(qint32,qint32)));
+}
+
+QAndroidMediaPlayerControl::~QAndroidMediaPlayerControl()
+{
+ delete mMediaPlayer;
+}
+
+QMediaPlayer::State QAndroidMediaPlayerControl::state() const
+{
+ return mCurrentState;
+}
+
+QMediaPlayer::MediaStatus QAndroidMediaPlayerControl::mediaStatus() const
+{
+ return mCurrentMediaStatus;
+}
+
+qint64 QAndroidMediaPlayerControl::duration() const
+{
+ return (mCurrentMediaStatus == QMediaPlayer::InvalidMedia
+ || mCurrentMediaStatus == QMediaPlayer::NoMedia) ? 0
+ : mMediaPlayer->getDuration();
+}
+
+qint64 QAndroidMediaPlayerControl::position() const
+{
+ if (!mMediaPlayerReady)
+ return mPendingPosition < 0 ? 0 : mPendingPosition;
+
+ return mMediaPlayer->getCurrentPosition();
+}
+
+void QAndroidMediaPlayerControl::setPosition(qint64 position)
+{
+ if (!mSeekable)
+ return;
+
+ const int seekPosition = (position > INT_MAX) ? INT_MAX : position;
+
+ if (!mMediaPlayerReady) {
+ mPendingPosition = seekPosition;
+ Q_EMIT positionChanged(seekPosition);
+ return;
+ }
+
+ mMediaPlayer->seekTo(seekPosition);
+ mPendingPosition = -1;
+}
+
+int QAndroidMediaPlayerControl::volume() const
+{
+ return mMediaPlayer->volume();
+}
+
+void QAndroidMediaPlayerControl::setVolume(int volume)
+{
+ mMediaPlayer->setVolume(volume);
+ Q_EMIT volumeChanged(volume);
+}
+
+bool QAndroidMediaPlayerControl::isMuted() const
+{
+ return mMediaPlayer->isMuted();
+}
+
+void QAndroidMediaPlayerControl::setMuted(bool muted)
+{
+ mMediaPlayer->setMuted(muted);
+ Q_EMIT mutedChanged(muted);
+}
+
+int QAndroidMediaPlayerControl::bufferStatus() const
+{
+ return mBufferPercent;
+}
+
+bool QAndroidMediaPlayerControl::isAudioAvailable() const
+{
+ return mAudioAvailable;
+}
+
+bool QAndroidMediaPlayerControl::isVideoAvailable() const
+{
+ return mVideoAvailable;
+}
+
+bool QAndroidMediaPlayerControl::isSeekable() const
+{
+ return mSeekable;
+}
+
+QMediaTimeRange QAndroidMediaPlayerControl::availablePlaybackRanges() const
+{
+ return mAvailablePlaybackRange;
+}
+
+void QAndroidMediaPlayerControl::updateAvailablePlaybackRanges()
+{
+ if (mBuffering) {
+ const qint64 pos = position();
+ const qint64 end = (duration() / 100) * mBufferPercent;
+ mAvailablePlaybackRange.addInterval(pos, end);
+ } else if (mSeekable) {
+ mAvailablePlaybackRange = QMediaTimeRange(0, duration());
+ } else {
+ mAvailablePlaybackRange = QMediaTimeRange();
+ }
+
+ Q_EMIT availablePlaybackRangesChanged(mAvailablePlaybackRange);
+}
+
+qreal QAndroidMediaPlayerControl::playbackRate() const
+{
+ return 1.0f;
+}
+
+void QAndroidMediaPlayerControl::setPlaybackRate(qreal rate)
+{
+ Q_UNUSED(rate);
+}
+
+QMediaContent QAndroidMediaPlayerControl::media() const
+{
+ return mMediaContent;
+}
+
+const QIODevice *QAndroidMediaPlayerControl::mediaStream() const
+{
+ return mMediaStream;
+}
+
+void QAndroidMediaPlayerControl::setMedia(const QMediaContent &mediaContent,
+ QIODevice *stream)
+{
+ mMediaContent = mediaContent;
+ mMediaStream = stream;
+
+ const QString uri = mediaContent.canonicalUrl().toString();
+
+ if (!uri.isEmpty())
+ mMediaPlayer->setDataSource(uri);
+ else
+ setMediaStatus(QMediaPlayer::NoMedia);
+
+ Q_EMIT mediaChanged(mMediaContent);
+
+ resetBufferingProgress();
+
+ // reset some properties
+ setAudioAvailable(false);
+ setVideoAvailable(false);
+ setSeekable(true);
+}
+
+void QAndroidMediaPlayerControl::setVideoOutput(QAndroidVideoOutput *videoOutput)
+{
+ if (mVideoOutput)
+ mVideoOutput->stop();
+
+ mVideoOutput = videoOutput;
+}
+
+void QAndroidMediaPlayerControl::play()
+{
+ if (!mMediaPlayerReady) {
+ mPendingState = QMediaPlayer::PlayingState;
+ if (mCurrentState == QMediaPlayer::StoppedState
+ && !mMediaContent.isNull()
+ && mCurrentMediaStatus != QMediaPlayer::LoadingMedia) {
+ setMedia(mMediaContent, 0);
+ }
+ return;
+ }
+
+ mMediaPlayer->play();
+ setState(QMediaPlayer::PlayingState);
+}
+
+void QAndroidMediaPlayerControl::pause()
+{
+ if (!mMediaPlayerReady) {
+ mPendingState = QMediaPlayer::PausedState;
+ return;
+ }
+
+ mMediaPlayer->pause();
+ setState(QMediaPlayer::PausedState);
+}
+
+void QAndroidMediaPlayerControl::stop()
+{
+ mMediaPlayer->stop();
+ setState(QMediaPlayer::StoppedState);
+}
+
+void QAndroidMediaPlayerControl::onInfo(qint32 what, qint32 extra)
+{
+ Q_UNUSED(extra);
+ switch (what) {
+ case JMediaPlayer::MEDIA_INFO_UNKNOWN:
+ break;
+ case JMediaPlayer::MEDIA_INFO_VIDEO_TRACK_LAGGING:
+ // IGNORE
+ break;
+ case JMediaPlayer::MEDIA_INFO_VIDEO_RENDERING_START:
+ break;
+ case JMediaPlayer::MEDIA_INFO_BUFFERING_START:
+ mPendingState = mCurrentState;
+ setState(QMediaPlayer::PausedState);
+ setMediaStatus(QMediaPlayer::StalledMedia);
+ break;
+ case JMediaPlayer::MEDIA_INFO_BUFFERING_END:
+ setMediaStatus(mBufferPercent == 100 ? QMediaPlayer::BufferedMedia : QMediaPlayer::BufferingMedia);
+ flushPendingStates();
+ break;
+ case JMediaPlayer::MEDIA_INFO_BAD_INTERLEAVING:
+ break;
+ case JMediaPlayer::MEDIA_INFO_NOT_SEEKABLE:
+ setSeekable(false);
+ break;
+ case JMediaPlayer::MEDIA_INFO_METADATA_UPDATE:
+ Q_EMIT metaDataUpdated();
+ break;
+ }
+}
+
+void QAndroidMediaPlayerControl::onMediaPlayerInfo(qint32 what, qint32 extra)
+{
+ switch (what) {
+ case JMediaPlayer::MEDIA_PLAYER_INVALID_STATE:
+ setError(what, QStringLiteral("Error: Invalid state"));
+ break;
+ case JMediaPlayer::MEDIA_PLAYER_PREPARING:
+ setMediaStatus(QMediaPlayer::LoadingMedia);
+ setState(QMediaPlayer::StoppedState);
+ break;
+ case JMediaPlayer::MEDIA_PLAYER_READY:
+ if (mBuffering) {
+ setMediaStatus(mBufferPercent == 100 ? QMediaPlayer::BufferedMedia
+ : QMediaPlayer::BufferingMedia);
+ } else {
+ setMediaStatus(QMediaPlayer::LoadedMedia);
+ mBufferPercent = 100;
+ Q_EMIT bufferStatusChanged(mBufferPercent);
+ updateAvailablePlaybackRanges();
+ }
+ setAudioAvailable(true);
+ mMediaPlayerReady = true;
+ flushPendingStates();
+ break;
+ case JMediaPlayer::MEDIA_PLAYER_DURATION:
+ Q_EMIT durationChanged(extra);
+ break;
+ case JMediaPlayer::MEDIA_PLAYER_PROGRESS:
+ Q_EMIT positionChanged(extra);
+ break;
+ case JMediaPlayer::MEDIA_PLAYER_FINISHED:
+ setState(QMediaPlayer::StoppedState);
+ setMediaStatus(QMediaPlayer::EndOfMedia);
+ break;
+ }
+}
+
+void QAndroidMediaPlayerControl::onError(qint32 what, qint32 extra)
+{
+ QString errorString;
+ QMediaPlayer::Error error = QMediaPlayer::ResourceError;
+
+ switch (what) {
+ case JMediaPlayer::MEDIA_ERROR_UNKNOWN:
+ errorString = QLatin1String("Error:");
+ break;
+ case JMediaPlayer::MEDIA_ERROR_SERVER_DIED:
+ errorString = QLatin1String("Error: Server died");
+ error = QMediaPlayer::ServiceMissingError;
+ break;
+ }
+
+ switch (extra) {
+ case JMediaPlayer::MEDIA_ERROR_IO: // Network OR file error
+ errorString += QLatin1String(" (I/O operation failed)");
+ error = QMediaPlayer::NetworkError;
+ setMediaStatus(QMediaPlayer::InvalidMedia);
+ break;
+ case JMediaPlayer::MEDIA_ERROR_MALFORMED:
+ errorString += QLatin1String(" (Malformed bitstream)");
+ error = QMediaPlayer::FormatError;
+ setMediaStatus(QMediaPlayer::InvalidMedia);
+ break;
+ case JMediaPlayer::MEDIA_ERROR_UNSUPPORTED:
+ errorString += QLatin1String(" (Unsupported media)");
+ error = QMediaPlayer::FormatError;
+ setMediaStatus(QMediaPlayer::InvalidMedia);
+ break;
+ case JMediaPlayer::MEDIA_ERROR_TIMED_OUT:
+ errorString += QLatin1String(" (Timed out)");
+ break;
+ case JMediaPlayer::MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK:
+ errorString += QLatin1String(" (Unable to start progressive playback')");
+ error = QMediaPlayer::FormatError;
+ setMediaStatus(QMediaPlayer::InvalidMedia);
+ break;
+ }
+
+ setError(error, errorString);
+}
+
+void QAndroidMediaPlayerControl::onBufferChanged(qint32 percent)
+{
+ mBuffering = true;
+ mBufferPercent = percent;
+ Q_EMIT bufferStatusChanged(mBufferPercent);
+
+ updateAvailablePlaybackRanges();
+
+ if (mBufferPercent == 100)
+ setMediaStatus(QMediaPlayer::BufferedMedia);
+}
+
+void QAndroidMediaPlayerControl::onVideoSizeChanged(qint32 width, qint32 height)
+{
+ if (width == 0 || height == 0)
+ return;
+
+ setVideoAvailable(true);
+
+ if (mVideoOutput) {
+ if (!mMediaPlayer->display())
+ mMediaPlayer->setDisplay(mVideoOutput->surfaceHolder());
+ if (mMediaPlayer->display())
+ mVideoOutput->setVideoSize(QSize(width, height));
+ }
+}
+
+void QAndroidMediaPlayerControl::setState(QMediaPlayer::State state)
+{
+ if (mCurrentState == state)
+ return;
+
+ if (state == QMediaPlayer::StoppedState) {
+ if (mVideoOutput)
+ mVideoOutput->stop();
+ resetBufferingProgress();
+ mMediaPlayerReady = false;
+ mPendingPosition = -1;
+ Q_EMIT positionChanged(0);
+ }
+
+ mCurrentState = state;
+ Q_EMIT stateChanged(mCurrentState);
+}
+
+void QAndroidMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status)
+{
+ if (mCurrentMediaStatus == status)
+ return;
+
+ if (status == QMediaPlayer::NoMedia || status == QMediaPlayer::InvalidMedia)
+ Q_EMIT durationChanged(0);
+
+ mCurrentMediaStatus = status;
+ Q_EMIT mediaStatusChanged(mCurrentMediaStatus);
+}
+
+void QAndroidMediaPlayerControl::setError(int error,
+ const QString &errorString)
+{
+ setState(QMediaPlayer::StoppedState);
+ Q_EMIT QMediaPlayerControl::error(error, errorString);
+}
+
+void QAndroidMediaPlayerControl::setSeekable(bool seekable)
+{
+ if (mSeekable == seekable)
+ return;
+
+ mSeekable = seekable;
+ Q_EMIT seekableChanged(mSeekable);
+}
+
+void QAndroidMediaPlayerControl::setAudioAvailable(bool available)
+{
+ if (mAudioAvailable == available)
+ return;
+
+ mAudioAvailable = available;
+ Q_EMIT audioAvailableChanged(mAudioAvailable);
+}
+
+void QAndroidMediaPlayerControl::setVideoAvailable(bool available)
+{
+ if (mVideoAvailable == available)
+ return;
+
+ mVideoAvailable = available;
+ Q_EMIT videoAvailableChanged(mVideoAvailable);
+}
+
+void QAndroidMediaPlayerControl::resetBufferingProgress()
+{
+ mBuffering = false;
+ mBufferPercent = 0;
+ mAvailablePlaybackRange = QMediaTimeRange();
+ Q_EMIT bufferStatusChanged(mBufferPercent);
+}
+
+void QAndroidMediaPlayerControl::flushPendingStates()
+{
+ switch (mPendingState) {
+ case QMediaPlayer::PlayingState:
+ if (mPendingPosition > -1)
+ setPosition(mPendingPosition);
+ play();
+ break;
+ case QMediaPlayer::PausedState:
+ pause();
+ break;
+ case QMediaPlayer::StoppedState:
+ stop();
+ break;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h
new file mode 100644
index 000000000..445e8de7a
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaplayercontrol.h
@@ -0,0 +1,127 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDMEDIAPLAYERCONTROL_H
+#define QANDROIDMEDIAPLAYERCONTROL_H
+
+#include <qglobal.h>
+#include <QMediaPlayerControl>
+
+QT_BEGIN_NAMESPACE
+
+class JMediaPlayer;
+class QAndroidVideoOutput;
+
+class QAndroidMediaPlayerControl : public QMediaPlayerControl
+{
+ Q_OBJECT
+public:
+ explicit QAndroidMediaPlayerControl(QObject *parent = 0);
+ ~QAndroidMediaPlayerControl() Q_DECL_OVERRIDE;
+
+ QMediaPlayer::State state() const Q_DECL_OVERRIDE;
+ QMediaPlayer::MediaStatus mediaStatus() const Q_DECL_OVERRIDE;
+ qint64 duration() const Q_DECL_OVERRIDE;
+ qint64 position() const Q_DECL_OVERRIDE;
+ int volume() const Q_DECL_OVERRIDE;
+ bool isMuted() const Q_DECL_OVERRIDE;
+ int bufferStatus() const Q_DECL_OVERRIDE;
+ bool isAudioAvailable() const Q_DECL_OVERRIDE;
+ bool isVideoAvailable() const Q_DECL_OVERRIDE;
+ bool isSeekable() const Q_DECL_OVERRIDE;
+ QMediaTimeRange availablePlaybackRanges() const Q_DECL_OVERRIDE;
+ qreal playbackRate() const Q_DECL_OVERRIDE;
+ void setPlaybackRate(qreal rate) Q_DECL_OVERRIDE;
+ QMediaContent media() const Q_DECL_OVERRIDE;
+ const QIODevice *mediaStream() const Q_DECL_OVERRIDE;
+ void setMedia(const QMediaContent &mediaContent, QIODevice *stream) Q_DECL_OVERRIDE;
+
+ void setVideoOutput(QAndroidVideoOutput *videoOutput);
+
+Q_SIGNALS:
+ void metaDataUpdated();
+
+public Q_SLOTS:
+ void setPosition(qint64 position) Q_DECL_OVERRIDE;
+ void play() Q_DECL_OVERRIDE;
+ void pause() Q_DECL_OVERRIDE;
+ void stop() Q_DECL_OVERRIDE;
+ void setVolume(int volume) Q_DECL_OVERRIDE;
+ void setMuted(bool muted) Q_DECL_OVERRIDE;
+
+private Q_SLOTS:
+ void onError(qint32 what, qint32 extra);
+ void onInfo(qint32 what, qint32 extra);
+ void onMediaPlayerInfo(qint32 what, qint32 extra);
+ void onBufferChanged(qint32 percent);
+ void onVideoSizeChanged(qint32 width, qint32 height);
+
+private:
+ JMediaPlayer *mMediaPlayer;
+ QMediaPlayer::State mCurrentState;
+ QMediaPlayer::MediaStatus mCurrentMediaStatus;
+ QMediaContent mMediaContent;
+ QIODevice *mMediaStream;
+ QAndroidVideoOutput *mVideoOutput;
+ bool mSeekable;
+ int mBufferPercent;
+ bool mAudioAvailable;
+ bool mVideoAvailable;
+ bool mBuffering;
+ QMediaTimeRange mAvailablePlaybackRange;
+ bool mMediaPlayerReady;
+ QMediaPlayer::State mPendingState;
+ qint64 mPendingPosition;
+
+ void setState(QMediaPlayer::State state);
+ void setMediaStatus(QMediaPlayer::MediaStatus status);
+ void setError(int error, const QString &errorString);
+ void setSeekable(bool seekable);
+ void setAudioAvailable(bool available);
+ void setVideoAvailable(bool available);
+ void updateAvailablePlaybackRanges();
+ void resetBufferingProgress();
+ void flushPendingStates();
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDMEDIAPLAYERCONTROL_H
diff --git a/src/plugins/android/mediaplayer/qandroidmediaservice.cpp b/src/plugins/android/mediaplayer/qandroidmediaservice.cpp
new file mode 100644
index 000000000..175958676
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaservice.cpp
@@ -0,0 +1,97 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidmediaservice.h"
+
+#include "qandroidmediaplayercontrol.h"
+#include "qandroidmetadatareadercontrol.h"
+#include "qandroidvideorendercontrol.h"
+
+QT_BEGIN_NAMESPACE
+
+QAndroidMediaService::QAndroidMediaService(QObject *parent)
+ : QMediaService(parent)
+ , mVideoRendererControl(0)
+{
+ mMediaControl = new QAndroidMediaPlayerControl;
+ mMetadataControl = new QAndroidMetaDataReaderControl;
+ connect(mMediaControl, SIGNAL(mediaChanged(QMediaContent)),
+ mMetadataControl, SLOT(onMediaChanged(QMediaContent)));
+ connect(mMediaControl, SIGNAL(metaDataUpdated()),
+ mMetadataControl, SLOT(onUpdateMetaData()));
+}
+
+QAndroidMediaService::~QAndroidMediaService()
+{
+ delete mMediaControl;
+ delete mMetadataControl;
+ delete mVideoRendererControl;
+}
+
+QMediaControl *QAndroidMediaService::requestControl(const char *name)
+{
+ if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
+ return mMediaControl;
+
+ if (qstrcmp(name, QMetaDataReaderControl_iid) == 0)
+ return mMetadataControl;
+
+ if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
+ if (!mVideoRendererControl) {
+ mVideoRendererControl = new QAndroidVideoRendererControl;
+ mMediaControl->setVideoOutput(mVideoRendererControl);
+ return mVideoRendererControl;
+ }
+ }
+
+ return 0;
+}
+
+void QAndroidMediaService::releaseControl(QMediaControl *control)
+{
+ if (control == mVideoRendererControl) {
+ mMediaControl->setVideoOutput(0);
+ delete mVideoRendererControl;
+ mVideoRendererControl = 0;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/mediaplayer/qandroidmediaservice.h b/src/plugins/android/mediaplayer/qandroidmediaservice.h
new file mode 100644
index 000000000..4d310e8e0
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaservice.h
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDMEDIASERVICE_H
+#define QANDROIDMEDIASERVICE_H
+
+#include <QMediaService>
+
+QT_BEGIN_NAMESPACE
+
+class QAndroidMediaPlayerControl;
+class QAndroidMetaDataReaderControl;
+class QAndroidVideoRendererControl;
+
+class QAndroidMediaService : public QMediaService
+{
+ Q_OBJECT
+public:
+ explicit QAndroidMediaService(QObject *parent = 0);
+ ~QAndroidMediaService() Q_DECL_OVERRIDE;
+
+ QMediaControl* requestControl(const char *name) Q_DECL_OVERRIDE;
+ void releaseControl(QMediaControl *control) Q_DECL_OVERRIDE;
+
+private:
+ QAndroidMediaPlayerControl *mMediaControl;
+ QAndroidMetaDataReaderControl *mMetadataControl;
+ QAndroidVideoRendererControl *mVideoRendererControl;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDMEDIASERVICE_H
diff --git a/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp
new file mode 100644
index 000000000..3bf703413
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.cpp
@@ -0,0 +1,107 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidmediaserviceplugin.h"
+
+#include "qandroidmediaservice.h"
+#include "jmediaplayer.h"
+#include "jsurfacetexture.h"
+#include "jsurfacetextureholder.h"
+#include <qdebug.h>
+
+QT_BEGIN_NAMESPACE
+
+QAndroidMediaServicePlugin::QAndroidMediaServicePlugin()
+{
+}
+
+QAndroidMediaServicePlugin::~QAndroidMediaServicePlugin()
+{
+}
+
+QMediaService *QAndroidMediaServicePlugin::create(const QString &key)
+{
+ if (key == QStringLiteral(Q_MEDIASERVICE_MEDIAPLAYER))
+ return new QAndroidMediaService;
+
+ qWarning() << "Android service plugin: unsupported key:" << key;
+ return 0;
+}
+
+void QAndroidMediaServicePlugin::release(QMediaService *service)
+{
+ delete service;
+}
+
+QMediaServiceProviderHint::Features QAndroidMediaServicePlugin::supportedFeatures(const QByteArray &service) const
+{
+ if (service == Q_MEDIASERVICE_MEDIAPLAYER)
+ return QMediaServiceProviderHint::VideoSurface;
+
+ return QMediaServiceProviderHint::Features();
+}
+
+
+Q_DECL_EXPORT jint JNICALL JNI_OnLoad(JavaVM *vm, void * /*reserved*/)
+{
+ typedef union {
+ JNIEnv *nativeEnvironment;
+ void *venv;
+ } UnionJNIEnvToVoid;
+
+ UnionJNIEnvToVoid uenv;
+ uenv.venv = NULL;
+
+ if (vm->GetEnv(&uenv.venv, JNI_VERSION_1_4) != JNI_OK)
+ return JNI_ERR;
+
+ JNIEnv *jniEnv = uenv.nativeEnvironment;
+
+ if (!JMediaPlayer::initJNI(jniEnv) ||
+ !JSurfaceTexture::initJNI(jniEnv) ||
+ !JSurfaceTextureHolder::initJNI(jniEnv)) {
+ return JNI_ERR;
+ }
+
+ return JNI_VERSION_1_4;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h
new file mode 100644
index 000000000..d004635f2
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmediaserviceplugin.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDMEDIASERVICEPLUGIN_H
+#define QANDROIDMEDIASERVICEPLUGIN_H
+
+#include <QMediaServiceProviderPlugin>
+
+QT_BEGIN_NAMESPACE
+
+class QMediaService;
+class QAndroidMediaService;
+
+class QAndroidMediaServicePlugin
+ : public QMediaServiceProviderPlugin
+ , public QMediaServiceFeaturesInterface
+{
+ Q_OBJECT
+ Q_INTERFACES(QMediaServiceFeaturesInterface)
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0"
+ FILE "mediaplayer.json")
+
+public:
+ QAndroidMediaServicePlugin();
+ ~QAndroidMediaServicePlugin();
+
+ QMediaService* create(QString const& key) Q_DECL_OVERRIDE;
+ void release(QMediaService *service) Q_DECL_OVERRIDE;
+ QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDMEDIASERVICEPLUGIN_H
diff --git a/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp
new file mode 100644
index 000000000..9b2f4e17b
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.cpp
@@ -0,0 +1,221 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidmetadatareadercontrol.h"
+
+#include "jmediametadataretriever.h"
+#include <qsize.h>
+#include <QDate>
+
+QT_BEGIN_NAMESPACE
+
+// Genre name ordered by ID
+// see: http://id3.org/id3v2.3.0#Appendix_A_-_Genre_List_from_ID3v1
+static const char* qt_ID3GenreNames[] =
+{
+ "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz",
+ "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno",
+ "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno",
+ "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental",
+ "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass", "Soul", "Punk",
+ "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave",
+ "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy",
+ "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American",
+ "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal",
+ "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", "Folk",
+ "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic",
+ "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock",
+ "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour",
+ "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus",
+ "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad",
+ "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella",
+ "Euro-House", "Dance Hall"
+};
+
+QAndroidMetaDataReaderControl::QAndroidMetaDataReaderControl(QObject *parent)
+ : QMetaDataReaderControl(parent)
+ , m_available(false)
+ , m_retriever(0)
+{
+ m_retriever = new JMediaMetadataRetriever;
+ if (!m_retriever->isValid()) {
+ delete m_retriever;
+ m_retriever = 0;
+ }
+}
+
+QAndroidMetaDataReaderControl::~QAndroidMetaDataReaderControl()
+{
+ if (m_retriever) {
+ m_retriever->release();
+ delete m_retriever;
+ }
+}
+
+bool QAndroidMetaDataReaderControl::isMetaDataAvailable() const
+{
+ return m_available;
+}
+
+QVariant QAndroidMetaDataReaderControl::metaData(const QString &key) const
+{
+ return m_metadata.value(key);
+}
+
+QStringList QAndroidMetaDataReaderControl::availableMetaData() const
+{
+ return m_metadata.keys();
+}
+
+void QAndroidMetaDataReaderControl::onMediaChanged(const QMediaContent &media)
+{
+ if (!m_retriever)
+ return;
+
+ m_mediaContent = media;
+ updateData();
+}
+
+void QAndroidMetaDataReaderControl::onUpdateMetaData()
+{
+ if (!m_retriever || m_mediaContent.isNull())
+ return;
+
+ updateData();
+}
+
+void QAndroidMetaDataReaderControl::updateData()
+{
+ m_metadata.clear();
+
+ if (!m_mediaContent.isNull()) {
+ if (m_retriever->setDataSource(m_mediaContent.canonicalUrl())) {
+ QString mimeType = m_retriever->extractMetadata(JMediaMetadataRetriever::MimeType);
+ if (!mimeType.isNull())
+ m_metadata.insert(QMediaMetaData::MediaType, mimeType);
+
+ bool isVideo = !m_retriever->extractMetadata(JMediaMetadataRetriever::HasVideo).isNull()
+ || mimeType.startsWith(QStringLiteral("video"));
+
+ QString string = m_retriever->extractMetadata(JMediaMetadataRetriever::Album);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::AlbumTitle, string);
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::AlbumArtist);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::AlbumArtist, string);
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Artist);
+ if (!string.isNull()) {
+ m_metadata.insert(isVideo ? QMediaMetaData::LeadPerformer
+ : QMediaMetaData::ContributingArtist,
+ string.split('/', QString::SkipEmptyParts));
+ }
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Author);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Author, string.split('/', QString::SkipEmptyParts));
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Bitrate);
+ if (!string.isNull()) {
+ m_metadata.insert(isVideo ? QMediaMetaData::VideoBitRate
+ : QMediaMetaData::AudioBitRate,
+ string.toInt());
+ }
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::CDTrackNumber);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::TrackNumber, string.toInt());
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Composer);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Composer, string.split('/', QString::SkipEmptyParts));
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Date);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Date, QDateTime::fromString(string, QStringLiteral("yyyyMMddTHHmmss.zzzZ")).date());
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Duration);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Duration, string.toLongLong());
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Genre);
+ if (!string.isNull()) {
+ // The genre can be returned as an ID3v2 id, get the name for it in that case
+ if (string.startsWith('(') && string.endsWith(')')) {
+ bool ok = false;
+ int genreId = string.mid(1, string.length() - 2).toInt(&ok);
+ if (ok && genreId >= 0 && genreId <= 125)
+ string = QLatin1String(qt_ID3GenreNames[genreId]);
+ }
+ m_metadata.insert(QMediaMetaData::Genre, string);
+ }
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Title);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Title, string);
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::VideoHeight);
+ if (!string.isNull()) {
+ int height = string.toInt();
+ int width = m_retriever->extractMetadata(JMediaMetadataRetriever::VideoWidth).toInt();
+ m_metadata.insert(QMediaMetaData::Resolution, QSize(width, height));
+ }
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Writer);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Writer, string.split('/', QString::SkipEmptyParts));
+
+ string = m_retriever->extractMetadata(JMediaMetadataRetriever::Year);
+ if (!string.isNull())
+ m_metadata.insert(QMediaMetaData::Year, string.toInt());
+ }
+ }
+
+ bool oldAvailable = m_available;
+ m_available = !m_metadata.isEmpty();
+ if (m_available != oldAvailable)
+ Q_EMIT metaDataAvailableChanged(m_available);
+
+ Q_EMIT metaDataChanged();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h
new file mode 100644
index 000000000..7ea736ffd
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidmetadatareadercontrol.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDMETADATAREADERCONTROL_H
+#define QANDROIDMETADATAREADERCONTROL_H
+
+#include <QMetaDataReaderControl>
+#include <qmediacontent.h>
+
+QT_BEGIN_NAMESPACE
+
+class JMediaMetadataRetriever;
+
+class QAndroidMetaDataReaderControl : public QMetaDataReaderControl
+{
+ Q_OBJECT
+public:
+ explicit QAndroidMetaDataReaderControl(QObject *parent = 0);
+ ~QAndroidMetaDataReaderControl() Q_DECL_OVERRIDE;
+
+ bool isMetaDataAvailable() const Q_DECL_OVERRIDE;
+
+ QVariant metaData(const QString &key) const Q_DECL_OVERRIDE;
+ QStringList availableMetaData() const Q_DECL_OVERRIDE;
+
+public Q_SLOTS:
+ void onMediaChanged(const QMediaContent &media);
+ void onUpdateMetaData();
+
+private:
+ void updateData();
+
+ QMediaContent m_mediaContent;
+ bool m_available;
+ QVariantMap m_metadata;
+
+ JMediaMetadataRetriever *m_retriever;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDMETADATAREADERCONTROL_H
diff --git a/src/plugins/android/mediaplayer/qandroidvideooutput.h b/src/plugins/android/mediaplayer/qandroidvideooutput.h
new file mode 100644
index 000000000..99db7c3e7
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidvideooutput.h
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDVIDEOOUTPUT_H
+#define QANDROIDVIDEOOUTPUT_H
+
+#include <qglobal.h>
+#include <qsize.h>
+#include <jni.h>
+
+QT_BEGIN_NAMESPACE
+
+class QAndroidVideoOutput
+{
+public:
+ QAndroidVideoOutput() { }
+ virtual ~QAndroidVideoOutput() { }
+
+ virtual jobject surfaceHolder() = 0;
+ virtual void setVideoSize(const QSize &size) = 0;
+ virtual void stop() = 0;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDVIDEOOUTPUT_H
diff --git a/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp
new file mode 100644
index 000000000..7b810fa41
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.cpp
@@ -0,0 +1,375 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qandroidvideorendercontrol.h"
+
+#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include "jsurfacetextureholder.h"
+#include <QAbstractVideoSurface>
+#include <QOpenGLContext>
+#include <QOffscreenSurface>
+#include <QOpenGLFramebufferObject>
+#include <QVideoSurfaceFormat>
+#include <QOpenGLFunctions>
+#include <QOpenGLShaderProgram>
+
+QT_BEGIN_NAMESPACE
+
+static const GLfloat g_vertex_data[] = {
+ -1.f, 1.f,
+ 1.f, 1.f,
+ 1.f, -1.f,
+ -1.f, -1.f
+};
+
+static const GLfloat g_texture_data[] = {
+ 0.f, 0.f,
+ 1.f, 0.f,
+ 1.f, 1.f,
+ 0.f, 1.f
+};
+
+class TextureVideoBuffer : public QAbstractVideoBuffer
+{
+public:
+ TextureVideoBuffer(GLuint textureId)
+ : QAbstractVideoBuffer(GLTextureHandle)
+ , m_textureId(textureId)
+ {}
+
+ virtual ~TextureVideoBuffer() {}
+
+ MapMode mapMode() const { return NotMapped; }
+ uchar *map(MapMode, int*, int*) { return 0; }
+ void unmap() {}
+
+ QVariant handle() const
+ {
+ return QVariant::fromValue<unsigned int>(m_textureId);
+ }
+
+private:
+ GLuint m_textureId;
+};
+
+class ImageVideoBuffer : public QAbstractVideoBuffer
+{
+public:
+ ImageVideoBuffer(const QImage &image)
+ : QAbstractVideoBuffer(NoHandle)
+ , m_image(image)
+ , m_mode(NotMapped)
+ {
+
+ }
+
+ MapMode mapMode() const { return m_mode; }
+ uchar *map(MapMode mode, int *, int *)
+ {
+ if (mode != NotMapped && m_mode == NotMapped) {
+ m_mode = mode;
+ return m_image.bits();
+ }
+
+ return 0;
+ }
+
+ void unmap()
+ {
+ m_mode = NotMapped;
+ }
+
+private:
+ QImage m_image;
+ MapMode m_mode;
+};
+
+QAndroidVideoRendererControl::QAndroidVideoRendererControl(QObject *parent)
+ : QVideoRendererControl(parent)
+ , m_surface(0)
+ , m_offscreenSurface(0)
+ , m_glContext(0)
+ , m_fbo(0)
+ , m_program(0)
+ , m_useImage(false)
+ , m_androidSurface(0)
+ , m_surfaceTexture(0)
+ , m_surfaceHolder(0)
+ , m_externalTex(0)
+{
+}
+
+QAndroidVideoRendererControl::~QAndroidVideoRendererControl()
+{
+ if (m_glContext)
+ m_glContext->makeCurrent(m_offscreenSurface);
+
+ if (m_surfaceTexture) {
+ QJNILocalRef<jobject> surfaceTex = m_surfaceTexture->surfaceTexture();
+ QJNIObject obj(surfaceTex.object());
+ obj.callMethod<void>("release");
+ delete m_surfaceTexture;
+ m_surfaceTexture = 0;
+ }
+ if (m_androidSurface) {
+ m_androidSurface->callMethod<void>("release");
+ delete m_androidSurface;
+ m_androidSurface = 0;
+ }
+ if (m_surfaceHolder) {
+ delete m_surfaceHolder;
+ m_surfaceHolder = 0;
+ }
+ if (m_externalTex)
+ glDeleteTextures(1, &m_externalTex);
+
+ delete m_fbo;
+ delete m_program;
+ delete m_glContext;
+ delete m_offscreenSurface;
+}
+
+QAbstractVideoSurface *QAndroidVideoRendererControl::surface() const
+{
+ return m_surface;
+}
+
+void QAndroidVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
+{
+ if (surface == m_surface)
+ return;
+
+ if (m_surface && m_surface->isActive())
+ m_surface->stop();
+
+ m_surface = surface;
+
+ m_useImage = !m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).contains(QVideoFrame::Format_BGR32);
+}
+
+jobject QAndroidVideoRendererControl::surfaceHolder()
+{
+ if (m_surfaceHolder)
+ return m_surfaceHolder->object();
+
+ QOpenGLContext *currContext = QOpenGLContext::currentContext();
+
+ // If we don't have a GL context in the current thread, create one and share it
+ // with the render thread GL context
+ if (!currContext && !m_glContext) {
+ m_offscreenSurface = new QOffscreenSurface;
+ QSurfaceFormat format;
+ format.setSwapBehavior(QSurfaceFormat::SingleBuffer);
+ m_offscreenSurface->setFormat(format);
+ m_offscreenSurface->create();
+
+ QOpenGLContext *shareContext = 0;
+ if (m_surface)
+ shareContext = qobject_cast<QOpenGLContext*>(m_surface->property("GLContext").value<QObject*>());
+ m_glContext = new QOpenGLContext;
+ m_glContext->setFormat(m_offscreenSurface->requestedFormat());
+
+ if (shareContext)
+ m_glContext->setShareContext(shareContext);
+
+ if (!m_glContext->create())
+ return 0;
+
+ // if sharing contexts is not supported, fallback to image rendering and send the bits
+ // to the video surface
+ if (!m_glContext->shareContext())
+ m_useImage = true;
+ }
+
+ if (m_glContext)
+ m_glContext->makeCurrent(m_offscreenSurface);
+
+ glGenTextures(1, &m_externalTex);
+ m_surfaceTexture = new JSurfaceTexture(m_externalTex);
+
+ if (m_surfaceTexture->isValid()) {
+ connect(m_surfaceTexture, SIGNAL(frameAvailable()), this, SLOT(onFrameAvailable()));
+
+ QJNILocalRef<jobject> surfaceTex = m_surfaceTexture->surfaceTexture();
+
+ m_androidSurface = new QJNIObject("android/view/Surface",
+ "(Landroid/graphics/SurfaceTexture;)V",
+ surfaceTex.object());
+
+ m_surfaceHolder = new JSurfaceTextureHolder(m_androidSurface->object());
+ } else {
+ delete m_surfaceTexture;
+ m_surfaceTexture = 0;
+ glDeleteTextures(1, &m_externalTex);
+ }
+
+ if (m_surfaceHolder)
+ return m_surfaceHolder->object();
+
+ return 0;
+}
+
+void QAndroidVideoRendererControl::setVideoSize(const QSize &size)
+{
+ if (m_nativeSize == size)
+ return;
+
+ m_nativeSize = size;
+
+ delete m_fbo;
+ m_fbo = 0;
+}
+
+void QAndroidVideoRendererControl::stop()
+{
+ if (m_surface && m_surface->isActive())
+ m_surface->stop();
+ m_nativeSize = QSize();
+}
+
+void QAndroidVideoRendererControl::onFrameAvailable()
+{
+ if (m_glContext)
+ m_glContext->makeCurrent(m_offscreenSurface);
+
+ m_surfaceTexture->updateTexImage();
+
+ if (!m_nativeSize.isValid())
+ return;
+
+ renderFrameToFbo();
+
+ QAbstractVideoBuffer *buffer = 0;
+ QVideoFrame frame;
+
+ if (m_useImage) {
+ buffer = new ImageVideoBuffer(m_fbo->toImage().mirrored());
+ frame = QVideoFrame(buffer, m_nativeSize, QVideoFrame::Format_RGB32);
+ } else {
+ buffer = new TextureVideoBuffer(m_fbo->texture());
+ frame = QVideoFrame(buffer, m_nativeSize, QVideoFrame::Format_BGR32);
+ }
+
+ if (m_surface && frame.isValid()) {
+ if (m_surface->isActive() && (m_surface->surfaceFormat().pixelFormat() != frame.pixelFormat()
+ || m_surface->nativeResolution() != frame.size())) {
+ m_surface->stop();
+ }
+
+ if (!m_surface->isActive()) {
+ QVideoSurfaceFormat format(frame.size(), frame.pixelFormat(),
+ m_useImage ? QAbstractVideoBuffer::NoHandle
+ : QAbstractVideoBuffer::GLTextureHandle);
+
+ m_surface->start(format);
+ }
+
+ if (m_surface->isActive())
+ m_surface->present(frame);
+ }
+}
+
+void QAndroidVideoRendererControl::renderFrameToFbo()
+{
+ createGLResources();
+
+ m_fbo->bind();
+
+ glViewport(0, 0, m_nativeSize.width(), m_nativeSize.height());
+
+ m_program->bind();
+ m_program->enableAttributeArray(0);
+ m_program->enableAttributeArray(1);
+ m_program->setUniformValue("frameTexture", GLuint(0));
+ m_program->setUniformValue("texMatrix", m_surfaceTexture->getTransformMatrix());
+
+ glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, g_vertex_data);
+ glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, g_texture_data);
+
+ glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+
+ m_program->disableAttributeArray(0);
+ m_program->disableAttributeArray(1);
+ m_program->release();
+
+ glBindTexture(GL_TEXTURE_EXTERNAL_OES, 0);
+ m_fbo->release();
+
+ glFinish();
+}
+
+void QAndroidVideoRendererControl::createGLResources()
+{
+ if (!m_fbo)
+ m_fbo = new QOpenGLFramebufferObject(m_nativeSize);
+
+ if (!m_program) {
+ m_program = new QOpenGLShaderProgram;
+
+ QOpenGLShader *vertexShader = new QOpenGLShader(QOpenGLShader::Vertex, m_program);
+ vertexShader->compileSourceCode("attribute highp vec4 vertexCoordsArray; \n" \
+ "attribute highp vec2 textureCoordArray; \n" \
+ "uniform highp mat4 texMatrix; \n" \
+ "varying highp vec2 textureCoords; \n" \
+ "void main(void) \n" \
+ "{ \n" \
+ " gl_Position = vertexCoordsArray; \n" \
+ " textureCoords = (texMatrix * vec4(textureCoordArray, 0.0, 1.0)).xy; \n" \
+ "}\n");
+ m_program->addShader(vertexShader);
+
+ QOpenGLShader *fragmentShader = new QOpenGLShader(QOpenGLShader::Fragment, m_program);
+ fragmentShader->compileSourceCode("#extension GL_OES_EGL_image_external : require \n" \
+ "varying highp vec2 textureCoords; \n" \
+ "uniform samplerExternalOES frameTexture; \n" \
+ "void main() \n" \
+ "{ \n" \
+ " gl_FragColor = texture2D(frameTexture, textureCoords); \n" \
+ "}\n");
+ m_program->addShader(fragmentShader);
+
+ m_program->bindAttributeLocation("vertexCoordsArray", 0);
+ m_program->bindAttributeLocation("textureCoordArray", 1);
+ m_program->link();
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h
new file mode 100644
index 000000000..525291e1f
--- /dev/null
+++ b/src/plugins/android/mediaplayer/qandroidvideorendercontrol.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDVIDEORENDERCONTROL_H
+#define QANDROIDVIDEORENDERCONTROL_H
+
+#include <qvideorenderercontrol.h>
+#include "qandroidvideooutput.h"
+#include "jsurfacetexture.h"
+
+QT_BEGIN_NAMESPACE
+
+class QOpenGLContext;
+class QOffscreenSurface;
+class QOpenGLFramebufferObject;
+class QOpenGLShaderProgram;
+class JSurfaceTextureHolder;
+
+class QAndroidVideoRendererControl : public QVideoRendererControl, public QAndroidVideoOutput
+{
+ Q_OBJECT
+public:
+ explicit QAndroidVideoRendererControl(QObject *parent = 0);
+ ~QAndroidVideoRendererControl() Q_DECL_OVERRIDE;
+
+ QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE;
+ void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE;
+
+ jobject surfaceHolder() Q_DECL_OVERRIDE;
+ void setVideoSize(const QSize &size) Q_DECL_OVERRIDE;
+ void stop() Q_DECL_OVERRIDE;
+
+private Q_SLOTS:
+ void onFrameAvailable();
+
+private:
+ void setupSurface();
+ void renderFrameToFbo();
+ void createGLResources();
+
+ QAbstractVideoSurface *m_surface;
+ QOffscreenSurface *m_offscreenSurface;
+ QOpenGLContext *m_glContext;
+ QOpenGLFramebufferObject *m_fbo;
+ QOpenGLShaderProgram *m_program;
+ bool m_useImage;
+ QSize m_nativeSize;
+
+ QJNIObject *m_androidSurface;
+ JSurfaceTexture *m_surfaceTexture;
+ JSurfaceTextureHolder *m_surfaceHolder;
+ uint m_externalTex;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDVIDEORENDERCONTROL_H
diff --git a/src/plugins/android/wrappers/jmediametadataretriever.cpp b/src/plugins/android/wrappers/jmediametadataretriever.cpp
new file mode 100644
index 000000000..ae5abcf43
--- /dev/null
+++ b/src/plugins/android/wrappers/jmediametadataretriever.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jmediametadataretriever.h"
+
+#include <QtPlatformSupport/private/qjnihelpers_p.h>
+#include <qpa/qplatformnativeinterface.h>
+#include <qguiapplication.h>
+
+QT_BEGIN_NAMESPACE
+
+static jobject g_activity = 0;
+
+JMediaMetadataRetriever::JMediaMetadataRetriever()
+ : QJNIObject("android/media/MediaMetadataRetriever")
+{
+ if (!g_activity) {
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ g_activity = static_cast<jobject>(nativeInterface->nativeResourceForIntegration("QtActivity"));
+ }
+}
+
+JMediaMetadataRetriever::~JMediaMetadataRetriever()
+{
+}
+
+QString JMediaMetadataRetriever::extractMetadata(MetadataKey key)
+{
+ QString value;
+
+ QJNILocalRef<jstring> metadata = callObjectMethod<jstring>("extractMetadata",
+ "(I)Ljava/lang/String;",
+ jint(key));
+ if (!metadata.isNull())
+ value = qt_convertJString(metadata.object());
+
+ return value;
+}
+
+void JMediaMetadataRetriever::release()
+{
+ callMethod<void>("release");
+}
+
+bool JMediaMetadataRetriever::setDataSource(const QUrl &url)
+{
+ QAttachedJNIEnv env;
+
+ bool loaded = false;
+
+ QJNILocalRef<jstring> string = qt_toJString(url.toString());
+
+ QJNILocalRef<jobject> uri = callStaticObjectMethod<jobject>("android/net/Uri",
+ "parse",
+ "(Ljava/lang/String;)Landroid/net/Uri;",
+ string.object());
+ if (env->ExceptionCheck()) {
+ env->ExceptionClear();
+ } else {
+ callMethod<void>("setDataSource",
+ "(Landroid/content/Context;Landroid/net/Uri;)V",
+ g_activity,
+ uri.object());
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
+ else
+ loaded = true;
+ }
+
+ return loaded;
+}
+
+bool JMediaMetadataRetriever::setDataSource(const QString &path)
+{
+ QAttachedJNIEnv env;
+
+ bool loaded = false;
+
+ callMethod<void>("setDataSource", "(Ljava/lang/String;)V", qt_toJString(path).object());
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
+ else
+ loaded = true;
+
+ return loaded;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/wrappers/jmediametadataretriever.h b/src/plugins/android/wrappers/jmediametadataretriever.h
new file mode 100644
index 000000000..dd63e0d87
--- /dev/null
+++ b/src/plugins/android/wrappers/jmediametadataretriever.h
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JMEDIAMETADATARETRIEVER_H
+#define JMEDIAMETADATARETRIEVER_H
+
+#include <QtPlatformSupport/private/qjniobject_p.h>
+#include <qurl.h>
+
+QT_BEGIN_NAMESPACE
+
+class JMediaMetadataRetriever : public QJNIObject
+{
+public:
+ enum MetadataKey {
+ Album = 1,
+ AlbumArtist = 13,
+ Artist = 2,
+ Author = 3,
+ Bitrate = 20,
+ CDTrackNumber = 0,
+ Compilation = 15,
+ Composer = 4,
+ Date = 5,
+ DiscNumber = 14,
+ Duration = 9,
+ Genre = 6,
+ HasAudio = 16,
+ HasVideo = 17,
+ Location = 23,
+ MimeType = 12,
+ NumTracks = 10,
+ Title = 7,
+ VideoHeight = 19,
+ VideoWidth = 18,
+ VideoRotation = 24,
+ Writer = 11,
+ Year = 8
+ };
+
+ JMediaMetadataRetriever();
+ ~JMediaMetadataRetriever();
+
+ QString extractMetadata(MetadataKey key);
+ void release();
+ bool setDataSource(const QUrl &url);
+ bool setDataSource(const QString &path);
+
+};
+
+QT_END_NAMESPACE
+
+#endif // JMEDIAMETADATARETRIEVER_H
diff --git a/src/plugins/android/wrappers/jmediaplayer.cpp b/src/plugins/android/wrappers/jmediaplayer.cpp
new file mode 100644
index 000000000..48e743b26
--- /dev/null
+++ b/src/plugins/android/wrappers/jmediaplayer.cpp
@@ -0,0 +1,265 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jmediaplayer.h"
+
+#include <QString>
+#include <qpa/qplatformnativeinterface.h>
+#include <qguiapplication.h>
+#include <QtPlatformSupport/private/qjnihelpers_p.h>
+
+namespace {
+
+jclass mediaPlayerClass = 0;
+
+QMap<jlong, JMediaPlayer *> mplayers;
+
+}
+
+QT_BEGIN_NAMESPACE
+
+bool JMediaPlayer::mActivitySet = false;
+
+JMediaPlayer::JMediaPlayer()
+ : QObject()
+ , QJNIObject(mediaPlayerClass, "(J)V", reinterpret_cast<jlong>(this))
+ , mId(reinterpret_cast<jlong>(this))
+ , mDisplay(0)
+{
+ mplayers.insert(mId, this);
+
+ if (!mActivitySet) {
+ QPlatformNativeInterface *nativeInterface = QGuiApplication::platformNativeInterface();
+ jobject activity = static_cast<jobject>(nativeInterface->nativeResourceForIntegration("QtActivity"));
+ QJNIObject::callStaticMethod<void>(mediaPlayerClass,
+ "setActivity",
+ "(Landroid/app/Activity;)V",
+ activity);
+ mActivitySet = true;
+ }
+}
+
+JMediaPlayer::~JMediaPlayer()
+{
+ mplayers.remove(mId);
+}
+
+void JMediaPlayer::onError(qint32 what, qint32 extra)
+{
+ Q_EMIT error(what, extra);
+}
+
+void JMediaPlayer::onBufferingUpdate(qint32 percent)
+{
+ Q_EMIT bufferingUpdate(percent);
+}
+
+void JMediaPlayer::onInfo(qint32 what, qint32 extra)
+{
+ Q_EMIT info(what, extra);
+}
+
+void JMediaPlayer::onMediaPlayerInfo(qint32 what, qint32 extra)
+{
+ Q_EMIT mediaPlayerInfo(what, extra);
+}
+
+void JMediaPlayer::onVideoSizeChanged(qint32 width, qint32 height)
+{
+ Q_EMIT videoSizeChanged(width, height);
+}
+
+int JMediaPlayer::getCurrentPosition()
+{
+ return callMethod<jint>("getCurrentPosition");
+}
+
+int JMediaPlayer::getDuration()
+{
+ return callMethod<jint>("getDuration");
+}
+
+bool JMediaPlayer::isPlaying()
+{
+ return callMethod<jboolean>("isPlaying");
+}
+
+int JMediaPlayer::volume()
+{
+ return callMethod<jint>("getVolume");
+}
+
+bool JMediaPlayer::isMuted()
+{
+ return callMethod<jboolean>("isMuted");
+}
+
+void JMediaPlayer::play()
+{
+ callMethod<void>("start");
+}
+
+void JMediaPlayer::pause()
+{
+ callMethod<void>("pause");
+}
+
+void JMediaPlayer::stop()
+{
+ callMethod<void>("stop");
+}
+
+void JMediaPlayer::seekTo(qint32 msec)
+{
+ callMethod<void>("seekTo", "(I)V", jint(msec));
+}
+
+void JMediaPlayer::setMuted(bool mute)
+{
+ callMethod<void>("mute", "(Z)V", jboolean(mute));
+}
+
+void JMediaPlayer::setDataSource(const QString &path)
+{
+ QJNILocalRef<jstring> string = qt_toJString(path);
+ callMethod<void>("setMediaPath", "(Ljava/lang/String;)V", string.object());
+}
+
+void JMediaPlayer::setVolume(int volume)
+{
+ callMethod<void>("setVolume", "(I)V", jint(volume));
+}
+
+void JMediaPlayer::setDisplay(jobject surfaceHolder)
+{
+ mDisplay = surfaceHolder;
+ callMethod<void>("setDisplay", "(Landroid/view/SurfaceHolder;)V", mDisplay);
+}
+
+QT_END_NAMESPACE
+
+static void onErrorNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id)
+{
+ Q_UNUSED(env);
+ Q_UNUSED(thiz);
+ JMediaPlayer *const mp = mplayers[id];
+ if (!mp)
+ return;
+
+ mp->onError(what, extra);
+}
+
+static void onBufferingUpdateNative(JNIEnv *env, jobject thiz, jint percent, jlong id)
+{
+ Q_UNUSED(env);
+ Q_UNUSED(thiz);
+ JMediaPlayer *const mp = mplayers[id];
+ if (!mp)
+ return;
+
+ mp->onBufferingUpdate(percent);
+}
+
+static void onInfoNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id)
+{
+ Q_UNUSED(env);
+ Q_UNUSED(thiz);
+ JMediaPlayer *const mp = mplayers[id];
+ if (!mp)
+ return;
+
+ mp->onInfo(what, extra);
+}
+
+static void onMediaPlayerInfoNative(JNIEnv *env, jobject thiz, jint what, jint extra, jlong id)
+{
+ Q_UNUSED(env);
+ Q_UNUSED(thiz);
+ JMediaPlayer *const mp = mplayers[id];
+ if (!mp)
+ return;
+
+ mp->onMediaPlayerInfo(what, extra);
+}
+
+static void onVideoSizeChangedNative(JNIEnv *env,
+ jobject thiz,
+ jint width,
+ jint height,
+ jlong id)
+{
+ Q_UNUSED(env);
+ Q_UNUSED(thiz);
+ JMediaPlayer *const mp = mplayers[id];
+ if (!mp)
+ return;
+
+ mp->onVideoSizeChanged(width, height);
+}
+
+QT_BEGIN_NAMESPACE
+
+bool JMediaPlayer::initJNI(JNIEnv *env)
+{
+ jclass jClass = env->FindClass("org/qtproject/qt5/android/multimedia/QtAndroidMediaPlayer");
+
+ if (jClass) {
+ mediaPlayerClass = static_cast<jclass>(env->NewGlobalRef(jClass));
+
+ JNINativeMethod methods[] = {
+ {"onErrorNative", "(IIJ)V", reinterpret_cast<void *>(onErrorNative)},
+ {"onBufferingUpdateNative", "(IJ)V", reinterpret_cast<void *>(onBufferingUpdateNative)},
+ {"onInfoNative", "(IIJ)V", reinterpret_cast<void *>(onInfoNative)},
+ {"onMediaPlayerInfoNative", "(IIJ)V", reinterpret_cast<void *>(onMediaPlayerInfoNative)},
+ {"onVideoSizeChangedNative", "(IIJ)V", reinterpret_cast<void *>(onVideoSizeChangedNative)}
+ };
+
+ if (env->RegisterNatives(mediaPlayerClass,
+ methods,
+ sizeof(methods) / sizeof(methods[0])) < 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/wrappers/jmediaplayer.h b/src/plugins/android/wrappers/jmediaplayer.h
new file mode 100644
index 000000000..f5cb11773
--- /dev/null
+++ b/src/plugins/android/wrappers/jmediaplayer.h
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QANDROIDMEDIAPLAYER_H
+#define QANDROIDMEDIAPLAYER_H
+
+#include <QObject>
+#include <QtPlatformSupport/private/qjniobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class JMediaPlayer : public QObject, public QJNIObject
+{
+ Q_OBJECT
+public:
+ JMediaPlayer();
+ ~JMediaPlayer();
+
+ enum MediaError
+ {
+ // What
+ MEDIA_ERROR_UNKNOWN = 1,
+ MEDIA_ERROR_SERVER_DIED = 100,
+ // Extra
+ MEDIA_ERROR_IO = -1004,
+ MEDIA_ERROR_MALFORMED = -1007,
+ MEDIA_ERROR_UNSUPPORTED = -1010,
+ MEDIA_ERROR_TIMED_OUT = -110,
+ MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200
+ };
+
+ enum MediaInfo
+ {
+ MEDIA_INFO_UNKNOWN = 1,
+ MEDIA_INFO_VIDEO_TRACK_LAGGING = 700,
+ MEDIA_INFO_VIDEO_RENDERING_START = 3,
+ MEDIA_INFO_BUFFERING_START = 701,
+ MEDIA_INFO_BUFFERING_END = 702,
+ MEDIA_INFO_BAD_INTERLEAVING = 800,
+ MEDIA_INFO_NOT_SEEKABLE = 801,
+ MEDIA_INFO_METADATA_UPDATE = 802
+ };
+
+ enum MediaPlayerInfo
+ {
+ MEDIA_PLAYER_INVALID_STATE = 1,
+ MEDIA_PLAYER_PREPARING = 2,
+ MEDIA_PLAYER_READY = 3,
+ MEDIA_PLAYER_DURATION = 4,
+ MEDIA_PLAYER_PROGRESS = 5,
+ MEDIA_PLAYER_FINISHED = 6
+ };
+
+ int getCurrentPosition();
+ int getDuration();
+ bool isPlaying();
+ int volume();
+ bool isMuted();
+ jobject display() { return mDisplay; }
+
+ void play();
+ void pause();
+ void stop();
+ void seekTo(qint32 msec);
+ void setMuted(bool mute);
+ void setDataSource(const QString &path);
+ void setVolume(int volume);
+ void setDisplay(jobject surfaceHolder);
+
+ void onError(qint32 what, qint32 extra);
+ void onBufferingUpdate(qint32 percent);
+ void onInfo(qint32 what, qint32 extra);
+ void onMediaPlayerInfo(qint32 what, qint32 extra);
+ void onVideoSizeChanged(qint32 width, qint32 height);
+
+ static bool initJNI(JNIEnv *env);
+
+Q_SIGNALS:
+ void error(qint32 what, qint32 extra);
+ void bufferingUpdate(qint32 percent);
+ void completion();
+ void info(qint32 what, qint32 extra);
+ void mediaPlayerInfo(qint32 what, qint32 extra);
+ void videoSizeChanged(qint32 width, qint32 height);
+
+private:
+ jlong mId;
+ jobject mDisplay;
+
+ static bool mActivitySet;
+};
+
+QT_END_NAMESPACE
+
+#endif // QANDROIDMEDIAPLAYER_H
diff --git a/src/plugins/android/wrappers/jsurfacetexture.cpp b/src/plugins/android/wrappers/jsurfacetexture.cpp
new file mode 100644
index 000000000..107f7be39
--- /dev/null
+++ b/src/plugins/android/wrappers/jsurfacetexture.cpp
@@ -0,0 +1,118 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jsurfacetexture.h"
+#include <QtPlatformSupport/private/qjnihelpers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+static jclass g_qtSurfaceTextureClass = 0;
+static QHash<int, JSurfaceTexture*> g_objectMap;
+
+// native method for QtSurfaceTexture.java
+static void notifyFrameAvailable(JNIEnv* , jobject, int id)
+{
+ JSurfaceTexture *obj = g_objectMap.value(id, 0);
+ if (obj)
+ Q_EMIT obj->frameAvailable();
+}
+
+JSurfaceTexture::JSurfaceTexture(unsigned int texName)
+ : QObject()
+ , QJNIObject(g_qtSurfaceTextureClass, "(I)V", jint(texName))
+ , m_texID(int(texName))
+{
+ if (m_jobject)
+ g_objectMap.insert(int(texName), this);
+}
+
+JSurfaceTexture::~JSurfaceTexture()
+{
+ if (m_jobject)
+ g_objectMap.remove(m_texID);
+}
+
+QMatrix4x4 JSurfaceTexture::getTransformMatrix()
+{
+ QAttachedJNIEnv env;
+
+ QMatrix4x4 matrix;
+ jfloatArray array = env->NewFloatArray(16);
+ callMethod<void>("getTransformMatrix", "([F)V", array);
+ env->GetFloatArrayRegion(array, 0, 16, matrix.data());
+ env->DeleteLocalRef(array);
+
+ return matrix;
+}
+
+void JSurfaceTexture::updateTexImage()
+{
+ callMethod<void>("updateTexImage");
+}
+
+QJNILocalRef<jobject> JSurfaceTexture::surfaceTexture()
+{
+ return getObjectField<jobject>("surfaceTexture", "Landroid/graphics/SurfaceTexture;");
+}
+
+static JNINativeMethod methods[] = {
+ {"notifyFrameAvailable", "(I)V", (void *)notifyFrameAvailable}
+};
+
+bool JSurfaceTexture::initJNI(JNIEnv *env)
+{
+ jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTexture");
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
+
+ if (clazz) {
+ g_qtSurfaceTextureClass = static_cast<jclass>(env->NewGlobalRef(clazz));
+ if (env->RegisterNatives(g_qtSurfaceTextureClass,
+ methods,
+ sizeof(methods) / sizeof(methods[0])) < 0) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/wrappers/jsurfacetexture.h b/src/plugins/android/wrappers/jsurfacetexture.h
new file mode 100644
index 000000000..49e007666
--- /dev/null
+++ b/src/plugins/android/wrappers/jsurfacetexture.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JSURFACETEXTURE_H
+#define JSURFACETEXTURE_H
+
+#include <qobject.h>
+#include <QtPlatformSupport/private/qjniobject_p.h>
+
+#include <QMatrix4x4>
+
+QT_BEGIN_NAMESPACE
+
+class JSurfaceTexture : public QObject, public QJNIObject
+{
+ Q_OBJECT
+public:
+ explicit JSurfaceTexture(unsigned int texName);
+ ~JSurfaceTexture();
+
+ QMatrix4x4 getTransformMatrix();
+ void updateTexImage();
+
+ QJNILocalRef<jobject> surfaceTexture();
+
+ static bool initJNI(JNIEnv *env);
+
+Q_SIGNALS:
+ void frameAvailable();
+
+private:
+ int m_texID;
+};
+
+QT_END_NAMESPACE
+
+#endif // JSURFACETEXTURE_H
diff --git a/src/plugins/android/wrappers/jsurfacetextureholder.cpp b/src/plugins/android/wrappers/jsurfacetextureholder.cpp
new file mode 100644
index 000000000..4ec8935c2
--- /dev/null
+++ b/src/plugins/android/wrappers/jsurfacetextureholder.cpp
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "jsurfacetextureholder.h"
+
+QT_BEGIN_NAMESPACE
+
+static jclass g_qtSurfaceTextureHolderClass = 0;
+
+JSurfaceTextureHolder::JSurfaceTextureHolder(jobject surface)
+ : QJNIObject(g_qtSurfaceTextureHolderClass, "(Landroid/view/Surface;)V", surface)
+{
+}
+
+bool JSurfaceTextureHolder::initJNI(JNIEnv *env)
+{
+ jclass clazz = env->FindClass("org/qtproject/qt5/android/multimedia/QtSurfaceTextureHolder");
+ if (env->ExceptionCheck())
+ env->ExceptionClear();
+
+ if (clazz)
+ g_qtSurfaceTextureHolderClass = static_cast<jclass>(env->NewGlobalRef(clazz));
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/android/wrappers/jsurfacetextureholder.h b/src/plugins/android/wrappers/jsurfacetextureholder.h
new file mode 100644
index 000000000..5b567de3a
--- /dev/null
+++ b/src/plugins/android/wrappers/jsurfacetextureholder.h
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef JSURFACETEXTUREHOLDER_H
+#define JSURFACETEXTUREHOLDER_H
+
+#include <QtPlatformSupport/private/qjniobject_p.h>
+
+QT_BEGIN_NAMESPACE
+
+class JSurfaceTextureHolder : public QJNIObject
+{
+public:
+ JSurfaceTextureHolder(jobject surface);
+
+ static bool initJNI(JNIEnv *env);
+};
+
+QT_END_NAMESPACE
+
+#endif // JSURFACETEXTUREHOLDER_H
diff --git a/src/plugins/android/wrappers/wrappers.pri b/src/plugins/android/wrappers/wrappers.pri
new file mode 100644
index 000000000..5b47ef531
--- /dev/null
+++ b/src/plugins/android/wrappers/wrappers.pri
@@ -0,0 +1,15 @@
+QT += platformsupport-private
+
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/jmediaplayer.h \
+ $$PWD/jsurfacetexture.h \
+ $$PWD/jsurfacetextureholder.h \
+ $$PWD/jmediametadataretriever.h
+
+SOURCES += \
+ $$PWD/jmediaplayer.cpp \
+ $$PWD/jsurfacetexture.cpp \
+ $$PWD/jsurfacetextureholder.cpp \
+ $$PWD/jmediametadataretriever.cpp
diff --git a/src/plugins/blackberry/bbserviceplugin.cpp b/src/plugins/blackberry/bbserviceplugin.cpp
new file mode 100644
index 000000000..90364f3f8
--- /dev/null
+++ b/src/plugins/blackberry/bbserviceplugin.cpp
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** Copyright (C) 2012 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbserviceplugin.h"
+
+#include "bbcameraservice.h"
+#include "bbmediaplayerservice.h"
+#include "bbvideodeviceselectorcontrol.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbServicePlugin::BbServicePlugin()
+{
+}
+
+QMediaService *BbServicePlugin::create(const QString &key)
+{
+ if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
+ return new BbCameraService();
+
+ if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
+ return new BbMediaPlayerService();
+
+ return 0;
+}
+
+void BbServicePlugin::release(QMediaService *service)
+{
+ delete service;
+}
+
+QMediaServiceProviderHint::Features BbServicePlugin::supportedFeatures(const QByteArray &service) const
+{
+ Q_UNUSED(service)
+ return QMediaServiceProviderHint::Features();
+}
+
+QList<QByteArray> BbServicePlugin::devices(const QByteArray &service) const
+{
+ if (service == Q_MEDIASERVICE_CAMERA) {
+ if (m_cameraDevices.isEmpty())
+ updateDevices();
+
+ return m_cameraDevices;
+ }
+
+ return QList<QByteArray>();
+}
+
+QString BbServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
+{
+ 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];
+ }
+
+ return QString();
+}
+
+void BbServicePlugin::updateDevices() const
+{
+ BbVideoDeviceSelectorControl::enumerateDevices(&m_cameraDevices, &m_cameraDescriptions);
+
+ if (m_cameraDevices.isEmpty()) {
+ qWarning() << "No camera devices found";
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaservice/bbserviceplugin.h b/src/plugins/blackberry/bbserviceplugin.h
index dbf507f10..62fc4a0df 100644
--- a/src/plugins/blackberry/mediaservice/bbserviceplugin.h
+++ b/src/plugins/blackberry/bbserviceplugin.h
@@ -47,9 +47,11 @@ QT_BEGIN_NAMESPACE
class BbServicePlugin
: public QMediaServiceProviderPlugin,
+ public QMediaServiceSupportedDevicesInterface,
public QMediaServiceFeaturesInterface
{
Q_OBJECT
+ Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
Q_INTERFACES(QMediaServiceFeaturesInterface)
Q_PLUGIN_METADATA(IID "org.qt-project.qt.mediaserviceproviderfactory/5.0" FILE "blackberry_mediaservice.json")
public:
@@ -58,6 +60,16 @@ public:
QMediaService *create(const QString &key) Q_DECL_OVERRIDE;
void release(QMediaService *service) Q_DECL_OVERRIDE;
QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const Q_DECL_OVERRIDE;
+
+ QList<QByteArray> devices(const QByteArray &service) const Q_DECL_OVERRIDE;
+ QString deviceDescription(const QByteArray &service, const QByteArray &device) Q_DECL_OVERRIDE;
+ QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property) Q_DECL_OVERRIDE;
+
+private:
+ void updateDevices() const;
+
+ mutable QList<QByteArray> m_cameraDevices;
+ mutable QStringList m_cameraDescriptions;
};
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/blackberry.pro b/src/plugins/blackberry/blackberry.pro
index a03476523..806f20333 100644
--- a/src/plugins/blackberry/blackberry.pro
+++ b/src/plugins/blackberry/blackberry.pro
@@ -1,5 +1,17 @@
-TEMPLATE = subdirs
+TARGET = qtmedia_blackberry
+QT += multimedia-private gui-private
-SUBDIRS += \
- mediaservice
+PLUGIN_TYPE=mediaservice
+PLUGIN_CLASS_NAME = BbServicePlugin
+load(qt_plugin)
+LIBS += -lscreen
+
+HEADERS += bbserviceplugin.h
+SOURCES += bbserviceplugin.cpp
+
+include(common/common.pri)
+include(camera/camera.pri)
+include(mediaplayer/mediaplayer.pri)
+
+OTHER_FILES += blackberry_mediaservice.json
diff --git a/src/plugins/blackberry/blackberry_mediaservice.json b/src/plugins/blackberry/blackberry_mediaservice.json
new file mode 100644
index 000000000..54c1c9f04
--- /dev/null
+++ b/src/plugins/blackberry/blackberry_mediaservice.json
@@ -0,0 +1,3 @@
+{
+ "Keys": ["org.qt-project.qt.camera", "org.qt-project.qt.mediaplayer"]
+}
diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp
new file mode 100644
index 000000000..2ff800a0f
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.cpp
@@ -0,0 +1,89 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraaudioencodersettingscontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraAudioEncoderSettingsControl::BbCameraAudioEncoderSettingsControl(BbCameraSession *session, QObject *parent)
+ : QAudioEncoderSettingsControl(parent)
+ , m_session(session)
+{
+}
+
+QStringList BbCameraAudioEncoderSettingsControl::supportedAudioCodecs() const
+{
+ return QStringList() << QLatin1String("none") << QLatin1String("aac") << QLatin1String("raw");
+}
+
+QString BbCameraAudioEncoderSettingsControl::codecDescription(const QString &codecName) const
+{
+ if (codecName == QLatin1String("none"))
+ return tr("No compression");
+ else if (codecName == QLatin1String("aac"))
+ return tr("AAC compression");
+ else if (codecName == QLatin1String("raw"))
+ return tr("PCM uncompressed");
+
+ return QString();
+}
+
+QList<int> BbCameraAudioEncoderSettingsControl::supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous) const
+{
+ Q_UNUSED(settings);
+ Q_UNUSED(continuous);
+
+ // no API provided by BB10 yet
+ return QList<int>();
+}
+
+QAudioEncoderSettings BbCameraAudioEncoderSettingsControl::audioSettings() const
+{
+ return m_session->audioSettings();
+}
+
+void BbCameraAudioEncoderSettingsControl::setAudioSettings(const QAudioEncoderSettings &settings)
+{
+ m_session->setAudioSettings(settings);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h
new file mode 100644
index 000000000..21fb520e7
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraaudioencodersettingscontrol.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAAUDIOENCODERSETTINGSCONTROL_H
+#define BBCAMERAAUDIOENCODERSETTINGSCONTROL_H
+
+#include <qaudioencodersettingscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraAudioEncoderSettingsControl : public QAudioEncoderSettingsControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraAudioEncoderSettingsControl(BbCameraSession *session, QObject *parent = 0);
+
+ QStringList supportedAudioCodecs() const Q_DECL_OVERRIDE;
+ QString codecDescription(const QString &codecName) const Q_DECL_OVERRIDE;
+ QList<int> supportedSampleRates(const QAudioEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
+ QAudioEncoderSettings audioSettings() const Q_DECL_OVERRIDE;
+ void setAudioSettings(const QAudioEncoderSettings &settings) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp
new file mode 100644
index 000000000..57f3c9fb1
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.cpp
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameracapturebufferformatcontrol.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraCaptureBufferFormatControl::BbCameraCaptureBufferFormatControl(QObject *parent)
+ : QCameraCaptureBufferFormatControl(parent)
+{
+}
+
+QList<QVideoFrame::PixelFormat> BbCameraCaptureBufferFormatControl::supportedBufferFormats() const
+{
+ return (QList<QVideoFrame::PixelFormat>() << QVideoFrame::Format_Jpeg);
+}
+
+QVideoFrame::PixelFormat BbCameraCaptureBufferFormatControl::bufferFormat() const
+{
+ return QVideoFrame::Format_Jpeg;
+}
+
+void BbCameraCaptureBufferFormatControl::setBufferFormat(QVideoFrame::PixelFormat format)
+{
+ Q_UNUSED(format)
+ // Do nothing, we support only Jpeg for now
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h
new file mode 100644
index 000000000..2897cb2fd
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracapturebufferformatcontrol.h
@@ -0,0 +1,61 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERACAPTUREBUFFERFORMATCONTROL_H
+#define BBCAMERACAPTUREBUFFERFORMATCONTROL_H
+
+#include <qcameracapturebufferformatcontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraCaptureBufferFormatControl : public QCameraCaptureBufferFormatControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraCaptureBufferFormatControl(QObject *parent = 0);
+
+ QList<QVideoFrame::PixelFormat> supportedBufferFormats() const Q_DECL_OVERRIDE;
+ QVideoFrame::PixelFormat bufferFormat() const Q_DECL_OVERRIDE;
+ void setBufferFormat(QVideoFrame::PixelFormat format) Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp
new file mode 100644
index 000000000..6b6bcfcb9
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.cpp
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameracapturedestinationcontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraCaptureDestinationControl::BbCameraCaptureDestinationControl(BbCameraSession *session, QObject *parent)
+ : QCameraCaptureDestinationControl(parent)
+ , m_session(session)
+{
+ connect(m_session, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)),
+ this, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)));
+}
+
+bool BbCameraCaptureDestinationControl::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
+{
+ return m_session->isCaptureDestinationSupported(destination);
+}
+
+QCameraImageCapture::CaptureDestinations BbCameraCaptureDestinationControl::captureDestination() const
+{
+ return m_session->captureDestination();;
+}
+
+void BbCameraCaptureDestinationControl::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
+{
+ m_session->setCaptureDestination(destination);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h
new file mode 100644
index 000000000..93a7d2d14
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracapturedestinationcontrol.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERACAPTUREDESTINATIONCONTROL_H
+#define BBCAMERACAPTUREDESTINATIONCONTROL_H
+
+#include <qcameracapturedestinationcontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraCaptureDestinationControl : public QCameraCaptureDestinationControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraCaptureDestinationControl(BbCameraSession *session, QObject *parent = 0);
+
+ bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const Q_DECL_OVERRIDE;
+ QCameraImageCapture::CaptureDestinations captureDestination() const Q_DECL_OVERRIDE;
+ void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameracontrol.cpp b/src/plugins/blackberry/camera/bbcameracontrol.cpp
new file mode 100644
index 000000000..bc3c78264
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracontrol.cpp
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameracontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraControl::BbCameraControl(BbCameraSession *session, QObject *parent)
+ : QCameraControl(parent)
+ , m_session(session)
+{
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)), this, SIGNAL(statusChanged(QCamera::Status)));
+ connect(m_session, SIGNAL(stateChanged(QCamera::State)), this, SIGNAL(stateChanged(QCamera::State)));
+ connect(m_session, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString)));
+ connect(m_session, SIGNAL(captureModeChanged(QCamera::CaptureModes)), this, SIGNAL(captureModeChanged(QCamera::CaptureModes)));
+}
+
+QCamera::State BbCameraControl::state() const
+{
+ return m_session->state();
+}
+
+void BbCameraControl::setState(QCamera::State state)
+{
+ m_session->setState(state);
+}
+
+QCamera::CaptureModes BbCameraControl::captureMode() const
+{
+ return m_session->captureMode();
+}
+
+void BbCameraControl::setCaptureMode(QCamera::CaptureModes mode)
+{
+ m_session->setCaptureMode(mode);
+}
+
+QCamera::Status BbCameraControl::status() const
+{
+ return m_session->status();
+}
+
+bool BbCameraControl::isCaptureModeSupported(QCamera::CaptureModes mode) const
+{
+ return m_session->isCaptureModeSupported(mode);
+}
+
+bool BbCameraControl::canChangeProperty(PropertyChangeType /* changeType */, QCamera::Status /* status */) const
+{
+ return false;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameracontrol.h b/src/plugins/blackberry/camera/bbcameracontrol.h
new file mode 100644
index 000000000..a5792c5df
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameracontrol.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERACONTROL_H
+#define BBCAMERACONTROL_H
+
+#include <qcameracontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraControl : public QCameraControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraControl(BbCameraSession *session, QObject *parent = 0);
+
+ QCamera::State state() const Q_DECL_OVERRIDE;
+ void setState(QCamera::State state) Q_DECL_OVERRIDE;
+
+ QCamera::Status status() const Q_DECL_OVERRIDE;
+
+ QCamera::CaptureModes captureMode() const Q_DECL_OVERRIDE;
+ void setCaptureMode(QCamera::CaptureModes) Q_DECL_OVERRIDE;
+ bool isCaptureModeSupported(QCamera::CaptureModes mode) const Q_DECL_OVERRIDE;
+
+ bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp
new file mode 100644
index 000000000..a24fdbaf1
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraexposurecontrol.cpp
@@ -0,0 +1,232 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraexposurecontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraExposureControl::BbCameraExposureControl(BbCameraSession *session, QObject *parent)
+ : QCameraExposureControl(parent)
+ , m_session(session)
+ , m_requestedExposureMode(QCameraExposure::ExposureAuto)
+{
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(statusChanged(QCamera::Status)));
+}
+
+bool BbCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
+{
+ switch (parameter) {
+ case QCameraExposureControl::ISO:
+ return false;
+ case QCameraExposureControl::Aperture:
+ return false;
+ case QCameraExposureControl::ShutterSpeed:
+ return false;
+ case QCameraExposureControl::ExposureCompensation:
+ return false;
+ case QCameraExposureControl::FlashPower:
+ return false;
+ case QCameraExposureControl::FlashCompensation:
+ return false;
+ case QCameraExposureControl::TorchPower:
+ return false;
+ case QCameraExposureControl::SpotMeteringPoint:
+ return false;
+ case QCameraExposureControl::ExposureMode:
+ return true;
+ case QCameraExposureControl::MeteringMode:
+ return false;
+ default:
+ return false;
+ }
+}
+
+QVariantList BbCameraExposureControl::supportedParameterRange(ExposureParameter parameter, bool *continuous) const
+{
+ if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment
+ return QVariantList();
+
+ if (m_session->status() != QCamera::ActiveStatus) // we can query supported exposure modes only with active viewfinder
+ return QVariantList();
+
+ if (continuous)
+ *continuous = false;
+
+ int supported = 0;
+ camera_scenemode_t modes[20];
+ const camera_error_t result = camera_get_scene_modes(m_session->handle(), 20, &supported, modes);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve supported scene modes:" << result;
+ return QVariantList();
+ }
+
+ QVariantList exposureModes;
+ for (int i = 0; i < supported; ++i) {
+ switch (modes[i]) {
+ case CAMERA_SCENE_AUTO:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposureAuto);
+ break;
+ case CAMERA_SCENE_SPORTS:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposureSports);
+ break;
+ case CAMERA_SCENE_CLOSEUP:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposurePortrait);
+ break;
+ case CAMERA_SCENE_ACTION:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposureSports);
+ break;
+ case CAMERA_SCENE_BEACHANDSNOW:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposureBeach) << QVariant::fromValue(QCameraExposure::ExposureSnow);
+ break;
+ case CAMERA_SCENE_NIGHT:
+ exposureModes << QVariant::fromValue(QCameraExposure::ExposureNight);
+ break;
+ default: break;
+ }
+ }
+
+ return exposureModes;
+}
+
+QVariant BbCameraExposureControl::requestedValue(ExposureParameter parameter) const
+{
+ if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment
+ return QVariant();
+
+ return QVariant::fromValue(m_requestedExposureMode);
+}
+
+QVariant BbCameraExposureControl::actualValue(ExposureParameter parameter) const
+{
+ if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment
+ return QVariantList();
+
+ if (m_session->status() != QCamera::ActiveStatus) // we can query actual scene modes only with active viewfinder
+ return QVariantList();
+
+ camera_scenemode_t sceneMode = CAMERA_SCENE_DEFAULT;
+ const camera_error_t result = camera_get_scene_mode(m_session->handle(), &sceneMode);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve scene mode:" << result;
+ return QVariant();
+ }
+
+ switch (sceneMode) {
+ case CAMERA_SCENE_AUTO:
+ return QVariant::fromValue(QCameraExposure::ExposureAuto);
+ case CAMERA_SCENE_SPORTS:
+ return QVariant::fromValue(QCameraExposure::ExposureSports);
+ case CAMERA_SCENE_CLOSEUP:
+ return QVariant::fromValue(QCameraExposure::ExposurePortrait);
+ case CAMERA_SCENE_ACTION:
+ return QVariant::fromValue(QCameraExposure::ExposureSports);
+ case CAMERA_SCENE_BEACHANDSNOW:
+ return (m_requestedExposureMode == QCameraExposure::ExposureBeach ? QVariant::fromValue(QCameraExposure::ExposureBeach)
+ : QVariant::fromValue(QCameraExposure::ExposureSnow));
+ case CAMERA_SCENE_NIGHT:
+ return QVariant::fromValue(QCameraExposure::ExposureNight);
+ default:
+ return QVariant();
+ }
+}
+
+bool BbCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
+{
+ if (parameter != QCameraExposureControl::ExposureMode) // no other parameter supported by BB10 API at the moment
+ return false;
+
+ if (m_session->status() != QCamera::ActiveStatus) // we can set actual scene modes only with active viewfinder
+ return false;
+
+ camera_scenemode_t sceneMode = CAMERA_SCENE_DEFAULT;
+
+ if (value.isValid()) {
+ m_requestedExposureMode = value.value<QCameraExposure::ExposureMode>();
+ emit requestedValueChanged(QCameraExposureControl::ExposureMode);
+
+ switch (m_requestedExposureMode) {
+ case QCameraExposure::ExposureAuto:
+ sceneMode = CAMERA_SCENE_AUTO;
+ break;
+ case QCameraExposure::ExposureSports:
+ sceneMode = CAMERA_SCENE_SPORTS;
+ break;
+ case QCameraExposure::ExposurePortrait:
+ sceneMode = CAMERA_SCENE_CLOSEUP;
+ break;
+ case QCameraExposure::ExposureBeach:
+ sceneMode = CAMERA_SCENE_BEACHANDSNOW;
+ break;
+ case QCameraExposure::ExposureSnow:
+ sceneMode = CAMERA_SCENE_BEACHANDSNOW;
+ break;
+ case QCameraExposure::ExposureNight:
+ sceneMode = CAMERA_SCENE_NIGHT;
+ break;
+ default:
+ sceneMode = CAMERA_SCENE_DEFAULT;
+ break;
+ }
+ }
+
+ const camera_error_t result = camera_set_scene_mode(m_session->handle(), sceneMode);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set scene mode:" << result;
+ return false;
+ }
+
+ emit actualValueChanged(QCameraExposureControl::ExposureMode);
+
+ return true;
+}
+
+void BbCameraExposureControl::statusChanged(QCamera::Status status)
+{
+ if (status == QCamera::ActiveStatus || status == QCamera::LoadedStatus)
+ emit parameterRangeChanged(QCameraExposureControl::ExposureMode);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraexposurecontrol.h b/src/plugins/blackberry/camera/bbcameraexposurecontrol.h
new file mode 100644
index 000000000..f4659b624
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraexposurecontrol.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAEXPOSURECONTROL_H
+#define BBCAMERAEXPOSURECONTROL_H
+
+#include <qcameraexposurecontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraExposureControl : public QCameraExposureControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraExposureControl(BbCameraSession *session, QObject *parent = 0);
+
+ virtual bool isParameterSupported(ExposureParameter parameter) const Q_DECL_OVERRIDE;
+ virtual QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const Q_DECL_OVERRIDE;
+
+ virtual QVariant requestedValue(ExposureParameter parameter) const Q_DECL_OVERRIDE;
+ virtual QVariant actualValue(ExposureParameter parameter) const Q_DECL_OVERRIDE;
+ virtual bool setValue(ExposureParameter parameter, const QVariant& value) Q_DECL_OVERRIDE;
+
+private Q_SLOTS:
+ void statusChanged(QCamera::Status status);
+
+private:
+ BbCameraSession *m_session;
+ QCameraExposure::ExposureMode m_requestedExposureMode;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp b/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp
new file mode 100644
index 000000000..06ebe01f6
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraflashcontrol.cpp
@@ -0,0 +1,113 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraflashcontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraFlashControl::BbCameraFlashControl(BbCameraSession *session, QObject *parent)
+ : QCameraFlashControl(parent)
+ , m_session(session)
+ , m_flashMode(QCameraExposure::FlashAuto)
+{
+}
+
+QCameraExposure::FlashModes BbCameraFlashControl::flashMode() const
+{
+ return m_flashMode;
+}
+
+void BbCameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode)
+{
+ if (m_flashMode == mode)
+ return;
+
+ if (m_session->status() != QCamera::ActiveStatus) // can only be changed when viewfinder is active
+ return;
+
+ if (m_flashMode == QCameraExposure::FlashVideoLight) {
+ const camera_error_t result = camera_config_videolight(m_session->handle(), CAMERA_VIDEOLIGHT_OFF);
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to switch off video light:" << result;
+ }
+
+ m_flashMode = mode;
+
+ if (m_flashMode == QCameraExposure::FlashVideoLight) {
+ const camera_error_t result = camera_config_videolight(m_session->handle(), CAMERA_VIDEOLIGHT_ON);
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to switch on video light:" << result;
+ } else {
+ camera_flashmode_t flashMode = CAMERA_FLASH_AUTO;
+
+ if (m_flashMode.testFlag(QCameraExposure::FlashAuto)) flashMode = CAMERA_FLASH_AUTO;
+ else if (mode.testFlag(QCameraExposure::FlashOff)) flashMode = CAMERA_FLASH_OFF;
+ else if (mode.testFlag(QCameraExposure::FlashOn)) flashMode = CAMERA_FLASH_ON;
+
+ const camera_error_t result = camera_config_flash(m_session->handle(), flashMode);
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to configure flash:" << result;
+ }
+}
+
+bool BbCameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const
+{
+ bool supportsVideoLight = false;
+ if (m_session->handle() != CAMERA_HANDLE_INVALID) {
+ supportsVideoLight = camera_has_feature(m_session->handle(), CAMERA_FEATURE_VIDEOLIGHT);
+ }
+
+ return (mode == QCameraExposure::FlashOff ||
+ mode == QCameraExposure::FlashOn ||
+ mode == QCameraExposure::FlashAuto ||
+ ((mode == QCameraExposure::FlashVideoLight) && supportsVideoLight));
+}
+
+bool BbCameraFlashControl::isFlashReady() const
+{
+ //TODO: check for flash charge-level here?!?
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraflashcontrol.h b/src/plugins/blackberry/camera/bbcameraflashcontrol.h
new file mode 100644
index 000000000..d46dc8c12
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraflashcontrol.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAFLASHCONTROL_H
+#define BBCAMERAFLASHCONTROL_H
+
+#include <qcameraflashcontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraFlashControl : public QCameraFlashControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraFlashControl(BbCameraSession *session, QObject *parent = 0);
+
+ QCameraExposure::FlashModes flashMode() const Q_DECL_OVERRIDE;
+ void setFlashMode(QCameraExposure::FlashModes mode) Q_DECL_OVERRIDE;
+ bool isFlashModeSupported(QCameraExposure::FlashModes mode) const Q_DECL_OVERRIDE;
+ bool isFlashReady() const Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+ QCameraExposure::FlashModes m_flashMode;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp b/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp
new file mode 100644
index 000000000..e0b57d6c6
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerafocuscontrol.cpp
@@ -0,0 +1,331 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcamerafocuscontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraFocusControl::BbCameraFocusControl(BbCameraSession *session, QObject *parent)
+ : QCameraFocusControl(parent)
+ , m_session(session)
+ , m_focusMode(QCameraFocus::FocusModes())
+ , m_focusPointMode(QCameraFocus::FocusPointAuto)
+ , m_customFocusPoint(QPointF(0, 0))
+{
+}
+
+QCameraFocus::FocusModes BbCameraFocusControl::focusMode() const
+{
+ camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF;
+
+ const camera_error_t result = camera_get_focus_mode(m_session->handle(), &focusMode);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve focus mode from camera:" << result;
+ return QCameraFocus::FocusModes();
+ }
+
+ switch (focusMode) {
+ case CAMERA_FOCUSMODE_EDOF:
+ return QCameraFocus::HyperfocalFocus;
+ case CAMERA_FOCUSMODE_MANUAL:
+ return QCameraFocus::ManualFocus;
+ case CAMERA_FOCUSMODE_AUTO:
+ return QCameraFocus::AutoFocus;
+ case CAMERA_FOCUSMODE_MACRO:
+ return QCameraFocus::MacroFocus;
+ case CAMERA_FOCUSMODE_CONTINUOUS_AUTO:
+ return QCameraFocus::ContinuousFocus;
+ case CAMERA_FOCUSMODE_CONTINUOUS_MACRO: // fall through
+ case CAMERA_FOCUSMODE_OFF: // fall through
+ default:
+ return QCameraFocus::FocusModes();
+ }
+}
+
+void BbCameraFocusControl::setFocusMode(QCameraFocus::FocusModes mode)
+{
+ if (m_focusMode == mode)
+ return;
+
+ camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF;
+
+ if (mode == QCameraFocus::HyperfocalFocus)
+ focusMode = CAMERA_FOCUSMODE_EDOF;
+ else if (mode == QCameraFocus::ManualFocus)
+ focusMode = CAMERA_FOCUSMODE_MANUAL;
+ else if (mode == QCameraFocus::AutoFocus)
+ focusMode = CAMERA_FOCUSMODE_AUTO;
+ else if (mode == QCameraFocus::MacroFocus)
+ focusMode = CAMERA_FOCUSMODE_MACRO;
+ else if (mode == QCameraFocus::ContinuousFocus)
+ focusMode = CAMERA_FOCUSMODE_CONTINUOUS_AUTO;
+
+ const camera_error_t result = camera_set_focus_mode(m_session->handle(), focusMode);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set focus mode:" << result;
+ return;
+ }
+
+ m_focusMode = mode;
+ emit focusModeChanged(m_focusMode);
+}
+
+bool BbCameraFocusControl::isFocusModeSupported(QCameraFocus::FocusModes mode) const
+{
+ if (m_session->state() == QCamera::UnloadedState)
+ return false;
+
+ if (mode == QCameraFocus::HyperfocalFocus)
+ return false; //TODO how to check?
+ else if (mode == QCameraFocus::ManualFocus)
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MANUALFOCUS);
+ else if (mode == QCameraFocus::AutoFocus)
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS);
+ else if (mode == QCameraFocus::MacroFocus)
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_MACROFOCUS);
+ else if (mode == QCameraFocus::ContinuousFocus)
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS);
+
+ return false;
+}
+
+QCameraFocus::FocusPointMode BbCameraFocusControl::focusPointMode() const
+{
+ return m_focusPointMode;
+}
+
+void BbCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode)
+{
+ if (m_session->status() != QCamera::ActiveStatus)
+ return;
+
+ if (m_focusPointMode == mode)
+ return;
+
+ m_focusPointMode = mode;
+ emit focusPointModeChanged(m_focusPointMode);
+
+ if (m_focusPointMode == QCameraFocus::FocusPointAuto) {
+ //TODO: is this correct?
+ const camera_error_t result = camera_set_focus_regions(m_session->handle(), 0, 0);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set focus region:" << result;
+ return;
+ }
+
+ emit focusZonesChanged();
+ } else if (m_focusPointMode == QCameraFocus::FocusPointCenter) {
+ // get the size of the viewfinder
+ int viewfinderWidth = 0;
+ int viewfinderHeight = 0;
+
+ if (!retrieveViewfinderSize(&viewfinderWidth, &viewfinderHeight))
+ return;
+
+ // define a 40x40 pixel focus region in the center of the viewfinder
+ camera_region_t focusRegion;
+ focusRegion.left = (viewfinderWidth / 2) - 20;
+ focusRegion.top = (viewfinderHeight / 2) - 20;
+ focusRegion.width = 40;
+ focusRegion.height = 40;
+
+ camera_error_t result = camera_set_focus_regions(m_session->handle(), 1, &focusRegion);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set focus region:" << result;
+ return;
+ }
+
+ // re-set focus mode to apply focus region changes
+ camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF;
+ result = camera_get_focus_mode(m_session->handle(), &focusMode);
+ camera_set_focus_mode(m_session->handle(), focusMode);
+
+ emit focusZonesChanged();
+
+ } else if (m_focusPointMode == QCameraFocus::FocusPointFaceDetection) {
+ //TODO: implement later
+ } else if (m_focusPointMode == QCameraFocus::FocusPointCustom) {
+ updateCustomFocusRegion();
+ }
+}
+
+bool BbCameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
+{
+ if (m_session->state() == QCamera::UnloadedState)
+ return false;
+
+ if (mode == QCameraFocus::FocusPointAuto) {
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_AUTOFOCUS);
+ } else if (mode == QCameraFocus::FocusPointCenter) {
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS);
+ } else if (mode == QCameraFocus::FocusPointFaceDetection) {
+ return false; //TODO: implement via custom region in combination with face detection in viewfinder
+ } else if (mode == QCameraFocus::FocusPointCustom) {
+ return camera_has_feature(m_session->handle(), CAMERA_FEATURE_REGIONFOCUS);
+ }
+
+ return false;
+}
+
+QPointF BbCameraFocusControl::customFocusPoint() const
+{
+ return m_customFocusPoint;
+}
+
+void BbCameraFocusControl::setCustomFocusPoint(const QPointF &point)
+{
+ if (m_customFocusPoint == point)
+ return;
+
+ m_customFocusPoint = point;
+ emit customFocusPointChanged(m_customFocusPoint);
+
+ updateCustomFocusRegion();
+}
+
+QCameraFocusZoneList BbCameraFocusControl::focusZones() const
+{
+ if (m_session->state() == QCamera::UnloadedState)
+ return QCameraFocusZoneList();
+
+ camera_region_t regions[20];
+ int supported = 0;
+ int asked = 0;
+ camera_error_t result = camera_get_focus_regions(m_session->handle(), 20, &supported, &asked, regions);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve focus regions:" << result;
+ return QCameraFocusZoneList();
+ }
+
+ // retrieve width and height of viewfinder
+ int viewfinderWidth = 0;
+ int viewfinderHeight = 0;
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(),
+ CAMERA_IMGPROP_WIDTH, &viewfinderWidth,
+ CAMERA_IMGPROP_HEIGHT, &viewfinderHeight);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(),
+ CAMERA_IMGPROP_WIDTH, &viewfinderWidth,
+ CAMERA_IMGPROP_HEIGHT, &viewfinderHeight);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve viewfinder size:" << result;
+ return QCameraFocusZoneList();
+ }
+
+ QCameraFocusZoneList list;
+ for (int i = 0; i < asked; ++i) {
+ const int x = regions[i].left;
+ const int y = regions[i].top;
+ const int width = regions[i].width;
+ const int height = regions[i].height;
+
+ QRectF rect(static_cast<float>(x)/static_cast<float>(viewfinderWidth),
+ static_cast<float>(y)/static_cast<float>(viewfinderHeight),
+ static_cast<float>(width)/static_cast<float>(viewfinderWidth),
+ static_cast<float>(height)/static_cast<float>(viewfinderHeight));
+
+ list << QCameraFocusZone(rect, QCameraFocusZone::Focused); //TODO: how to know if a zone is unused/selected/focused?!?
+ }
+
+ return list;
+}
+
+void BbCameraFocusControl::updateCustomFocusRegion()
+{
+ // get the size of the viewfinder
+ int viewfinderWidth = 0;
+ int viewfinderHeight = 0;
+
+ if (!retrieveViewfinderSize(&viewfinderWidth, &viewfinderHeight))
+ return;
+
+ // define a 40x40 pixel focus region around the custom focus point
+ camera_region_t focusRegion;
+ focusRegion.left = qMax(0, static_cast<int>(m_customFocusPoint.x() * viewfinderWidth) - 20);
+ focusRegion.top = qMax(0, static_cast<int>(m_customFocusPoint.y() * viewfinderHeight) - 20);
+ focusRegion.width = 40;
+ focusRegion.height = 40;
+
+ camera_error_t result = camera_set_focus_regions(m_session->handle(), 1, &focusRegion);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set focus region:" << result;
+ return;
+ }
+
+ // re-set focus mode to apply focus region changes
+ camera_focusmode_t focusMode = CAMERA_FOCUSMODE_OFF;
+ result = camera_get_focus_mode(m_session->handle(), &focusMode);
+ camera_set_focus_mode(m_session->handle(), focusMode);
+
+ emit focusZonesChanged();
+}
+
+bool BbCameraFocusControl::retrieveViewfinderSize(int *width, int *height)
+{
+ if (!width || !height)
+ return false;
+
+ camera_error_t result = CAMERA_EOK;
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(),
+ CAMERA_IMGPROP_WIDTH, width,
+ CAMERA_IMGPROP_HEIGHT, height);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(),
+ CAMERA_IMGPROP_WIDTH, width,
+ CAMERA_IMGPROP_HEIGHT, height);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve viewfinder size:" << result;
+ return false;
+ }
+
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcamerafocuscontrol.h b/src/plugins/blackberry/camera/bbcamerafocuscontrol.h
new file mode 100644
index 000000000..052c29b4b
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerafocuscontrol.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAFOCUSCONTROL_H
+#define BBCAMERAFOCUSCONTROL_H
+
+#include <qcamerafocuscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraFocusControl : public QCameraFocusControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraFocusControl(BbCameraSession *session, QObject *parent = 0);
+
+ QCameraFocus::FocusModes focusMode() const Q_DECL_OVERRIDE;
+ void setFocusMode(QCameraFocus::FocusModes mode) Q_DECL_OVERRIDE;
+ bool isFocusModeSupported(QCameraFocus::FocusModes mode) const Q_DECL_OVERRIDE;
+ QCameraFocus::FocusPointMode focusPointMode() const Q_DECL_OVERRIDE;
+ void setFocusPointMode(QCameraFocus::FocusPointMode mode) Q_DECL_OVERRIDE;
+ bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const Q_DECL_OVERRIDE;
+ QPointF customFocusPoint() const Q_DECL_OVERRIDE;
+ void setCustomFocusPoint(const QPointF &point) Q_DECL_OVERRIDE;
+ QCameraFocusZoneList focusZones() const Q_DECL_OVERRIDE;
+
+private:
+ void updateCustomFocusRegion();
+ bool retrieveViewfinderSize(int *width, int *height);
+
+ BbCameraSession *m_session;
+
+ QCameraFocus::FocusModes m_focusMode;
+ QCameraFocus::FocusPointMode m_focusPointMode;
+ QPointF m_customFocusPoint;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp
new file mode 100644
index 000000000..a2f61f73d
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.cpp
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraimagecapturecontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraImageCaptureControl::BbCameraImageCaptureControl(BbCameraSession *session, QObject *parent)
+ : QCameraImageCaptureControl(parent)
+ , m_session(session)
+{
+ connect(m_session, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool)));
+ connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int)));
+ connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage)));
+ connect(m_session, SIGNAL(imageMetadataAvailable(int,QString,QVariant)), this, SIGNAL(imageMetadataAvailable(int,QString,QVariant)));
+ connect(m_session, SIGNAL(imageAvailable(int,QVideoFrame)), this, SIGNAL(imageAvailable(int,QVideoFrame)));
+ connect(m_session, SIGNAL(imageSaved(int,QString)), this, SIGNAL(imageSaved(int,QString)));
+ connect(m_session, SIGNAL(imageCaptureError(int,int,QString)), this, SIGNAL(error(int,int,QString)));
+}
+
+bool BbCameraImageCaptureControl::isReadyForCapture() const
+{
+ return m_session->isReadyForCapture();
+}
+
+QCameraImageCapture::DriveMode BbCameraImageCaptureControl::driveMode() const
+{
+ return m_session->driveMode();
+}
+
+void BbCameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode)
+{
+ m_session->setDriveMode(mode);
+}
+
+int BbCameraImageCaptureControl::capture(const QString &fileName)
+{
+ return m_session->capture(fileName);
+}
+
+void BbCameraImageCaptureControl::cancelCapture()
+{
+ m_session->cancelCapture();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h
new file mode 100644
index 000000000..a73a4f1d5
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraimagecapturecontrol.h
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAIMAGECAPTURECONTROL_H
+#define BBCAMERAIMAGECAPTURECONTROL_H
+
+#include <qcameraimagecapturecontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraImageCaptureControl : public QCameraImageCaptureControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraImageCaptureControl(BbCameraSession *session, QObject *parent = 0);
+
+ bool isReadyForCapture() const Q_DECL_OVERRIDE;
+
+ QCameraImageCapture::DriveMode driveMode() const Q_DECL_OVERRIDE;
+ void setDriveMode(QCameraImageCapture::DriveMode mode) Q_DECL_OVERRIDE;
+
+ int capture(const QString &fileName) Q_DECL_OVERRIDE;
+ void cancelCapture() Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp
new file mode 100644
index 000000000..54ae48c6b
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraimageprocessingcontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraImageProcessingControl::BbCameraImageProcessingControl(BbCameraSession *session, QObject *parent)
+ : QCameraImageProcessingControl(parent)
+ , m_session(session)
+{
+}
+
+bool BbCameraImageProcessingControl::isParameterSupported(ProcessingParameter parameter) const
+{
+ return (parameter == QCameraImageProcessingControl::WhiteBalancePreset);
+}
+
+bool BbCameraImageProcessingControl::isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const
+{
+ if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
+ return false;
+
+ if (m_session->handle() == CAMERA_HANDLE_INVALID)
+ return false;
+
+ int supported = 0;
+ camera_whitebalancemode_t modes[20];
+ const camera_error_t result = camera_get_whitebalance_modes(m_session->handle(), 20, &supported, modes);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve supported whitebalance modes:" << result;
+ return false;
+ }
+
+ QSet<QCameraImageProcessing::WhiteBalanceMode> supportedModes;
+ for (int i = 0; i < supported; ++i) {
+ switch (modes[i]) {
+ case CAMERA_WHITEBALANCEMODE_AUTO:
+ supportedModes.insert(QCameraImageProcessing::WhiteBalanceAuto);
+ break;
+ case CAMERA_WHITEBALANCEMODE_MANUAL:
+ supportedModes.insert(QCameraImageProcessing::WhiteBalanceManual);
+ break;
+ default:
+ break;
+ }
+ }
+
+ return supportedModes.contains(value.value<QCameraImageProcessing::WhiteBalanceMode>());
+}
+
+QVariant BbCameraImageProcessingControl::parameter(ProcessingParameter parameter) const
+{
+ if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
+ return QVariant();
+
+ if (m_session->handle() == CAMERA_HANDLE_INVALID)
+ return QVariant();
+
+ camera_whitebalancemode_t mode;
+ const camera_error_t result = camera_get_whitebalance_mode(m_session->handle(), &mode);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve current whitebalance mode:" << result;
+ return QVariant();
+ }
+
+ switch (mode) {
+ case CAMERA_WHITEBALANCEMODE_AUTO:
+ return QVariant::fromValue(QCameraImageProcessing::WhiteBalanceAuto);
+ case CAMERA_WHITEBALANCEMODE_MANUAL:
+ return QVariant::fromValue(QCameraImageProcessing::WhiteBalanceManual);
+ default:
+ return QVariant();
+ }
+}
+
+void BbCameraImageProcessingControl::setParameter(ProcessingParameter parameter, const QVariant &value)
+{
+ if (parameter != QCameraImageProcessingControl::WhiteBalancePreset)
+ return;
+
+ if (m_session->handle() == CAMERA_HANDLE_INVALID)
+ return;
+
+ camera_whitebalancemode_t mode = CAMERA_WHITEBALANCEMODE_DEFAULT;
+ switch (value.value<QCameraImageProcessing::WhiteBalanceMode>()) {
+ case QCameraImageProcessing::WhiteBalanceAuto:
+ mode = CAMERA_WHITEBALANCEMODE_AUTO;
+ break;
+ case QCameraImageProcessing::WhiteBalanceManual:
+ mode = CAMERA_WHITEBALANCEMODE_MANUAL;
+ break;
+ default:
+ break;
+ }
+
+ const camera_error_t result = camera_set_whitebalance_mode(m_session->handle(), mode);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set whitebalance mode:" << result;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h
new file mode 100644
index 000000000..ec16d66d7
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraimageprocessingcontrol.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAIMAGEPROCESSINGCONTROL_H
+#define BBCAMERAIMAGEPROCESSINGCONTROL_H
+
+#include <qcameraimageprocessingcontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraImageProcessingControl : public QCameraImageProcessingControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraImageProcessingControl(BbCameraSession *session, QObject *parent = 0);
+
+ bool isParameterSupported(ProcessingParameter) const Q_DECL_OVERRIDE;
+ bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const Q_DECL_OVERRIDE;
+ QVariant parameter(ProcessingParameter parameter) const Q_DECL_OVERRIDE;
+ void setParameter(ProcessingParameter parameter, const QVariant &value) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.cpp b/src/plugins/blackberry/camera/bbcameralockscontrol.cpp
new file mode 100644
index 000000000..471940549
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameralockscontrol.cpp
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameralockscontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraLocksControl::BbCameraLocksControl(BbCameraSession *session, QObject *parent)
+ : QCameraLocksControl(parent)
+ , m_session(session)
+{
+ connect(m_session, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)),
+ this, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)));
+}
+
+QCamera::LockTypes BbCameraLocksControl::supportedLocks() const
+{
+ return m_session->supportedLocks();
+}
+
+QCamera::LockStatus BbCameraLocksControl::lockStatus(QCamera::LockType lock) const
+{
+ return m_session->lockStatus(lock);
+}
+
+void BbCameraLocksControl::searchAndLock(QCamera::LockTypes locks)
+{
+ m_session->searchAndLock(locks);
+}
+
+void BbCameraLocksControl::unlock(QCamera::LockTypes locks)
+{
+ m_session->unlock(locks);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameralockscontrol.h b/src/plugins/blackberry/camera/bbcameralockscontrol.h
new file mode 100644
index 000000000..6c4b2da6b
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameralockscontrol.h
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERALOCKSCONTROL_H
+#define BBCAMERALOCKSCONTROL_H
+
+#include <qcameralockscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraLocksControl : public QCameraLocksControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraLocksControl(BbCameraSession *session, QObject *parent = 0);
+
+ QCamera::LockTypes supportedLocks() const Q_DECL_OVERRIDE;
+ QCamera::LockStatus lockStatus(QCamera::LockType lock) const Q_DECL_OVERRIDE;
+ void searchAndLock(QCamera::LockTypes locks) Q_DECL_OVERRIDE;
+ void unlock(QCamera::LockTypes locks) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp
new file mode 100644
index 000000000..a4a42abf8
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.cpp
@@ -0,0 +1,158 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameramediarecordercontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+#include <QUrl>
+
+#include <audio/audio_manager_device.h>
+#include <audio/audio_manager_volume.h>
+
+QT_BEGIN_NAMESPACE
+
+static audio_manager_device_t currentAudioInputDevice()
+{
+ audio_manager_device_t device = AUDIO_DEVICE_HEADSET;
+
+ const int result = audio_manager_get_default_input_device(&device);
+ if (result != EOK) {
+ qWarning() << "Unable to retrieve default audio input device:" << result;
+ return AUDIO_DEVICE_HEADSET;
+ }
+
+ return device;
+}
+
+BbCameraMediaRecorderControl::BbCameraMediaRecorderControl(BbCameraSession *session, QObject *parent)
+ : QMediaRecorderControl(parent)
+ , m_session(session)
+{
+ connect(m_session, SIGNAL(videoStateChanged(QMediaRecorder::State)), this, SIGNAL(stateChanged(QMediaRecorder::State)));
+ connect(m_session, SIGNAL(videoStatusChanged(QMediaRecorder::Status)), this, SIGNAL(statusChanged(QMediaRecorder::Status)));
+ connect(m_session, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
+ connect(m_session, SIGNAL(actualLocationChanged(QUrl)), this, SIGNAL(actualLocationChanged(QUrl)));
+ connect(m_session, SIGNAL(videoError(int,QString)), this, SIGNAL(error(int,QString)));
+}
+
+QUrl BbCameraMediaRecorderControl::outputLocation() const
+{
+ return m_session->outputLocation();
+}
+
+bool BbCameraMediaRecorderControl::setOutputLocation(const QUrl &location)
+{
+ return m_session->setOutputLocation(location);
+}
+
+QMediaRecorder::State BbCameraMediaRecorderControl::state() const
+{
+ return m_session->videoState();
+}
+
+QMediaRecorder::Status BbCameraMediaRecorderControl::status() const
+{
+ return m_session->videoStatus();
+}
+
+qint64 BbCameraMediaRecorderControl::duration() const
+{
+ return m_session->duration();
+}
+
+bool BbCameraMediaRecorderControl::isMuted() const
+{
+ bool muted = false;
+
+ const int result = audio_manager_get_input_mute(currentAudioInputDevice(), &muted);
+ if (result != EOK) {
+ emit const_cast<BbCameraMediaRecorderControl*>(this)->error(QMediaRecorder::ResourceError, tr("Unable to retrieve mute status"));
+ return false;
+ }
+
+ return muted;
+}
+
+qreal BbCameraMediaRecorderControl::volume() const
+{
+ double level = 0.0;
+
+ const int result = audio_manager_get_input_level(currentAudioInputDevice(), &level);
+ if (result != EOK) {
+ emit const_cast<BbCameraMediaRecorderControl*>(this)->error(QMediaRecorder::ResourceError, tr("Unable to retrieve audio input volume"));
+ return 0.0;
+ }
+
+ return (level / 100);
+}
+
+void BbCameraMediaRecorderControl::applySettings()
+{
+ m_session->applyVideoSettings();
+}
+
+void BbCameraMediaRecorderControl::setState(QMediaRecorder::State state)
+{
+ m_session->setVideoState(state);
+}
+
+void BbCameraMediaRecorderControl::setMuted(bool muted)
+{
+ const int result = audio_manager_set_input_mute(currentAudioInputDevice(), muted);
+ if (result != EOK) {
+ emit error(QMediaRecorder::ResourceError, tr("Unable to set mute status"));
+ } else {
+ emit mutedChanged(muted);
+ }
+}
+
+void BbCameraMediaRecorderControl::setVolume(qreal volume)
+{
+ const int result = audio_manager_set_input_level(currentAudioInputDevice(), (volume * 100));
+ if (result != EOK) {
+ emit error(QMediaRecorder::ResourceError, tr("Unable to set audio input volume"));
+ } else {
+ emit volumeChanged(volume);
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameramediarecordercontrol.h b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.h
new file mode 100644
index 000000000..dffd18be5
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameramediarecordercontrol.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAMEDIARECORDERCONTROL_H
+#define BBCAMERAMEDIARECORDERCONTROL_H
+
+#include <qmediarecordercontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraMediaRecorderControl : public QMediaRecorderControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraMediaRecorderControl(BbCameraSession *session, QObject *parent = 0);
+
+ QUrl outputLocation() const Q_DECL_OVERRIDE;
+ bool setOutputLocation(const QUrl &location) Q_DECL_OVERRIDE;
+ QMediaRecorder::State state() const Q_DECL_OVERRIDE;
+ QMediaRecorder::Status status() const Q_DECL_OVERRIDE;
+ qint64 duration() const Q_DECL_OVERRIDE;
+ bool isMuted() const Q_DECL_OVERRIDE;
+ qreal volume() const Q_DECL_OVERRIDE;
+ void applySettings() Q_DECL_OVERRIDE;
+
+public Q_SLOTS:
+ void setState(QMediaRecorder::State state) Q_DECL_OVERRIDE;
+ void setMuted(bool muted) Q_DECL_OVERRIDE;
+ void setVolume(qreal volume) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp b/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp
new file mode 100644
index 000000000..7e89162a8
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraorientationhandler.cpp
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraorientationhandler.h"
+
+#include <QAbstractEventDispatcher>
+#include <QCoreApplication>
+#include <QDebug>
+
+#include <bps/orientation.h>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraOrientationHandler::BbCameraOrientationHandler(QObject *parent)
+ : QObject(parent)
+ , m_orientation(0)
+{
+ QCoreApplication::eventDispatcher()->installNativeEventFilter(this);
+ int result = orientation_request_events(0);
+ if (result == BPS_FAILURE)
+ qWarning() << "Unable to register for orientation change events";
+
+ orientation_direction_t direction = ORIENTATION_FACE_UP;
+ int angle = 0;
+
+ result = orientation_get(&direction, &angle);
+ if (result == BPS_FAILURE) {
+ qWarning() << "Unable to retrieve initial orientation";
+ } else {
+ m_orientation = angle;
+ }
+}
+
+BbCameraOrientationHandler::~BbCameraOrientationHandler()
+{
+ const int result = orientation_stop_events(0);
+ if (result == BPS_FAILURE)
+ qWarning() << "Unable to unregister for orientation change events";
+
+ QCoreApplication::eventDispatcher()->removeNativeEventFilter(this);
+}
+
+bool BbCameraOrientationHandler::nativeEventFilter(const QByteArray&, void *message, long*)
+{
+ bps_event_t* const event = static_cast<bps_event_t*>(message);
+ if (!event || bps_event_get_domain(event) != orientation_get_domain())
+ return false;
+
+ const int angle = orientation_event_get_angle(event);
+ if (angle != m_orientation) {
+ m_orientation = angle;
+ emit orientationChanged(m_orientation);
+ }
+
+ return false; // do not drop the event
+}
+
+int BbCameraOrientationHandler::orientation() const
+{
+ return m_orientation;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraorientationhandler.h b/src/plugins/blackberry/camera/bbcameraorientationhandler.h
new file mode 100644
index 000000000..3d236b884
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraorientationhandler.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAORIENTATIONHANDLER_H
+#define BBCAMERAORIENTATIONHANDLER_H
+
+#include <QAbstractNativeEventFilter>
+#include <QObject>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraOrientationHandler : public QObject, public QAbstractNativeEventFilter
+{
+ Q_OBJECT
+public:
+ explicit BbCameraOrientationHandler(QObject *parent = 0);
+ ~BbCameraOrientationHandler();
+
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
+
+ int orientation() const;
+
+Q_SIGNALS:
+ void orientationChanged(int degree);
+
+private:
+ int m_orientation;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraservice.cpp b/src/plugins/blackberry/camera/bbcameraservice.cpp
new file mode 100644
index 000000000..d9adc7c9d
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraservice.cpp
@@ -0,0 +1,141 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraservice.h"
+
+#include "bbcameraaudioencodersettingscontrol.h"
+#include "bbcameracapturebufferformatcontrol.h"
+#include "bbcameracapturedestinationcontrol.h"
+#include "bbcameracontrol.h"
+#include "bbcameraexposurecontrol.h"
+#include "bbcameraflashcontrol.h"
+#include "bbcamerafocuscontrol.h"
+#include "bbcameraimagecapturecontrol.h"
+#include "bbcameraimageprocessingcontrol.h"
+#include "bbcameralockscontrol.h"
+#include "bbcameramediarecordercontrol.h"
+#include "bbcamerasession.h"
+#include "bbcameravideoencodersettingscontrol.h"
+#include "bbcameraviewfindersettingscontrol.h"
+#include "bbcamerazoomcontrol.h"
+#include "bbimageencodercontrol.h"
+#include "bbvideodeviceselectorcontrol.h"
+#include "bbvideorenderercontrol.h"
+
+#include <QDebug>
+#include <QVariant>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraService::BbCameraService(QObject *parent)
+ : QMediaService(parent)
+ , m_cameraSession(new BbCameraSession(this))
+ , m_cameraAudioEncoderSettingsControl(new BbCameraAudioEncoderSettingsControl(m_cameraSession, this))
+ , m_cameraCaptureBufferFormatControl(new BbCameraCaptureBufferFormatControl(this))
+ , m_cameraCaptureDestinationControl(new BbCameraCaptureDestinationControl(m_cameraSession, this))
+ , m_cameraControl(new BbCameraControl(m_cameraSession, this))
+ , m_cameraExposureControl(new BbCameraExposureControl(m_cameraSession, this))
+ , m_cameraFlashControl(new BbCameraFlashControl(m_cameraSession, this))
+ , m_cameraFocusControl(new BbCameraFocusControl(m_cameraSession, this))
+ , m_cameraImageCaptureControl(new BbCameraImageCaptureControl(m_cameraSession, this))
+ , m_cameraImageProcessingControl(new BbCameraImageProcessingControl(m_cameraSession, this))
+ , m_cameraLocksControl(new BbCameraLocksControl(m_cameraSession, this))
+ , m_cameraMediaRecorderControl(new BbCameraMediaRecorderControl(m_cameraSession, this))
+ , m_cameraVideoEncoderSettingsControl(new BbCameraVideoEncoderSettingsControl(m_cameraSession, this))
+ , m_cameraViewfinderSettingsControl(new BbCameraViewfinderSettingsControl(m_cameraSession, this))
+ , m_cameraZoomControl(new BbCameraZoomControl(m_cameraSession, this))
+ , m_imageEncoderControl(new BbImageEncoderControl(m_cameraSession, this))
+ , m_videoDeviceSelectorControl(new BbVideoDeviceSelectorControl(m_cameraSession, this))
+ , m_videoRendererControl(new BbVideoRendererControl(m_cameraSession, this))
+{
+}
+
+BbCameraService::~BbCameraService()
+{
+}
+
+QMediaControl* BbCameraService::requestControl(const char *name)
+{
+ if (qstrcmp(name, QAudioEncoderSettingsControl_iid) == 0)
+ return m_cameraAudioEncoderSettingsControl;
+ else if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
+ return m_cameraCaptureBufferFormatControl;
+ else if (qstrcmp(name, QCameraCaptureDestinationControl_iid) == 0)
+ return m_cameraCaptureDestinationControl;
+ else if (qstrcmp(name, QCameraControl_iid) == 0)
+ return m_cameraControl;
+ else if (qstrcmp(name, QCameraExposureControl_iid) == 0)
+ return m_cameraExposureControl;
+ else if (qstrcmp(name, QCameraFlashControl_iid) == 0)
+ return m_cameraFlashControl;
+ else if (qstrcmp(name, QCameraFocusControl_iid) == 0)
+ return m_cameraFocusControl;
+ else if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
+ return m_cameraImageCaptureControl;
+ else if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0)
+ return m_cameraImageProcessingControl;
+ else if (qstrcmp(name, QCameraLocksControl_iid) == 0)
+ return m_cameraLocksControl;
+ else if (qstrcmp(name, QMediaRecorderControl_iid) == 0)
+ return m_cameraMediaRecorderControl;
+ else if (qstrcmp(name, QVideoEncoderSettingsControl_iid) == 0)
+ return m_cameraVideoEncoderSettingsControl;
+ else if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
+ return m_cameraViewfinderSettingsControl;
+ else if (qstrcmp(name, QCameraZoomControl_iid) == 0)
+ return m_cameraZoomControl;
+ else if (qstrcmp(name, QImageEncoderControl_iid) == 0)
+ return m_imageEncoderControl;
+ else if (qstrcmp(name, QVideoDeviceSelectorControl_iid) == 0)
+ return m_videoDeviceSelectorControl;
+ else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
+ return m_videoRendererControl;
+
+ return 0;
+}
+
+void BbCameraService::releaseControl(QMediaControl *control)
+{
+ Q_UNUSED(control)
+
+ // Implemented as a singleton, so we do nothing.
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraservice.h b/src/plugins/blackberry/camera/bbcameraservice.h
new file mode 100644
index 000000000..374d03c36
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraservice.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERASERVICE_H
+#define BBCAMERASERVICE_H
+
+#include <QObject>
+
+#include <qmediaservice.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraAudioEncoderSettingsControl;
+class BbCameraCaptureBufferFormatControl;
+class BbCameraCaptureDestinationControl;
+class BbCameraControl;
+class BbCameraExposureControl;
+class BbCameraFlashControl;
+class BbCameraFocusControl;
+class BbCameraImageCaptureControl;
+class BbCameraImageProcessingControl;
+class BbCameraLocksControl;
+class BbCameraMediaRecorderControl;
+class BbCameraSession;
+class BbCameraVideoEncoderSettingsControl;
+class BbCameraViewfinderSettingsControl;
+class BbCameraZoomControl;
+class BbImageEncoderControl;
+class BbVideoDeviceSelectorControl;
+class BbVideoRendererControl;
+
+class BbCameraService : public QMediaService
+{
+ Q_OBJECT
+
+public:
+ explicit BbCameraService(QObject *parent = 0);
+ ~BbCameraService();
+
+ virtual QMediaControl* requestControl(const char *name);
+ virtual void releaseControl(QMediaControl *control);
+
+private:
+ BbCameraSession* m_cameraSession;
+
+ BbCameraAudioEncoderSettingsControl* m_cameraAudioEncoderSettingsControl;
+ BbCameraCaptureBufferFormatControl* m_cameraCaptureBufferFormatControl;
+ BbCameraCaptureDestinationControl* m_cameraCaptureDestinationControl;
+ BbCameraControl* m_cameraControl;
+ BbCameraExposureControl* m_cameraExposureControl;
+ BbCameraFlashControl* m_cameraFlashControl;
+ BbCameraFocusControl* m_cameraFocusControl;
+ BbCameraImageCaptureControl* m_cameraImageCaptureControl;
+ BbCameraImageProcessingControl* m_cameraImageProcessingControl;
+ BbCameraLocksControl* m_cameraLocksControl;
+ BbCameraMediaRecorderControl* m_cameraMediaRecorderControl;
+ BbCameraVideoEncoderSettingsControl* m_cameraVideoEncoderSettingsControl;
+ BbCameraViewfinderSettingsControl* m_cameraViewfinderSettingsControl;
+ BbCameraZoomControl* m_cameraZoomControl;
+ BbImageEncoderControl* m_imageEncoderControl;
+ BbVideoDeviceSelectorControl* m_videoDeviceSelectorControl;
+ BbVideoRendererControl* m_videoRendererControl;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcamerasession.cpp b/src/plugins/blackberry/camera/bbcamerasession.cpp
new file mode 100644
index 000000000..d2eb62278
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerasession.cpp
@@ -0,0 +1,1281 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcamerasession.h"
+
+#include "bbcameraorientationhandler.h"
+#include "bbcameraviewfindersettingscontrol.h"
+#include "windowgrabber.h"
+
+#include <QAbstractVideoSurface>
+#include <QBuffer>
+#include <QDebug>
+#include <QImage>
+#include <QUrl>
+#include <QVideoSurfaceFormat>
+#include <qmath.h>
+
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+
+static QString errorToString(camera_error_t error)
+{
+ switch (error) {
+ case CAMERA_EOK:
+ return QLatin1String("No error");
+ case CAMERA_EAGAIN:
+ return QLatin1String("Camera unavailable");
+ case CAMERA_EINVAL:
+ return QLatin1String("Inavlid argument");
+ case CAMERA_ENODEV:
+ return QLatin1String("Camera not found");
+ case CAMERA_EMFILE:
+ return QLatin1String("File table overflow");
+ case CAMERA_EBADF:
+ return QLatin1String("Invalid handle passed");
+ case CAMERA_EACCESS:
+ return QLatin1String("No permission");
+ case CAMERA_EBADR:
+ return QLatin1String("Invalid file descriptor");
+ case CAMERA_ENOENT:
+ return QLatin1String("File or directory does not exists");
+ case CAMERA_ENOMEM:
+ return QLatin1String("Memory allocation failed");
+ case CAMERA_EOPNOTSUPP:
+ return QLatin1String("Operation not supported");
+ case CAMERA_ETIMEDOUT:
+ return QLatin1String("Communication timeout");
+ case CAMERA_EALREADY:
+ return QLatin1String("Operation already in progress");
+ case CAMERA_ENOSPC:
+ return QLatin1String("Disk is full");
+ case CAMERA_EUNINIT:
+ return QLatin1String("Camera library not initialized");
+ case CAMERA_EREGFAULT:
+ return QLatin1String("Callback registration failed");
+ case CAMERA_EMICINUSE:
+ return QLatin1String("Microphone in use already");
+ case CAMERA_EDESKTOPCAMERAINUSE:
+ return QLatin1String("Desktop camera in use already");
+ default:
+ return QLatin1String("Unknown error");
+ }
+}
+
+QDebug operator<<(QDebug debug, camera_error_t error)
+{
+ debug.nospace() << errorToString(error);
+ return debug.space();
+}
+
+BbCameraSession::BbCameraSession(QObject *parent)
+ : QObject(parent)
+ , m_nativeCameraOrientation(0)
+ , m_orientationHandler(new BbCameraOrientationHandler(this))
+ , m_status(QCamera::UnloadedStatus)
+ , m_state(QCamera::UnloadedState)
+ , m_captureMode(QCamera::CaptureStillImage)
+ , m_device("bb:RearCamera")
+ , m_previewIsVideo(true)
+ , m_surface(0)
+ , m_captureImageDriveMode(QCameraImageCapture::SingleImageCapture)
+ , m_lastImageCaptureId(0)
+ , m_captureDestination(QCameraImageCapture::CaptureToFile)
+ , m_locksApplyMode(IndependentMode)
+ , m_focusLockStatus(QCamera::Unlocked)
+ , m_videoState(QMediaRecorder::StoppedState)
+ , m_videoStatus(QMediaRecorder::LoadedStatus)
+ , m_handle(CAMERA_HANDLE_INVALID)
+ , m_windowGrabber(new WindowGrabber(this))
+{
+ connect(this, SIGNAL(statusChanged(QCamera::Status)), SLOT(updateReadyForCapture()));
+ connect(this, SIGNAL(captureModeChanged(QCamera::CaptureModes)), SLOT(updateReadyForCapture()));
+ connect(m_orientationHandler, SIGNAL(orientationChanged(int)), SLOT(deviceOrientationChanged(int)));
+
+ connect(m_windowGrabber, SIGNAL(frameGrabbed(QImage)), SLOT(viewfinderFrameGrabbed(QImage)));
+}
+
+BbCameraSession::~BbCameraSession()
+{
+ stopViewFinder();
+ closeCamera();
+}
+
+camera_handle_t BbCameraSession::handle() const
+{
+ return m_handle;
+}
+
+QCamera::State BbCameraSession::state() const
+{
+ return m_state;
+}
+
+void BbCameraSession::setState(QCamera::State state)
+{
+ if (m_state == state)
+ return;
+
+ const QCamera::State previousState = m_state;
+
+ if (previousState == QCamera::UnloadedState) {
+ if (state == QCamera::LoadedState) {
+ if (openCamera()) {
+ m_state = state;
+ }
+ } else if (state == QCamera::ActiveState) {
+ if (openCamera()) {
+ applyConfiguration();
+ if (startViewFinder()) {
+ m_state = state;
+ }
+ }
+ }
+ } else if (previousState == QCamera::LoadedState) {
+ if (state == QCamera::UnloadedState) {
+ closeCamera();
+ m_state = state;
+ } else if (state == QCamera::ActiveState) {
+ applyConfiguration();
+ if (startViewFinder()) {
+ m_state = state;
+ }
+ }
+ } else if (previousState == QCamera::ActiveState) {
+ if (state == QCamera::LoadedState) {
+ stopViewFinder();
+ m_state = state;
+ } else if (state == QCamera::UnloadedState) {
+ stopViewFinder();
+ closeCamera();
+ m_state = state;
+ }
+ }
+
+ if (m_state != previousState)
+ emit stateChanged(m_state);
+}
+
+QCamera::Status BbCameraSession::status() const
+{
+ return m_status;
+}
+
+QCamera::CaptureModes BbCameraSession::captureMode() const
+{
+ return m_captureMode;
+}
+
+void BbCameraSession::setCaptureMode(QCamera::CaptureModes captureMode)
+{
+ if (m_captureMode == captureMode)
+ return;
+
+ m_captureMode = captureMode;
+ emit captureModeChanged(m_captureMode);
+}
+
+bool BbCameraSession::isCaptureModeSupported(QCamera::CaptureModes mode) const
+{
+ if (m_handle == CAMERA_HANDLE_INVALID) {
+ // the camera has not been loaded yet via QCamera::load(), so
+ // we open it temporarily to peek for the supported capture modes
+
+ camera_unit_t unit = CAMERA_UNIT_REAR;
+ if (m_device == cameraIdentifierFront())
+ unit = CAMERA_UNIT_FRONT;
+ else if (m_device == cameraIdentifierRear())
+ unit = CAMERA_UNIT_REAR;
+ else if (m_device == cameraIdentifierDesktop())
+ unit = CAMERA_UNIT_DESKTOP;
+
+ camera_handle_t handle;
+ const camera_error_t result = camera_open(unit, CAMERA_MODE_RW, &handle);
+ if (result != CAMERA_EOK)
+ return true;
+
+ const bool supported = isCaptureModeSupported(handle, mode);
+
+ camera_close(handle);
+
+ return supported;
+ } else {
+ return isCaptureModeSupported(m_handle, mode);
+ }
+}
+
+QByteArray BbCameraSession::cameraIdentifierFront()
+{
+ return "bb:FrontCamera";
+}
+
+QByteArray BbCameraSession::cameraIdentifierRear()
+{
+ return "bb:RearCamera";
+}
+
+QByteArray BbCameraSession::cameraIdentifierDesktop()
+{
+ return "bb:DesktopCamera";
+}
+
+void BbCameraSession::setDevice(const QByteArray &device)
+{
+ m_device = device;
+}
+
+QByteArray BbCameraSession::device() const
+{
+ return m_device;
+}
+
+QAbstractVideoSurface* BbCameraSession::surface() const
+{
+ return m_surface;
+}
+
+void BbCameraSession::setSurface(QAbstractVideoSurface *surface)
+{
+ QMutexLocker locker(&m_surfaceMutex);
+
+ if (m_surface == surface)
+ return;
+
+ m_surface = surface;
+}
+
+bool BbCameraSession::isReadyForCapture() const
+{
+ if (m_captureMode & QCamera::CaptureStillImage)
+ return (m_status == QCamera::ActiveStatus);
+
+ if (m_captureMode & QCamera::CaptureVideo)
+ return (m_status == QCamera::ActiveStatus);
+
+ return false;
+}
+
+QCameraImageCapture::DriveMode BbCameraSession::driveMode() const
+{
+ return m_captureImageDriveMode;
+}
+
+void BbCameraSession::setDriveMode(QCameraImageCapture::DriveMode mode)
+{
+ m_captureImageDriveMode = mode;
+}
+
+/**
+ * A helper structure that keeps context data for image capture callbacks.
+ */
+struct ImageCaptureData
+{
+ int requestId;
+ QString fileName;
+ BbCameraSession *session;
+};
+
+static void imageCaptureShutterCallback(camera_handle_t handle, void *context)
+{
+ Q_UNUSED(handle)
+
+ const ImageCaptureData *data = static_cast<ImageCaptureData*>(context);
+
+ // We are inside a worker thread here, so emit imageExposed inside the main thread
+ QMetaObject::invokeMethod(data->session, "imageExposed", Qt::QueuedConnection,
+ Q_ARG(int, data->requestId));
+}
+
+static void imageCaptureImageCallback(camera_handle_t handle, camera_buffer_t *buffer, void *context)
+{
+ Q_UNUSED(handle)
+
+ QScopedPointer<ImageCaptureData> data(static_cast<ImageCaptureData*>(context));
+
+ if (buffer->frametype != CAMERA_FRAMETYPE_JPEG) {
+ // We are inside a worker thread here, so emit error signal inside the main thread
+ QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection,
+ Q_ARG(int, data->requestId),
+ Q_ARG(QCameraImageCapture::Error, QCameraImageCapture::FormatError),
+ Q_ARG(QString, QObject::tr("Camera provides image in unsupported format")));
+ return;
+ }
+
+ const QByteArray rawData((const char*)buffer->framebuf, buffer->framedesc.jpeg.bufsize);
+
+ QImage image;
+ const bool ok = image.loadFromData(rawData, "JPG");
+ if (!ok) {
+ const QString errorMessage = QObject::tr("Could not load JPEG data from frame");
+ // We are inside a worker thread here, so emit error signal inside the main thread
+ QMetaObject::invokeMethod(data->session, "imageCaptureError", Qt::QueuedConnection,
+ Q_ARG(int, data->requestId),
+ Q_ARG(QCameraImageCapture::Error, QCameraImageCapture::FormatError),
+ Q_ARG(QString, errorMessage));
+ return;
+ }
+
+
+ // We are inside a worker thread here, so invoke imageCaptured inside the main thread
+ QMetaObject::invokeMethod(data->session, "imageCaptured", Qt::QueuedConnection,
+ Q_ARG(int, data->requestId),
+ Q_ARG(QImage, image),
+ Q_ARG(QString, data->fileName));
+}
+
+int BbCameraSession::capture(const QString &fileName)
+{
+ m_lastImageCaptureId++;
+
+ if (!isReadyForCapture()) {
+ emit imageCaptureError(m_lastImageCaptureId, QCameraImageCapture::NotReadyError, tr("Camera not ready"));
+ return m_lastImageCaptureId;
+ }
+
+ if (m_captureImageDriveMode == QCameraImageCapture::SingleImageCapture) {
+ // prepare context object for callback
+ ImageCaptureData *context = new ImageCaptureData;
+ context->requestId = m_lastImageCaptureId;
+ context->fileName = fileName;
+ context->session = this;
+
+ const camera_error_t result = camera_take_photo(m_handle,
+ imageCaptureShutterCallback,
+ 0,
+ 0,
+ imageCaptureImageCallback,
+ context, false);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to take photo:" << result;
+ } else {
+ // TODO: implement burst mode when available in Qt API
+ }
+
+ return m_lastImageCaptureId;
+}
+
+void BbCameraSession::cancelCapture()
+{
+ // BB10 API doesn't provide functionality for that
+}
+
+bool BbCameraSession::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
+{
+ // capture to buffer, file and both are supported.
+ return destination & (QCameraImageCapture::CaptureToFile | QCameraImageCapture::CaptureToBuffer);
+}
+
+QCameraImageCapture::CaptureDestinations BbCameraSession::captureDestination() const
+{
+ return m_captureDestination;
+}
+
+void BbCameraSession::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
+{
+ if (m_captureDestination != destination) {
+ m_captureDestination = destination;
+ emit captureDestinationChanged(m_captureDestination);
+ }
+}
+
+QList<QSize> BbCameraSession::supportedResolutions(const QImageEncoderSettings&, bool *continuous) const
+{
+ if (continuous)
+ *continuous = false;
+
+ if (m_status == QCamera::UnloadedStatus)
+ return QList<QSize>();
+
+ if (m_captureMode & QCamera::CaptureStillImage) {
+ return supportedResolutions(QCamera::CaptureStillImage);
+ } else if (m_captureMode & QCamera::CaptureVideo) {
+ return supportedResolutions(QCamera::CaptureVideo);
+ }
+
+ return QList<QSize>();
+}
+
+QImageEncoderSettings BbCameraSession::imageSettings() const
+{
+ return m_imageEncoderSettings;
+}
+
+void BbCameraSession::setImageSettings(const QImageEncoderSettings &settings)
+{
+ m_imageEncoderSettings = settings;
+ if (m_imageEncoderSettings.codec().isEmpty())
+ m_imageEncoderSettings.setCodec(QLatin1String("jpeg"));
+}
+
+QCamera::LockTypes BbCameraSession::supportedLocks() const
+{
+ if (m_locksApplyMode == FocusOnlyMode)
+ return QCamera::LockFocus;
+ else
+ return (QCamera::LockExposure | QCamera::LockWhiteBalance | QCamera::LockFocus);
+}
+
+QCamera::LockStatus BbCameraSession::lockStatus(QCamera::LockType lock) const
+{
+ switch (lock) {
+ case QCamera::LockExposure:
+ return QCamera::Unlocked;
+ case QCamera::LockWhiteBalance:
+ return QCamera::Unlocked;
+ case QCamera::LockFocus:
+ return m_focusLockStatus;
+ default:
+ return QCamera::Unlocked;
+ }
+}
+
+void BbCameraSession::searchAndLock(QCamera::LockTypes locks)
+{
+ m_currentLockTypes |= locks;
+
+ uint32_t lockModes = CAMERA_3A_NONE;
+
+ switch (m_locksApplyMode) {
+ case IndependentMode:
+ if (m_currentLockTypes & QCamera::LockExposure)
+ lockModes |= CAMERA_3A_AUTOEXPOSURE;
+ if (m_currentLockTypes & QCamera::LockWhiteBalance)
+ lockModes |= CAMERA_3A_AUTOWHITEBALANCE;
+ if (m_currentLockTypes & QCamera::LockFocus)
+ lockModes |= CAMERA_3A_AUTOFOCUS;
+ break;
+ case FocusExposureBoundMode:
+ if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus))
+ lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS);
+ break;
+ case AllBoundMode:
+ lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE);
+ break;
+ case FocusOnlyMode:
+ lockModes = CAMERA_3A_AUTOFOCUS;
+ break;
+ }
+
+ const camera_error_t result = camera_set_3a_lock(m_handle, lockModes);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to set lock modes:" << result;
+ }
+}
+
+void BbCameraSession::unlock(QCamera::LockTypes locks)
+{
+ m_currentLockTypes &= ~locks;
+
+ uint32_t lockModes = CAMERA_3A_NONE;
+
+ switch (m_locksApplyMode) {
+ case IndependentMode:
+ if (m_currentLockTypes & QCamera::LockExposure)
+ lockModes |= CAMERA_3A_AUTOEXPOSURE;
+ if (m_currentLockTypes & QCamera::LockWhiteBalance)
+ lockModes |= CAMERA_3A_AUTOWHITEBALANCE;
+ if (m_currentLockTypes & QCamera::LockFocus)
+ lockModes |= CAMERA_3A_AUTOFOCUS;
+ break;
+ case FocusExposureBoundMode:
+ if ((m_currentLockTypes & QCamera::LockExposure) || (m_currentLockTypes & QCamera::LockFocus))
+ lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS);
+ break;
+ case AllBoundMode:
+ lockModes = (CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOWHITEBALANCE);
+ break;
+ case FocusOnlyMode:
+ lockModes = CAMERA_3A_AUTOFOCUS;
+ break;
+ }
+
+ const camera_error_t result = camera_set_3a_lock(m_handle, lockModes);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set lock modes:" << result;
+}
+
+QUrl BbCameraSession::outputLocation() const
+{
+ return QUrl::fromLocalFile(m_videoOutputLocation);
+}
+
+bool BbCameraSession::setOutputLocation(const QUrl &location)
+{
+ m_videoOutputLocation = location.toLocalFile();
+
+ return true;
+}
+
+QMediaRecorder::State BbCameraSession::videoState() const
+{
+ return m_videoState;
+}
+
+void BbCameraSession::setVideoState(QMediaRecorder::State state)
+{
+ if (m_videoState == state)
+ return;
+
+ const QMediaRecorder::State previousState = m_videoState;
+
+ if (previousState == QMediaRecorder::StoppedState) {
+ if (state == QMediaRecorder::RecordingState) {
+ if (startVideoRecording()) {
+ m_videoState = state;
+ }
+ } else if (state == QMediaRecorder::PausedState) {
+ // do nothing
+ }
+ } else if (previousState == QMediaRecorder::RecordingState) {
+ if (state == QMediaRecorder::StoppedState) {
+ stopVideoRecording();
+ m_videoState = state;
+ } else if (state == QMediaRecorder::PausedState) {
+ //TODO: (pause) not supported by BB10 API yet
+ }
+ } else if (previousState == QMediaRecorder::PausedState) {
+ if (state == QMediaRecorder::StoppedState) {
+ stopVideoRecording();
+ m_videoState = state;
+ } else if (state == QMediaRecorder::RecordingState) {
+ //TODO: (resume) not supported by BB10 API yet
+ }
+ }
+
+ emit videoStateChanged(m_videoState);
+}
+
+QMediaRecorder::Status BbCameraSession::videoStatus() const
+{
+ return m_videoStatus;
+}
+
+qint64 BbCameraSession::duration() const
+{
+ return (m_videoRecordingDuration.isValid() ? m_videoRecordingDuration.elapsed() : 0);
+}
+
+void BbCameraSession::applyVideoSettings()
+{
+ if (m_handle == CAMERA_HANDLE_INVALID)
+ return;
+
+ // apply viewfinder configuration
+ const QList<QSize> videoOutputResolutions = supportedResolutions(QCamera::CaptureVideo);
+
+ if (!m_videoEncoderSettings.resolution().isValid() || !videoOutputResolutions.contains(m_videoEncoderSettings.resolution()))
+ m_videoEncoderSettings.setResolution(videoOutputResolutions.first());
+
+ QSize viewfinderResolution;
+
+ if (m_previewIsVideo) {
+ // The viewfinder is responsible for encoding the video frames, so the resolutions must match.
+ viewfinderResolution = m_videoEncoderSettings.resolution();
+ } else {
+ // The frames are encoded separately from the viewfinder, so only the aspect ratio must match.
+ const QSize videoResolution = m_videoEncoderSettings.resolution();
+ const qreal aspectRatio = static_cast<qreal>(videoResolution.width())/static_cast<qreal>(videoResolution.height());
+
+ QList<QSize> sizes = supportedViewfinderResolutions(QCamera::CaptureVideo);
+ std::reverse(sizes.begin(), sizes.end()); // use smallest possible resolution
+ foreach (const QSize &size, sizes) {
+ // search for viewfinder resolution with the same aspect ratio
+ if (qFuzzyCompare(aspectRatio, (static_cast<qreal>(size.width())/static_cast<qreal>(size.height())))) {
+ viewfinderResolution = size;
+ break;
+ }
+ }
+ }
+
+ Q_ASSERT(viewfinderResolution.isValid());
+
+ const QByteArray windowId = QString().sprintf("qcamera_vf_%p", this).toLatin1();
+ m_windowGrabber->setWindowId(windowId);
+
+ const QByteArray windowGroupId = m_windowGrabber->windowGroupId();
+
+ camera_error_t result = CAMERA_EOK;
+ result = camera_set_videovf_property(m_handle,
+ CAMERA_IMGPROP_WIN_GROUPID, windowGroupId.data(),
+ CAMERA_IMGPROP_WIN_ID, windowId.data(),
+ CAMERA_IMGPROP_WIDTH, viewfinderResolution.width(),
+ CAMERA_IMGPROP_HEIGHT, viewfinderResolution.height(),
+ CAMERA_IMGPROP_ROTATION, 360 - m_nativeCameraOrientation);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to apply video viewfinder settings:" << result;
+ return;
+ }
+
+ QString videoCodec = m_videoEncoderSettings.codec();
+ if (videoCodec.isEmpty())
+ videoCodec = QLatin1String("h264");
+
+ camera_videocodec_t cameraVideoCodec = CAMERA_VIDEOCODEC_H264;
+ if (videoCodec == QLatin1String("none"))
+ cameraVideoCodec = CAMERA_VIDEOCODEC_NONE;
+ else if (videoCodec == QLatin1String("avc1"))
+ cameraVideoCodec = CAMERA_VIDEOCODEC_AVC1;
+ else if (videoCodec == QLatin1String("h264"))
+ cameraVideoCodec = CAMERA_VIDEOCODEC_H264;
+
+ const QSize resolution = m_videoEncoderSettings.resolution();
+
+ qreal frameRate = m_videoEncoderSettings.frameRate();
+ if (frameRate == 0) {
+ const QList<qreal> frameRates = supportedFrameRates(QVideoEncoderSettings(), 0);
+ if (!frameRates.isEmpty())
+ frameRate = frameRates.last();
+ }
+
+ QString audioCodec = m_audioEncoderSettings.codec();
+ if (audioCodec.isEmpty())
+ audioCodec = QLatin1String("aac");
+
+ camera_audiocodec_t cameraAudioCodec = CAMERA_AUDIOCODEC_AAC;
+ if (audioCodec == QLatin1String("none"))
+ cameraAudioCodec = CAMERA_AUDIOCODEC_NONE;
+ else if (audioCodec == QLatin1String("aac"))
+ cameraAudioCodec = CAMERA_AUDIOCODEC_AAC;
+ else if (audioCodec == QLatin1String("raw"))
+ cameraAudioCodec = CAMERA_AUDIOCODEC_RAW;
+
+ result = camera_set_video_property(m_handle,
+ CAMERA_IMGPROP_WIDTH, resolution.width(),
+ CAMERA_IMGPROP_HEIGHT, resolution.height(),
+ CAMERA_IMGPROP_VIDEOCODEC, cameraVideoCodec,
+ CAMERA_IMGPROP_AUDIOCODEC, cameraAudioCodec);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to apply video settings:" << result;
+ emit videoError(QMediaRecorder::ResourceError, tr("Unable to apply video settings"));
+ }
+}
+
+QList<QSize> BbCameraSession::supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const
+{
+ Q_UNUSED(settings);
+
+ if (continuous)
+ *continuous = false;
+
+ return supportedResolutions(QCamera::CaptureVideo);
+}
+
+QList<qreal> BbCameraSession::supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const
+{
+ Q_UNUSED(settings);
+
+ if (m_handle == CAMERA_HANDLE_INVALID)
+ return QList<qreal>();
+
+ int supported = 0;
+ double rates[20];
+ bool maxmin = false;
+
+ /**
+ * Since in current version of the BB10 platform the video viewfinder encodes the video frames, we use
+ * the values as returned by camera_get_video_vf_framerates().
+ */
+ const camera_error_t result = camera_get_video_vf_framerates(m_handle, 20, &supported, rates, &maxmin);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve supported viewfinder framerates:" << result;
+ return QList<qreal>();
+ }
+
+ QList<qreal> frameRates;
+ for (int i = 0; i < supported; ++i)
+ frameRates << rates[i];
+
+ if (continuous)
+ *continuous = maxmin;
+
+ return frameRates;
+}
+
+QVideoEncoderSettings BbCameraSession::videoSettings() const
+{
+ return m_videoEncoderSettings;
+}
+
+void BbCameraSession::setVideoSettings(const QVideoEncoderSettings &settings)
+{
+ m_videoEncoderSettings = settings;
+}
+
+QAudioEncoderSettings BbCameraSession::audioSettings() const
+{
+ return m_audioEncoderSettings;
+}
+
+void BbCameraSession::setAudioSettings(const QAudioEncoderSettings &settings)
+{
+ m_audioEncoderSettings = settings;
+}
+
+void BbCameraSession::updateReadyForCapture()
+{
+ emit readyForCaptureChanged(isReadyForCapture());
+}
+
+void BbCameraSession::imageCaptured(int requestId, const QImage &rawImage, const QString &fileName)
+{
+ QTransform transform;
+
+ // subtract out the native rotation
+ transform.rotate(m_nativeCameraOrientation);
+
+ // subtract out the current device orientation
+ if (m_device == cameraIdentifierRear())
+ transform.rotate(360 - m_orientationHandler->orientation());
+ else
+ transform.rotate(m_orientationHandler->orientation());
+
+ const QImage image = rawImage.transformed(transform);
+
+ // Generate snap preview as downscaled image
+ {
+ QSize previewSize = image.size();
+ int downScaleSteps = 0;
+ while (previewSize.width() > 800 && downScaleSteps < 8) {
+ previewSize.rwidth() /= 2;
+ previewSize.rheight() /= 2;
+ downScaleSteps++;
+ }
+
+ const QImage snapPreview = image.scaled(previewSize);
+
+ emit imageCaptured(requestId, snapPreview);
+ }
+
+ if (m_captureDestination & QCameraImageCapture::CaptureToBuffer) {
+ QVideoFrame frame(image);
+
+ emit imageAvailable(requestId, frame);
+ }
+
+ if (m_captureDestination & QCameraImageCapture::CaptureToFile) {
+ const QString actualFileName = m_mediaStorageLocation.generateFileName(fileName,
+ QCamera::CaptureStillImage,
+ QLatin1String("IMG_"),
+ QLatin1String("jpg"));
+
+ QFile file(actualFileName);
+ if (file.open(QFile::WriteOnly)) {
+ if (image.save(&file, "JPG")) {
+ emit imageSaved(requestId, actualFileName);
+ } else {
+ emit imageCaptureError(requestId, QCameraImageCapture::OutOfSpaceError, file.errorString());
+ }
+ } else {
+ const QString errorMessage = tr("Could not open destination file:\n%1").arg(actualFileName);
+ emit imageCaptureError(requestId, QCameraImageCapture::ResourceError, errorMessage);
+ }
+ }
+}
+
+void BbCameraSession::handleFocusStatusChanged(int value)
+{
+ const camera_focusstate_t focusState = static_cast<camera_focusstate_t>(value);
+
+ switch (focusState) {
+ case CAMERA_FOCUSSTATE_NONE:
+ case CAMERA_FOCUSSTATE_WAITING:
+ m_focusLockStatus = QCamera::Unlocked;
+ emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::UserRequest);
+ break;
+ case CAMERA_FOCUSSTATE_SEARCHING:
+ m_focusLockStatus = QCamera::Searching;
+ emit lockStatusChanged(QCamera::LockFocus, QCamera::Searching, QCamera::UserRequest);
+ break;
+ case CAMERA_FOCUSSTATE_FAILED:
+ m_focusLockStatus = QCamera::Unlocked;
+ emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockFailed);
+ break;
+ case CAMERA_FOCUSSTATE_LOCKED:
+ m_focusLockStatus = QCamera::Locked;
+ emit lockStatusChanged(QCamera::LockFocus, QCamera::Locked, QCamera::LockAcquired);
+ break;
+ case CAMERA_FOCUSSTATE_SCENECHANGE:
+ m_focusLockStatus = QCamera::Unlocked;
+ emit lockStatusChanged(QCamera::LockFocus, QCamera::Unlocked, QCamera::LockTemporaryLost);
+ break;
+ default:
+ break;
+ }
+}
+
+void BbCameraSession::handleVideoRecordingPaused()
+{
+ //TODO: implement once BB10 API supports pausing a video
+}
+
+void BbCameraSession::handleVideoRecordingResumed()
+{
+ if (m_videoStatus == QMediaRecorder::StartingStatus) {
+ m_videoStatus = QMediaRecorder::RecordingStatus;
+ emit videoStatusChanged(m_videoStatus);
+
+ m_videoRecordingDuration.restart();
+ }
+}
+
+void BbCameraSession::deviceOrientationChanged(int angle)
+{
+ if (m_handle != CAMERA_HANDLE_INVALID)
+ camera_set_device_orientation(m_handle, angle);
+}
+
+void BbCameraSession::handleCameraPowerUp()
+{
+ stopViewFinder();
+ startViewFinder();
+}
+
+void BbCameraSession::viewfinderFrameGrabbed(const QImage &image)
+{
+ QTransform transform;
+
+ transform.rotate(m_nativeCameraOrientation);
+
+ QImage frame = image.copy().transformed(transform);
+ if (m_device == cameraIdentifierFront())
+ frame = frame.mirrored(true, false);
+
+ QMutexLocker locker(&m_surfaceMutex);
+ if (m_surface) {
+ if (frame.size() != m_surface->surfaceFormat().frameSize()) {
+ m_surface->stop();
+ m_surface->start(QVideoSurfaceFormat(frame.size(), QVideoFrame::Format_ARGB32));
+ }
+
+ QVideoFrame videoFrame(frame);
+
+ m_surface->present(videoFrame);
+ }
+}
+
+bool BbCameraSession::openCamera()
+{
+ if (m_handle != CAMERA_HANDLE_INVALID) // camera is already open
+ return true;
+
+ m_status = QCamera::LoadingStatus;
+ emit statusChanged(m_status);
+
+ camera_unit_t unit = CAMERA_UNIT_REAR;
+ if (m_device == cameraIdentifierFront())
+ unit = CAMERA_UNIT_FRONT;
+ else if (m_device == cameraIdentifierRear())
+ unit = CAMERA_UNIT_REAR;
+ else if (m_device == cameraIdentifierDesktop())
+ unit = CAMERA_UNIT_DESKTOP;
+
+ camera_error_t result = camera_open(unit, CAMERA_MODE_RW, &m_handle);
+ if (result != CAMERA_EOK) {
+ m_handle = CAMERA_HANDLE_INVALID;
+ m_status = QCamera::UnloadedStatus;
+ emit statusChanged(m_status);
+
+ qWarning() << "Unable to open camera:" << result;
+ emit error(QCamera::CameraError, tr("Unable to open camera"));
+ return false;
+ }
+
+ result = camera_get_native_orientation(m_handle, &m_nativeCameraOrientation);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve native camera orientation:" << result;
+ emit error(QCamera::CameraError, tr("Unable to retrieve native camera orientation"));
+ return false;
+ }
+
+ m_previewIsVideo = camera_has_feature(m_handle, CAMERA_FEATURE_PREVIEWISVIDEO);
+
+ m_status = QCamera::LoadedStatus;
+ emit statusChanged(m_status);
+
+ return true;
+}
+
+void BbCameraSession::closeCamera()
+{
+ if (m_handle == CAMERA_HANDLE_INVALID) // camera is closed already
+ return;
+
+ m_status = QCamera::UnloadingStatus;
+ emit statusChanged(m_status);
+
+ const camera_error_t result = camera_close(m_handle);
+ if (result != CAMERA_EOK) {
+ m_status = QCamera::LoadedStatus;
+ emit statusChanged(m_status);
+
+ qWarning() << "Unable to close camera:" << result;
+ emit error(QCamera::CameraError, tr("Unable to close camera"));
+ return;
+ }
+
+ m_handle = CAMERA_HANDLE_INVALID;
+
+ m_status = QCamera::UnloadedStatus;
+ emit statusChanged(m_status);
+}
+
+static void viewFinderStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context)
+{
+ Q_UNUSED(handle)
+
+ if (status == CAMERA_STATUS_FOCUS_CHANGE) {
+ BbCameraSession *session = static_cast<BbCameraSession*>(context);
+ QMetaObject::invokeMethod(session, "handleFocusStatusChanged", Qt::QueuedConnection, Q_ARG(int, value));
+ } else if (status == CAMERA_STATUS_POWERUP) {
+ BbCameraSession *session = static_cast<BbCameraSession*>(context);
+ QMetaObject::invokeMethod(session, "handleCameraPowerUp", Qt::QueuedConnection);
+ }
+}
+
+bool BbCameraSession::startViewFinder()
+{
+ m_status = QCamera::StartingStatus;
+ emit statusChanged(m_status);
+
+ QSize viewfinderResolution;
+ camera_error_t result = CAMERA_EOK;
+ if (m_captureMode & QCamera::CaptureStillImage) {
+ result = camera_start_photo_viewfinder(m_handle, 0, viewFinderStatusCallback, this);
+ viewfinderResolution = currentViewfinderResolution(QCamera::CaptureStillImage);
+ } else if (m_captureMode & QCamera::CaptureVideo) {
+ result = camera_start_video_viewfinder(m_handle, 0, viewFinderStatusCallback, this);
+ viewfinderResolution = currentViewfinderResolution(QCamera::CaptureVideo);
+ }
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to start viewfinder:" << result;
+ return false;
+ }
+
+ // retrieve information about lock apply modes
+ {
+ int supported = 0;
+ uint32_t modes[20];
+
+ const camera_error_t result = camera_get_3a_lock_modes(m_handle, 20, &supported, modes);
+
+ if (result == CAMERA_EOK) {
+ // see API documentation of camera_get_3a_lock_modes for explanation of case discrimination below
+ if (supported == 4) {
+ m_locksApplyMode = IndependentMode;
+ } else if (supported == 3) {
+ m_locksApplyMode = FocusExposureBoundMode;
+ } else if (supported == 2) {
+ if (modes[0] == (CAMERA_3A_AUTOFOCUS | CAMERA_3A_AUTOEXPOSURE | CAMERA_3A_AUTOWHITEBALANCE))
+ m_locksApplyMode = AllBoundMode;
+ else
+ m_locksApplyMode = FocusOnlyMode;
+ }
+ }
+ }
+
+ const int angle = m_orientationHandler->orientation();
+
+ const QSize rotatedSize = ((angle == 0 || angle == 180) ? viewfinderResolution
+ : viewfinderResolution.transposed());
+
+ m_surfaceMutex.lock();
+ if (m_surface) {
+ const bool ok = m_surface->start(QVideoSurfaceFormat(rotatedSize, QVideoFrame::Format_ARGB32));
+ if (!ok)
+ qWarning() << "Unable to start camera viewfinder surface";
+ }
+ m_surfaceMutex.unlock();
+
+ m_status = QCamera::ActiveStatus;
+ emit statusChanged(m_status);
+
+ return true;
+}
+
+void BbCameraSession::stopViewFinder()
+{
+ m_windowGrabber->stop();
+
+ m_status = QCamera::StoppingStatus;
+ emit statusChanged(m_status);
+
+ m_surfaceMutex.lock();
+ if (m_surface) {
+ m_surface->stop();
+ }
+ m_surfaceMutex.unlock();
+
+ camera_error_t result = CAMERA_EOK;
+ if (m_captureMode & QCamera::CaptureStillImage)
+ result = camera_stop_photo_viewfinder(m_handle);
+ else if (m_captureMode & QCamera::CaptureVideo)
+ result = camera_stop_video_viewfinder(m_handle);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to stop viewfinder:" << result;
+ return;
+ }
+
+ m_status = QCamera::LoadedStatus;
+ emit statusChanged(m_status);
+}
+
+void BbCameraSession::applyConfiguration()
+{
+ if (m_captureMode & QCamera::CaptureStillImage) {
+ const QList<QSize> photoOutputResolutions = supportedResolutions(QCamera::CaptureStillImage);
+
+ if (!m_imageEncoderSettings.resolution().isValid() || !photoOutputResolutions.contains(m_imageEncoderSettings.resolution()))
+ m_imageEncoderSettings.setResolution(photoOutputResolutions.first());
+
+ const QSize photoResolution = m_imageEncoderSettings.resolution();
+ const qreal aspectRatio = static_cast<qreal>(photoResolution.width())/static_cast<qreal>(photoResolution.height());
+
+ // apply viewfinder configuration
+ QSize viewfinderResolution;
+ QList<QSize> sizes = supportedViewfinderResolutions(QCamera::CaptureStillImage);
+ std::reverse(sizes.begin(), sizes.end()); // use smallest possible resolution
+ foreach (const QSize &size, sizes) {
+ // search for viewfinder resolution with the same aspect ratio
+ if (qFuzzyCompare(aspectRatio, (static_cast<qreal>(size.width())/static_cast<qreal>(size.height())))) {
+ viewfinderResolution = size;
+ break;
+ }
+ }
+
+ Q_ASSERT(viewfinderResolution.isValid());
+
+ const QByteArray windowId = QString().sprintf("qcamera_vf_%p", this).toLatin1();
+ m_windowGrabber->setWindowId(windowId);
+
+ const QByteArray windowGroupId = m_windowGrabber->windowGroupId();
+
+ camera_error_t result = camera_set_photovf_property(m_handle,
+ CAMERA_IMGPROP_WIN_GROUPID, windowGroupId.data(),
+ CAMERA_IMGPROP_WIN_ID, windowId.data(),
+ CAMERA_IMGPROP_WIDTH, viewfinderResolution.width(),
+ CAMERA_IMGPROP_HEIGHT, viewfinderResolution.height(),
+ CAMERA_IMGPROP_FORMAT, CAMERA_FRAMETYPE_NV12,
+ CAMERA_IMGPROP_ROTATION, 360 - m_nativeCameraOrientation);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to apply photo viewfinder settings:" << result;
+ return;
+ }
+
+
+ int jpegQuality = 100;
+ switch (m_imageEncoderSettings.quality()) {
+ case QMultimedia::VeryLowQuality:
+ jpegQuality = 20;
+ break;
+ case QMultimedia::LowQuality:
+ jpegQuality = 40;
+ break;
+ case QMultimedia::NormalQuality:
+ jpegQuality = 60;
+ break;
+ case QMultimedia::HighQuality:
+ jpegQuality = 80;
+ break;
+ case QMultimedia::VeryHighQuality:
+ jpegQuality = 100;
+ break;
+ }
+
+ // apply photo configuration
+ result = camera_set_photo_property(m_handle,
+ CAMERA_IMGPROP_WIDTH, photoResolution.width(),
+ CAMERA_IMGPROP_HEIGHT, photoResolution.height(),
+ CAMERA_IMGPROP_JPEGQFACTOR, jpegQuality,
+ CAMERA_IMGPROP_ROTATION, 360 - m_nativeCameraOrientation);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to apply photo settings:" << result;
+ return;
+ }
+
+ } else if (m_captureMode & QCamera::CaptureVideo) {
+ applyVideoSettings();
+ }
+}
+
+static void videoRecordingStatusCallback(camera_handle_t handle, camera_devstatus_t status, uint16_t value, void *context)
+{
+ Q_UNUSED(handle)
+ Q_UNUSED(value)
+
+ if (status == CAMERA_STATUS_VIDEO_PAUSE) {
+ BbCameraSession *session = static_cast<BbCameraSession*>(context);
+ QMetaObject::invokeMethod(session, "handleVideoRecordingPaused", Qt::QueuedConnection);
+ } else if (status == CAMERA_STATUS_VIDEO_RESUME) {
+ BbCameraSession *session = static_cast<BbCameraSession*>(context);
+ QMetaObject::invokeMethod(session, "handleVideoRecordingResumed", Qt::QueuedConnection);
+ }
+}
+
+bool BbCameraSession::startVideoRecording()
+{
+ m_videoRecordingDuration.invalidate();
+
+ m_videoStatus = QMediaRecorder::StartingStatus;
+ emit videoStatusChanged(m_videoStatus);
+
+ if (m_videoOutputLocation.isEmpty())
+ m_videoOutputLocation = m_mediaStorageLocation.generateFileName(QLatin1String("VID_"), m_mediaStorageLocation.defaultDir(QCamera::CaptureVideo), QLatin1String("mp4"));
+
+ emit actualLocationChanged(m_videoOutputLocation);
+
+ const camera_error_t result = camera_start_video(m_handle, QFile::encodeName(m_videoOutputLocation), 0, videoRecordingStatusCallback, this);
+ if (result != CAMERA_EOK) {
+ m_videoStatus = QMediaRecorder::LoadedStatus;
+ emit videoStatusChanged(m_videoStatus);
+
+ emit videoError(QMediaRecorder::ResourceError, tr("Unable to start video recording"));
+ return false;
+ }
+
+ return true;
+}
+
+void BbCameraSession::stopVideoRecording()
+{
+ m_videoStatus = QMediaRecorder::FinalizingStatus;
+ emit videoStatusChanged(m_videoStatus);
+
+ const camera_error_t result = camera_stop_video(m_handle);
+ if (result != CAMERA_EOK) {
+ emit videoError(QMediaRecorder::ResourceError, tr("Unable to stop video recording"));
+ }
+
+ m_videoStatus = QMediaRecorder::LoadedStatus;
+ emit videoStatusChanged(m_videoStatus);
+
+ m_videoRecordingDuration.invalidate();
+}
+
+bool BbCameraSession::isCaptureModeSupported(camera_handle_t handle, QCamera::CaptureModes mode) const
+{
+ if (mode & QCamera::CaptureStillImage)
+ return camera_has_feature(handle, CAMERA_FEATURE_PHOTO);
+
+ if (mode & QCamera::CaptureVideo)
+ return camera_has_feature(handle, CAMERA_FEATURE_VIDEO);
+
+ return false;
+}
+
+QList<QSize> BbCameraSession::supportedResolutions(QCamera::CaptureMode mode) const
+{
+ Q_ASSERT(m_handle != CAMERA_HANDLE_INVALID);
+
+ QList<QSize> list;
+
+ camera_error_t result = CAMERA_EOK;
+ camera_res_t resolutions[20];
+ unsigned int supported = 0;
+
+ if (mode == QCamera::CaptureStillImage)
+ result = camera_get_photo_output_resolutions(m_handle, CAMERA_FRAMETYPE_JPEG, 20, &supported, resolutions);
+ else if (mode == QCamera::CaptureVideo)
+ result = camera_get_video_output_resolutions(m_handle, 20, &supported, resolutions);
+
+ if (result != CAMERA_EOK)
+ return list;
+
+ for (unsigned int i = 0; i < supported; ++i)
+ list << QSize(resolutions[i].width, resolutions[i].height);
+
+ return list;
+}
+
+QList<QSize> BbCameraSession::supportedViewfinderResolutions(QCamera::CaptureMode mode) const
+{
+ Q_ASSERT(m_handle != CAMERA_HANDLE_INVALID);
+
+ QList<QSize> list;
+
+ camera_error_t result = CAMERA_EOK;
+ camera_res_t resolutions[20];
+ unsigned int supported = 0;
+
+ if (mode == QCamera::CaptureStillImage)
+ result = camera_get_photo_vf_resolutions(m_handle, 20, &supported, resolutions);
+ else if (mode == QCamera::CaptureVideo)
+ result = camera_get_video_vf_resolutions(m_handle, 20, &supported, resolutions);
+
+ if (result != CAMERA_EOK)
+ return list;
+
+ for (unsigned int i = 0; i < supported; ++i)
+ list << QSize(resolutions[i].width, resolutions[i].height);
+
+ return list;
+}
+
+QSize BbCameraSession::currentViewfinderResolution(QCamera::CaptureMode mode) const
+{
+ Q_ASSERT(m_handle != CAMERA_HANDLE_INVALID);
+
+ camera_error_t result = CAMERA_EOK;
+ int width = 0;
+ int height = 0;
+
+ if (mode == QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_handle, CAMERA_IMGPROP_WIDTH, &width,
+ CAMERA_IMGPROP_HEIGHT, &height);
+ else if (mode == QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_handle, CAMERA_IMGPROP_WIDTH, &width,
+ CAMERA_IMGPROP_HEIGHT, &height);
+
+ if (result != CAMERA_EOK)
+ return QSize();
+
+ return QSize(width, height);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcamerasession.h b/src/plugins/blackberry/camera/bbcamerasession.h
new file mode 100644
index 000000000..f57c7dabf
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerasession.h
@@ -0,0 +1,236 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERASESSION_H
+#define BBCAMERASESSION_H
+
+#include "bbmediastoragelocation.h"
+
+#include <QCamera>
+#include <QCameraImageCapture>
+#include <QCameraViewfinderSettingsControl>
+#include <QElapsedTimer>
+#include <QMediaRecorder>
+#include <QMutex>
+#include <QObject>
+#include <QPointer>
+
+#include <camera/camera_api.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraOrientationHandler;
+class WindowGrabber;
+
+class BbCameraSession : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BbCameraSession(QObject *parent = 0);
+ ~BbCameraSession();
+
+ camera_handle_t handle() const;
+
+ // camera control
+ QCamera::State state() const;
+ void setState(QCamera::State state);
+ QCamera::Status status() const;
+ QCamera::CaptureModes captureMode() const;
+ void setCaptureMode(QCamera::CaptureModes);
+ bool isCaptureModeSupported(QCamera::CaptureModes mode) const;
+
+ // video device selector control
+ static QByteArray cameraIdentifierFront();
+ static QByteArray cameraIdentifierRear();
+ static QByteArray cameraIdentifierDesktop();
+
+ void setDevice(const QByteArray &device);
+ QByteArray device() const;
+
+ // video renderer control
+ QAbstractVideoSurface *surface() const;
+ void setSurface(QAbstractVideoSurface *surface);
+
+ // image capture control
+ bool isReadyForCapture() const;
+ QCameraImageCapture::DriveMode driveMode() const;
+ void setDriveMode(QCameraImageCapture::DriveMode mode);
+ int capture(const QString &fileName);
+ void cancelCapture();
+
+ // capture destination control
+ bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const;
+ QCameraImageCapture::CaptureDestinations captureDestination() const;
+ void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination);
+
+ // image encoder control
+ QList<QSize> supportedResolutions(const QImageEncoderSettings &settings, bool *continuous) const;
+ QImageEncoderSettings imageSettings() const;
+ void setImageSettings(const QImageEncoderSettings &settings);
+
+ // locks control
+ enum LocksApplyMode
+ {
+ IndependentMode,
+ FocusExposureBoundMode,
+ AllBoundMode,
+ FocusOnlyMode
+ };
+
+ QCamera::LockTypes supportedLocks() const;
+ QCamera::LockStatus lockStatus(QCamera::LockType lock) const;
+ void searchAndLock(QCamera::LockTypes locks);
+ void unlock(QCamera::LockTypes locks);
+
+ // media recorder control
+ QUrl outputLocation() const;
+ bool setOutputLocation(const QUrl &location);
+ QMediaRecorder::State videoState() const;
+ void setVideoState(QMediaRecorder::State state);
+ QMediaRecorder::Status videoStatus() const;
+ qint64 duration() const;
+ void applyVideoSettings();
+
+ // video encoder settings control
+ QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const;
+ QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const;
+ QVideoEncoderSettings videoSettings() const;
+ void setVideoSettings(const QVideoEncoderSettings &settings);
+
+ // audio encoder settings control
+ QAudioEncoderSettings audioSettings() const;
+ void setAudioSettings(const QAudioEncoderSettings &settings);
+
+Q_SIGNALS:
+ // camera control
+ void statusChanged(QCamera::Status);
+ void stateChanged(QCamera::State);
+ void error(int error, const QString &errorString);
+ void captureModeChanged(QCamera::CaptureModes);
+
+ // image capture control
+ void readyForCaptureChanged(bool);
+ void imageExposed(int id);
+ void imageCaptured(int id, const QImage &preview);
+ void imageMetadataAvailable(int id, const QString &key, const QVariant &value);
+ void imageAvailable(int id, const QVideoFrame &buffer);
+ void imageSaved(int id, const QString &fileName);
+ void imageCaptureError(int id, int error, const QString &errorString);
+
+ // capture destination control
+ void captureDestinationChanged(QCameraImageCapture::CaptureDestinations destination);
+
+ // locks control
+ void lockStatusChanged(QCamera::LockType type, QCamera::LockStatus status, QCamera::LockChangeReason reason);
+
+ // media recorder control
+ void videoStateChanged(QMediaRecorder::State state);
+ void videoStatusChanged(QMediaRecorder::Status status);
+ void durationChanged(qint64 duration);
+ void actualLocationChanged(const QUrl &location);
+ void videoError(int error, const QString &errorString);
+
+private slots:
+ void updateReadyForCapture();
+ void imageCaptured(int, const QImage&, const QString&);
+ void handleFocusStatusChanged(int);
+ void handleVideoRecordingPaused();
+ void handleVideoRecordingResumed();
+ void deviceOrientationChanged(int);
+ void handleCameraPowerUp();
+ void viewfinderFrameGrabbed(const QImage &image);
+
+private:
+ bool openCamera();
+ void closeCamera();
+ bool startViewFinder();
+ void stopViewFinder();
+ void applyConfiguration();
+ bool startVideoRecording();
+ void stopVideoRecording();
+
+ bool isCaptureModeSupported(camera_handle_t handle, QCamera::CaptureModes mode) const;
+ QList<QSize> supportedResolutions(QCamera::CaptureMode mode) const;
+ QList<QSize> supportedViewfinderResolutions(QCamera::CaptureMode mode) const;
+ QSize currentViewfinderResolution(QCamera::CaptureMode mode) const;
+
+ quint32 m_nativeCameraOrientation;
+ BbCameraOrientationHandler* m_orientationHandler;
+
+ QCamera::Status m_status;
+ QCamera::State m_state;
+ QCamera::CaptureModes m_captureMode;
+
+ QByteArray m_device;
+ bool m_previewIsVideo;
+
+ QPointer<QAbstractVideoSurface> m_surface;
+ QMutex m_surfaceMutex;
+
+ QCameraImageCapture::DriveMode m_captureImageDriveMode;
+ int m_lastImageCaptureId;
+ QCameraImageCapture::CaptureDestinations m_captureDestination;
+
+ QImageEncoderSettings m_imageEncoderSettings;
+
+ LocksApplyMode m_locksApplyMode;
+ QCamera::LockStatus m_focusLockStatus;
+ QCamera::LockTypes m_currentLockTypes;
+
+ QString m_videoOutputLocation;
+ QMediaRecorder::State m_videoState;
+ QMediaRecorder::Status m_videoStatus;
+ QElapsedTimer m_videoRecordingDuration;
+
+ QVideoEncoderSettings m_videoEncoderSettings;
+ QAudioEncoderSettings m_audioEncoderSettings;
+
+ BbMediaStorageLocation m_mediaStorageLocation;
+
+ camera_handle_t m_handle;
+
+ WindowGrabber* m_windowGrabber;
+};
+
+QDebug operator<<(QDebug debug, camera_error_t error);
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp b/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp
new file mode 100644
index 000000000..eae448e5b
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.cpp
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameravideoencodersettingscontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbCameraVideoEncoderSettingsControl::BbCameraVideoEncoderSettingsControl(BbCameraSession *session, QObject *parent)
+ : QVideoEncoderSettingsControl(parent)
+ , m_session(session)
+{
+}
+
+QList<QSize> BbCameraVideoEncoderSettingsControl::supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const
+{
+ return m_session->supportedResolutions(settings, continuous);
+}
+
+QList<qreal> BbCameraVideoEncoderSettingsControl::supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const
+{
+ return m_session->supportedFrameRates(settings, continuous);
+}
+
+QStringList BbCameraVideoEncoderSettingsControl::supportedVideoCodecs() const
+{
+ return QStringList() << QLatin1String("none") << QLatin1String("avc1") << QLatin1String("h264");
+}
+
+QString BbCameraVideoEncoderSettingsControl::videoCodecDescription(const QString &codecName) const
+{
+ if (codecName == QLatin1String("none"))
+ return tr("No compression");
+ else if (codecName == QLatin1String("avc1"))
+ return tr("AVC1 compression");
+ else if (codecName == QLatin1String("h264"))
+ return tr("H264 compression");
+
+ return QString();
+}
+
+QVideoEncoderSettings BbCameraVideoEncoderSettingsControl::videoSettings() const
+{
+ return m_session->videoSettings();
+}
+
+void BbCameraVideoEncoderSettingsControl::setVideoSettings(const QVideoEncoderSettings &settings)
+{
+ m_session->setVideoSettings(settings);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h b/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h
new file mode 100644
index 000000000..8ecf49c85
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameravideoencodersettingscontrol.h
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAVIDEOENCODERSETTINGSCONTROL_H
+#define BBCAMERAVIDEOENCODERSETTINGSCONTROL_H
+
+#include <qvideoencodersettingscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraVideoEncoderSettingsControl : public QVideoEncoderSettingsControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraVideoEncoderSettingsControl(BbCameraSession *session, QObject *parent = 0);
+
+ QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
+ QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
+ QStringList supportedVideoCodecs() const Q_DECL_OVERRIDE;
+ QString videoCodecDescription(const QString &codecName) const Q_DECL_OVERRIDE;
+ QVideoEncoderSettings videoSettings() const Q_DECL_OVERRIDE;
+ void setVideoSettings(const QVideoEncoderSettings &settings) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp
new file mode 100644
index 000000000..a63d7a731
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.cpp
@@ -0,0 +1,247 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcameraviewfindersettingscontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraViewfinderSettingsControl::BbCameraViewfinderSettingsControl(BbCameraSession *session, QObject *parent)
+ : QCameraViewfinderSettingsControl(parent)
+ , m_session(session)
+{
+}
+
+bool BbCameraViewfinderSettingsControl::isViewfinderParameterSupported(ViewfinderParameter parameter) const
+{
+ switch (parameter) {
+ case QCameraViewfinderSettingsControl::Resolution:
+ return true;
+ case QCameraViewfinderSettingsControl::PixelAspectRatio:
+ return false;
+ case QCameraViewfinderSettingsControl::MinimumFrameRate:
+ return true;
+ case QCameraViewfinderSettingsControl::MaximumFrameRate:
+ return true;
+ case QCameraViewfinderSettingsControl::PixelFormat:
+ return true;
+ default:
+ return false;
+ }
+}
+
+QVariant BbCameraViewfinderSettingsControl::viewfinderParameter(ViewfinderParameter parameter) const
+{
+ if (parameter == QCameraViewfinderSettingsControl::Resolution) {
+ camera_error_t result = CAMERA_EOK;
+ unsigned int width = 0;
+ unsigned int height = 0;
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage) {
+ result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, &width,
+ CAMERA_IMGPROP_HEIGHT, &height);
+ } else if (m_session->captureMode() & QCamera::CaptureVideo) {
+ result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, &width,
+ CAMERA_IMGPROP_HEIGHT, &height);
+ }
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve resolution of viewfinder:" << result;
+ return QVariant();
+ }
+
+ return QSize(width, height);
+
+ } else if (parameter == QCameraViewfinderSettingsControl::MinimumFrameRate) {
+ camera_error_t result = CAMERA_EOK;
+ double minimumFrameRate = 0;
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, &minimumFrameRate);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, &minimumFrameRate);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve minimum framerate of viewfinder:" << result;
+ return QVariant();
+ }
+
+ return QVariant(static_cast<qreal>(minimumFrameRate));
+
+ } else if (parameter == QCameraViewfinderSettingsControl::MaximumFrameRate) {
+ camera_error_t result = CAMERA_EOK;
+ double maximumFrameRate = 0;
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, &maximumFrameRate);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, &maximumFrameRate);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve maximum framerate of viewfinder:" << result;
+ return QVariant();
+ }
+
+ return QVariant(static_cast<qreal>(maximumFrameRate));
+ } else if (parameter == QCameraViewfinderSettingsControl::PixelFormat) {
+ camera_error_t result = CAMERA_EOK;
+ camera_frametype_t format = CAMERA_FRAMETYPE_UNSPECIFIED;
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, &format);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, &format);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve pixel format of viewfinder:" << result;
+ return QVariant();
+ }
+
+ switch (format) {
+ case CAMERA_FRAMETYPE_UNSPECIFIED:
+ return QVideoFrame::Format_Invalid;
+ case CAMERA_FRAMETYPE_NV12:
+ return QVideoFrame::Format_NV12;
+ case CAMERA_FRAMETYPE_RGB8888:
+ return QVideoFrame::Format_ARGB32;
+ case CAMERA_FRAMETYPE_RGB888:
+ return QVideoFrame::Format_RGB24;
+ case CAMERA_FRAMETYPE_JPEG:
+ return QVideoFrame::Format_Jpeg;
+ case CAMERA_FRAMETYPE_GRAY8:
+ return QVideoFrame::Format_Y8;
+ case CAMERA_FRAMETYPE_METADATA:
+ return QVideoFrame::Format_Invalid;
+ case CAMERA_FRAMETYPE_BAYER:
+ return QVideoFrame::Format_Invalid;
+ case CAMERA_FRAMETYPE_CBYCRY:
+ return QVideoFrame::Format_Invalid;
+ case CAMERA_FRAMETYPE_COMPRESSEDVIDEO:
+ return QVideoFrame::Format_Invalid;
+ case CAMERA_FRAMETYPE_COMPRESSEDAUDIO:
+ return QVideoFrame::Format_Invalid;
+ default:
+ return QVideoFrame::Format_Invalid;
+ }
+ }
+
+ return QVariant();
+}
+
+void BbCameraViewfinderSettingsControl::setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value)
+{
+ if (parameter == QCameraViewfinderSettingsControl::Resolution) {
+ camera_error_t result = CAMERA_EOK;
+ const QSize size = value.toSize();
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage) {
+ result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, size.width(),
+ CAMERA_IMGPROP_HEIGHT, size.height());
+ } else if (m_session->captureMode() & QCamera::CaptureVideo) {
+ result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_WIDTH, size.width(),
+ CAMERA_IMGPROP_HEIGHT, size.height());
+ }
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set resolution of viewfinder:" << result;
+
+ } else if (parameter == QCameraViewfinderSettingsControl::MinimumFrameRate) {
+ camera_error_t result = CAMERA_EOK;
+ const double minimumFrameRate = value.toReal();
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, minimumFrameRate);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_MINFRAMERATE, minimumFrameRate);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set minimum framerate of viewfinder:" << result;
+
+ } else if (parameter == QCameraViewfinderSettingsControl::MaximumFrameRate) {
+ camera_error_t result = CAMERA_EOK;
+ const double maximumFrameRate = value.toReal();
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, maximumFrameRate);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_FRAMERATE, maximumFrameRate);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set maximum framerate of viewfinder:" << result;
+
+ } else if (parameter == QCameraViewfinderSettingsControl::PixelFormat) {
+ camera_error_t result = CAMERA_EOK;
+ camera_frametype_t format = CAMERA_FRAMETYPE_UNSPECIFIED;
+
+ switch (value.value<QVideoFrame::PixelFormat>()) {
+ case QVideoFrame::Format_NV12:
+ format = CAMERA_FRAMETYPE_NV12;
+ break;
+ case QVideoFrame::Format_ARGB32:
+ format = CAMERA_FRAMETYPE_RGB8888;
+ break;
+ case QVideoFrame::Format_RGB24:
+ format = CAMERA_FRAMETYPE_RGB888;
+ break;
+ case QVideoFrame::Format_Jpeg:
+ format = CAMERA_FRAMETYPE_JPEG;
+ break;
+ case QVideoFrame::Format_Y8:
+ format = CAMERA_FRAMETYPE_GRAY8;
+ break;
+ default:
+ format = CAMERA_FRAMETYPE_UNSPECIFIED;
+ break;
+ }
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_set_photovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, format);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_set_videovf_property(m_session->handle(), CAMERA_IMGPROP_FORMAT, format);
+
+ if (result != CAMERA_EOK)
+ qWarning() << "Unable to set pixel format of viewfinder:" << result;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h
new file mode 100644
index 000000000..f1434c31c
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcameraviewfindersettingscontrol.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAVIEWVINDERSETTINGSCONTROL_H
+#define BBCAMERAVIEWVINDERSETTINGSCONTROL_H
+
+#include <qcameraviewfindersettingscontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraViewfinderSettingsControl : public QCameraViewfinderSettingsControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraViewfinderSettingsControl(BbCameraSession *session, QObject *parent = 0);
+
+ bool isViewfinderParameterSupported(ViewfinderParameter parameter) const Q_DECL_OVERRIDE;
+ QVariant viewfinderParameter(ViewfinderParameter parameter) const Q_DECL_OVERRIDE;
+ void setViewfinderParameter(ViewfinderParameter parameter, const QVariant &value) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp b/src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp
new file mode 100644
index 000000000..f73cf000a
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerazoomcontrol.cpp
@@ -0,0 +1,157 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbcamerazoomcontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbCameraZoomControl::BbCameraZoomControl(BbCameraSession *session, QObject *parent)
+ : QCameraZoomControl(parent)
+ , m_session(session)
+ , m_minimumZoomFactor(1.0)
+ , m_maximumZoomFactor(1.0)
+ , m_supportsSmoothZoom(false)
+ , m_requestedZoomFactor(1.0)
+{
+ connect(m_session, SIGNAL(statusChanged(QCamera::Status)), this, SLOT(statusChanged(QCamera::Status)));
+}
+
+qreal BbCameraZoomControl::maximumOpticalZoom() const
+{
+ //TODO: optical zoom support not available in BB10 API yet
+ return 1.0;
+}
+
+qreal BbCameraZoomControl::maximumDigitalZoom() const
+{
+ return m_maximumZoomFactor;
+}
+
+qreal BbCameraZoomControl::requestedOpticalZoom() const
+{
+ //TODO: optical zoom support not available in BB10 API yet
+ return 1.0;
+}
+
+qreal BbCameraZoomControl::requestedDigitalZoom() const
+{
+ return currentDigitalZoom();
+}
+
+qreal BbCameraZoomControl::currentOpticalZoom() const
+{
+ //TODO: optical zoom support not available in BB10 API yet
+ return 1.0;
+}
+
+qreal BbCameraZoomControl::currentDigitalZoom() const
+{
+ if (m_session->status() != QCamera::ActiveStatus)
+ return 1.0;
+
+ unsigned int zoomFactor = 0;
+ camera_error_t result = CAMERA_EOK;
+
+ if (m_session->captureMode() & QCamera::CaptureStillImage)
+ result = camera_get_photovf_property(m_session->handle(), CAMERA_IMGPROP_ZOOMFACTOR, &zoomFactor);
+ else if (m_session->captureMode() & QCamera::CaptureVideo)
+ result = camera_get_videovf_property(m_session->handle(), CAMERA_IMGPROP_ZOOMFACTOR, &zoomFactor);
+
+ if (result != CAMERA_EOK)
+ return 1.0;
+
+ return zoomFactor;
+}
+
+void BbCameraZoomControl::zoomTo(qreal optical, qreal digital)
+{
+ Q_UNUSED(optical)
+
+ if (m_session->status() != QCamera::ActiveStatus)
+ return;
+
+ const qreal actualZoom = qBound(m_minimumZoomFactor, digital, m_maximumZoomFactor);
+
+ const camera_error_t result = camera_set_zoom(m_session->handle(), actualZoom, false);
+
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to change zoom factor:" << result;
+ return;
+ }
+
+ if (m_requestedZoomFactor != digital) {
+ m_requestedZoomFactor = digital;
+ emit requestedDigitalZoomChanged(m_requestedZoomFactor);
+ }
+
+ emit currentDigitalZoomChanged(actualZoom);
+}
+
+void BbCameraZoomControl::statusChanged(QCamera::Status status)
+{
+ if (status == QCamera::ActiveStatus) {
+ // retrieve information about zoom limits
+ unsigned int maximumZoomLimit = 0;
+ unsigned int minimumZoomLimit = 0;
+ bool smoothZoom = false;
+
+ const camera_error_t result = camera_get_zoom_limits(m_session->handle(), &maximumZoomLimit, &minimumZoomLimit, &smoothZoom);
+ if (result == CAMERA_EOK) {
+ const qreal oldMaximumZoomFactor = m_maximumZoomFactor;
+ m_maximumZoomFactor = maximumZoomLimit;
+
+ if (oldMaximumZoomFactor != m_maximumZoomFactor)
+ emit maximumDigitalZoomChanged(m_maximumZoomFactor);
+
+ m_minimumZoomFactor = minimumZoomLimit;
+ m_supportsSmoothZoom = smoothZoom;
+ } else {
+ m_maximumZoomFactor = 1.0;
+ m_minimumZoomFactor = 1.0;
+ m_supportsSmoothZoom = false;
+ }
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbcamerazoomcontrol.h b/src/plugins/blackberry/camera/bbcamerazoomcontrol.h
new file mode 100644
index 000000000..a1fecab89
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbcamerazoomcontrol.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBCAMERAZOOMCONTROL_H
+#define BBCAMERAZOOMCONTROL_H
+
+#include <qcamera.h>
+#include <qcamerazoomcontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbCameraZoomControl : public QCameraZoomControl
+{
+ Q_OBJECT
+public:
+ explicit BbCameraZoomControl(BbCameraSession *session, QObject *parent = 0);
+
+ qreal maximumOpticalZoom() const Q_DECL_OVERRIDE;
+ qreal maximumDigitalZoom() const Q_DECL_OVERRIDE;
+ qreal requestedOpticalZoom() const Q_DECL_OVERRIDE;
+ qreal requestedDigitalZoom() const Q_DECL_OVERRIDE;
+ qreal currentOpticalZoom() const Q_DECL_OVERRIDE;
+ qreal currentDigitalZoom() const Q_DECL_OVERRIDE;
+ void zoomTo(qreal optical, qreal digital) Q_DECL_OVERRIDE;
+
+private Q_SLOTS:
+ void statusChanged(QCamera::Status status);
+
+private:
+ BbCameraSession *m_session;
+
+ qreal m_minimumZoomFactor;
+ qreal m_maximumZoomFactor;
+ bool m_supportsSmoothZoom;
+ qreal m_requestedZoomFactor;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbimageencodercontrol.cpp b/src/plugins/blackberry/camera/bbimageencodercontrol.cpp
new file mode 100644
index 000000000..1265b9ca4
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbimageencodercontrol.cpp
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbimageencodercontrol.h"
+
+#include "bbcamerasession.h"
+
+QT_BEGIN_NAMESPACE
+
+BbImageEncoderControl::BbImageEncoderControl(BbCameraSession *session, QObject *parent)
+ : QImageEncoderControl(parent)
+ , m_session(session)
+{
+}
+
+QStringList BbImageEncoderControl::supportedImageCodecs() const
+{
+ return QStringList() << QLatin1String("jpeg");
+}
+
+QString BbImageEncoderControl::imageCodecDescription(const QString &codecName) const
+{
+ if (codecName == QLatin1String("jpeg"))
+ return tr("JPEG image");
+
+ return QString();
+}
+
+QList<QSize> BbImageEncoderControl::supportedResolutions(const QImageEncoderSettings &settings, bool *continuous) const
+{
+ return m_session->supportedResolutions(settings, continuous);
+}
+
+QImageEncoderSettings BbImageEncoderControl::imageSettings() const
+{
+ return m_session->imageSettings();
+}
+
+void BbImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings)
+{
+ m_session->setImageSettings(settings);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbimageencodercontrol.h b/src/plugins/blackberry/camera/bbimageencodercontrol.h
new file mode 100644
index 000000000..4db2e7def
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbimageencodercontrol.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBIMAGEENCODERCONTROL_H
+#define BBIMAGEENCODERCONTROL_H
+
+#include <qimageencodercontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbImageEncoderControl : public QImageEncoderControl
+{
+ Q_OBJECT
+public:
+ explicit BbImageEncoderControl(BbCameraSession *session, QObject *parent = 0);
+
+ QStringList supportedImageCodecs() const Q_DECL_OVERRIDE;
+ QString imageCodecDescription(const QString &codecName) const Q_DECL_OVERRIDE;
+ QList<QSize> supportedResolutions(const QImageEncoderSettings &settings, bool *continuous = 0) const Q_DECL_OVERRIDE;
+ QImageEncoderSettings imageSettings() const Q_DECL_OVERRIDE;
+ void setImageSettings(const QImageEncoderSettings &settings) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbmediastoragelocation.cpp b/src/plugins/blackberry/camera/bbmediastoragelocation.cpp
new file mode 100644
index 000000000..3d939ce4f
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbmediastoragelocation.cpp
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbmediastoragelocation.h"
+
+#include <QStandardPaths>
+
+QT_BEGIN_NAMESPACE
+
+BbMediaStorageLocation::BbMediaStorageLocation()
+{
+}
+
+QDir BbMediaStorageLocation::defaultDir(QCamera::CaptureMode mode) const
+{
+ QStringList dirCandidates;
+
+ dirCandidates << QLatin1String("shared/camera");
+
+ if (mode == QCamera::CaptureVideo) {
+ dirCandidates << QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
+ } else {
+ dirCandidates << QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+ }
+
+ dirCandidates << QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+ dirCandidates << QDir::homePath();
+ dirCandidates << QDir::currentPath();
+ dirCandidates << QDir::tempPath();
+
+ Q_FOREACH (const QString &path, dirCandidates) {
+ if (QFileInfo(path).isWritable())
+ return QDir(path);
+ }
+
+ return QDir();
+}
+
+QString BbMediaStorageLocation::generateFileName(const QString &requestedName, QCamera::CaptureMode mode, const QString &prefix, const QString &extension) const
+{
+ if (requestedName.isEmpty())
+ return generateFileName(prefix, defaultDir(mode), extension);
+
+ if (QFileInfo(requestedName).isDir())
+ return generateFileName(prefix, QDir(requestedName), extension);
+
+ return requestedName;
+}
+
+QString BbMediaStorageLocation::generateFileName(const QString &prefix, const QDir &dir, const QString &extension) const
+{
+ const QString lastMediaKey = dir.absolutePath() + QLatin1Char(' ') + prefix + QLatin1Char(' ') + extension;
+ qint64 lastMediaIndex = m_lastUsedIndex.value(lastMediaKey, 0);
+
+ if (lastMediaIndex == 0) {
+ // first run, find the maximum media number during the fist capture
+ Q_FOREACH (const QString &fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(extension))) {
+ const qint64 mediaIndex = fileName.mid(prefix.length(), fileName.size() - prefix.length() - extension.length() - 1).toInt();
+ lastMediaIndex = qMax(lastMediaIndex, mediaIndex);
+ }
+ }
+
+ // don't just rely on cached lastMediaIndex value,
+ // someone else may create a file after camera started
+ while (true) {
+ const QString name = QString("%1%2.%3").arg(prefix)
+ .arg(lastMediaIndex + 1, 8, 10, QLatin1Char('0'))
+ .arg(extension);
+
+ const QString path = dir.absoluteFilePath(name);
+ if (!QFileInfo(path).exists()) {
+ m_lastUsedIndex[lastMediaKey] = lastMediaIndex + 1;
+ return path;
+ }
+
+ lastMediaIndex++;
+ }
+
+ return QString();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbmediastoragelocation.h b/src/plugins/blackberry/camera/bbmediastoragelocation.h
new file mode 100644
index 000000000..efa89c8ed
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbmediastoragelocation.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBMEDIASTORAGELOCATION_H
+#define BBMEDIASTORAGELOCATION_H
+
+#include <QCamera>
+#include <QDir>
+#include <QHash>
+
+QT_BEGIN_NAMESPACE
+
+class BbMediaStorageLocation
+{
+public:
+ BbMediaStorageLocation();
+
+ QDir defaultDir(QCamera::CaptureMode mode) const;
+
+ QString generateFileName(const QString &requestedName, QCamera::CaptureMode mode, const QString &prefix, const QString &extension) const;
+ QString generateFileName(const QString &prefix, const QDir &dir, const QString &extension) const;
+
+private:
+ mutable QHash<QString, qint64> m_lastUsedIndex;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp b/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp
new file mode 100644
index 000000000..6a6e9d3cd
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.cpp
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbvideodeviceselectorcontrol.h"
+
+#include "bbcamerasession.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+BbVideoDeviceSelectorControl::BbVideoDeviceSelectorControl(BbCameraSession *session, QObject *parent)
+ : QVideoDeviceSelectorControl(parent)
+ , m_session(session)
+ , m_selected(0)
+{
+ enumerateDevices(&m_devices, &m_descriptions);
+
+ // pre-select the rear camera
+ const int index = m_devices.indexOf(BbCameraSession::cameraIdentifierRear());
+ if (index != -1)
+ m_selected = index;
+}
+
+int BbVideoDeviceSelectorControl::deviceCount() const
+{
+ return m_devices.count();
+}
+
+QString BbVideoDeviceSelectorControl::deviceName(int index) const
+{
+ if (index < 0 || index >= m_devices.count())
+ return QString();
+
+ return QString::fromUtf8(m_devices.at(index));
+}
+
+QString BbVideoDeviceSelectorControl::deviceDescription(int index) const
+{
+ if (index < 0 || index >= m_descriptions.count())
+ return QString();
+
+ return m_descriptions.at(index);
+}
+
+int BbVideoDeviceSelectorControl::defaultDevice() const
+{
+ return 0;
+}
+
+int BbVideoDeviceSelectorControl::selectedDevice() const
+{
+ return m_selected;
+}
+
+void BbVideoDeviceSelectorControl::enumerateDevices(QList<QByteArray> *devices, QStringList *descriptions)
+{
+ devices->clear();
+ descriptions->clear();
+
+ camera_unit_t cameras[10];
+
+ unsigned int knownCameras = 0;
+ const camera_error_t result = camera_get_supported_cameras(10, &knownCameras, cameras);
+ if (result != CAMERA_EOK) {
+ qWarning() << "Unable to retrieve supported camera types:" << result;
+ return;
+ }
+
+ for (unsigned int i = 0; i < knownCameras; ++i) {
+ switch (cameras[i]) {
+ case CAMERA_UNIT_FRONT:
+ devices->append(BbCameraSession::cameraIdentifierFront());
+ descriptions->append(tr("Front Camera"));
+ break;
+ case CAMERA_UNIT_REAR:
+ devices->append(BbCameraSession::cameraIdentifierRear());
+ descriptions->append(tr("Rear Camera"));
+ break;
+ case CAMERA_UNIT_DESKTOP:
+ devices->append(BbCameraSession::cameraIdentifierDesktop());
+ descriptions->append(tr("Desktop Camera"));
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+void BbVideoDeviceSelectorControl::setSelectedDevice(int index)
+{
+ if (index < 0 || index >= m_devices.count())
+ return;
+
+ if (!m_session)
+ return;
+
+ const QByteArray device = m_devices.at(index);
+ if (device == m_session->device())
+ return;
+
+ m_session->setDevice(device);
+ m_selected = index;
+
+ emit selectedDeviceChanged(QString::fromUtf8(device));
+ emit selectedDeviceChanged(index);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h b/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h
new file mode 100644
index 000000000..1987f5491
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbvideodeviceselectorcontrol.h
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBVIDEODEVICESELECTORCONTROL_H
+#define BBVIDEODEVICESELECTORCONTROL_H
+
+#include <qvideodeviceselectorcontrol.h>
+#include <QStringList>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbVideoDeviceSelectorControl : public QVideoDeviceSelectorControl
+{
+ Q_OBJECT
+public:
+ explicit BbVideoDeviceSelectorControl(BbCameraSession *session, QObject *parent = 0);
+
+ int deviceCount() const Q_DECL_OVERRIDE;
+ QString deviceName(int index) const Q_DECL_OVERRIDE;
+ QString deviceDescription(int index) const Q_DECL_OVERRIDE;
+ int defaultDevice() const Q_DECL_OVERRIDE;
+ int selectedDevice() const Q_DECL_OVERRIDE;
+
+ static void enumerateDevices(QList<QByteArray> *devices, QStringList *descriptions);
+
+public Q_SLOTS:
+ void setSelectedDevice(int index) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession* m_session;
+
+ QList<QByteArray> m_devices;
+ QStringList m_descriptions;
+
+ int m_selected;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/mediaservice/bbserviceplugin.cpp b/src/plugins/blackberry/camera/bbvideorenderercontrol.cpp
index 92dc4aee4..4fadf9afb 100644
--- a/src/plugins/blackberry/mediaservice/bbserviceplugin.cpp
+++ b/src/plugins/blackberry/camera/bbvideorenderercontrol.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 Research In Motion
+** Copyright (C) 2013 Research In Motion
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
@@ -38,32 +38,27 @@
** $QT_END_LICENSE$
**
****************************************************************************/
-#include "bbserviceplugin.h"
-#include "bbmediaplayerservice.h"
-QT_BEGIN_NAMESPACE
+#include "bbvideorenderercontrol.h"
-BbServicePlugin::BbServicePlugin()
-{
-}
+#include "bbcamerasession.h"
-QMediaService *BbServicePlugin::create(const QString &key)
-{
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new BbMediaPlayerService();
+QT_BEGIN_NAMESPACE
- return 0;
+BbVideoRendererControl::BbVideoRendererControl(BbCameraSession *session, QObject *parent)
+ : QVideoRendererControl(parent)
+ , m_session(session)
+{
}
-void BbServicePlugin::release(QMediaService *service)
+QAbstractVideoSurface* BbVideoRendererControl::surface() const
{
- delete service;
+ return m_session->surface();
}
-QMediaServiceProviderHint::Features BbServicePlugin::supportedFeatures(const QByteArray &service) const
+void BbVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
{
- Q_UNUSED(service)
- return QMediaServiceProviderHint::Features();
+ m_session->setSurface(surface);
}
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/camera/bbvideorenderercontrol.h b/src/plugins/blackberry/camera/bbvideorenderercontrol.h
new file mode 100644
index 000000000..93b2b6475
--- /dev/null
+++ b/src/plugins/blackberry/camera/bbvideorenderercontrol.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBVIDEORENDERERCONTROL_H
+#define BBVIDEORENDERERCONTROL_H
+
+#include <qvideorenderercontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbCameraSession;
+
+class BbVideoRendererControl : public QVideoRendererControl
+{
+ Q_OBJECT
+public:
+ explicit BbVideoRendererControl(BbCameraSession *session, QObject *parent = 0);
+
+ QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE;
+ void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE;
+
+private:
+ BbCameraSession *m_session;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/camera/camera.pri b/src/plugins/blackberry/camera/camera.pri
new file mode 100644
index 000000000..8186cdcc6
--- /dev/null
+++ b/src/plugins/blackberry/camera/camera.pri
@@ -0,0 +1,49 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/bbcameraaudioencodersettingscontrol.h \
+ $$PWD/bbcameracapturebufferformatcontrol.h \
+ $$PWD/bbcameracapturedestinationcontrol.h \
+ $$PWD/bbcameracontrol.h \
+ $$PWD/bbcameraexposurecontrol.h \
+ $$PWD/bbcameraflashcontrol.h \
+ $$PWD/bbcamerafocuscontrol.h \
+ $$PWD/bbcameraimagecapturecontrol.h \
+ $$PWD/bbcameraimageprocessingcontrol.h \
+ $$PWD/bbcameralockscontrol.h \
+ $$PWD/bbcameramediarecordercontrol.h \
+ $$PWD/bbcameraorientationhandler.h \
+ $$PWD/bbcameraservice.h \
+ $$PWD/bbcamerasession.h \
+ $$PWD/bbcameravideoencodersettingscontrol.h \
+ $$PWD/bbcameraviewfindersettingscontrol.h \
+ $$PWD/bbcamerazoomcontrol.h \
+ $$PWD/bbimageencodercontrol.h \
+ $$PWD/bbmediastoragelocation.h \
+ $$PWD/bbvideodeviceselectorcontrol.h \
+ $$PWD/bbvideorenderercontrol.h
+
+SOURCES += \
+ $$PWD/bbcameraaudioencodersettingscontrol.cpp \
+ $$PWD/bbcameracapturebufferformatcontrol.cpp \
+ $$PWD/bbcameracapturedestinationcontrol.cpp \
+ $$PWD/bbcameracontrol.cpp \
+ $$PWD/bbcameraexposurecontrol.cpp \
+ $$PWD/bbcameraflashcontrol.cpp \
+ $$PWD/bbcamerafocuscontrol.cpp \
+ $$PWD/bbcameraimagecapturecontrol.cpp \
+ $$PWD/bbcameraimageprocessingcontrol.cpp \
+ $$PWD/bbcameralockscontrol.cpp \
+ $$PWD/bbcameramediarecordercontrol.cpp \
+ $$PWD/bbcameraorientationhandler.cpp \
+ $$PWD/bbcameraservice.cpp \
+ $$PWD/bbcamerasession.cpp \
+ $$PWD/bbcameravideoencodersettingscontrol.cpp \
+ $$PWD/bbcameraviewfindersettingscontrol.cpp \
+ $$PWD/bbcamerazoomcontrol.cpp \
+ $$PWD/bbimageencodercontrol.cpp \
+ $$PWD/bbmediastoragelocation.cpp \
+ $$PWD/bbvideodeviceselectorcontrol.cpp \
+ $$PWD/bbvideorenderercontrol.cpp
+
+LIBS += -lcamapi -laudio_manager
diff --git a/src/plugins/blackberry/common/common.pri b/src/plugins/blackberry/common/common.pri
new file mode 100644
index 000000000..1a6693474
--- /dev/null
+++ b/src/plugins/blackberry/common/common.pri
@@ -0,0 +1,7 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/windowgrabber.h
+
+SOURCES += \
+ $$PWD/windowgrabber.cpp
diff --git a/src/plugins/blackberry/common/windowgrabber.cpp b/src/plugins/blackberry/common/windowgrabber.cpp
new file mode 100644
index 000000000..d02e022aa
--- /dev/null
+++ b/src/plugins/blackberry/common/windowgrabber.cpp
@@ -0,0 +1,291 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "windowgrabber.h"
+
+#include <QAbstractEventDispatcher>
+#include <QDebug>
+#include <QGuiApplication>
+#include <QImage>
+#include <qpa/qplatformnativeinterface.h>
+
+#include <bps/screen.h>
+#include <errno.h>
+
+QT_BEGIN_NAMESPACE
+
+WindowGrabber::WindowGrabber(QObject *parent)
+ : QObject(parent),
+ m_screenBuffer(0),
+ m_active(false),
+ m_screenContextInitialized(false),
+ m_screenPixmapInitialized(false),
+ m_screenPixmapBufferInitialized(false)
+{
+ // grab the window frame with 60 frames per second
+ m_timer.setInterval(1000/60);
+
+ connect(&m_timer, SIGNAL(timeout()), SLOT(grab()));
+
+ QCoreApplication::eventDispatcher()->installNativeEventFilter(this);
+}
+
+WindowGrabber::~WindowGrabber()
+{
+ QCoreApplication::eventDispatcher()->removeNativeEventFilter(this);
+}
+
+void WindowGrabber::setFrameRate(int frameRate)
+{
+ m_timer.setInterval(1000/frameRate);
+}
+
+void WindowGrabber::setWindowId(const QByteArray &windowId)
+{
+ m_windowId = windowId;
+}
+
+void WindowGrabber::start()
+{
+ int result = 0;
+
+ result = screen_create_context(&m_screenContext, SCREEN_APPLICATION_CONTEXT);
+ if (result != 0) {
+ qWarning() << "WindowGrabber: cannot create screen context:" << strerror(errno);
+ return;
+ } else {
+ m_screenContextInitialized = true;
+ }
+
+ result = screen_create_pixmap(&m_screenPixmap, m_screenContext);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot create pixmap:" << strerror(errno);
+ return;
+ } else {
+ m_screenPixmapInitialized = true;
+ }
+
+ const int usage = SCREEN_USAGE_READ | SCREEN_USAGE_NATIVE;
+ result = screen_set_pixmap_property_iv(m_screenPixmap, SCREEN_PROPERTY_USAGE, &usage);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot set pixmap usage:" << strerror(errno);
+ return;
+ }
+
+ const int format = SCREEN_FORMAT_RGBA8888;
+ result = screen_set_pixmap_property_iv(m_screenPixmap, SCREEN_PROPERTY_FORMAT, &format);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot set pixmap format:" << strerror(errno);
+ return;
+ }
+
+ int size[2] = { 0, 0 };
+ result = screen_get_window_property_iv(m_window, SCREEN_PROPERTY_SIZE, size);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot get window size:" << strerror(errno);
+ return;
+ }
+
+ m_screenBufferWidth = size[0];
+ m_screenBufferHeight = size[1];
+
+ result = screen_set_pixmap_property_iv(m_screenPixmap, SCREEN_PROPERTY_BUFFER_SIZE, size);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot set pixmap size:" << strerror(errno);
+ return;
+ }
+
+ result = screen_create_pixmap_buffer(m_screenPixmap);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot create pixmap buffer:" << strerror(errno);
+ return;
+ }
+
+ result = screen_get_pixmap_property_pv(m_screenPixmap, SCREEN_PROPERTY_RENDER_BUFFERS, (void**)&m_screenPixmapBuffer);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot get pixmap buffer:" << strerror(errno);
+ return;
+ } else {
+ m_screenPixmapBufferInitialized = true;
+ }
+
+ result = screen_get_buffer_property_pv(m_screenPixmapBuffer, SCREEN_PROPERTY_POINTER, (void**)&m_screenBuffer);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot get pixmap buffer pointer:" << strerror(errno);
+ return;
+ }
+
+ result = screen_get_buffer_property_iv(m_screenPixmapBuffer, SCREEN_PROPERTY_STRIDE, &m_screenBufferStride);
+ if (result != 0) {
+ cleanup();
+ qWarning() << "WindowGrabber: cannot get pixmap buffer stride:" << strerror(errno);
+ return;
+ }
+
+ m_timer.start();
+
+ m_active = true;
+}
+
+void WindowGrabber::stop()
+{
+ if (!m_active)
+ return;
+
+ cleanup();
+
+ m_timer.stop();
+
+ m_active = false;
+}
+
+void WindowGrabber::pause()
+{
+ m_timer.stop();
+}
+
+void WindowGrabber::resume()
+{
+ if (!m_active)
+ return;
+
+ m_timer.start();
+}
+
+bool WindowGrabber::nativeEventFilter(const QByteArray&, void *message, long*)
+{
+ bps_event_t * const event = static_cast<bps_event_t *>(message);
+
+ if (event && bps_event_get_domain(event) == screen_get_domain()) {
+ const screen_event_t screen_event = screen_event_get_event(event);
+
+ int eventType;
+ if (screen_get_event_property_iv(screen_event, SCREEN_PROPERTY_TYPE, &eventType) != 0) {
+ qWarning() << "WindowGrabber: Failed to query screen event type";
+ return false;
+ }
+
+ if (eventType != SCREEN_EVENT_CREATE)
+ return false;
+
+ screen_window_t window = 0;
+ if (screen_get_event_property_pv(screen_event, SCREEN_PROPERTY_WINDOW, (void**)&window) != 0) {
+ qWarning() << "WindowGrabber: Failed to query window property";
+ return false;
+ }
+
+ const int maxIdStrLength = 128;
+ char idString[maxIdStrLength];
+ if (screen_get_window_property_cv(window, SCREEN_PROPERTY_ID_STRING, maxIdStrLength, idString) != 0) {
+ qWarning() << "WindowGrabber: Failed to query window ID string";
+ return false;
+ }
+
+ if (m_windowId == idString) {
+ m_window = window;
+ start();
+ }
+ }
+
+ return false;
+}
+
+QByteArray WindowGrabber::windowGroupId() const
+{
+ QWindow *window = QGuiApplication::allWindows().isEmpty() ? 0 : QGuiApplication::allWindows().first();
+ if (!window)
+ return QByteArray();
+
+ QPlatformNativeInterface * const nativeInterface = QGuiApplication::platformNativeInterface();
+ if (!nativeInterface) {
+ qWarning() << "WindowGrabber: Unable to get platform native interface";
+ return QByteArray();
+ }
+
+ const char * const groupIdData = static_cast<const char *>(
+ nativeInterface->nativeResourceForWindow("windowGroup", window));
+ if (!groupIdData) {
+ qWarning() << "WindowGrabber: Unable to find window group for window" << window;
+ return QByteArray();
+ }
+
+ return QByteArray(groupIdData);
+}
+
+void WindowGrabber::grab()
+{
+ const int result = screen_read_window(m_window, m_screenPixmapBuffer, 0, 0, 0);
+ if (result != 0)
+ return;
+
+ const QImage frame((unsigned char*)m_screenBuffer, m_screenBufferWidth, m_screenBufferHeight,
+ m_screenBufferStride, QImage::Format_ARGB32);
+
+ emit frameGrabbed(frame);
+}
+
+void WindowGrabber::cleanup()
+{
+ if (m_screenPixmapBufferInitialized) {
+ screen_destroy_buffer(m_screenPixmapBuffer);
+ m_screenPixmapBufferInitialized = false;
+ }
+
+ if (m_screenPixmapInitialized) {
+ screen_destroy_pixmap(m_screenPixmap);
+ m_screenPixmapInitialized = false;
+ }
+
+ if (m_screenContextInitialized) {
+ screen_destroy_context(m_screenContext);
+ m_screenContextInitialized = false;
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/common/windowgrabber.h b/src/plugins/blackberry/common/windowgrabber.h
new file mode 100644
index 000000000..547742da1
--- /dev/null
+++ b/src/plugins/blackberry/common/windowgrabber.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef WINDOWGRABBER_H
+#define WINDOWGRABBER_H
+
+#include <QAbstractNativeEventFilter>
+#include <QObject>
+#include <QTimer>
+
+#include <screen/screen.h>
+
+QT_BEGIN_NAMESPACE
+
+class WindowGrabber : public QObject, public QAbstractNativeEventFilter
+{
+ Q_OBJECT
+
+public:
+ explicit WindowGrabber(QObject *parent = 0);
+ ~WindowGrabber();
+
+ void setFrameRate(int frameRate);
+
+ void setWindowId(const QByteArray &windowId);
+
+ void start();
+ void stop();
+
+ void pause();
+ void resume();
+
+ bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
+
+ QByteArray windowGroupId() const;
+
+signals:
+ void frameGrabbed(const QImage &frame);
+
+private slots:
+ void grab();
+
+private:
+ void cleanup();
+
+ QTimer m_timer;
+
+ QByteArray m_windowId;
+
+ screen_window_t m_window;
+ screen_context_t m_screenContext;
+ screen_pixmap_t m_screenPixmap;
+ screen_buffer_t m_screenPixmapBuffer;
+
+ char* m_screenBuffer;
+
+ int m_screenBufferWidth;
+ int m_screenBufferHeight;
+ int m_screenBufferStride;
+
+ bool m_active : 1;
+ bool m_screenContextInitialized : 1;
+ bool m_screenPixmapInitialized : 1;
+ bool m_screenPixmapBufferInitialized : 1;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/mediaservice/bbmediaplayercontrol.cpp b/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp
index 55c8a7f69..1ef68cb12 100644
--- a/src/plugins/blackberry/mediaservice/bbmediaplayercontrol.cpp
+++ b/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.cpp
@@ -39,8 +39,10 @@
**
****************************************************************************/
#include "bbmediaplayercontrol.h"
-#include "bbvideowindowcontrol.h"
+#include "bbmetadatareadercontrol.h"
+#include "bbplayervideorenderercontrol.h"
#include "bbutil.h"
+#include "bbvideowindowcontrol.h"
#include <QtCore/qabstracteventdispatcher.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
@@ -181,8 +183,11 @@ void BbMediaPlayerControl::attach()
return;
}
- if (m_videoControl)
- m_videoControl->attachDisplay(m_context);
+ if (m_videoRendererControl)
+ m_videoRendererControl->attachDisplay(m_context);
+
+ if (m_videoWindowControl)
+ m_videoWindowControl->attachDisplay(m_context);
m_audioId = mmr_output_attach(m_context, "audio:default", "audio");
if (m_audioId == -1) {
@@ -221,8 +226,10 @@ void BbMediaPlayerControl::detach()
mmr_input_detach(m_context);
m_inputAttached = false;
}
- if (m_videoControl)
- m_videoControl->detachDisplay();
+ if (m_videoRendererControl)
+ m_videoRendererControl->detachDisplay();
+ if (m_videoWindowControl)
+ m_videoWindowControl->detachDisplay();
if (m_audioId != -1 && m_context) {
mmr_output_detach(m_context, m_audioId);
m_audioId = -1;
@@ -321,6 +328,15 @@ void BbMediaPlayerControl::setMediaStatus(QMediaPlayer::MediaStatus status)
void BbMediaPlayerControl::setState(QMediaPlayer::State state)
{
if (m_state != state) {
+ if (m_videoRendererControl) {
+ if (state == QMediaPlayer::PausedState)
+ m_videoRendererControl->pause();
+ else if ((state == QMediaPlayer::PlayingState)
+ && (m_state == QMediaPlayer::PausedState)) {
+ m_videoRendererControl->resume();
+ }
+ }
+
m_state = state;
emit stateChanged(m_state);
}
@@ -510,9 +526,19 @@ void BbMediaPlayerControl::stop()
stopInternal(StopMmRenderer);
}
-void BbMediaPlayerControl::setVideoControl(BbVideoWindowControl *videoControl)
+void BbMediaPlayerControl::setVideoRendererControl(BbPlayerVideoRendererControl *videoControl)
{
- m_videoControl = videoControl;
+ m_videoRendererControl = videoControl;
+}
+
+void BbMediaPlayerControl::setVideoWindowControl(BbVideoWindowControl *videoControl)
+{
+ m_videoWindowControl = videoControl;
+}
+
+void BbMediaPlayerControl::setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl)
+{
+ m_metaDataReaderControl = metaDataReaderControl;
}
bool BbMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
@@ -526,8 +552,8 @@ bool BbMediaPlayerControl::nativeEventFilter(const QByteArray &eventType, void *
bps_event_get_domain(event) != screen_get_domain()))
return false;
- if (m_videoControl)
- m_videoControl->bpsEventHandler(event);
+ if (m_videoWindowControl)
+ m_videoWindowControl->bpsEventHandler(event);
if (bps_event_get_domain(event) == mmrenderer_get_domain()) {
if (bps_event_get_code(event) == MMRENDERER_STATE_CHANGE) {
@@ -589,8 +615,11 @@ void BbMediaPlayerControl::updateMetaData()
else
m_metaData.clear();
- if (m_videoControl)
- m_videoControl->setMetaData(m_metaData);
+ if (m_videoWindowControl)
+ m_videoWindowControl->setMetaData(m_metaData);
+
+ if (m_metaDataReaderControl)
+ m_metaDataReaderControl->setMetaData(m_metaData);
emit durationChanged(m_metaData.duration());
emit audioAvailableChanged(m_metaData.hasAudio());
diff --git a/src/plugins/blackberry/mediaservice/bbmediaplayercontrol.h b/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h
index eb87ea872..a8a4a929c 100644
--- a/src/plugins/blackberry/mediaservice/bbmediaplayercontrol.h
+++ b/src/plugins/blackberry/mediaplayer/bbmediaplayercontrol.h
@@ -54,6 +54,8 @@ typedef struct mmrenderer_monitor mmrenderer_monitor_t;
QT_BEGIN_NAMESPACE
+class BbMetaDataReaderControl;
+class BbPlayerVideoRendererControl;
class BbVideoWindowControl;
class BbMediaPlayerControl : public QMediaPlayerControl, public QAbstractNativeEventFilter
@@ -98,7 +100,9 @@ public:
void pause() Q_DECL_OVERRIDE;
void stop() Q_DECL_OVERRIDE;
- void setVideoControl(BbVideoWindowControl *videoControl);
+ void setVideoRendererControl(BbPlayerVideoRendererControl *videoControl);
+ void setVideoWindowControl(BbVideoWindowControl *videoControl);
+ void setMetaDataReaderControl(BbMetaDataReaderControl *metaDataReaderControl);
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
private Q_SLOTS:
@@ -136,7 +140,9 @@ private:
int m_volume;
bool m_muted;
qreal m_rate;
- QPointer<BbVideoWindowControl> m_videoControl;
+ QPointer<BbPlayerVideoRendererControl> m_videoRendererControl;
+ QPointer<BbVideoWindowControl> m_videoWindowControl;
+ QPointer<BbMetaDataReaderControl> m_metaDataReaderControl;
BbMetaData m_metaData;
int m_id;
mmrenderer_monitor_t *m_eventMonitor;
diff --git a/src/plugins/blackberry/mediaservice/bbmediaplayerservice.cpp b/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp
index 8730d2ddc..5846cc020 100644
--- a/src/plugins/blackberry/mediaservice/bbmediaplayerservice.cpp
+++ b/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.cpp
@@ -41,22 +41,31 @@
#include "bbmediaplayerservice.h"
#include "bbmediaplayercontrol.h"
+#include "bbmetadatareadercontrol.h"
+#include "bbplayervideorenderercontrol.h"
+#include "bbutil.h"
#include "bbvideowindowcontrol.h"
QT_BEGIN_NAMESPACE
BbMediaPlayerService::BbMediaPlayerService(QObject *parent)
: QMediaService(parent),
+ m_videoRendererControl(0),
m_videoWindowControl(0),
- m_mediaPlayerControl(0)
+ m_mediaPlayerControl(0),
+ m_metaDataReaderControl(0),
+ m_appHasDrmPermission(false),
+ m_appHasDrmPermissionChecked(false)
{
}
BbMediaPlayerService::~BbMediaPlayerService()
{
// Someone should have called releaseControl(), but better be safe
+ delete m_videoRendererControl;
delete m_videoWindowControl;
delete m_mediaPlayerControl;
+ delete m_metaDataReaderControl;
}
QMediaControl *BbMediaPlayerService::requestControl(const char *name)
@@ -68,6 +77,32 @@ QMediaControl *BbMediaPlayerService::requestControl(const char *name)
}
return m_mediaPlayerControl;
}
+ else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
+ if (!m_metaDataReaderControl) {
+ m_metaDataReaderControl = new BbMetaDataReaderControl();
+ updateControls();
+ }
+ return m_metaDataReaderControl;
+ }
+ else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
+ if (!m_appHasDrmPermissionChecked) {
+ m_appHasDrmPermission = checkForDrmPermission();
+ m_appHasDrmPermissionChecked = true;
+ }
+
+ if (m_appHasDrmPermission) {
+ // When the application wants to play back DRM secured media, we can't use
+ // the QVideoRendererControl, because we won't have access to the pixel data
+ // in this case.
+ return 0;
+ }
+
+ if (!m_videoRendererControl) {
+ m_videoRendererControl = new BbPlayerVideoRendererControl();
+ updateControls();
+ }
+ return m_videoRendererControl;
+ }
else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
if (!m_videoWindowControl) {
m_videoWindowControl = new BbVideoWindowControl();
@@ -80,17 +115,27 @@ QMediaControl *BbMediaPlayerService::requestControl(const char *name)
void BbMediaPlayerService::releaseControl(QMediaControl *control)
{
+ if (control == m_videoRendererControl)
+ m_videoRendererControl = 0;
if (control == m_videoWindowControl)
m_videoWindowControl = 0;
if (control == m_mediaPlayerControl)
m_mediaPlayerControl = 0;
+ if (control == m_metaDataReaderControl)
+ m_metaDataReaderControl = 0;
delete control;
}
void BbMediaPlayerService::updateControls()
{
+ if (m_videoRendererControl && m_mediaPlayerControl)
+ m_mediaPlayerControl->setVideoRendererControl(m_videoRendererControl);
+
if (m_videoWindowControl && m_mediaPlayerControl)
- m_mediaPlayerControl->setVideoControl(m_videoWindowControl);
+ m_mediaPlayerControl->setVideoWindowControl(m_videoWindowControl);
+
+ if (m_metaDataReaderControl && m_mediaPlayerControl)
+ m_mediaPlayerControl->setMetaDataReaderControl(m_metaDataReaderControl);
}
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaservice/bbmediaplayerservice.h b/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h
index 8ff52cd28..03aa7818f 100644
--- a/src/plugins/blackberry/mediaservice/bbmediaplayerservice.h
+++ b/src/plugins/blackberry/mediaplayer/bbmediaplayerservice.h
@@ -47,6 +47,8 @@
QT_BEGIN_NAMESPACE
class BbMediaPlayerControl;
+class BbMetaDataReaderControl;
+class BbPlayerVideoRendererControl;
class BbVideoWindowControl;
class BbMediaPlayerService : public QMediaService
@@ -62,8 +64,13 @@ public:
private:
void updateControls();
+ QPointer<BbPlayerVideoRendererControl> m_videoRendererControl;
QPointer<BbVideoWindowControl> m_videoWindowControl;
QPointer<BbMediaPlayerControl> m_mediaPlayerControl;
+ QPointer<BbMetaDataReaderControl> m_metaDataReaderControl;
+
+ bool m_appHasDrmPermission : 1;
+ bool m_appHasDrmPermissionChecked : 1;
};
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaservice/bbmetadata.cpp b/src/plugins/blackberry/mediaplayer/bbmetadata.cpp
index c2650354e..680833e85 100644
--- a/src/plugins/blackberry/mediaservice/bbmetadata.cpp
+++ b/src/plugins/blackberry/mediaplayer/bbmetadata.cpp
@@ -51,7 +51,16 @@ BbMetaData::BbMetaData()
clear();
}
+static const char * titleKey = "md_title_name";
+static const char * artistKey = "md_title_artist";
+static const char * commentKey = "md_title_comment";
+static const char * genreKey = "md_title_genre";
+static const char * yearKey = "md_title_year";
static const char * durationKey = "md_title_duration";
+static const char * bitRateKey = "md_title_bitrate";
+static const char * sampleKey = "md_title_samplerate";
+static const char * albumKey = "md_title_album";
+static const char * trackKey = "md_title_track";
static const char * widthKey = "md_video_width";
static const char * heightKey = "md_video_height";
static const char * mediaTypeKey = "md_title_mediatype";
@@ -103,8 +112,26 @@ bool BbMetaData::parse(const QString &contextName)
m_pixelWidth = value.toFloat();
else if (key == pixelHeightKey)
m_pixelHeight = value.toFloat();
+ else if (key == titleKey)
+ m_title = value;
else if (key == seekableKey)
m_seekable = !(value == QLatin1String("0"));
+ else if (key == artistKey)
+ m_artist = value;
+ else if (key == commentKey)
+ m_comment = value;
+ else if (key == genreKey)
+ m_genre = value;
+ else if (key == yearKey)
+ m_year = value.toInt();
+ else if (key == bitRateKey)
+ m_audioBitRate = value.toInt();
+ else if (key == sampleKey)
+ m_sampleRate = value.toInt();
+ else if (key == albumKey)
+ m_album = value;
+ else if (key == trackKey)
+ m_track = value.toInt();
}
}
@@ -120,6 +147,15 @@ void BbMetaData::clear()
m_pixelWidth = 1;
m_pixelHeight = 1;
m_seekable = true;
+ m_title.clear();
+ m_artist.clear();
+ m_comment.clear();
+ m_genre.clear();
+ m_year = 0;
+ m_audioBitRate = 0;
+ m_sampleRate = 0;
+ m_album.clear();
+ m_track = 0;
}
qlonglong BbMetaData::duration() const
@@ -165,9 +201,69 @@ bool BbMetaData::hasAudio() const
return (m_mediaType & mediaTypeAudioFlag);
}
+QString BbMetaData::title() const
+{
+ return m_title;
+}
+
bool BbMetaData::isSeekable() const
{
return m_seekable;
}
+QString BbMetaData::artist() const
+{
+ return m_artist;
+}
+
+QString BbMetaData::comment() const
+{
+ return m_comment;
+}
+
+QString BbMetaData::genre() const
+{
+ return m_genre;
+}
+
+int BbMetaData::year() const
+{
+ return m_year;
+}
+
+QString BbMetaData::mediaType() const
+{
+ if (hasVideo())
+ return QLatin1String("video");
+ else if (hasAudio())
+ return QLatin1String("audio");
+ else
+ return QString();
+}
+
+int BbMetaData::audioBitRate() const
+{
+ return m_audioBitRate;
+}
+
+int BbMetaData::sampleRate() const
+{
+ return m_sampleRate;
+}
+
+QString BbMetaData::album() const
+{
+ return m_album;
+}
+
+int BbMetaData::track() const
+{
+ return m_track;
+}
+
+QSize BbMetaData::resolution() const
+{
+ return QSize(width(), height());
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaservice/bbmetadata.h b/src/plugins/blackberry/mediaplayer/bbmetadata.h
index e3ac9d5c4..f4b742296 100644
--- a/src/plugins/blackberry/mediaservice/bbmetadata.h
+++ b/src/plugins/blackberry/mediaplayer/bbmetadata.h
@@ -42,6 +42,8 @@
#define BBMETADATA_H
#include <QtCore/qglobal.h>
+#include <QtCore/QSize>
+#include <QtCore/QString>
QT_BEGIN_NAMESPACE
@@ -61,6 +63,18 @@ public:
bool hasAudio() const;
bool isSeekable() const;
+ QString title() const;
+ QString artist() const;
+ QString comment() const;
+ QString genre() const;
+ int year() const;
+ QString mediaType() const;
+ int audioBitRate() const;
+ int sampleRate() const;
+ QString album() const;
+ int track() const;
+ QSize resolution() const;
+
private:
qlonglong m_duration;
int m_height;
@@ -69,6 +83,15 @@ private:
float m_pixelWidth;
float m_pixelHeight;
bool m_seekable;
+ QString m_title;
+ QString m_artist;
+ QString m_comment;
+ QString m_genre;
+ int m_year;
+ int m_audioBitRate;
+ int m_sampleRate;
+ QString m_album;
+ int m_track;
};
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp b/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp
new file mode 100644
index 000000000..95f85f5e3
--- /dev/null
+++ b/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.cpp
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#include "bbmetadatareadercontrol.h"
+
+QT_BEGIN_NAMESPACE
+
+BbMetaDataReaderControl::BbMetaDataReaderControl(QObject *parent)
+ : QMetaDataReaderControl(parent)
+{
+}
+
+bool BbMetaDataReaderControl::isMetaDataAvailable() const
+{
+ return !availableMetaData().isEmpty();
+}
+
+QVariant BbMetaDataReaderControl::metaData(const QString &key) const
+{
+ if (key == QMediaMetaData::Title)
+ return m_metaData.title();
+ else if (key == QMediaMetaData::Author)
+ return m_metaData.artist();
+ else if (key == QMediaMetaData::Comment)
+ return m_metaData.comment();
+ else if (key == QMediaMetaData::Genre)
+ return m_metaData.genre();
+ else if (key == QMediaMetaData::Year)
+ return m_metaData.year();
+ else if (key == QMediaMetaData::MediaType)
+ return m_metaData.mediaType();
+ else if (key == QMediaMetaData::Duration)
+ return m_metaData.duration();
+ else if (key == QMediaMetaData::AudioBitRate)
+ return m_metaData.audioBitRate();
+ else if (key == QMediaMetaData::SampleRate)
+ return m_metaData.sampleRate();
+ else if (key == QMediaMetaData::AlbumTitle)
+ return m_metaData.album();
+ else if (key == QMediaMetaData::TrackNumber)
+ return m_metaData.track();
+ else if (key == QMediaMetaData::Resolution)
+ return m_metaData.resolution();
+
+ return QVariant();
+}
+
+QStringList BbMetaDataReaderControl::availableMetaData() const
+{
+ QStringList metaData;
+
+ if (!m_metaData.title().isEmpty())
+ metaData << QMediaMetaData::Title;
+ if (!m_metaData.artist().isEmpty())
+ metaData << QMediaMetaData::Author;
+ if (!m_metaData.comment().isEmpty())
+ metaData << QMediaMetaData::Comment;
+ if (!m_metaData.genre().isEmpty())
+ metaData << QMediaMetaData::Genre;
+ if (m_metaData.year() != 0)
+ metaData << QMediaMetaData::Year;
+ if (!m_metaData.mediaType().isEmpty())
+ metaData << QMediaMetaData::MediaType;
+ if (m_metaData.duration() != 0)
+ metaData << QMediaMetaData::Duration;
+ if (m_metaData.audioBitRate() != 0)
+ metaData << QMediaMetaData::AudioBitRate;
+ if (m_metaData.sampleRate() != 0)
+ metaData << QMediaMetaData::SampleRate;
+ if (!m_metaData.album().isEmpty())
+ metaData << QMediaMetaData::AlbumTitle;
+ if (m_metaData.track() != 0)
+ metaData << QMediaMetaData::TrackNumber;
+ if (m_metaData.resolution().isValid())
+ metaData << QMediaMetaData::Resolution;
+
+ return metaData;
+}
+
+void BbMetaDataReaderControl::setMetaData(const BbMetaData &data)
+{
+ const BbMetaData oldMetaData = m_metaData;
+ const bool oldMetaDataAvailable = isMetaDataAvailable();
+
+ m_metaData = data;
+
+ bool changed = false;
+ if (m_metaData.title() != oldMetaData.title()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Title, m_metaData.title());
+ } else if (m_metaData.artist() != oldMetaData.artist()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Author, m_metaData.artist());
+ } else if (m_metaData.comment() != oldMetaData.comment()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Comment, m_metaData.comment());
+ } else if (m_metaData.genre() != oldMetaData.genre()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Genre, m_metaData.genre());
+ } else if (m_metaData.year() != oldMetaData.year()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Year, m_metaData.year());
+ } else if (m_metaData.mediaType() != oldMetaData.mediaType()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::MediaType, m_metaData.mediaType());
+ } else if (m_metaData.duration() != oldMetaData.duration()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Duration, m_metaData.duration());
+ } else if (m_metaData.audioBitRate() != oldMetaData.audioBitRate()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::AudioBitRate, m_metaData.audioBitRate());
+ } else if (m_metaData.sampleRate() != oldMetaData.sampleRate()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::SampleRate, m_metaData.sampleRate());
+ } else if (m_metaData.album() != oldMetaData.album()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::AlbumTitle, m_metaData.album());
+ } else if (m_metaData.track() != oldMetaData.track()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::TrackNumber, m_metaData.track());
+ } else if (m_metaData.resolution() != oldMetaData.resolution()) {
+ changed = true;
+ emit metaDataChanged(QMediaMetaData::Resolution, m_metaData.resolution());
+ }
+
+ if (changed)
+ emit metaDataChanged();
+
+ const bool metaDataAvailable = isMetaDataAvailable();
+ if (metaDataAvailable != oldMetaDataAvailable)
+ emit metaDataAvailableChanged(metaDataAvailable);
+}
diff --git a/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h b/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h
new file mode 100644
index 000000000..c825b54f3
--- /dev/null
+++ b/src/plugins/blackberry/mediaplayer/bbmetadatareadercontrol.h
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBMETADATAREADERCONTROL_H
+#define BBMETADATAREADERCONTROL_H
+
+#include "bbmetadata.h"
+#include <qmetadatareadercontrol.h>
+
+QT_BEGIN_NAMESPACE
+
+class BbMetaDataReaderControl : public QMetaDataReaderControl
+{
+ Q_OBJECT
+public:
+ explicit BbMetaDataReaderControl(QObject *parent = 0);
+
+ bool isMetaDataAvailable() const Q_DECL_OVERRIDE;
+
+ QVariant metaData(const QString &key) const Q_DECL_OVERRIDE;
+ QStringList availableMetaData() const Q_DECL_OVERRIDE;
+
+ void setMetaData(const BbMetaData &data);
+
+private:
+ BbMetaData m_metaData;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp
new file mode 100644
index 000000000..096ae55ec
--- /dev/null
+++ b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "bbplayervideorenderercontrol.h"
+
+#include "windowgrabber.h"
+
+#include <QCoreApplication>
+#include <QDebug>
+#include <QVideoSurfaceFormat>
+
+#include <mm/renderer.h>
+
+QT_BEGIN_NAMESPACE
+
+static int winIdCounter = 0;
+
+BbPlayerVideoRendererControl::BbPlayerVideoRendererControl(QObject *parent)
+ : QVideoRendererControl(parent)
+ , m_windowGrabber(new WindowGrabber(this))
+ , m_context(0)
+ , m_videoId(-1)
+{
+ connect(m_windowGrabber, SIGNAL(frameGrabbed(QImage)), SLOT(frameGrabbed(QImage)));
+}
+
+BbPlayerVideoRendererControl::~BbPlayerVideoRendererControl()
+{
+ detachDisplay();
+}
+
+QAbstractVideoSurface *BbPlayerVideoRendererControl::surface() const
+{
+ return m_surface;
+}
+
+void BbPlayerVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
+{
+ m_surface = QPointer<QAbstractVideoSurface>(surface);
+}
+
+void BbPlayerVideoRendererControl::attachDisplay(mmr_context_t *context)
+{
+ if (m_videoId != -1) {
+ qWarning() << "BbPlayerVideoRendererControl: Video output already attached!";
+ return;
+ }
+
+ if (!context) {
+ qWarning() << "BbPlayerVideoRendererControl: No media player context!";
+ return;
+ }
+
+ const QByteArray windowGroupId = m_windowGrabber->windowGroupId();
+ if (windowGroupId.isEmpty()) {
+ qWarning() << "BbPlayerVideoRendererControl: Unable to find window group";
+ return;
+ }
+
+ const QString windowName = QStringLiteral("BbPlayerVideoRendererControl_%1_%2")
+ .arg(winIdCounter++)
+ .arg(QCoreApplication::applicationPid());
+
+ m_windowGrabber->setWindowId(windowName.toLatin1());
+
+ // Start with an invisible window, because we just want to grab the frames from it.
+ const QString videoDeviceUrl = QStringLiteral("screen:?winid=%1&wingrp=%2&initflags=invisible&nodstviewport=1")
+ .arg(windowName)
+ .arg(QString::fromLatin1(windowGroupId));
+
+ m_videoId = mmr_output_attach(context, videoDeviceUrl.toLatin1(), "video");
+ if (m_videoId == -1) {
+ qWarning() << "mmr_output_attach() for video failed";
+ return;
+ }
+
+ m_context = context;
+}
+
+void BbPlayerVideoRendererControl::detachDisplay()
+{
+ m_windowGrabber->stop();
+
+ if (m_surface)
+ m_surface->stop();
+
+ if (m_context && m_videoId != -1)
+ mmr_output_detach(m_context, m_videoId);
+
+ m_context = 0;
+ m_videoId = -1;
+}
+
+void BbPlayerVideoRendererControl::pause()
+{
+ m_windowGrabber->pause();
+}
+
+void BbPlayerVideoRendererControl::resume()
+{
+ m_windowGrabber->resume();
+}
+
+void BbPlayerVideoRendererControl::frameGrabbed(const QImage &frame)
+{
+ if (m_surface) {
+ if (!m_surface->isActive())
+ m_surface->start(QVideoSurfaceFormat(frame.size(), QVideoFrame::Format_ARGB32));
+
+ m_surface->present(frame.copy());
+ }
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h
new file mode 100644
index 000000000..fff80dfe8
--- /dev/null
+++ b/src/plugins/blackberry/mediaplayer/bbplayervideorenderercontrol.h
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+#ifndef BBPLAYERVIDEORENDERERCONTROL_H
+#define BBPLAYERVIDEORENDERERCONTROL_H
+
+#include <QPointer>
+#include <qabstractvideosurface.h>
+#include <qvideorenderercontrol.h>
+
+typedef struct mmr_context mmr_context_t;
+struct bps_event_t;
+
+QT_BEGIN_NAMESPACE
+
+class WindowGrabber;
+
+class BbPlayerVideoRendererControl : public QVideoRendererControl
+{
+ Q_OBJECT
+public:
+ explicit BbPlayerVideoRendererControl(QObject *parent = 0);
+ ~BbPlayerVideoRendererControl();
+
+ QAbstractVideoSurface *surface() const Q_DECL_OVERRIDE;
+ void setSurface(QAbstractVideoSurface *surface) Q_DECL_OVERRIDE;
+
+ // Called by media control
+ void attachDisplay(mmr_context_t *context);
+ void detachDisplay();
+ void pause();
+ void resume();
+
+private Q_SLOTS:
+ void frameGrabbed(const QImage &frame);
+
+private:
+ QPointer<QAbstractVideoSurface> m_surface;
+
+ WindowGrabber* m_windowGrabber;
+ mmr_context_t *m_context;
+
+ int m_videoId;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/blackberry/mediaservice/bbutil.cpp b/src/plugins/blackberry/mediaplayer/bbutil.cpp
index f79bcb1ba..2e95c3571 100644
--- a/src/plugins/blackberry/mediaservice/bbutil.cpp
+++ b/src/plugins/blackberry/mediaplayer/bbutil.cpp
@@ -40,7 +40,12 @@
****************************************************************************/
#include "bbutil.h"
-#include <QtCore/qstring.h>
+#include <QDebug>
+#include <QDir>
+#include <QFile>
+#include <QString>
+#include <QXmlStreamReader>
+
#include <mm/renderer.h>
QT_BEGIN_NAMESPACE
@@ -80,7 +85,7 @@ static const MmError mmErrors[] = {
MM_ERROR_ENTRY(MMR_ERROR_DRM_OPL_BLUETOOTH),
MM_ERROR_ENTRY(MMR_ERROR_DRM_OPL_WIRELESSHD),
};
-static const int numMmErrors = sizeof(mmErrors) / sizeof(MmError);
+static const unsigned int numMmErrors = sizeof(mmErrors) / sizeof(MmError);
QString mmErrorMessage(const QString &msg, mmr_context_t *context, int *errorCode)
{
@@ -89,7 +94,7 @@ QString mmErrorMessage(const QString &msg, mmr_context_t *context, int *errorCod
if (errorCode)
*errorCode = mmError->error_code;
- if (mmError->error_code >= 0 && mmError->error_code < numMmErrors) {
+ if (mmError->error_code < numMmErrors) {
return QString("%1: %2 (code %3)").arg(msg).arg(mmErrors[mmError->error_code].name)
.arg(mmError->error_code);
} else {
@@ -97,4 +102,28 @@ QString mmErrorMessage(const QString &msg, mmr_context_t *context, int *errorCod
}
}
+bool checkForDrmPermission()
+{
+ QDir sandboxDir = QDir::home(); // always returns 'data' directory
+ sandboxDir.cdUp(); // change to app sandbox directory
+
+ QFile file(sandboxDir.filePath("app/native/bar-descriptor.xml"));
+ if (!file.open(QIODevice::ReadOnly)) {
+ qWarning() << "checkForDrmPermission: Unable to open bar-descriptor.xml";
+ return false;
+ }
+
+ QXmlStreamReader reader(&file);
+ while (!reader.atEnd()) {
+ reader.readNextStartElement();
+ if (reader.name() == QLatin1String("action")
+ || reader.name() == QLatin1String("permission")) {
+ if (reader.readElementText().trimmed() == QLatin1String("access_protected_media"))
+ return true;
+ }
+ }
+
+ return false;
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/blackberry/mediaservice/bbutil.h b/src/plugins/blackberry/mediaplayer/bbutil.h
index 44fde4ed4..35d59fe48 100644
--- a/src/plugins/blackberry/mediaservice/bbutil.h
+++ b/src/plugins/blackberry/mediaplayer/bbutil.h
@@ -51,6 +51,8 @@ class QString;
QString mmErrorMessage(const QString &msg, mmr_context_t *context, int * errorCode = 0);
+bool checkForDrmPermission();
+
QT_END_NAMESPACE
#endif
diff --git a/src/plugins/blackberry/mediaservice/bbvideowindowcontrol.cpp b/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp
index 5668332d1..d29f36f0a 100644
--- a/src/plugins/blackberry/mediaservice/bbvideowindowcontrol.cpp
+++ b/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.cpp
@@ -204,7 +204,7 @@ void BbVideoWindowControl::attachDisplay(mmr_context_t *context)
QPlatformNativeInterface * const nativeInterface = QGuiApplication::platformNativeInterface();
if (!nativeInterface) {
- qDebug() << "BbVideoWindowControl: Unable to get platform native interface. Qt too old?";
+ qDebug() << "BbVideoWindowControl: Unable to get platform native interface";
return;
}
diff --git a/src/plugins/blackberry/mediaservice/bbvideowindowcontrol.h b/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h
index 81bf79682..81bf79682 100644
--- a/src/plugins/blackberry/mediaservice/bbvideowindowcontrol.h
+++ b/src/plugins/blackberry/mediaplayer/bbvideowindowcontrol.h
diff --git a/src/plugins/blackberry/mediaplayer/mediaplayer.pri b/src/plugins/blackberry/mediaplayer/mediaplayer.pri
new file mode 100644
index 000000000..065c799a6
--- /dev/null
+++ b/src/plugins/blackberry/mediaplayer/mediaplayer.pri
@@ -0,0 +1,21 @@
+INCLUDEPATH += $$PWD
+
+HEADERS += \
+ $$PWD/bbmediaplayercontrol.h \
+ $$PWD/bbmediaplayerservice.h \
+ $$PWD/bbmetadata.h \
+ $$PWD/bbmetadatareadercontrol.h \
+ $$PWD/bbplayervideorenderercontrol.h \
+ $$PWD/bbutil.h \
+ $$PWD/bbvideowindowcontrol.h
+
+SOURCES += \
+ $$PWD/bbmediaplayercontrol.cpp \
+ $$PWD/bbmediaplayerservice.cpp \
+ $$PWD/bbmetadata.cpp \
+ $$PWD/bbmetadatareadercontrol.cpp \
+ $$PWD/bbplayervideorenderercontrol.cpp \
+ $$PWD/bbutil.cpp \
+ $$PWD/bbvideowindowcontrol.cpp
+
+LIBS += -lmmrndclient -lstrm
diff --git a/src/plugins/blackberry/mediaservice/mediaservice.pro b/src/plugins/blackberry/mediaservice/mediaservice.pro
deleted file mode 100644
index ffaed4816..000000000
--- a/src/plugins/blackberry/mediaservice/mediaservice.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-TARGET = qtmedia_blackberry
-QT += multimedia-private gui-private
-
-PLUGIN_TYPE=mediaservice
-PLUGIN_CLASS_NAME = BbServicePlugin
-load(qt_plugin)
-
-LIBS += -lmmrndclient -lstrm -lscreen
-
-HEADERS += \
- bbserviceplugin.h \
- bbmediaplayerservice.h \
- bbmediaplayercontrol.h \
- bbmetadata.h \
- bbutil.h \
- bbvideowindowcontrol.h
-
-SOURCES += \
- bbserviceplugin.cpp \
- bbmediaplayerservice.cpp \
- bbmediaplayercontrol.cpp \
- bbmetadata.cpp \
- bbutil.cpp \
- bbvideowindowcontrol.cpp
-
-OTHER_FILES += blackberry_mediaservice.json
diff --git a/src/plugins/directshow/camera/dscameracontrol.h b/src/plugins/directshow/camera/dscameracontrol.h
index 5c32f73f7..5c7661643 100644
--- a/src/plugins/directshow/camera/dscameracontrol.h
+++ b/src/plugins/directshow/camera/dscameracontrol.h
@@ -45,8 +45,6 @@
#include <QtCore/qobject.h>
#include <qcameracontrol.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSCameraService;
@@ -87,8 +85,6 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/plugins/directshow/camera/dscameraservice.cpp b/src/plugins/directshow/camera/dscameraservice.cpp
index 306cd16bb..2c6ea0e94 100644
--- a/src/plugins/directshow/camera/dscameraservice.cpp
+++ b/src/plugins/directshow/camera/dscameraservice.cpp
@@ -119,6 +119,7 @@ QMediaControl* DSCameraService::requestControl(const char *name)
void DSCameraService::releaseControl(QMediaControl *control)
{
+ Q_UNUSED(control)
// Implemented as a singleton, so we do nothing.
}
diff --git a/src/plugins/directshow/camera/dscameraservice.h b/src/plugins/directshow/camera/dscameraservice.h
index 0f2d3182b..e39ea0adc 100644
--- a/src/plugins/directshow/camera/dscameraservice.h
+++ b/src/plugins/directshow/camera/dscameraservice.h
@@ -46,8 +46,6 @@
#include <qmediaservice.h>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSCameraControl;
@@ -85,6 +83,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
index 71f0c07cf..f921dac20 100644
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ b/src/plugins/directshow/camera/dscamerasession.cpp
@@ -96,6 +96,8 @@ public:
STDMETHODIMP SampleCB(double Time, IMediaSample *pSample)
{
+ Q_UNUSED(Time)
+ Q_UNUSED(pSample)
return E_NOTIMPL;
}
diff --git a/src/plugins/directshow/camera/dscamerasession.h b/src/plugins/directshow/camera/dscamerasession.h
index 59277fa27..db0038813 100644
--- a/src/plugins/directshow/camera/dscamerasession.h
+++ b/src/plugins/directshow/camera/dscamerasession.h
@@ -56,11 +56,15 @@
#include <dshow.h>
#include <objbase.h>
#include <initguid.h>
-#pragma comment(lib, "strmiids.lib")
-#pragma comment(lib, "ole32.lib")
+#ifdef Q_CC_MSVC
+# pragma comment(lib, "strmiids.lib")
+# pragma comment(lib, "ole32.lib")
+#endif // Q_CC_MSVC
#include <windows.h>
-#pragma include_alias("dxtrans.h","qedit.h")
+#ifdef Q_CC_MSVC
+# pragma include_alias("dxtrans.h","qedit.h")
+#endif // Q_CC_MSVC
#define __IDxtCompositor_INTERFACE_DEFINED__
#define __IDxtAlphaSetter_INTERFACE_DEFINED__
#define __IDxtJpeg_INTERFACE_DEFINED__
@@ -70,8 +74,6 @@
struct ICaptureGraphBuilder2;
struct ISampleGrabber;
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSVideoRenderer;
@@ -202,7 +204,5 @@ protected:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/plugins/directshow/camera/dsimagecapturecontrol.h b/src/plugins/directshow/camera/dsimagecapturecontrol.h
index b8bc1b31a..e39539191 100644
--- a/src/plugins/directshow/camera/dsimagecapturecontrol.h
+++ b/src/plugins/directshow/camera/dsimagecapturecontrol.h
@@ -45,8 +45,6 @@
#include <qcameraimagecapturecontrol.h>
#include "dscamerasession.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSImageCaptureControl : public QCameraImageCaptureControl
@@ -60,7 +58,7 @@ public:
int capture(const QString &fileName);
virtual QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- virtual void setDriveMode(QCameraImageCapture::DriveMode mode) { }
+ virtual void setDriveMode(QCameraImageCapture::DriveMode mode) { Q_UNUSED(mode) }
virtual void cancelCapture() {}
@@ -75,6 +73,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // DSCAPTURECONTROL_H
diff --git a/src/plugins/directshow/camera/dsvideodevicecontrol.h b/src/plugins/directshow/camera/dsvideodevicecontrol.h
index 29c18ad27..11ee550bc 100644
--- a/src/plugins/directshow/camera/dsvideodevicecontrol.h
+++ b/src/plugins/directshow/camera/dsvideodevicecontrol.h
@@ -45,8 +45,6 @@
#include <qvideodeviceselectorcontrol.h>
#include <QStringList>
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSCameraSession;
@@ -80,6 +78,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif
diff --git a/src/plugins/directshow/camera/dsvideorenderer.h b/src/plugins/directshow/camera/dsvideorenderer.h
index 4c5576bc8..3621cc5a5 100644
--- a/src/plugins/directshow/camera/dsvideorenderer.h
+++ b/src/plugins/directshow/camera/dsvideorenderer.h
@@ -47,8 +47,6 @@
class CameraFormatConverter;
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
@@ -72,6 +70,4 @@ private:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // DSVIDEORENDERER_H
diff --git a/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp b/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp
index db2ef1a54..fde9f554e 100644
--- a/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp
+++ b/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp
@@ -48,6 +48,7 @@
QT_BEGIN_NAMESPACE
DSVideoWidgetSurface::DSVideoWidgetSurface(QLabel *pWidget, QObject *parent)
+ : QAbstractVideoSurface(parent)
{
widget = pWidget;
myPixmap = 0;
@@ -106,11 +107,13 @@ void DSVideoWidgetSurface::updateVideoRect()
void DSVideoWidgetSurface::paint(QPainter *painter)
{
+ Q_UNUSED(painter)
}
DSVideoWidgetControl::DSVideoWidgetControl(DSCameraSession* session, QObject *parent) :
- m_session(session), QVideoWidgetControl(parent),
+ QVideoWidgetControl(parent),
+ m_session(session),
m_widget(new QLabel()),
m_fullScreen(false)
{
diff --git a/src/plugins/directshow/camera/dsvideowidgetcontrol.h b/src/plugins/directshow/camera/dsvideowidgetcontrol.h
index aced707fa..ac40fbd7c 100644
--- a/src/plugins/directshow/camera/dsvideowidgetcontrol.h
+++ b/src/plugins/directshow/camera/dsvideowidgetcontrol.h
@@ -51,8 +51,6 @@
#include <qvideowidgetcontrol.h>
#include "dscameracontrol.h"
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class DSVideoWidgetSurface : public QAbstractVideoSurface
@@ -149,6 +147,4 @@ private: // Data
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // DSVideoWidgetControl_H
diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp
index 8b487674b..dca7430af 100644
--- a/src/plugins/directshow/dsserviceplugin.cpp
+++ b/src/plugins/directshow/dsserviceplugin.cpp
@@ -69,8 +69,10 @@ extern const CLSID CLSID_VideoInputDeviceCategory;
#include <dshow.h>
#include <objbase.h>
#include <initguid.h>
-#pragma comment(lib, "strmiids.lib")
-#pragma comment(lib, "ole32.lib")
+#ifdef Q_CC_MSVC
+# pragma comment(lib, "strmiids.lib")
+# pragma comment(lib, "ole32.lib")
+#endif // Q_CC_MSVC
#include <windows.h>
#include <ocidl.h>
#endif
diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp
index b9fdd09e6..f382b3b9c 100644
--- a/src/plugins/directshow/player/directshowiosource.cpp
+++ b/src/plugins/directshow/player/directshowiosource.cpp
@@ -174,6 +174,7 @@ HRESULT DirectShowIOSource::GetClassID(CLSID *pClassID)
// IMediaFilter
HRESULT DirectShowIOSource::Run(REFERENCE_TIME tStart)
{
+ Q_UNUSED(tStart)
QMutexLocker locker(&m_mutex);
m_state = State_Running;
@@ -627,7 +628,7 @@ bool DirectShowRcSource::open(const QUrl &url)
qDebug("qrc file %s", qPrintable(m_file.fileName()));
if (m_file.open(QIODevice::ReadOnly)) {
- qDebug("Size %d", m_file.size());
+ qDebug("Size %d", int(m_file.size()));
qDebug("Sequential %d", int(m_file.isSequential()));
setDevice(&m_file);
diff --git a/src/plugins/directshow/player/directshowmediatypelist.cpp b/src/plugins/directshow/player/directshowmediatypelist.cpp
index 35eb34e27..1a6298e2b 100644
--- a/src/plugins/directshow/player/directshowmediatypelist.cpp
+++ b/src/plugins/directshow/player/directshowmediatypelist.cpp
@@ -198,7 +198,7 @@ HRESULT DirectShowMediaTypeList::nextMediaType(
if (fetchedCount)
*fetchedCount = boundedCount;
- return boundedCount == count ? S_OK : S_FALSE;
+ return boundedCount == int(count) ? S_OK : S_FALSE;
}
}
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
index a06788e4f..d89ed7bdb 100644
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ b/src/plugins/directshow/player/directshowplayerservice.cpp
@@ -357,6 +357,7 @@ void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
DirectShowIOSource *source = new DirectShowIOSource(m_loop);
source->setDevice(m_stream);
@@ -512,6 +513,7 @@ void DirectShowPlayerService::doRender(QMutexLocker *locker)
void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
if (m_graphStatus != Loaded) {
if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
event->GetEventHandle(reinterpret_cast<OAEVENT *>(&m_eventHandle));
@@ -783,6 +785,7 @@ void DirectShowPlayerService::stop()
void DirectShowPlayerService::doStop(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
if (m_executedTasks & (Play | Pause)) {
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
control->Stop();
@@ -1002,6 +1005,7 @@ void DirectShowPlayerService::setAudioOutput(IBaseFilter *filter)
void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
m_pendingTasks |= m_executedTasks & (Play | Pause);
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
@@ -1075,6 +1079,7 @@ void DirectShowPlayerService::setVideoOutput(IBaseFilter *filter)
void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
m_pendingTasks |= m_executedTasks & (Play | Pause);
if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
@@ -1170,6 +1175,7 @@ void DirectShowPlayerService::videoOutputChanged()
void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
{
+ Q_UNUSED(locker)
if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
long eventCode;
LONG_PTR param1;
diff --git a/src/plugins/directshow/player/videosurfacefilter.cpp b/src/plugins/directshow/player/videosurfacefilter.cpp
index e31b270c1..b8a775bb7 100644
--- a/src/plugins/directshow/player/videosurfacefilter.cpp
+++ b/src/plugins/directshow/player/videosurfacefilter.cpp
@@ -160,6 +160,7 @@ HRESULT VideoSurfaceFilter::Stop()
HRESULT VideoSurfaceFilter::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
{
+ Q_UNUSED(dwMilliSecsTimeout)
if (!pState)
return E_POINTER;
@@ -264,6 +265,8 @@ ULONG VideoSurfaceFilter::GetMiscFlags()
HRESULT VideoSurfaceFilter::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
{
+ Q_UNUSED(pReceivePin)
+ Q_UNUSED(pmt)
// This is an input pin, you shouldn't be calling Connect on it.
return E_POINTER;
}
@@ -547,19 +550,20 @@ HRESULT VideoSurfaceFilter::cloneMediaType(int token, int index, IEnumMediaTypes
void VideoSurfaceFilter::customEvent(QEvent *event)
{
- if (event->type() == StartSurface) {
+ const int type = event->type();
+ if (type == StartSurface) {
QMutexLocker locker(&m_mutex);
m_startResult = start();
m_wait.wakeAll();
- } else if (event->type() == StopSurface) {
+ } else if (type == StopSurface) {
QMutexLocker locker(&m_mutex);
stop();
m_wait.wakeAll();
- } else if (event->type() == FlushSurface) {
+ } else if (type == FlushSurface) {
QMutexLocker locker(&m_mutex);
flush();
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index 24708e0bc..8f751ae3b 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -8,10 +8,18 @@ TEMPLATE = subdirs
SUBDIRS += m3u
+android {
+ SUBDIRS += android
+}
+
blackberry {
SUBDIRS += blackberry
}
+qnx {
+ SUBDIRS += qnx
+}
+
win32 {
SUBDIRS += audiocapture
}
@@ -37,8 +45,11 @@ unix:!mac {
}
mac:!simulator {
- SUBDIRS += audiocapture qt7
+ SUBDIRS += audiocapture
- config_avfoundation: SUBDIRS += avfoundation
+ !ios {
+ SUBDIRS += qt7
+ config_avfoundation: SUBDIRS += avfoundation
+ }
}
diff --git a/src/plugins/qnx/audio/audio.pro b/src/plugins/qnx/audio/audio.pro
new file mode 100644
index 000000000..c38b09b79
--- /dev/null
+++ b/src/plugins/qnx/audio/audio.pro
@@ -0,0 +1,26 @@
+TARGET = qtmedia_qnx_audio
+QT += multimedia-private
+CONFIG += no_private_qt_headers_warning
+
+PLUGIN_TYPE = audio
+
+load(qt_plugin)
+DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
+LIBS += -lasound
+
+HEADERS += qnxaudioplugin.h \
+ qnxaudiodeviceinfo.h \
+ qnxaudioinput.h \
+ qnxaudiooutput.h \
+ qnxaudioutils.h
+
+SOURCES += qnxaudioplugin.cpp \
+ qnxaudiodeviceinfo.cpp \
+ qnxaudioinput.cpp \
+ qnxaudiooutput.cpp \
+ qnxaudioutils.cpp
+
+OTHER_FILES += qnx_audio.json
+
+target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
+INSTALLS += target
diff --git a/src/plugins/qnx/audio/qnx_audio.json b/src/plugins/qnx/audio/qnx_audio.json
new file mode 100644
index 000000000..a31d52107
--- /dev/null
+++ b/src/plugins/qnx/audio/qnx_audio.json
@@ -0,0 +1,3 @@
+{
+ "Keys": ["default"]
+}
diff --git a/src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp b/src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp
new file mode 100644
index 000000000..ce8083573
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudiodeviceinfo.cpp
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnxaudiodeviceinfo.h"
+
+#include "qnxaudioutils.h"
+
+#include <sys/asoundlib.h>
+
+QT_BEGIN_NAMESPACE
+
+QnxAudioDeviceInfo::QnxAudioDeviceInfo(const QString &deviceName, QAudio::Mode mode)
+ : m_name(deviceName),
+ m_mode(mode)
+{
+}
+
+QnxAudioDeviceInfo::~QnxAudioDeviceInfo()
+{
+}
+
+QAudioFormat QnxAudioDeviceInfo::preferredFormat() const
+{
+ QAudioFormat format;
+ if (m_mode == QAudio::AudioOutput) {
+ format.setSampleRate(44100);
+ format.setChannelCount(2);
+ format.setByteOrder(QAudioFormat::LittleEndian);
+ format.setSampleType(QAudioFormat::SignedInt);
+ format.setSampleSize(16);
+ format.setCodec(QLatin1String("audio/pcm"));
+ } else {
+ format.setSampleRate(8000);
+ format.setChannelCount(1);
+ format.setSampleType(QAudioFormat::UnSignedInt);
+ format.setSampleSize(8);
+ format.setCodec(QLatin1String("audio/pcm"));
+ if (!isFormatSupported(format)) {
+ format.setChannelCount(2);
+ format.setSampleSize(16);
+ format.setSampleType(QAudioFormat::SignedInt);
+ }
+ }
+ return format;
+}
+
+bool QnxAudioDeviceInfo::isFormatSupported(const QAudioFormat &format) const
+{
+ if (!format.codec().startsWith(QLatin1String("audio/pcm")))
+ return false;
+
+ const int pcmMode = (m_mode == QAudio::AudioOutput) ? SND_PCM_OPEN_PLAYBACK : SND_PCM_OPEN_CAPTURE;
+ snd_pcm_t *handle;
+
+ int card = 0;
+ int device = 0;
+ if (snd_pcm_open_preferred(&handle, &card, &device, pcmMode) < 0)
+ return false;
+
+ snd_pcm_channel_info_t info;
+ memset (&info, 0, sizeof(info));
+ info.channel = (m_mode == QAudio::AudioOutput) ? SND_PCM_CHANNEL_PLAYBACK : SND_PCM_CHANNEL_CAPTURE;
+
+ if (snd_pcm_plugin_info(handle, &info) < 0) {
+ qWarning("QAudioDeviceInfo: couldn't get channel info");
+ snd_pcm_close(handle);
+ return false;
+ }
+
+ snd_pcm_channel_params_t params = QnxAudioUtils::formatToChannelParams(format, m_mode, info.max_fragment_size);
+ const int errorCode = snd_pcm_plugin_params(handle, &params);
+ snd_pcm_close(handle);
+
+ return errorCode == 0;
+}
+
+QString QnxAudioDeviceInfo::deviceName() const
+{
+ return m_name;
+}
+
+QStringList QnxAudioDeviceInfo::supportedCodecs()
+{
+ return QStringList() << QLatin1String("audio/pcm");
+}
+
+QList<int> QnxAudioDeviceInfo::supportedSampleRates()
+{
+ return QList<int>() << 8000 << 11025 << 22050 << 44100 << 48000;
+}
+
+QList<int> QnxAudioDeviceInfo::supportedChannelCounts()
+{
+ return QList<int>() << 1 << 2;
+}
+
+QList<int> QnxAudioDeviceInfo::supportedSampleSizes()
+{
+ return QList<int>() << 8 << 16 << 32;
+}
+
+QList<QAudioFormat::Endian> QnxAudioDeviceInfo::supportedByteOrders()
+{
+ return QList<QAudioFormat::Endian>() << QAudioFormat::LittleEndian << QAudioFormat::BigEndian;
+}
+
+QList<QAudioFormat::SampleType> QnxAudioDeviceInfo::supportedSampleTypes()
+{
+ return QList<QAudioFormat::SampleType>() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/audio/qnxaudiodeviceinfo.h b/src/plugins/qnx/audio/qnxaudiodeviceinfo.h
new file mode 100644
index 000000000..72c10cc75
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudiodeviceinfo.h
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNXAUDIODEVICEINFO_H
+#define QNXAUDIODEVICEINFO_H
+
+#include "qaudiosystem.h"
+
+QT_BEGIN_NAMESPACE
+
+class QnxAudioDeviceInfo : public QAbstractAudioDeviceInfo
+{
+ Q_OBJECT
+
+public:
+ QnxAudioDeviceInfo(const QString &deviceName, QAudio::Mode mode);
+ ~QnxAudioDeviceInfo();
+
+ QAudioFormat preferredFormat() const Q_DECL_OVERRIDE;
+ bool isFormatSupported(const QAudioFormat &format) const Q_DECL_OVERRIDE;
+ QString deviceName() const Q_DECL_OVERRIDE;
+ QStringList supportedCodecs() Q_DECL_OVERRIDE;
+ QList<int> supportedSampleRates() Q_DECL_OVERRIDE;
+ QList<int> supportedChannelCounts() Q_DECL_OVERRIDE;
+ QList<int> supportedSampleSizes() Q_DECL_OVERRIDE;
+ QList<QAudioFormat::Endian> supportedByteOrders() Q_DECL_OVERRIDE;
+ QList<QAudioFormat::SampleType> supportedSampleTypes() Q_DECL_OVERRIDE;
+
+private:
+ const QString m_name;
+ const QAudio::Mode m_mode;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/audio/qnxaudioinput.cpp b/src/plugins/qnx/audio/qnxaudioinput.cpp
new file mode 100644
index 000000000..eb8064598
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioinput.cpp
@@ -0,0 +1,447 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnxaudioinput.h"
+
+#include "qnxaudioutils.h"
+
+#include <private/qaudiohelpers_p.h>
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QnxAudioInput::QnxAudioInput()
+ : m_audioSource(0)
+ , m_pcmHandle(0)
+ , m_pcmNotifier(0)
+ , m_error(QAudio::NoError)
+ , m_state(QAudio::StoppedState)
+ , m_bytesRead(0)
+ , m_elapsedTimeOffset(0)
+ , m_totalTimeValue(0)
+ , m_volume(qreal(1.0f))
+ , m_bytesAvailable(0)
+ , m_bufferSize(0)
+ , m_periodSize(0)
+ , m_intervalTime(1000)
+ , m_pullMode(true)
+{
+}
+
+QnxAudioInput::~QnxAudioInput()
+{
+ close();
+}
+
+void QnxAudioInput::start(QIODevice *device)
+{
+ if (m_state != QAudio::StoppedState)
+ close();
+
+ if (!m_pullMode && m_audioSource)
+ delete m_audioSource;
+
+ m_pullMode = true;
+ m_audioSource = device;
+
+ if (open()) {
+ setError(QAudio::NoError);
+ setState(QAudio::ActiveState);
+ } else {
+ setError(QAudio::OpenError);
+ setState(QAudio::StoppedState);
+ }
+}
+
+QIODevice *QnxAudioInput::start()
+{
+ if (m_state != QAudio::StoppedState)
+ close();
+
+ if (!m_pullMode && m_audioSource)
+ delete m_audioSource;
+
+ m_pullMode = false;
+ m_audioSource = new InputPrivate(this);
+ m_audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
+
+ if (open()) {
+ setError(QAudio::NoError);
+ setState(QAudio::IdleState);
+ } else {
+ delete m_audioSource;
+ m_audioSource = 0;
+
+ setError(QAudio::OpenError);
+ setState(QAudio::StoppedState);
+ }
+
+ return m_audioSource;
+}
+
+void QnxAudioInput::stop()
+{
+ if (m_state == QAudio::StoppedState)
+ return;
+
+ setError(QAudio::NoError);
+ setState(QAudio::StoppedState);
+ close();
+}
+
+void QnxAudioInput::reset()
+{
+ stop();
+ m_bytesAvailable = 0;
+}
+
+void QnxAudioInput::suspend()
+{
+ if (m_pcmNotifier)
+ m_pcmNotifier->setEnabled(false);
+
+ setState(QAudio::SuspendedState);
+}
+
+void QnxAudioInput::resume()
+{
+ if (m_pcmNotifier)
+ m_pcmNotifier->setEnabled(true);
+
+ if (m_pullMode) {
+ setState(QAudio::ActiveState);
+ } else {
+ setState(QAudio::IdleState);
+ }
+}
+
+int QnxAudioInput::bytesReady() const
+{
+ return qMax(m_bytesAvailable, 0);
+}
+
+int QnxAudioInput::periodSize() const
+{
+ return m_periodSize;
+}
+
+void QnxAudioInput::setBufferSize(int bufferSize)
+{
+ m_bufferSize = bufferSize;
+}
+
+int QnxAudioInput::bufferSize() const
+{
+ return m_bufferSize;
+}
+
+void QnxAudioInput::setNotifyInterval(int milliSeconds)
+{
+ m_intervalTime = qMax(0, milliSeconds);
+}
+
+int QnxAudioInput::notifyInterval() const
+{
+ return m_intervalTime;
+}
+
+qint64 QnxAudioInput::processedUSecs() const
+{
+ return qint64(1000000) * m_format.framesForBytes(m_bytesRead) / m_format.sampleRate();
+}
+
+qint64 QnxAudioInput::elapsedUSecs() const
+{
+ if (m_state == QAudio::StoppedState)
+ return 0;
+
+ return m_clockStamp.elapsed() * 1000;
+}
+
+QAudio::Error QnxAudioInput::error() const
+{
+ return m_error;
+}
+
+QAudio::State QnxAudioInput::state() const
+{
+ return m_state;
+}
+
+void QnxAudioInput::setFormat(const QAudioFormat &format)
+{
+ if (m_state == QAudio::StoppedState)
+ m_format = format;
+}
+
+QAudioFormat QnxAudioInput::format() const
+{
+ return m_format;
+}
+
+void QnxAudioInput::setVolume(qreal volume)
+{
+ m_volume = qBound(qreal(0.0), volume, qreal(1.0));
+}
+
+qreal QnxAudioInput::volume() const
+{
+ return m_volume;
+}
+
+void QnxAudioInput::userFeed()
+{
+ if (m_state == QAudio::StoppedState || m_state == QAudio::SuspendedState)
+ return;
+
+ deviceReady();
+}
+
+bool QnxAudioInput::deviceReady()
+{
+ if (m_pullMode) {
+ // reads some audio data and writes it to QIODevice
+ read(0, 0);
+ } else {
+ m_bytesAvailable = m_periodSize;
+
+ // emits readyRead() so user will call read() on QIODevice to get some audio data
+ if (m_audioSource != 0) {
+ InputPrivate *input = qobject_cast<InputPrivate*>(m_audioSource);
+ input->trigger();
+ }
+ }
+
+ if (m_state != QAudio::ActiveState)
+ return true;
+
+ if (m_intervalTime && (m_timeStamp.elapsed() + m_elapsedTimeOffset) > m_intervalTime) {
+ emit notify();
+ m_elapsedTimeOffset = m_timeStamp.elapsed() + m_elapsedTimeOffset - m_intervalTime;
+ m_timeStamp.restart();
+ }
+
+ return true;
+}
+
+bool QnxAudioInput::open()
+{
+ if (!m_format.isValid() || m_format.sampleRate() <= 0) {
+ if (!m_format.isValid())
+ qWarning("QnxAudioInput: open error, invalid format.");
+ else
+ qWarning("QnxAudioInput: open error, invalid sample rate (%d).", m_format.sampleRate());
+
+ return false;
+ }
+
+ int errorCode = 0;
+
+ int card = 0;
+ int device = 0;
+ if ((errorCode = snd_pcm_open_preferred(&m_pcmHandle, &card, &device, SND_PCM_OPEN_CAPTURE)) < 0) {
+ qWarning("QnxAudioInput: open error, couldn't open card (0x%x)", -errorCode);
+ return false;
+ }
+
+ // Necessary so that bytesFree() which uses the "free" member of the status struct works
+ snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_DISABLE_MMAP);
+
+ snd_pcm_channel_info_t info;
+ memset(&info, 0, sizeof(info));
+ info.channel = SND_PCM_CHANNEL_CAPTURE;
+ if ((errorCode = snd_pcm_plugin_info(m_pcmHandle, &info)) < 0) {
+ qWarning("QnxAudioInput: open error, couldn't get channel info (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ snd_pcm_channel_params_t params = QnxAudioUtils::formatToChannelParams(m_format, QAudio::AudioInput, info.max_fragment_size);
+
+ if ((errorCode = snd_pcm_plugin_params(m_pcmHandle, &params)) < 0) {
+ qWarning("QnxAudioInput: open error, couldn't set channel params (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ if ((errorCode = snd_pcm_plugin_prepare(m_pcmHandle, SND_PCM_CHANNEL_CAPTURE)) < 0) {
+ qWarning("QnxAudioInput: open error, couldn't prepare channel (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ snd_pcm_channel_setup_t setup;
+
+ memset(&setup, 0, sizeof(setup));
+ setup.channel = SND_PCM_CHANNEL_CAPTURE;
+ if ((errorCode = snd_pcm_plugin_setup(m_pcmHandle, &setup)) < 0) {
+ qWarning("QnxAudioInput: open error, couldn't get channel setup (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ m_periodSize = qMin(2048, setup.buf.block.frag_size);
+
+ m_clockStamp.restart();
+ m_timeStamp.restart();
+ m_elapsedTimeOffset = 0;
+ m_totalTimeValue = 0;
+ m_bytesRead = 0;
+
+ m_pcmNotifier = new QSocketNotifier(snd_pcm_file_descriptor(m_pcmHandle, SND_PCM_CHANNEL_CAPTURE),
+ QSocketNotifier::Read, this);
+ connect(m_pcmNotifier, SIGNAL(activated(int)), SLOT(userFeed()));
+
+ return true;
+}
+
+void QnxAudioInput::close()
+{
+ if (m_pcmHandle)
+ snd_pcm_plugin_flush(m_pcmHandle, SND_PCM_CHANNEL_CAPTURE);
+
+ if (m_pcmNotifier) {
+ delete m_pcmNotifier;
+ m_pcmNotifier = 0;
+ }
+
+ if (m_pcmHandle) {
+ snd_pcm_close(m_pcmHandle);
+ m_pcmHandle = 0;
+ }
+
+ if (!m_pullMode && m_audioSource) {
+ delete m_audioSource;
+ m_audioSource = 0;
+ }
+}
+
+qint64 QnxAudioInput::read(char *data, qint64 len)
+{
+ int errorCode = 0;
+ QByteArray tempBuffer(m_periodSize, 0);
+
+ const int actualRead = snd_pcm_plugin_read(m_pcmHandle, tempBuffer.data(), m_periodSize);
+ if (actualRead < 1) {
+ snd_pcm_channel_status_t status;
+ memset(&status, 0, sizeof(status));
+ status.channel = SND_PCM_CHANNEL_CAPTURE;
+ if ((errorCode = snd_pcm_plugin_status(m_pcmHandle, &status)) < 0) {
+ qWarning("QnxAudioInput: read error, couldn't get plugin status (0x%x)", -errorCode);
+ close();
+ setError(QAudio::FatalError);
+ setState(QAudio::StoppedState);
+ return -1;
+ }
+
+ if (status.status == SND_PCM_STATUS_READY
+ || status.status == SND_PCM_STATUS_OVERRUN) {
+ if ((errorCode = snd_pcm_plugin_prepare(m_pcmHandle, SND_PCM_CHANNEL_CAPTURE)) < 0) {
+ qWarning("QnxAudioInput: read error, couldn't prepare plugin (0x%x)", -errorCode);
+ close();
+ setError(QAudio::FatalError);
+ setState(QAudio::StoppedState);
+ return -1;
+ }
+ }
+ } else {
+ setError(QAudio::NoError);
+ setState(QAudio::ActiveState);
+ }
+
+ if (m_volume < 1.0f)
+ QAudioHelperInternal::qMultiplySamples(m_volume, m_format, tempBuffer.data(), tempBuffer.data(), actualRead);
+
+ m_bytesRead += actualRead;
+
+ if (m_pullMode) {
+ m_audioSource->write(tempBuffer.data(), actualRead);
+ } else {
+ memcpy(data, tempBuffer.data(), qMin(static_cast<qint64>(actualRead), len));
+ }
+
+ m_bytesAvailable = 0;
+
+ return actualRead;
+}
+
+void QnxAudioInput::setError(QAudio::Error error)
+{
+ if (m_error == error)
+ return;
+
+ m_error = error;
+ emit errorChanged(m_error);
+}
+
+void QnxAudioInput::setState(QAudio::State state)
+{
+ if (m_state == state)
+ return;
+
+ m_state = state;
+ emit stateChanged(m_state);
+}
+
+InputPrivate::InputPrivate(QnxAudioInput *audio)
+ : m_audioDevice(audio)
+{
+}
+
+qint64 InputPrivate::readData(char *data, qint64 len)
+{
+ return m_audioDevice->read(data, len);
+}
+
+qint64 InputPrivate::writeData(const char *data, qint64 len)
+{
+ Q_UNUSED(data)
+ Q_UNUSED(len)
+ return 0;
+}
+
+void InputPrivate::trigger()
+{
+ emit readyRead();
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/audio/qnxaudioinput.h b/src/plugins/qnx/audio/qnxaudioinput.h
new file mode 100644
index 000000000..3084b1de3
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioinput.h
@@ -0,0 +1,139 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNXAUDIOINPUT_H
+#define QNXAUDIOINPUT_H
+
+#include "qaudiosystem.h"
+
+#include <QSocketNotifier>
+#include <QTime>
+#include <QTimer>
+
+#include <sys/asoundlib.h>
+
+QT_BEGIN_NAMESPACE
+
+class QnxAudioInput : public QAbstractAudioInput
+{
+ Q_OBJECT
+
+public:
+ QnxAudioInput();
+ ~QnxAudioInput();
+
+ void start(QIODevice*) Q_DECL_OVERRIDE;
+ QIODevice* start() Q_DECL_OVERRIDE;
+ void stop() Q_DECL_OVERRIDE;
+ void reset() Q_DECL_OVERRIDE;
+ void suspend() Q_DECL_OVERRIDE;
+ void resume() Q_DECL_OVERRIDE;
+ int bytesReady() const Q_DECL_OVERRIDE;
+ int periodSize() const Q_DECL_OVERRIDE;
+ void setBufferSize(int ) Q_DECL_OVERRIDE;
+ int bufferSize() const Q_DECL_OVERRIDE;
+ void setNotifyInterval(int ) Q_DECL_OVERRIDE;
+ int notifyInterval() const Q_DECL_OVERRIDE;
+ qint64 processedUSecs() const Q_DECL_OVERRIDE;
+ qint64 elapsedUSecs() const Q_DECL_OVERRIDE;
+ QAudio::Error error() const Q_DECL_OVERRIDE;
+ QAudio::State state() const Q_DECL_OVERRIDE;
+ void setFormat(const QAudioFormat&) Q_DECL_OVERRIDE;
+ QAudioFormat format() const Q_DECL_OVERRIDE;
+ void setVolume(qreal) Q_DECL_OVERRIDE;
+ qreal volume() const Q_DECL_OVERRIDE;
+
+private slots:
+ void userFeed();
+ bool deviceReady();
+
+private:
+ friend class InputPrivate;
+
+ bool open();
+ void close();
+ qint64 read(char *data, qint64 len);
+ void setError(QAudio::Error error);
+ void setState(QAudio::State state);
+
+ QTime m_timeStamp;
+ QTime m_clockStamp;
+ QAudioFormat m_format;
+
+ QIODevice *m_audioSource;
+ snd_pcm_t *m_pcmHandle;
+ QSocketNotifier *m_pcmNotifier;
+
+ QAudio::Error m_error;
+ QAudio::State m_state;
+
+ qint64 m_bytesRead;
+ qint64 m_elapsedTimeOffset;
+ qint64 m_totalTimeValue;
+
+ qreal m_volume;
+
+ int m_bytesAvailable;
+ int m_bufferSize;
+ int m_periodSize;
+ int m_intervalTime;
+
+ bool m_pullMode;
+};
+
+class InputPrivate : public QIODevice
+{
+ Q_OBJECT
+public:
+ InputPrivate(QnxAudioInput *audio);
+
+ qint64 readData(char *data, qint64 len) Q_DECL_OVERRIDE;
+ qint64 writeData(const char *data, qint64 len) Q_DECL_OVERRIDE;
+
+ void trigger();
+
+private:
+ QnxAudioInput *m_audioDevice;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/audio/qnxaudiooutput.cpp b/src/plugins/qnx/audio/qnxaudiooutput.cpp
new file mode 100644
index 000000000..4a82e93bb
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudiooutput.cpp
@@ -0,0 +1,443 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnxaudiooutput.h"
+
+#include "qnxaudioutils.h"
+
+#include <private/qaudiohelpers_p.h>
+
+QT_BEGIN_NAMESPACE
+
+QnxAudioOutput::QnxAudioOutput()
+ : m_source(0),
+ m_pushSource(false),
+ m_notifyInterval(1000),
+ m_error(QAudio::NoError),
+ m_state(QAudio::StoppedState),
+ m_volume(1.0),
+ m_periodSize(0),
+ m_pcmHandle(0),
+ m_bytesWritten(0),
+ m_intervalOffset(0)
+{
+ m_timer.setSingleShot(false);
+ m_timer.setInterval(20);
+ connect(&m_timer, SIGNAL(timeout()), this, SLOT(pullData()));
+}
+
+QnxAudioOutput::~QnxAudioOutput()
+{
+ stop();
+}
+
+void QnxAudioOutput::start(QIODevice *source)
+{
+ if (m_state != QAudio::StoppedState)
+ stop();
+
+ m_error = QAudio::NoError;
+ m_source = source;
+ m_pushSource = false;
+
+ if (open()) {
+ setState(QAudio::ActiveState);
+ m_timer.start();
+ } else {
+ setError(QAudio::OpenError);
+ setState(QAudio::StoppedState);
+ }
+}
+
+QIODevice *QnxAudioOutput::start()
+{
+ if (m_state != QAudio::StoppedState)
+ stop();
+
+ m_error = QAudio::NoError;
+ m_source = new QnxPushIODevice(this);
+ m_source->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
+ m_pushSource = true;
+
+ if (open())
+ setState(QAudio::IdleState);
+ else {
+ setError(QAudio::OpenError);
+ setState(QAudio::StoppedState);
+ }
+
+ return m_source;
+}
+
+void QnxAudioOutput::stop()
+{
+ if (m_state == QAudio::StoppedState)
+ return;
+
+ setError(QAudio::NoError);
+ setState(QAudio::StoppedState);
+ close();
+}
+
+void QnxAudioOutput::reset()
+{
+ if (m_pcmHandle)
+ snd_pcm_playback_drain(m_pcmHandle);
+ stop();
+}
+
+void QnxAudioOutput::suspend()
+{
+ m_timer.stop();
+ setState(QAudio::SuspendedState);
+}
+
+void QnxAudioOutput::resume()
+{
+ if (m_pushSource)
+ setState(QAudio::IdleState);
+ else {
+ setState(QAudio::ActiveState);
+ m_timer.start();
+ }
+}
+
+int QnxAudioOutput::bytesFree() const
+{
+ if (m_state != QAudio::ActiveState && m_state != QAudio::IdleState)
+ return 0;
+
+ snd_pcm_channel_status_t status;
+ status.channel = SND_PCM_CHANNEL_PLAYBACK;
+ const int errorCode = snd_pcm_plugin_status(m_pcmHandle, &status);
+
+ if (errorCode)
+ return 0;
+ else
+ return status.free;
+}
+
+int QnxAudioOutput::periodSize() const
+{
+ return m_periodSize;
+}
+
+void QnxAudioOutput::setNotifyInterval(int ms)
+{
+ m_notifyInterval = ms;
+}
+
+int QnxAudioOutput::notifyInterval() const
+{
+ return m_notifyInterval;
+}
+
+qint64 QnxAudioOutput::processedUSecs() const
+{
+ return qint64(1000000) * m_format.framesForBytes(m_bytesWritten) / m_format.sampleRate();
+}
+
+qint64 QnxAudioOutput::elapsedUSecs() const
+{
+ if (m_state == QAudio::StoppedState)
+ return 0;
+ else
+ return m_startTimeStamp.elapsed() * 1000;
+}
+
+QAudio::Error QnxAudioOutput::error() const
+{
+ return m_error;
+}
+
+QAudio::State QnxAudioOutput::state() const
+{
+ return m_state;
+}
+
+void QnxAudioOutput::setFormat(const QAudioFormat &format)
+{
+ if (m_state == QAudio::StoppedState)
+ m_format = format;
+}
+
+QAudioFormat QnxAudioOutput::format() const
+{
+ return m_format;
+}
+
+void QnxAudioOutput::setVolume(qreal volume)
+{
+ m_volume = qBound(qreal(0.0), volume, qreal(1.0));
+}
+
+qreal QnxAudioOutput::volume() const
+{
+ return m_volume;
+}
+
+void QnxAudioOutput::pullData()
+{
+ if (m_state == QAudio::StoppedState || m_state == QAudio::SuspendedState)
+ return;
+
+ const int bytesAvailable = bytesFree();
+ const int frames = m_format.framesForBytes(bytesAvailable);
+
+ if (frames == 0 || bytesAvailable < periodSize())
+ return;
+
+ const int bytesRequested = m_format.bytesForFrames(frames);
+
+ char buffer[bytesRequested];
+ const int bytesRead = m_source->read(buffer, bytesRequested);
+
+ // reading can take a while and stream may have been stopped
+ if (!m_pcmHandle)
+ return;
+
+ if (bytesRead > 0) {
+ // Got some data to output
+ if (m_state != QAudio::ActiveState)
+ return;
+
+ const qint64 bytesWritten = write(buffer, bytesRead);
+ if (bytesWritten != bytesRead)
+ m_source->seek(m_source->pos()-(bytesRead-bytesWritten));
+
+ } else {
+ // We're done
+ close();
+ if (bytesRead != 0)
+ setError(QAudio::IOError);
+ setState(QAudio::StoppedState);
+ }
+
+ if (m_state != QAudio::ActiveState)
+ return;
+
+ if (m_notifyInterval > 0 && (m_intervalTimeStamp.elapsed() + m_intervalOffset) > m_notifyInterval) {
+ emit notify();
+ m_intervalOffset = m_intervalTimeStamp.elapsed() + m_intervalOffset - m_notifyInterval;
+ m_intervalTimeStamp.restart();
+ }
+}
+
+bool QnxAudioOutput::open()
+{
+ if (!m_format.isValid() || m_format.sampleRate() <= 0) {
+ if (!m_format.isValid())
+ qWarning("QnxAudioOutput: open error, invalid format.");
+ else
+ qWarning("QnxAudioOutput: open error, invalid sample rate (%d).", m_format.sampleRate());
+
+ return false;
+ }
+
+ int errorCode = 0;
+
+ int card = 0;
+ int device = 0;
+ if ((errorCode = snd_pcm_open_preferred(&m_pcmHandle, &card, &device, SND_PCM_OPEN_PLAYBACK)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't open card (0x%x)", -errorCode);
+ return false;
+ }
+
+ if ((errorCode = snd_pcm_nonblock_mode(m_pcmHandle, 0)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't set non block mode (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ // Necessary so that bytesFree() which uses the "free" member of the status struct works
+ snd_pcm_plugin_set_disable(m_pcmHandle, PLUGIN_DISABLE_MMAP);
+
+ snd_pcm_channel_info_t info;
+ memset(&info, 0, sizeof(info));
+ info.channel = SND_PCM_CHANNEL_PLAYBACK;
+ if ((errorCode = snd_pcm_plugin_info(m_pcmHandle, &info)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't get channel info (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ snd_pcm_channel_params_t params = QnxAudioUtils::formatToChannelParams(m_format, QAudio::AudioOutput, info.max_fragment_size);
+
+ if ((errorCode = snd_pcm_plugin_params(m_pcmHandle, &params)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't set channel params (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ if ((errorCode = snd_pcm_plugin_prepare(m_pcmHandle, SND_PCM_CHANNEL_PLAYBACK)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't prepare channel (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ snd_pcm_channel_setup_t setup;
+ memset(&setup, 0, sizeof(setup));
+ setup.channel = SND_PCM_CHANNEL_PLAYBACK;
+ if ((errorCode = snd_pcm_plugin_setup(m_pcmHandle, &setup)) < 0) {
+ qWarning("QnxAudioOutput: open error, couldn't get channel setup (0x%x)", -errorCode);
+ close();
+ return false;
+ }
+
+ m_periodSize = qMin(2048, setup.buf.block.frag_size);
+ m_startTimeStamp.restart();
+ m_intervalTimeStamp.restart();
+ m_intervalOffset = 0;
+ m_bytesWritten = 0;
+
+ return true;
+}
+
+void QnxAudioOutput::close()
+{
+ m_timer.stop();
+
+ if (m_pcmHandle) {
+ snd_pcm_plugin_flush(m_pcmHandle, SND_PCM_CHANNEL_PLAYBACK);
+ snd_pcm_close(m_pcmHandle);
+ m_pcmHandle = 0;
+ }
+
+ if (m_pushSource) {
+ delete m_source;
+ m_source = 0;
+ }
+}
+
+void QnxAudioOutput::setError(QAudio::Error error)
+{
+ if (m_error != error) {
+ m_error = error;
+ emit errorChanged(error);
+ }
+}
+
+void QnxAudioOutput::setState(QAudio::State state)
+{
+ if (m_state != state) {
+ m_state = state;
+ emit stateChanged(state);
+ }
+}
+
+qint64 QnxAudioOutput::write(const char *data, qint64 len)
+{
+ if (!m_pcmHandle)
+ return 0;
+
+ // Make sure we're writing (N * frame) worth of bytes
+ const int size = m_format.bytesForFrames(qBound(qint64(0), qint64(bytesFree()), len) / m_format.bytesPerFrame());
+
+ if (size == 0)
+ return 0;
+
+ int written = 0;
+
+ if (m_volume < 1.0f) {
+ char out[size];
+ QAudioHelperInternal::qMultiplySamples(m_volume, m_format, data, out, size);
+ written = snd_pcm_plugin_write(m_pcmHandle, out, size);
+ } else {
+ written = snd_pcm_plugin_write(m_pcmHandle, data, size);
+ }
+
+ if (written > 0) {
+ m_bytesWritten += written;
+ setError(QAudio::NoError);
+ setState(QAudio::ActiveState);
+ return written;
+ } else {
+ close();
+ setError(QAudio::FatalError);
+ setState(QAudio::StoppedState);
+ return 0;
+ }
+}
+
+QnxPushIODevice::QnxPushIODevice(QnxAudioOutput *output)
+ : QIODevice(output),
+ m_output(output)
+{
+}
+
+QnxPushIODevice::~QnxPushIODevice()
+{
+}
+
+qint64 QnxPushIODevice::readData(char *data, qint64 len)
+{
+ Q_UNUSED(data);
+ Q_UNUSED(len);
+ return 0;
+}
+
+qint64 QnxPushIODevice::writeData(const char *data, qint64 len)
+{
+ int retry = 0;
+ qint64 written = 0;
+
+ if (m_output->state() == QAudio::ActiveState
+ || m_output->state() == QAudio::IdleState) {
+ while (written < len) {
+ const int writeSize = m_output->write(data + written, len - written);
+
+ if (writeSize <= 0) {
+ retry++;
+ if (retry > 10)
+ return written;
+ else
+ continue;
+ }
+
+ retry = 0;
+ written += writeSize;
+ }
+ }
+
+ return written;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/audio/qnxaudiooutput.h b/src/plugins/qnx/audio/qnxaudiooutput.h
new file mode 100644
index 000000000..77c15e47a
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudiooutput.h
@@ -0,0 +1,131 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNXAUDIOOUTPUT_H
+#define QNXAUDIOOUTPUT_H
+
+#include "qaudiosystem.h"
+
+#include <QTime>
+#include <QTimer>
+
+#include <sys/asoundlib.h>
+
+QT_BEGIN_NAMESPACE
+
+class QnxPushIODevice;
+
+class QnxAudioOutput : public QAbstractAudioOutput
+{
+ Q_OBJECT
+
+public:
+ QnxAudioOutput();
+ ~QnxAudioOutput();
+
+ void start(QIODevice *source) Q_DECL_OVERRIDE;
+ QIODevice *start() Q_DECL_OVERRIDE;
+ void stop() Q_DECL_OVERRIDE;
+ void reset() Q_DECL_OVERRIDE;
+ void suspend() Q_DECL_OVERRIDE;
+ void resume() Q_DECL_OVERRIDE;
+ int bytesFree() const Q_DECL_OVERRIDE;
+ int periodSize() const Q_DECL_OVERRIDE;
+ void setBufferSize(int) Q_DECL_OVERRIDE {}
+ int bufferSize() const Q_DECL_OVERRIDE { return 0; }
+ void setNotifyInterval(int ms) Q_DECL_OVERRIDE;
+ int notifyInterval() const Q_DECL_OVERRIDE;
+ qint64 processedUSecs() const Q_DECL_OVERRIDE;
+ qint64 elapsedUSecs() const Q_DECL_OVERRIDE;
+ QAudio::Error error() const Q_DECL_OVERRIDE;
+ QAudio::State state() const Q_DECL_OVERRIDE;
+ void setFormat(const QAudioFormat &format) Q_DECL_OVERRIDE;
+ QAudioFormat format() const Q_DECL_OVERRIDE;
+ void setVolume(qreal volume) Q_DECL_OVERRIDE;
+ qreal volume() const Q_DECL_OVERRIDE;
+
+private slots:
+ void pullData();
+
+private:
+ bool open();
+ void close();
+ void setError(QAudio::Error error);
+ void setState(QAudio::State state);
+
+ friend class QnxPushIODevice;
+ qint64 write(const char *data, qint64 len);
+
+ QIODevice *m_source;
+ bool m_pushSource;
+ QTimer m_timer;
+
+ int m_notifyInterval;
+ QAudio::Error m_error;
+ QAudio::State m_state;
+ QAudioFormat m_format;
+ qreal m_volume;
+ int m_periodSize;
+
+ snd_pcm_t *m_pcmHandle;
+ qint64 m_bytesWritten;
+ QTime m_startTimeStamp;
+ QTime m_intervalTimeStamp;
+ qint64 m_intervalOffset;
+};
+
+class QnxPushIODevice : public QIODevice
+{
+ Q_OBJECT
+public:
+ explicit QnxPushIODevice(QnxAudioOutput *output);
+ ~QnxPushIODevice();
+
+ qint64 readData(char *data, qint64 len);
+ qint64 writeData(const char *data, qint64 len);
+
+private:
+ QnxAudioOutput *m_output;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/audio/qnxaudioplugin.cpp b/src/plugins/qnx/audio/qnxaudioplugin.cpp
new file mode 100644
index 000000000..f63474f90
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioplugin.cpp
@@ -0,0 +1,88 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnxaudioplugin.h"
+
+#include "qnxaudiodeviceinfo.h"
+#include "qnxaudioinput.h"
+#include "qnxaudiooutput.h"
+
+#include <sys/asoundlib.h>
+
+static const char *INPUT_ID = "QnxAudioInput";
+static const char *OUTPUT_ID = "QnxAudioOutput";
+
+QT_BEGIN_NAMESPACE
+
+QnxAudioPlugin::QnxAudioPlugin(QObject *parent)
+ : QAudioSystemPlugin(parent)
+{
+}
+
+QList<QByteArray> QnxAudioPlugin::availableDevices(QAudio::Mode mode) const
+{
+ if (mode == QAudio::AudioOutput)
+ return QList<QByteArray>() << OUTPUT_ID;
+ else
+ return QList<QByteArray>() << INPUT_ID;
+}
+
+QAbstractAudioInput *QnxAudioPlugin::createInput(const QByteArray &device)
+{
+ Q_ASSERT(device == INPUT_ID);
+ Q_UNUSED(device);
+ return new QnxAudioInput();
+}
+
+QAbstractAudioOutput *QnxAudioPlugin::createOutput(const QByteArray &device)
+{
+ Q_ASSERT(device == OUTPUT_ID);
+ Q_UNUSED(device);
+ return new QnxAudioOutput();
+}
+
+QAbstractAudioDeviceInfo *QnxAudioPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode)
+{
+ Q_ASSERT(device == OUTPUT_ID || device == INPUT_ID);
+ return new QnxAudioDeviceInfo(device, mode);
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/audio/qnxaudioplugin.h b/src/plugins/qnx/audio/qnxaudioplugin.h
new file mode 100644
index 000000000..1886057b4
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioplugin.h
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNXAUDIOPLUGIN_H
+#define QNXAUDIOPLUGIN_H
+
+#include <qaudiosystemplugin.h>
+
+QT_BEGIN_NAMESPACE
+
+class QnxAudioPlugin : public QAudioSystemPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "qnx_audio.json")
+
+public:
+ explicit QnxAudioPlugin(QObject *parent = 0);
+ ~QnxAudioPlugin() {}
+
+ QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE;
+ QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE;
+ QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE;
+ QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode) Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/audio/qnxaudioutils.cpp b/src/plugins/qnx/audio/qnxaudioutils.cpp
new file mode 100644
index 000000000..d6400c2b1
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioutils.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qnxaudioutils.h"
+
+QT_BEGIN_NAMESPACE
+
+snd_pcm_channel_params_t QnxAudioUtils::formatToChannelParams(const QAudioFormat &format, QAudio::Mode mode, int fragmentSize)
+{
+ snd_pcm_channel_params_t params;
+ memset(&params, 0, sizeof(params));
+ params.channel = (mode == QAudio::AudioOutput) ? SND_PCM_CHANNEL_PLAYBACK : SND_PCM_CHANNEL_CAPTURE;
+ params.mode = SND_PCM_MODE_BLOCK;
+ params.start_mode = SND_PCM_START_DATA;
+ params.stop_mode = SND_PCM_STOP_ROLLOVER;
+ params.buf.block.frag_size = fragmentSize;
+ params.buf.block.frags_min = 1;
+ params.buf.block.frags_max = 1;
+ strcpy(params.sw_mixer_subchn_name, "QAudio Channel");
+
+ params.format.interleave = 1;
+ params.format.rate = format.sampleRate();
+ params.format.voices = format.channelCount();
+
+ switch (format.sampleSize()) {
+ case 8:
+ switch (format.sampleType()) {
+ case QAudioFormat::SignedInt:
+ params.format.format = SND_PCM_SFMT_S8;
+ break;
+ case QAudioFormat::UnSignedInt:
+ params.format.format = SND_PCM_SFMT_U8;
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 16:
+ switch (format.sampleType()) {
+ case QAudioFormat::SignedInt:
+ if (format.byteOrder() == QAudioFormat::LittleEndian) {
+ params.format.format = SND_PCM_SFMT_S16_LE;
+ } else {
+ params.format.format = SND_PCM_SFMT_S16_BE;
+ }
+ break;
+ case QAudioFormat::UnSignedInt:
+ if (format.byteOrder() == QAudioFormat::LittleEndian) {
+ params.format.format = SND_PCM_SFMT_U16_LE;
+ } else {
+ params.format.format = SND_PCM_SFMT_U16_BE;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+
+ case 32:
+ switch (format.sampleType()) {
+ case QAudioFormat::SignedInt:
+ if (format.byteOrder() == QAudioFormat::LittleEndian) {
+ params.format.format = SND_PCM_SFMT_S32_LE;
+ } else {
+ params.format.format = SND_PCM_SFMT_S32_BE;
+ }
+ break;
+ case QAudioFormat::UnSignedInt:
+ if (format.byteOrder() == QAudioFormat::LittleEndian) {
+ params.format.format = SND_PCM_SFMT_U32_LE;
+ } else {
+ params.format.format = SND_PCM_SFMT_U32_BE;
+ }
+ break;
+ case QAudioFormat::Float:
+ if (format.byteOrder() == QAudioFormat::LittleEndian) {
+ params.format.format = SND_PCM_SFMT_FLOAT_LE;
+ } else {
+ params.format.format = SND_PCM_SFMT_FLOAT_BE;
+ }
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+
+ return params;
+}
+
+QT_END_NAMESPACE
diff --git a/src/plugins/qnx/audio/qnxaudioutils.h b/src/plugins/qnx/audio/qnxaudioutils.h
new file mode 100644
index 000000000..ddd30b191
--- /dev/null
+++ b/src/plugins/qnx/audio/qnxaudioutils.h
@@ -0,0 +1,57 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Research In Motion
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QNXAUDIOUTILS_H
+#define QNXAUDIOUTILS_H
+
+#include "qaudiosystem.h"
+#include <sys/asoundlib.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QnxAudioUtils
+{
+ snd_pcm_channel_params_t formatToChannelParams(const QAudioFormat &format, QAudio::Mode mode, int fragmentSize);
+}
+
+QT_END_NAMESPACE
+
+#endif
diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro
new file mode 100644
index 000000000..3049729b8
--- /dev/null
+++ b/src/plugins/qnx/qnx.pro
@@ -0,0 +1,3 @@
+TEMPLATE = subdirs
+
+SUBDIRS = audio
diff --git a/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-amd64.txt b/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-amd64.txt
index 626cba4fc..7ff972c33 100644
--- a/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-amd64.txt
+++ b/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-amd64.txt
@@ -5015,157 +5015,6 @@ QAccessibleTableModelChangeEvent (0x7f96f2e62d00) 0
QAccessibleEvent (0x7f96f31b99c0) 0
primary-for QAccessibleTableModelChangeEvent (0x7f96f2e62d00)
-Vtable for QAccessibleTextInterface
-QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI24QAccessibleTextInterface)
-16 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-24 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))QAccessibleTextInterface::textBeforeOffset
-104 (int (*)(...))QAccessibleTextInterface::textAfterOffset
-112 (int (*)(...))QAccessibleTextInterface::textAtOffset
-120 (int (*)(...))__cxa_pure_virtual
-128 (int (*)(...))__cxa_pure_virtual
-136 (int (*)(...))__cxa_pure_virtual
-144 (int (*)(...))__cxa_pure_virtual
-152 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTextInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTextInterface (0x7f96f31b9a80) 0 nearly-empty
- vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 16u)
-
-Vtable for QAccessibleEditableTextInterface
-QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface)
-16 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-24 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleEditableTextInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleEditableTextInterface (0x7f96f31b9ae0) 0 nearly-empty
- vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 16u)
-
-Vtable for QAccessibleValueInterface
-QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleValueInterface)
-16 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-24 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleValueInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleValueInterface (0x7f96f31b9b40) 0 nearly-empty
- vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 16u)
-
-Vtable for QAccessibleTableCellInterface
-QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface)
-16 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-24 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableCellInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTableCellInterface (0x7f96f31b9ba0) 0 nearly-empty
- vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 16u)
-
-Vtable for QAccessibleTableInterface
-QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleTableInterface)
-16 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-24 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))__cxa_pure_virtual
-104 (int (*)(...))__cxa_pure_virtual
-112 (int (*)(...))__cxa_pure_virtual
-120 (int (*)(...))__cxa_pure_virtual
-128 (int (*)(...))__cxa_pure_virtual
-136 (int (*)(...))__cxa_pure_virtual
-144 (int (*)(...))__cxa_pure_virtual
-152 (int (*)(...))__cxa_pure_virtual
-160 (int (*)(...))__cxa_pure_virtual
-168 (int (*)(...))__cxa_pure_virtual
-176 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTableInterface (0x7f96f31b9c00) 0 nearly-empty
- vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 16u)
-
-Vtable for QAccessibleActionInterface
-QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI26QAccessibleActionInterface)
-16 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-24 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))QAccessibleActionInterface::localizedActionName
-48 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleActionInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleActionInterface (0x7f96f31b9c60) 0 nearly-empty
- vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 16u)
-
-Vtable for QAccessibleImageInterface
-QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleImageInterface)
-16 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-24 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleImageInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleImageInterface (0x7f96f31b9cc0) 0 nearly-empty
- vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 16u)
-
Vtable for QAccessibleBridge
QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries
0 (int (*)(...))0
diff --git a/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-ia32.txt b/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-ia32.txt
index 40984e30f..24afc6fa9 100644
--- a/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-ia32.txt
+++ b/tests/auto/bic/data/QtMultimedia.5.0.0.linux-gcc-ia32.txt
@@ -5015,157 +5015,6 @@ QAccessibleTableModelChangeEvent (0xb3777618) 0
QAccessibleEvent (0xb3634348) 0
primary-for QAccessibleTableModelChangeEvent (0xb3777618)
-Vtable for QAccessibleTextInterface
-QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI24QAccessibleTextInterface)
-8 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-12 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))QAccessibleTextInterface::textBeforeOffset
-52 (int (*)(...))QAccessibleTextInterface::textAfterOffset
-56 (int (*)(...))QAccessibleTextInterface::textAtOffset
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTextInterface (0xb363d968) 0 nearly-empty
- vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 8u)
-
-Vtable for QAccessibleEditableTextInterface
-QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface)
-8 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-12 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleEditableTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleEditableTextInterface (0xb363dbd0) 0 nearly-empty
- vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 8u)
-
-Vtable for QAccessibleValueInterface
-QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleValueInterface)
-8 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-12 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleValueInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleValueInterface (0xb363de38) 0 nearly-empty
- vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 8u)
-
-Vtable for QAccessibleTableCellInterface
-QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface)
-8 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-12 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableCellInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableCellInterface (0xb3652000) 0 nearly-empty
- vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 8u)
-
-Vtable for QAccessibleTableInterface
-QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleTableInterface)
-8 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-12 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-52 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-84 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableInterface (0xb3652268) 0 nearly-empty
- vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 8u)
-
-Vtable for QAccessibleActionInterface
-QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI26QAccessibleActionInterface)
-8 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-12 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))QAccessibleActionInterface::localizedActionName
-24 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleActionInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleActionInterface (0xb36524d0) 0 nearly-empty
- vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 8u)
-
-Vtable for QAccessibleImageInterface
-QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleImageInterface)
-8 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-12 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleImageInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleImageInterface (0xb3652818) 0 nearly-empty
- vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 8u)
-
Vtable for QAccessibleBridge
QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries
0 (int (*)(...))0
diff --git a/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-amd64.txt b/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-amd64.txt
index 0ca499942..5b55c44f1 100644
--- a/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-amd64.txt
+++ b/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-amd64.txt
@@ -4203,157 +4203,6 @@ QAccessibleTableModelChangeEvent (0x7f51f09026e8) 0
QAccessibleEvent (0x7f51f08549c0) 0
primary-for QAccessibleTableModelChangeEvent (0x7f51f09026e8)
-Vtable for QAccessibleTextInterface
-QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI24QAccessibleTextInterface)
-16 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-24 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))QAccessibleTextInterface::textBeforeOffset
-104 (int (*)(...))QAccessibleTextInterface::textAfterOffset
-112 (int (*)(...))QAccessibleTextInterface::textAtOffset
-120 (int (*)(...))__cxa_pure_virtual
-128 (int (*)(...))__cxa_pure_virtual
-136 (int (*)(...))__cxa_pure_virtual
-144 (int (*)(...))__cxa_pure_virtual
-152 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTextInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTextInterface (0x7f51f0854a80) 0 nearly-empty
- vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 16u)
-
-Vtable for QAccessibleEditableTextInterface
-QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface)
-16 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-24 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleEditableTextInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleEditableTextInterface (0x7f51f0854ae0) 0 nearly-empty
- vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 16u)
-
-Vtable for QAccessibleValueInterface
-QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleValueInterface)
-16 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-24 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleValueInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleValueInterface (0x7f51f0854b40) 0 nearly-empty
- vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 16u)
-
-Vtable for QAccessibleTableCellInterface
-QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface)
-16 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-24 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableCellInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTableCellInterface (0x7f51f0854ba0) 0 nearly-empty
- vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 16u)
-
-Vtable for QAccessibleTableInterface
-QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleTableInterface)
-16 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-24 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-96 (int (*)(...))__cxa_pure_virtual
-104 (int (*)(...))__cxa_pure_virtual
-112 (int (*)(...))__cxa_pure_virtual
-120 (int (*)(...))__cxa_pure_virtual
-128 (int (*)(...))__cxa_pure_virtual
-136 (int (*)(...))__cxa_pure_virtual
-144 (int (*)(...))__cxa_pure_virtual
-152 (int (*)(...))__cxa_pure_virtual
-160 (int (*)(...))__cxa_pure_virtual
-168 (int (*)(...))__cxa_pure_virtual
-176 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleTableInterface (0x7f51f0854c00) 0 nearly-empty
- vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 16u)
-
-Vtable for QAccessibleActionInterface
-QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI26QAccessibleActionInterface)
-16 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-24 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))QAccessibleActionInterface::localizedActionName
-48 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-56 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleActionInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleActionInterface (0x7f51f0854c60) 0 nearly-empty
- vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 16u)
-
-Vtable for QAccessibleImageInterface
-QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI25QAccessibleImageInterface)
-16 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-24 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-32 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleImageInterface
- size=8 align=8
- base size=8 base align=8
-QAccessibleImageInterface (0x7f51f0854cc0) 0 nearly-empty
- vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 16u)
-
Vtable for QAccessibleBridge
QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries
0 (int (*)(...))0
@@ -9582,56 +9431,6 @@ Class QVideoSurfaceFormat
base size=8 base align=8
QVideoSurfaceFormat (0x7f51ee13bae0) 0
-Vtable for QAccessibleWidget
-QAccessibleWidget::_ZTV17QAccessibleWidget: 35u entries
-0 (int (*)(...))0
-8 (int (*)(...))(& _ZTI17QAccessibleWidget)
-16 (int (*)(...))QAccessibleWidget::~QAccessibleWidget
-24 (int (*)(...))QAccessibleWidget::~QAccessibleWidget
-32 (int (*)(...))QAccessibleObject::isValid
-40 (int (*)(...))QAccessibleObject::object
-48 (int (*)(...))QAccessibleWidget::window
-56 (int (*)(...))QAccessibleWidget::relations
-64 (int (*)(...))QAccessibleWidget::focusChild
-72 (int (*)(...))QAccessibleObject::childAt
-80 (int (*)(...))QAccessibleWidget::parent
-88 (int (*)(...))QAccessibleWidget::child
-96 (int (*)(...))QAccessibleWidget::childCount
-104 (int (*)(...))QAccessibleWidget::indexOfChild
-112 (int (*)(...))QAccessibleWidget::text
-120 (int (*)(...))QAccessibleObject::setText
-128 (int (*)(...))QAccessibleWidget::rect
-136 (int (*)(...))QAccessibleWidget::role
-144 (int (*)(...))QAccessibleWidget::state
-152 (int (*)(...))QAccessibleWidget::foregroundColor
-160 (int (*)(...))QAccessibleWidget::backgroundColor
-168 (int (*)(...))QAccessibleInterface::virtual_hook
-176 (int (*)(...))QAccessibleWidget::interface_cast
-184 (int (*)(...))QAccessibleWidget::actionNames
-192 (int (*)(...))QAccessibleWidget::doAction
-200 (int (*)(...))QAccessibleWidget::keyBindingsForAction
-208 (int (*)(...))-16
-216 (int (*)(...))(& _ZTI17QAccessibleWidget)
-224 (int (*)(...))QAccessibleWidget::_ZThn16_N17QAccessibleWidgetD1Ev
-232 (int (*)(...))QAccessibleWidget::_ZThn16_N17QAccessibleWidgetD0Ev
-240 (int (*)(...))QAccessibleWidget::_ZThn16_NK17QAccessibleWidget11actionNamesEv
-248 (int (*)(...))QAccessibleActionInterface::localizedActionName
-256 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-264 (int (*)(...))QAccessibleWidget::_ZThn16_N17QAccessibleWidget8doActionERK7QString
-272 (int (*)(...))QAccessibleWidget::_ZThn16_NK17QAccessibleWidget20keyBindingsForActionERK7QString
-
-Class QAccessibleWidget
- size=32 align=8
- base size=32 base align=8
-QAccessibleWidget (0x7f51ee1fe150) 0
- vptr=((& QAccessibleWidget::_ZTV17QAccessibleWidget) + 16u)
- QAccessibleObject (0x7f51ee1fa6e8) 0
- primary-for QAccessibleWidget (0x7f51ee1fe150)
- QAccessibleInterface (0x7f51ee13bf60) 0 nearly-empty
- primary-for QAccessibleObject (0x7f51ee1fa6e8)
- QAccessibleActionInterface (0x7f51ee203000) 16 nearly-empty
- vptr=((& QAccessibleWidget::_ZTV17QAccessibleWidget) + 224u)
-
Class QSizePolicy
size=4 align=4
base size=4 base align=4
diff --git a/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-ia32.txt b/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-ia32.txt
index 64df8f078..110a56892 100644
--- a/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-ia32.txt
+++ b/tests/auto/bic/data/QtMultimediaWidgets.5.0.0.linux-gcc-ia32.txt
@@ -4203,157 +4203,6 @@ QAccessibleTableModelChangeEvent (0xb3963dd4) 0
QAccessibleEvent (0xb38b6b60) 0
primary-for QAccessibleTableModelChangeEvent (0xb3963dd4)
-Vtable for QAccessibleTextInterface
-QAccessibleTextInterface::_ZTV24QAccessibleTextInterface: 20u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI24QAccessibleTextInterface)
-8 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-12 (int (*)(...))QAccessibleTextInterface::~QAccessibleTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))QAccessibleTextInterface::textBeforeOffset
-52 (int (*)(...))QAccessibleTextInterface::textAfterOffset
-56 (int (*)(...))QAccessibleTextInterface::textAtOffset
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTextInterface (0xb38cc150) 0 nearly-empty
- vptr=((& QAccessibleTextInterface::_ZTV24QAccessibleTextInterface) + 8u)
-
-Vtable for QAccessibleEditableTextInterface
-QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI32QAccessibleEditableTextInterface)
-8 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-12 (int (*)(...))QAccessibleEditableTextInterface::~QAccessibleEditableTextInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleEditableTextInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleEditableTextInterface (0xb38cc3b8) 0 nearly-empty
- vptr=((& QAccessibleEditableTextInterface::_ZTV32QAccessibleEditableTextInterface) + 8u)
-
-Vtable for QAccessibleValueInterface
-QAccessibleValueInterface::_ZTV25QAccessibleValueInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleValueInterface)
-8 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-12 (int (*)(...))QAccessibleValueInterface::~QAccessibleValueInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleValueInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleValueInterface (0xb38cc620) 0 nearly-empty
- vptr=((& QAccessibleValueInterface::_ZTV25QAccessibleValueInterface) + 8u)
-
-Vtable for QAccessibleTableCellInterface
-QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface: 13u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI29QAccessibleTableCellInterface)
-8 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-12 (int (*)(...))QAccessibleTableCellInterface::~QAccessibleTableCellInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableCellInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableCellInterface (0xb38cc888) 0 nearly-empty
- vptr=((& QAccessibleTableCellInterface::_ZTV29QAccessibleTableCellInterface) + 8u)
-
-Vtable for QAccessibleTableInterface
-QAccessibleTableInterface::_ZTV25QAccessibleTableInterface: 23u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleTableInterface)
-8 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-12 (int (*)(...))QAccessibleTableInterface::~QAccessibleTableInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-36 (int (*)(...))__cxa_pure_virtual
-40 (int (*)(...))__cxa_pure_virtual
-44 (int (*)(...))__cxa_pure_virtual
-48 (int (*)(...))__cxa_pure_virtual
-52 (int (*)(...))__cxa_pure_virtual
-56 (int (*)(...))__cxa_pure_virtual
-60 (int (*)(...))__cxa_pure_virtual
-64 (int (*)(...))__cxa_pure_virtual
-68 (int (*)(...))__cxa_pure_virtual
-72 (int (*)(...))__cxa_pure_virtual
-76 (int (*)(...))__cxa_pure_virtual
-80 (int (*)(...))__cxa_pure_virtual
-84 (int (*)(...))__cxa_pure_virtual
-88 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleTableInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleTableInterface (0xb38ccaf0) 0 nearly-empty
- vptr=((& QAccessibleTableInterface::_ZTV25QAccessibleTableInterface) + 8u)
-
-Vtable for QAccessibleActionInterface
-QAccessibleActionInterface::_ZTV26QAccessibleActionInterface: 9u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI26QAccessibleActionInterface)
-8 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-12 (int (*)(...))QAccessibleActionInterface::~QAccessibleActionInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))QAccessibleActionInterface::localizedActionName
-24 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-28 (int (*)(...))__cxa_pure_virtual
-32 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleActionInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleActionInterface (0xb38ccd58) 0 nearly-empty
- vptr=((& QAccessibleActionInterface::_ZTV26QAccessibleActionInterface) + 8u)
-
-Vtable for QAccessibleImageInterface
-QAccessibleImageInterface::_ZTV25QAccessibleImageInterface: 7u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI25QAccessibleImageInterface)
-8 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-12 (int (*)(...))QAccessibleImageInterface::~QAccessibleImageInterface
-16 (int (*)(...))__cxa_pure_virtual
-20 (int (*)(...))__cxa_pure_virtual
-24 (int (*)(...))__cxa_pure_virtual
-
-Class QAccessibleImageInterface
- size=4 align=4
- base size=4 base align=4
-QAccessibleImageInterface (0xb38cc8f8) 0 nearly-empty
- vptr=((& QAccessibleImageInterface::_ZTV25QAccessibleImageInterface) + 8u)
-
Vtable for QAccessibleBridge
QAccessibleBridge::_ZTV17QAccessibleBridge: 6u entries
0 (int (*)(...))0
@@ -9582,56 +9431,6 @@ Class QVideoSurfaceFormat
base size=4 base align=4
QVideoSurfaceFormat (0xb2022770) 0
-Vtable for QAccessibleWidget
-QAccessibleWidget::_ZTV17QAccessibleWidget: 35u entries
-0 (int (*)(...))0
-4 (int (*)(...))(& _ZTI17QAccessibleWidget)
-8 (int (*)(...))QAccessibleWidget::~QAccessibleWidget
-12 (int (*)(...))QAccessibleWidget::~QAccessibleWidget
-16 (int (*)(...))QAccessibleObject::isValid
-20 (int (*)(...))QAccessibleObject::object
-24 (int (*)(...))QAccessibleWidget::window
-28 (int (*)(...))QAccessibleWidget::relations
-32 (int (*)(...))QAccessibleWidget::focusChild
-36 (int (*)(...))QAccessibleObject::childAt
-40 (int (*)(...))QAccessibleWidget::parent
-44 (int (*)(...))QAccessibleWidget::child
-48 (int (*)(...))QAccessibleWidget::childCount
-52 (int (*)(...))QAccessibleWidget::indexOfChild
-56 (int (*)(...))QAccessibleWidget::text
-60 (int (*)(...))QAccessibleObject::setText
-64 (int (*)(...))QAccessibleWidget::rect
-68 (int (*)(...))QAccessibleWidget::role
-72 (int (*)(...))QAccessibleWidget::state
-76 (int (*)(...))QAccessibleWidget::foregroundColor
-80 (int (*)(...))QAccessibleWidget::backgroundColor
-84 (int (*)(...))QAccessibleInterface::virtual_hook
-88 (int (*)(...))QAccessibleWidget::interface_cast
-92 (int (*)(...))QAccessibleWidget::actionNames
-96 (int (*)(...))QAccessibleWidget::doAction
-100 (int (*)(...))QAccessibleWidget::keyBindingsForAction
-104 (int (*)(...))-0x00000000000000008
-108 (int (*)(...))(& _ZTI17QAccessibleWidget)
-112 (int (*)(...))QAccessibleWidget::_ZThn8_N17QAccessibleWidgetD1Ev
-116 (int (*)(...))QAccessibleWidget::_ZThn8_N17QAccessibleWidgetD0Ev
-120 (int (*)(...))QAccessibleWidget::_ZThn8_NK17QAccessibleWidget11actionNamesEv
-124 (int (*)(...))QAccessibleActionInterface::localizedActionName
-128 (int (*)(...))QAccessibleActionInterface::localizedActionDescription
-132 (int (*)(...))QAccessibleWidget::_ZThn8_N17QAccessibleWidget8doActionERK7QString
-136 (int (*)(...))QAccessibleWidget::_ZThn8_NK17QAccessibleWidget20keyBindingsForActionERK7QString
-
-Class QAccessibleWidget
- size=16 align=4
- base size=16 base align=4
-QAccessibleWidget (0xb2016b40) 0
- vptr=((& QAccessibleWidget::_ZTV17QAccessibleWidget) + 8u)
- QAccessibleObject (0xb20fc780) 0
- primary-for QAccessibleWidget (0xb2016b40)
- QAccessibleInterface (0xb203ba10) 0 nearly-empty
- primary-for QAccessibleObject (0xb20fc780)
- QAccessibleActionInterface (0xb203ba48) 8 nearly-empty
- vptr=((& QAccessibleWidget::_ZTV17QAccessibleWidget) + 112u)
-
Class QSizePolicy
size=4 align=4
base size=4 base align=4
diff --git a/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h b/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h
index ac1c89d98..27305dfab 100644
--- a/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h
+++ b/tests/auto/unit/qmultimedia_common/mockaudiodecodercontrol.h
@@ -53,8 +53,6 @@
#define MOCK_DECODER_MAX_BUFFERS 10
-QT_BEGIN_HEADER
-
QT_BEGIN_NAMESPACE
class MockAudioDecoderControl : public QAudioDecoderControl
@@ -218,6 +216,4 @@ public:
QT_END_NAMESPACE
-QT_END_HEADER
-
#endif // QAUDIODECODERCONTROL_H
diff --git a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
index e9e71edff..7671c7ec6 100644
--- a/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
+++ b/tests/auto/unit/qpaintervideosurface/tst_qpaintervideosurface.cpp
@@ -1039,12 +1039,6 @@ void tst_QPainterVideoSurface::shaderPresent()
QVideoSurfaceFormat formatA(frameSizeA, pixelFormatA);
-#if defined(Q_OS_LINUX) && !defined(UBUNTU_PRECISE_PANGOLIN)
- QEXPECT_FAIL("ARBfp: rgb32 -> argb32", "QTBUG-26320 - Failing for linux versions", Abort);
- QEXPECT_FAIL("ARBfp: rgb32 -> rgb565", "QTBUG-26320 - Failing for linux versions", Abort);
- QEXPECT_FAIL("ARBfp: rgb32 -> yuv420p", "QTBUG-26320 - Failing for linux versions", Abort);
- QEXPECT_FAIL("ARBfp: yv12 -> rgb32", "QTBUG-26320 - Failing for linux versions", Abort);
-#endif
QVERIFY(surface.start(formatA));
QCOMPARE(surface.isActive(), true);
QCOMPARE(surface.isReady(), true);