summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gsttools/gsttools.pro69
-rw-r--r--src/gsttools/qgstreamerbushelper.cpp237
-rw-r--r--src/gsttools/qgstreamermessage.cpp93
-rw-r--r--src/gsttools/qgstutils.cpp165
-rw-r--r--src/gsttools/qgstvideobuffer.cpp97
-rw-r--r--src/gsttools/qgstxvimagebuffer.cpp311
-rw-r--r--src/gsttools/qvideosurfacegstsink.cpp791
-rw-r--r--src/imports/imports.pro5
-rw-r--r--src/imports/multimedia/multimedia.cpp108
-rw-r--r--src/imports/multimedia/multimedia.pro76
-rw-r--r--src/imports/multimedia/qdeclarativeaudio.cpp699
-rw-r--r--src/imports/multimedia/qdeclarativeaudio_p.h183
-rw-r--r--src/imports/multimedia/qdeclarativebackgroundaudio.cpp141
-rw-r--r--src/imports/multimedia/qdeclarativebackgroundaudio_p.h97
-rw-r--r--src/imports/multimedia/qdeclarativecamera.cpp580
-rw-r--r--src/imports/multimedia/qdeclarativecamera_p.h276
-rw-r--r--src/imports/multimedia/qdeclarativecameracapture.cpp233
-rw-r--r--src/imports/multimedia/qdeclarativecameracapture_p.h128
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure.cpp260
-rw-r--r--src/imports/multimedia/qdeclarativecameraexposure_p.h135
-rw-r--r--src/imports/multimedia/qdeclarativecameraflash.cpp148
-rw-r--r--src/imports/multimedia/qdeclarativecameraflash_p.h96
-rw-r--r--src/imports/multimedia/qdeclarativecamerafocus.cpp259
-rw-r--r--src/imports/multimedia/qdeclarativecamerafocus_p.h136
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing.cpp204
-rw-r--r--src/imports/multimedia/qdeclarativecameraimageprocessing_p.h132
-rw-r--r--src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp97
-rw-r--r--src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h76
-rw-r--r--src/imports/multimedia/qdeclarativecamerarecorder.cpp226
-rw-r--r--src/imports/multimedia/qdeclarativecamerarecorder_p.h162
-rw-r--r--src/imports/multimedia/qdeclarativemediabase.cpp571
-rw-r--r--src/imports/multimedia/qdeclarativemediabase_p.h187
-rw-r--r--src/imports/multimedia/qdeclarativemediametadata_p.h185
-rw-r--r--src/imports/multimedia/qdeclarativeradio.cpp218
-rw-r--r--src/imports/multimedia/qdeclarativeradio_p.h184
-rw-r--r--src/imports/multimedia/qdeclarativeradiodata.cpp118
-rw-r--r--src/imports/multimedia/qdeclarativeradiodata_p.h178
-rw-r--r--src/imports/multimedia/qdeclarativevideo.cpp951
-rw-r--r--src/imports/multimedia/qdeclarativevideo_p.h202
-rw-r--r--src/imports/multimedia/qdeclarativevideooutput.cpp366
-rw-r--r--src/imports/multimedia/qdeclarativevideooutput_p.h115
-rw-r--r--src/imports/multimedia/qmldir1
-rw-r--r--src/imports/multimedia/qmldir.qtmultimediakit1
-rw-r--r--src/imports/multimedia/qsgvideonode.cpp67
-rw-r--r--src/imports/multimedia/qsgvideonode_i420.cpp296
-rw-r--r--src/imports/multimedia/qsgvideonode_i420.h79
-rw-r--r--src/imports/multimedia/qsgvideonode_p.h72
-rw-r--r--src/imports/multimedia/qsgvideonode_rgb.cpp275
-rw-r--r--src/imports/multimedia/qsgvideonode_rgb.h74
-rw-r--r--src/imports/qimportbase.pri30
-rw-r--r--src/multimedia/audio/audio.pri60
-rw-r--r--src/multimedia/audio/qaudio.cpp103
-rw-r--r--src/multimedia/audio/qaudio.h74
-rw-r--r--src/multimedia/audio/qaudio_mac.cpp145
-rw-r--r--src/multimedia/audio/qaudio_mac_p.h145
-rw-r--r--src/multimedia/audio/qaudiodevicefactory.cpp288
-rw-r--r--src/multimedia/audio/qaudiodevicefactory_p.h100
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.cpp483
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo.h116
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp535
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_alsa_p.h129
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp351
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_mac_p.h99
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp465
-rw-r--r--src/multimedia/audio/qaudiodeviceinfo_win32_p.h120
-rw-r--r--src/multimedia/audio/qaudioformat.cpp407
-rw-r--r--src/multimedia/audio/qaudioformat.h109
-rw-r--r--src/multimedia/audio/qaudioinput.cpp402
-rw-r--r--src/multimedia/audio/qaudioinput.h114
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.cpp867
-rw-r--r--src/multimedia/audio/qaudioinput_alsa_p.h191
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.cpp989
-rw-r--r--src/multimedia/audio/qaudioinput_mac_p.h174
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp642
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.h179
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp404
-rw-r--r--src/multimedia/audio/qaudiooutput.h117
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.cpp834
-rw-r--r--src/multimedia/audio/qaudiooutput_alsa_p.h175
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.cpp734
-rw-r--r--src/multimedia/audio/qaudiooutput_mac_p.h174
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.cpp715
-rw-r--r--src/multimedia/audio/qaudiooutput_win32_p.h175
-rw-r--r--src/multimedia/audio/qaudiopluginloader.cpp176
-rw-r--r--src/multimedia/audio/qaudiopluginloader_p.h100
-rw-r--r--src/multimedia/audio/qaudiosystem.cpp436
-rw-r--r--src/multimedia/audio/qaudiosystem.h141
-rw-r--r--src/multimedia/audio/qaudiosystemplugin.cpp143
-rw-r--r--src/multimedia/audio/qaudiosystemplugin.h96
-rw-r--r--src/multimedia/effects/effects.pri38
-rw-r--r--src/multimedia/effects/qsamplecache_p.cpp398
-rw-r--r--src/multimedia/effects/qsamplecache_p.h161
-rw-r--r--src/multimedia/effects/qsoundeffect.cpp300
-rw-r--r--src/multimedia/effects/qsoundeffect.h132
-rw-r--r--src/multimedia/effects/qsoundeffect_pulse_p.cpp957
-rw-r--r--src/multimedia/effects/qsoundeffect_pulse_p.h163
-rw-r--r--src/multimedia/effects/qsoundeffect_qmedia_p.cpp233
-rw-r--r--src/multimedia/effects/qsoundeffect_qmedia_p.h122
-rw-r--r--src/multimedia/effects/qsoundeffect_qsound_p.cpp222
-rw-r--r--src/multimedia/effects/qsoundeffect_qsound_p.h121
-rw-r--r--src/multimedia/effects/qwavedecoder_p.cpp307
-rw-r--r--src/multimedia/effects/qwavedecoder_p.h141
-rw-r--r--src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h86
-rw-r--r--src/multimedia/gsttools_headers/qgstreamerbushelper_p.h100
-rw-r--r--src/multimedia/gsttools_headers/qgstreamermessage_p.h79
-rw-r--r--src/multimedia/gsttools_headers/qgstutils_p.h70
-rw-r--r--src/multimedia/gsttools_headers/qgstvideobuffer_p.h83
-rw-r--r--src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h141
-rw-r--r--src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h174
-rw-r--r--src/multimedia/multimedia.pro160
-rw-r--r--src/multimedia/qaudiocapturesource.cpp275
-rw-r--r--src/multimedia/qaudiocapturesource.h103
-rw-r--r--src/multimedia/qaudioencodercontrol.cpp167
-rw-r--r--src/multimedia/qaudioencodercontrol.h95
-rw-r--r--src/multimedia/qaudioendpointselector.cpp140
-rw-r--r--src/multimedia/qaudioendpointselector.h86
-rw-r--r--src/multimedia/qaudionamespace.qdoc70
-rw-r--r--src/multimedia/qcamera.cpp1035
-rw-r--r--src/multimedia/qcamera.h238
-rw-r--r--src/multimedia/qcameracapturebufferformatcontrol.cpp117
-rw-r--r--src/multimedia/qcameracapturebufferformatcontrol.h81
-rw-r--r--src/multimedia/qcameracapturedestinationcontrol.cpp121
-rw-r--r--src/multimedia/qcameracapturedestinationcontrol.h81
-rw-r--r--src/multimedia/qcameracontrol.cpp215
-rw-r--r--src/multimedia/qcameracontrol.h101
-rw-r--r--src/multimedia/qcameraexposure.cpp646
-rw-r--r--src/multimedia/qcameraexposure.h185
-rw-r--r--src/multimedia/qcameraexposurecontrol.cpp252
-rw-r--r--src/multimedia/qcameraexposurecontrol.h124
-rw-r--r--src/multimedia/qcameraflashcontrol.cpp141
-rw-r--r--src/multimedia/qcameraflashcontrol.h87
-rw-r--r--src/multimedia/qcamerafocus.cpp478
-rw-r--r--src/multimedia/qcamerafocus.h183
-rw-r--r--src/multimedia/qcamerafocuscontrol.cpp253
-rw-r--r--src/multimedia/qcamerafocuscontrol.h103
-rw-r--r--src/multimedia/qcameraimagecapture.cpp681
-rw-r--r--src/multimedia/qcameraimagecapture.h170
-rw-r--r--src/multimedia/qcameraimagecapturecontrol.cpp208
-rw-r--r--src/multimedia/qcameraimagecapturecontrol.h99
-rw-r--r--src/multimedia/qcameraimageprocessing.cpp352
-rw-r--r--src/multimedia/qcameraimageprocessing.h124
-rw-r--r--src/multimedia/qcameraimageprocessingcontrol.cpp169
-rw-r--r--src/multimedia/qcameraimageprocessingcontrol.h100
-rw-r--r--src/multimedia/qcameralockscontrol.cpp134
-rw-r--r--src/multimedia/qcameralockscontrol.h86
-rw-r--r--src/multimedia/qimageencodercontrol.cpp142
-rw-r--r--src/multimedia/qimageencodercontrol.h91
-rw-r--r--src/multimedia/qlocalmediaplaylistprovider.cpp194
-rw-r--r--src/multimedia/qlocalmediaplaylistprovider.h87
-rw-r--r--src/multimedia/qmediabackgroundplaybackcontrol.cpp149
-rw-r--r--src/multimedia/qmediabackgroundplaybackcontrol.h83
-rw-r--r--src/multimedia/qmediabindableinterface.cpp85
-rw-r--r--src/multimedia/qmediabindableinterface.h77
-rw-r--r--src/multimedia/qmediacontainercontrol.cpp126
-rw-r--r--src/multimedia/qmediacontainercontrol.h80
-rw-r--r--src/multimedia/qmediacontent.cpp254
-rw-r--r--src/multimedia/qmediacontent.h95
-rw-r--r--src/multimedia/qmediacontrol.cpp138
-rw-r--r--src/multimedia/qmediacontrol.h87
-rw-r--r--src/multimedia/qmediacontrol_p.h80
-rw-r--r--src/multimedia/qmediaencodersettings.cpp822
-rw-r--r--src/multimedia/qmediaencodersettings.h168
-rw-r--r--src/multimedia/qmediaenumdebug.h79
-rw-r--r--src/multimedia/qmediaimageviewer.cpp604
-rw-r--r--src/multimedia/qmediaimageviewer.h142
-rw-r--r--src/multimedia/qmediaimageviewerservice.cpp463
-rw-r--r--src/multimedia/qmediaimageviewerservice_p.h147
-rw-r--r--src/multimedia/qmedianetworkaccesscontrol.cpp103
-rw-r--r--src/multimedia/qmedianetworkaccesscontrol.h83
-rw-r--r--src/multimedia/qmediaobject.cpp423
-rw-r--r--src/multimedia/qmediaobject.h118
-rw-r--r--src/multimedia/qmediaobject_p.h99
-rw-r--r--src/multimedia/qmediaplayer.cpp1139
-rw-r--r--src/multimedia/qmediaplayer.h227
-rw-r--r--src/multimedia/qmediaplayercontrol.cpp414
-rw-r--r--src/multimedia/qmediaplayercontrol.h131
-rw-r--r--src/multimedia/qmediaplaylist.cpp756
-rw-r--r--src/multimedia/qmediaplaylist.h154
-rw-r--r--src/multimedia/qmediaplaylist_p.h177
-rw-r--r--src/multimedia/qmediaplaylistcontrol.cpp219
-rw-r--r--src/multimedia/qmediaplaylistcontrol.h98
-rw-r--r--src/multimedia/qmediaplaylistioplugin.cpp204
-rw-r--r--src/multimedia/qmediaplaylistioplugin.h126
-rw-r--r--src/multimedia/qmediaplaylistnavigator.cpp568
-rw-r--r--src/multimedia/qmediaplaylistnavigator.h115
-rw-r--r--src/multimedia/qmediaplaylistprovider.cpp329
-rw-r--r--src/multimedia/qmediaplaylistprovider.h115
-rw-r--r--src/multimedia/qmediaplaylistprovider_p.h80
-rw-r--r--src/multimedia/qmediaplaylistsourcecontrol.cpp128
-rw-r--r--src/multimedia/qmediaplaylistsourcecontrol.h82
-rw-r--r--src/multimedia/qmediapluginloader.cpp234
-rw-r--r--src/multimedia/qmediapluginloader_p.h99
-rw-r--r--src/multimedia/qmediarecorder.cpp904
-rw-r--r--src/multimedia/qmediarecorder.h197
-rw-r--r--src/multimedia/qmediarecordercontrol.cpp209
-rw-r--r--src/multimedia/qmediarecordercontrol.h101
-rw-r--r--src/multimedia/qmediaresource.cpp440
-rw-r--r--src/multimedia/qmediaresource.h134
-rw-r--r--src/multimedia/qmediaservice.cpp151
-rw-r--r--src/multimedia/qmediaservice.h97
-rw-r--r--src/multimedia/qmediaservice_p.h80
-rw-r--r--src/multimedia/qmediaserviceprovider.cpp783
-rw-r--r--src/multimedia/qmediaserviceprovider.h186
-rw-r--r--src/multimedia/qmediaserviceproviderplugin.h129
-rw-r--r--src/multimedia/qmediastreamscontrol.cpp161
-rw-r--r--src/multimedia/qmediastreamscontrol.h95
-rw-r--r--src/multimedia/qmediatimerange.cpp759
-rw-r--r--src/multimedia/qmediatimerange.h140
-rw-r--r--src/multimedia/qmetadatareadercontrol.cpp163
-rw-r--r--src/multimedia/qmetadatareadercontrol.h92
-rw-r--r--src/multimedia/qmetadatawritercontrol.cpp195
-rw-r--r--src/multimedia/qmetadatawritercontrol.h97
-rw-r--r--src/multimedia/qradiodata.cpp341
-rw-r--r--src/multimedia/qradiodata.h136
-rw-r--r--src/multimedia/qradiodatacontrol.cpp216
-rw-r--r--src/multimedia/qradiodatacontrol.h97
-rw-r--r--src/multimedia/qradiotuner.cpp643
-rw-r--r--src/multimedia/qradiotuner.h165
-rw-r--r--src/multimedia/qradiotunercontrol.cpp378
-rw-r--r--src/multimedia/qradiotunercontrol.h125
-rw-r--r--src/multimedia/qtmedianamespace.h345
-rw-r--r--src/multimedia/qtmedianamespace.qdoc208
-rw-r--r--src/multimedia/qtmultimediadefs.h90
-rw-r--r--src/multimedia/qvideodevicecontrol.cpp159
-rw-r--r--src/multimedia/qvideodevicecontrol.h88
-rw-r--r--src/multimedia/qvideoencodercontrol.cpp190
-rw-r--r--src/multimedia/qvideoencodercontrol.h98
-rw-r--r--src/multimedia/qvideorenderercontrol.cpp114
-rw-r--r--src/multimedia/qvideorenderercontrol.h81
-rw-r--r--src/multimedia/qvideosurfaceoutput.cpp100
-rw-r--r--src/multimedia/qvideosurfaceoutput_p.h86
-rw-r--r--src/multimedia/video/qabstractvideobuffer.cpp224
-rw-r--r--src/multimedia/video/qabstractvideobuffer.h116
-rw-r--r--src/multimedia/video/qabstractvideobuffer_p.h88
-rw-r--r--src/multimedia/video/qabstractvideosurface.cpp340
-rw-r--r--src/multimedia/video/qabstractvideosurface.h115
-rw-r--r--src/multimedia/video/qimagevideobuffer.cpp106
-rw-r--r--src/multimedia/video/qimagevideobuffer_p.h87
-rw-r--r--src/multimedia/video/qmemoryvideobuffer.cpp132
-rw-r--r--src/multimedia/video/qmemoryvideobuffer_p.h89
-rw-r--r--src/multimedia/video/qvideoframe.cpp843
-rw-r--r--src/multimedia/video/qvideoframe.h178
-rw-r--r--src/multimedia/video/qvideosurfaceformat.cpp632
-rw-r--r--src/multimedia/video/qvideosurfaceformat.h149
-rw-r--r--src/multimedia/video/video.pri22
-rw-r--r--src/multimediawidgets/multimediawidgets.pro68
-rw-r--r--src/multimediawidgets/qcameraviewfinder.cpp113
-rw-r--r--src/multimediawidgets/qcameraviewfinder.h90
-rw-r--r--src/multimediawidgets/qeglimagetexturesurface.cpp554
-rw-r--r--src/multimediawidgets/qeglimagetexturesurface_p.h150
-rw-r--r--src/multimediawidgets/qgraphicsvideoitem.cpp431
-rw-r--r--src/multimediawidgets/qgraphicsvideoitem.h115
-rw-r--r--src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp498
-rw-r--r--src/multimediawidgets/qpaintervideosurface.cpp1728
-rw-r--r--src/multimediawidgets/qpaintervideosurface_mac.mm285
-rw-r--r--src/multimediawidgets/qpaintervideosurface_mac_p.h103
-rw-r--r--src/multimediawidgets/qpaintervideosurface_p.h191
-rw-r--r--src/multimediawidgets/qtmultimediawidgetdefs.h89
-rw-r--r--src/multimediawidgets/qvideowidget.cpp1043
-rw-r--r--src/multimediawidgets/qvideowidget.h139
-rw-r--r--src/multimediawidgets/qvideowidget_p.h290
-rw-r--r--src/multimediawidgets/qvideowidgetcontrol.cpp245
-rw-r--r--src/multimediawidgets/qvideowidgetcontrol.h105
-rw-r--r--src/multimediawidgets/qvideowindowcontrol.cpp284
-rw-r--r--src/multimediawidgets/qvideowindowcontrol.h112
-rw-r--r--src/plugins/audiocapture/audiocapture.pro28
-rw-r--r--src/plugins/audiocapture/audiocaptureservice.cpp90
-rw-r--r--src/plugins/audiocapture/audiocaptureservice.h74
-rw-r--r--src/plugins/audiocapture/audiocaptureserviceplugin.cpp69
-rw-r--r--src/plugins/audiocapture/audiocaptureserviceplugin.h60
-rw-r--r--src/plugins/audiocapture/audiocapturesession.cpp358
-rw-r--r--src/plugins/audiocapture/audiocapturesession.h152
-rw-r--r--src/plugins/audiocapture/audiocontainercontrol.cpp74
-rw-r--r--src/plugins/audiocapture/audiocontainercontrol.h70
-rw-r--r--src/plugins/audiocapture/audioencodercontrol.cpp168
-rw-r--r--src/plugins/audiocapture/audioencodercontrol.h79
-rw-r--r--src/plugins/audiocapture/audioendpointselector.cpp110
-rw-r--r--src/plugins/audiocapture/audioendpointselector.h77
-rw-r--r--src/plugins/audiocapture/audiomediarecordercontrol.cpp102
-rw-r--r--src/plugins/audiocapture/audiomediarecordercontrol.h82
-rw-r--r--src/plugins/directshow/camera/camera.pri31
-rw-r--r--src/plugins/directshow/camera/directshowglobal.h236
-rw-r--r--src/plugins/directshow/camera/dscameracontrol.cpp103
-rw-r--r--src/plugins/directshow/camera/dscameracontrol.h94
-rw-r--r--src/plugins/directshow/camera/dscameraservice.cpp114
-rw-r--r--src/plugins/directshow/camera/dscameraservice.h88
-rw-r--r--src/plugins/directshow/camera/dscamerasession.cpp1160
-rw-r--r--src/plugins/directshow/camera/dscamerasession.h208
-rw-r--r--src/plugins/directshow/camera/dsimagecapturecontrol.cpp83
-rw-r--r--src/plugins/directshow/camera/dsimagecapturecontrol.h80
-rw-r--r--src/plugins/directshow/camera/dsvideodevicecontrol.cpp168
-rw-r--r--src/plugins/directshow/camera/dsvideodevicecontrol.h83
-rw-r--r--src/plugins/directshow/camera/dsvideorenderer.cpp72
-rw-r--r--src/plugins/directshow/camera/dsvideorenderer.h77
-rw-r--r--src/plugins/directshow/camera/dsvideowidgetcontrol.cpp250
-rw-r--r--src/plugins/directshow/camera/dsvideowidgetcontrol.h154
-rw-r--r--src/plugins/directshow/directshow.pro23
-rw-r--r--src/plugins/directshow/dsserviceplugin.cpp212
-rw-r--r--src/plugins/directshow/dsserviceplugin.h76
-rw-r--r--src/plugins/directshow/player/directshowaudioendpointcontrol.cpp161
-rw-r--r--src/plugins/directshow/player/directshowaudioendpointcontrol.h82
-rw-r--r--src/plugins/directshow/player/directshoweventloop.cpp150
-rw-r--r--src/plugins/directshow/player/directshoweventloop.h78
-rw-r--r--src/plugins/directshow/player/directshowglobal.h139
-rw-r--r--src/plugins/directshow/player/directshowioreader.cpp496
-rw-r--r--src/plugins/directshow/player/directshowioreader.h120
-rw-r--r--src/plugins/directshow/player/directshowiosource.cpp639
-rw-r--r--src/plugins/directshow/player/directshowiosource.h149
-rw-r--r--src/plugins/directshow/player/directshowmediatype.cpp185
-rw-r--r--src/plugins/directshow/player/directshowmediatype.h74
-rw-r--r--src/plugins/directshow/player/directshowmediatypelist.cpp226
-rw-r--r--src/plugins/directshow/player/directshowmediatypelist.h69
-rw-r--r--src/plugins/directshow/player/directshowmetadatacontrol.cpp352
-rw-r--r--src/plugins/directshow/player/directshowmetadatacontrol.h93
-rw-r--r--src/plugins/directshow/player/directshowpinenum.cpp134
-rw-r--r--src/plugins/directshow/player/directshowpinenum.h72
-rw-r--r--src/plugins/directshow/player/directshowplayercontrol.cpp405
-rw-r--r--src/plugins/directshow/player/directshowplayercontrol.h146
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.cpp1408
-rw-r--r--src/plugins/directshow/player/directshowplayerservice.h219
-rw-r--r--src/plugins/directshow/player/directshowsamplescheduler.cpp437
-rw-r--r--src/plugins/directshow/player/directshowsamplescheduler.h117
-rw-r--r--src/plugins/directshow/player/directshowvideorenderercontrol.cpp86
-rw-r--r--src/plugins/directshow/player/directshowvideorenderercontrol.h75
-rw-r--r--src/plugins/directshow/player/mediasamplevideobuffer.cpp86
-rw-r--r--src/plugins/directshow/player/mediasamplevideobuffer.h69
-rw-r--r--src/plugins/directshow/player/player.pri47
-rw-r--r--src/plugins/directshow/player/videosurfacefilter.cpp631
-rw-r--r--src/plugins/directshow/player/videosurfacefilter.h176
-rw-r--r--src/plugins/directshow/player/vmr9videowindowcontrol.cpp329
-rw-r--r--src/plugins/directshow/player/vmr9videowindowcontrol.h108
-rw-r--r--src/plugins/gstreamer/camerabin/camerabin.pri50
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp129
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinaudioencoder.h100
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp78
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h72
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp74
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincapturedestination.h69
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.cpp129
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontainer.h89
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.cpp341
-rw-r--r--src/plugins/gstreamer/camerabin/camerabincontrol.h101
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.cpp232
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinexposure.h83
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.cpp104
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinflash.h73
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.cpp225
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinfocus.h103
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp339
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimagecapture.h83
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp87
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageencoder.h86
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp171
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinimageprocessing.h84
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.cpp88
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinlocks.h79
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.cpp198
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinmetadata.h75
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.cpp139
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinrecorder.h83
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp184
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h84
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.cpp250
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinservice.h96
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.cpp1216
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinsession.h232
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp182
-rw-r--r--src/plugins/gstreamer/camerabin/camerabinvideoencoder.h103
-rw-r--r--src/plugins/gstreamer/camerabuttonlistener_meego.cpp92
-rw-r--r--src/plugins/gstreamer/camerabuttonlistener_meego.h65
-rw-r--r--src/plugins/gstreamer/gstreamer.pro94
-rw-r--r--src/plugins/gstreamer/gstvideoconnector.c425
-rw-r--r--src/plugins/gstreamer/gstvideoconnector.h87
-rw-r--r--src/plugins/gstreamer/mediacapture/mediacapture.pri27
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp290
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h97
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp185
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h98
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp198
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h75
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp184
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h96
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp1024
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h211
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp98
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h73
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp90
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h80
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp135
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h84
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp289
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h91
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp293
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h83
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp331
-rw-r--r--src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h98
-rw-r--r--src/plugins/gstreamer/mediaplayer/mediaplayer.pri30
-rw-r--r--src/plugins/gstreamer/mediaplayer/playerresourcepolicy.cpp176
-rw-r--r--src/plugins/gstreamer/mediaplayer/playerresourcepolicy.h90
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstappsrc.cpp227
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstappsrc.h106
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp192
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h74
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp775
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h158
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp134
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h90
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp1618
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h229
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp89
-rw-r--r--src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h71
-rw-r--r--src/plugins/gstreamer/qgstcodecsinfo.cpp183
-rw-r--r--src/plugins/gstreamer/qgstcodecsinfo.h72
-rw-r--r--src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp167
-rw-r--r--src/plugins/gstreamer/qgstreameraudioinputendpointselector.h76
-rw-r--r--src/plugins/gstreamer/qgstreamergltexturerenderer.cpp583
-rw-r--r--src/plugins/gstreamer/qgstreamergltexturerenderer.h130
-rw-r--r--src/plugins/gstreamer/qgstreamerserviceplugin.cpp395
-rw-r--r--src/plugins/gstreamer/qgstreamerserviceplugin.h86
-rw-r--r--src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp162
-rw-r--r--src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h77
-rw-r--r--src/plugins/gstreamer/qgstreamervideooverlay.cpp232
-rw-r--r--src/plugins/gstreamer/qgstreamervideooverlay.h119
-rw-r--r--src/plugins/gstreamer/qgstreamervideorenderer.cpp120
-rw-r--r--src/plugins/gstreamer/qgstreamervideorenderer.h79
-rw-r--r--src/plugins/gstreamer/qgstreamervideorendererinterface.cpp46
-rw-r--r--src/plugins/gstreamer/qgstreamervideorendererinterface.h74
-rw-r--r--src/plugins/gstreamer/qgstreamervideowidget.cpp352
-rw-r--r--src/plugins/gstreamer/qgstreamervideowidget.h112
-rw-r--r--src/plugins/gstreamer/qgstreamervideowindow.cpp351
-rw-r--r--src/plugins/gstreamer/qgstreamervideowindow.h134
-rw-r--r--src/plugins/gstreamer/qx11videosurface.cpp529
-rw-r--r--src/plugins/gstreamer/qx11videosurface.h117
-rw-r--r--src/plugins/m3u/m3u.pro16
-rw-r--r--src/plugins/m3u/main.cpp47
-rw-r--r--src/plugins/m3u/qm3uhandler.cpp237
-rw-r--r--src/plugins/m3u/qm3uhandler.h70
-rw-r--r--src/plugins/plugins.pro41
-rw-r--r--src/plugins/pulseaudio/pulseaudio.pro29
-rw-r--r--src/plugins/pulseaudio/qaudiodeviceinfo_pulse.cpp105
-rw-r--r--src/plugins/pulseaudio/qaudiodeviceinfo_pulse.h92
-rw-r--r--src/plugins/pulseaudio/qaudioinput_pulse.cpp600
-rw-r--r--src/plugins/pulseaudio/qaudioinput_pulse.h153
-rw-r--r--src/plugins/pulseaudio/qaudiooutput_pulse.cpp621
-rw-r--r--src/plugins/pulseaudio/qaudiooutput_pulse.h160
-rw-r--r--src/plugins/pulseaudio/qpulseaudioengine.cpp354
-rw-r--r--src/plugins/pulseaudio/qpulseaudioengine.h100
-rw-r--r--src/plugins/pulseaudio/qpulseaudioplugin.cpp89
-rw-r--r--src/plugins/pulseaudio/qpulseaudioplugin.h71
-rw-r--r--src/plugins/pulseaudio/qpulsehelpers.cpp220
-rw-r--r--src/plugins/pulseaudio/qpulsehelpers.h73
-rw-r--r--src/plugins/qt7/mediaplayer/mediaplayer.pri16
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playercontrol.h109
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playercontrol.mm191
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playermetadata.h77
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playermetadata.mm260
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playerservice.h82
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playerservice.mm129
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playersession.h194
-rw-r--r--src/plugins/qt7/mediaplayer/qt7playersession.mm751
-rw-r--r--src/plugins/qt7/qcvdisplaylink.h88
-rw-r--r--src/plugins/qt7/qcvdisplaylink.mm156
-rw-r--r--src/plugins/qt7/qt7.pro61
-rw-r--r--src/plugins/qt7/qt7backend.h68
-rw-r--r--src/plugins/qt7/qt7backend.mm60
-rw-r--r--src/plugins/qt7/qt7ciimagevideobuffer.h86
-rw-r--r--src/plugins/qt7/qt7ciimagevideobuffer.mm107
-rw-r--r--src/plugins/qt7/qt7movierenderer.h107
-rw-r--r--src/plugins/qt7/qt7movierenderer.mm479
-rw-r--r--src/plugins/qt7/qt7movievideowidget.h126
-rw-r--r--src/plugins/qt7/qt7movievideowidget.mm437
-rw-r--r--src/plugins/qt7/qt7movieviewoutput.h116
-rw-r--r--src/plugins/qt7/qt7movieviewoutput.mm339
-rw-r--r--src/plugins/qt7/qt7movieviewrenderer.h93
-rw-r--r--src/plugins/qt7/qt7movieviewrenderer.mm373
-rw-r--r--src/plugins/qt7/qt7serviceplugin.h75
-rw-r--r--src/plugins/qt7/qt7serviceplugin.mm129
-rw-r--r--src/plugins/qt7/qt7videooutput.h116
-rw-r--r--src/plugins/qt7/qt7videooutput.mm91
-rw-r--r--src/plugins/simulator/camera/simulatorcamera.pri25
-rw-r--r--src/plugins/simulator/camera/simulatorcameracontrol.cpp179
-rw-r--r--src/plugins/simulator/camera/simulatorcameracontrol.h87
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp502
-rw-r--r--src/plugins/simulator/camera/simulatorcameraexposurecontrol.h125
-rw-r--r--src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp120
-rw-r--r--src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h87
-rw-r--r--src/plugins/simulator/camera/simulatorcameraservice.cpp161
-rw-r--r--src/plugins/simulator/camera/simulatorcameraservice.h92
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasession.cpp147
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasession.h96
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasettings.cpp174
-rw-r--r--src/plugins/simulator/camera/simulatorcamerasettings.h110
-rw-r--r--src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp152
-rw-r--r--src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h83
-rw-r--r--src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp130
-rw-r--r--src/plugins/simulator/camera/simulatorvideorenderercontrol.h82
-rw-r--r--src/plugins/simulator/qsimulatormultimediaconnection.cpp122
-rw-r--r--src/plugins/simulator/qsimulatormultimediaconnection_p.h89
-rw-r--r--src/plugins/simulator/qsimulatormultimediadata.cpp78
-rw-r--r--src/plugins/simulator/qsimulatormultimediadata_p.h81
-rw-r--r--src/plugins/simulator/qsimulatorserviceplugin.cpp127
-rw-r--r--src/plugins/simulator/qsimulatorserviceplugin.h75
-rw-r--r--src/plugins/simulator/simulator.pro28
-rw-r--r--src/plugins/v4l/radio/radio.pri9
-rw-r--r--src/plugins/v4l/radio/v4lradiocontrol.cpp538
-rw-r--r--src/plugins/v4l/radio/v4lradiocontrol.h134
-rw-r--r--src/plugins/v4l/radio/v4lradioservice.cpp71
-rw-r--r--src/plugins/v4l/radio/v4lradioservice.h67
-rw-r--r--src/plugins/v4l/v4l.pro16
-rw-r--r--src/plugins/v4l/v4lserviceplugin.cpp84
-rw-r--r--src/plugins/v4l/v4lserviceplugin.h63
-rw-r--r--src/plugins/wmf/player/evr9videowindowcontrol.cpp351
-rw-r--r--src/plugins/wmf/player/evr9videowindowcontrol.h111
-rw-r--r--src/plugins/wmf/player/mfaudioendpointcontrol.cpp162
-rw-r--r--src/plugins/wmf/player/mfaudioendpointcontrol.h84
-rw-r--r--src/plugins/wmf/player/mfmetadatacontrol.cpp246
-rw-r--r--src/plugins/wmf/player/mfmetadatacontrol.h80
-rw-r--r--src/plugins/wmf/player/mfplayercontrol.cpp317
-rw-r--r--src/plugins/wmf/player/mfplayercontrol.h124
-rw-r--r--src/plugins/wmf/player/mfplayerservice.cpp155
-rw-r--r--src/plugins/wmf/player/mfplayerservice.h96
-rw-r--r--src/plugins/wmf/player/mfplayersession.cpp1393
-rw-r--r--src/plugins/wmf/player/mfplayersession.h212
-rw-r--r--src/plugins/wmf/player/mfstream.cpp361
-rw-r--r--src/plugins/wmf/player/mfstream.h150
-rw-r--r--src/plugins/wmf/player/mfvideorenderercontrol.cpp2200
-rw-r--r--src/plugins/wmf/player/mfvideorenderercontrol.h76
-rw-r--r--src/plugins/wmf/player/player.pri30
-rw-r--r--src/plugins/wmf/player/sourceresolver.cpp318
-rw-r--r--src/plugins/wmf/player/sourceresolver.h106
-rw-r--r--src/plugins/wmf/wmf.pro16
-rw-r--r--src/plugins/wmf/wmfserviceplugin.cpp97
-rw-r--r--src/plugins/wmf/wmfserviceplugin.h68
-rw-r--r--src/src.pro19
534 files changed, 0 insertions, 113048 deletions
diff --git a/src/gsttools/gsttools.pro b/src/gsttools/gsttools.pro
deleted file mode 100644
index c8beed8..0000000
--- a/src/gsttools/gsttools.pro
+++ /dev/null
@@ -1,69 +0,0 @@
-TEMPLATE = lib
-
-TARGET = qgsttools_p
-QPRO_PWD = $$PWD
-QT = core multimedia
-
-!static:DEFINES += QT_MAKEDLL
-
-unix:!maemo*:contains(QT_CONFIG, alsa) {
-DEFINES += HAVE_ALSA
-LIBS += \
- -lasound
-}
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-interfaces-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10 \
- gstreamer-pbutils-0.10
-
-maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10
-contains(config_test_gstreamer_appsrc, yes): PKGCONFIG += gstreamer-app-0.10
-
-contains(config_test_resourcepolicy, yes) {
- DEFINES += HAVE_RESOURCE_POLICY
- PKGCONFIG += libresourceqt1
-}
-
-# Header files must go inside source directory of a module
-# to be installed by syncqt.
-INCLUDEPATH += ../multimedia/gsttools_headers/
-DEPENDPATH += ../multimedia/gsttools_headers/
-
-PRIVATE_HEADERS += \
- qabstractgstbufferpool_p.h \
- qgstreamerbushelper_p.h \
- qgstreamermessage_p.h \
- qgstutils_p.h \
- qgstvideobuffer_p.h \
- qvideosurfacegstsink_p.h \
-
-SOURCES += \
- qgstreamerbushelper.cpp \
- qgstreamermessage.cpp \
- qgstutils.cpp \
- qgstvideobuffer.cpp \
- qvideosurfacegstsink.cpp \
-
-!win32:!contains(QT_CONFIG,embedded):!mac:!simulator:!contains(QT_CONFIG, qpa) {
- LIBS += -lXv -lX11 -lXext
-
- PRIVATE_HEADERS += \
- qgstxvimagebuffer_p.h \
-
-
- SOURCES += \
- qgstxvimagebuffer.cpp \
-}
-
-HEADERS += $$PRIVATE_HEADERS
-
-DESTDIR = $$QT.multimedia.libs
-target.path = $$[QT_INSTALL_LIBS]
-
-INSTALLS += target
diff --git a/src/gsttools/qgstreamerbushelper.cpp b/src/gsttools/qgstreamerbushelper.cpp
deleted file mode 100644
index 211c364..0000000
--- a/src/gsttools/qgstreamerbushelper.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qmap.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qlist.h>
-
-#include "qgstreamerbushelper_p.h"
-
-
-#ifndef QT_NO_GLIB
-class QGstreamerBusHelperPrivate : public QObject
-{
- Q_OBJECT
-
-public:
- void addWatch(GstBus* bus, QGstreamerBusHelper* helper)
- {
- setParent(helper);
- m_tag = gst_bus_add_watch_full(bus, 0, busCallback, this, NULL);
- m_helper = helper;
- }
-
- void removeWatch(QGstreamerBusHelper* helper)
- {
- Q_UNUSED(helper);
- g_source_remove(m_tag);
- }
-
- static QGstreamerBusHelperPrivate* instance()
- {
- return new QGstreamerBusHelperPrivate;
- }
-
-private:
- void processMessage(GstBus* bus, GstMessage* message)
- {
- Q_UNUSED(bus);
- QGstreamerMessage msg(message);
- foreach (QGstreamerBusMessageFilter *filter, busFilters) {
- if (filter->processBusMessage(msg))
- break;
- }
- emit m_helper->message(msg);
- }
-
- static gboolean busCallback(GstBus *bus, GstMessage *message, gpointer data)
- {
- reinterpret_cast<QGstreamerBusHelperPrivate*>(data)->processMessage(bus, message);
- return TRUE;
- }
-
- guint m_tag;
- QGstreamerBusHelper* m_helper;
-
-public:
- GstBus* bus;
- QMutex filterMutex;
- QList<QGstreamerSyncMessageFilter*> syncFilters;
- QList<QGstreamerBusMessageFilter*> busFilters;
-};
-
-#else
-
-class QGstreamerBusHelperPrivate : public QObject
-{
- Q_OBJECT
- typedef QMap<QGstreamerBusHelper*, GstBus*> HelperMap;
-
-public:
- void addWatch(GstBus* bus, QGstreamerBusHelper* helper)
- {
- m_helperMap.insert(helper, bus);
-
- if (m_helperMap.size() == 1)
- m_intervalTimer->start();
- }
-
- void removeWatch(QGstreamerBusHelper* helper)
- {
- m_helperMap.remove(helper);
-
- if (m_helperMap.size() == 0)
- m_intervalTimer->stop();
- }
-
- static QGstreamerBusHelperPrivate* instance()
- {
- static QGstreamerBusHelperPrivate self;
-
- return &self;
- }
-
-private slots:
- void interval()
- {
- for (HelperMap::iterator it = m_helperMap.begin(); it != m_helperMap.end(); ++it) {
- GstMessage* message;
-
- while ((message = gst_bus_poll(it.value(), GST_MESSAGE_ANY, 0)) != 0) {
- QGstreamerMessage msg(message);
- foreach (QGstreamerBusMessageFilter *filter, busFilters) {
- if (filter->processBusMessage(msg))
- break;
- }
- emit it.key()->message(msg);
-
- gst_message_unref(message);
- }
-
- emit it.key()->message(QGstreamerMessage());
- }
- }
-
-private:
- QGstreamerBusHelperPrivate()
- {
- m_intervalTimer = new QTimer(this);
- m_intervalTimer->setInterval(250);
-
- connect(m_intervalTimer, SIGNAL(timeout()), SLOT(interval()));
- }
-
- HelperMap m_helperMap;
- QTimer* m_intervalTimer;
-
-public:
- GstBus* bus;
- QMutex filterMutex;
- QList<QGstreamerSyncMessageFilter*> syncFilters;
- QList<QGstreamerBusMessageFilter*> busFilters;
-};
-#endif
-
-
-static GstBusSyncReply syncGstBusFilter(GstBus* bus, GstMessage* message, QGstreamerBusHelperPrivate *d)
-{
- Q_UNUSED(bus);
- QMutexLocker lock(&d->filterMutex);
-
- foreach (QGstreamerSyncMessageFilter *filter, d->syncFilters) {
- if (filter->processSyncMessage(QGstreamerMessage(message)))
- return GST_BUS_DROP;
- }
-
- return GST_BUS_PASS;
-}
-
-
-/*!
- \class gstreamer::QGstreamerBusHelper
- \internal
-*/
-
-QGstreamerBusHelper::QGstreamerBusHelper(GstBus* bus, QObject* parent):
- QObject(parent),
- d(QGstreamerBusHelperPrivate::instance())
-{
- d->bus = bus;
- d->addWatch(bus, this);
-
- gst_bus_set_sync_handler(bus, (GstBusSyncHandler)syncGstBusFilter, d);
-}
-
-QGstreamerBusHelper::~QGstreamerBusHelper()
-{
- d->removeWatch(this);
- gst_bus_set_sync_handler(d->bus,0,0);
-}
-
-void QGstreamerBusHelper::installMessageFilter(QObject *filter)
-{
- QGstreamerSyncMessageFilter *syncFilter = qobject_cast<QGstreamerSyncMessageFilter*>(filter);
- if (syncFilter) {
- QMutexLocker lock(&d->filterMutex);
- if (!d->syncFilters.contains(syncFilter))
- d->syncFilters.append(syncFilter);
- }
-
- QGstreamerBusMessageFilter *busFilter = qobject_cast<QGstreamerBusMessageFilter*>(filter);
- if (busFilter && !d->busFilters.contains(busFilter))
- d->busFilters.append(busFilter);
-}
-
-void QGstreamerBusHelper::removeMessageFilter(QObject *filter)
-{
- QGstreamerSyncMessageFilter *syncFilter = qobject_cast<QGstreamerSyncMessageFilter*>(filter);
- if (syncFilter) {
- QMutexLocker lock(&d->filterMutex);
- d->syncFilters.removeAll(syncFilter);
- }
-
- QGstreamerBusMessageFilter *busFilter = qobject_cast<QGstreamerBusMessageFilter*>(filter);
- if (busFilter)
- d->busFilters.removeAll(busFilter);
-}
-
-#include "qgstreamerbushelper.moc"
diff --git a/src/gsttools/qgstreamermessage.cpp b/src/gsttools/qgstreamermessage.cpp
deleted file mode 100644
index d36fa92..0000000
--- a/src/gsttools/qgstreamermessage.cpp
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <gst/gst.h>
-
-#include "qgstreamermessage_p.h"
-
-
-static int wuchi = qRegisterMetaType<QGstreamerMessage>();
-
-
-/*!
- \class gstreamer::QGstreamerMessage
- \internal
-*/
-
-QGstreamerMessage::QGstreamerMessage():
- m_message(0)
-{
-}
-
-QGstreamerMessage::QGstreamerMessage(GstMessage* message):
- m_message(message)
-{
- gst_message_ref(m_message);
-}
-
-QGstreamerMessage::QGstreamerMessage(QGstreamerMessage const& m):
- m_message(m.m_message)
-{
- gst_message_ref(m_message);
-}
-
-
-QGstreamerMessage::~QGstreamerMessage()
-{
- if (m_message != 0)
- gst_message_unref(m_message);
-}
-
-GstMessage* QGstreamerMessage::rawMessage() const
-{
- return m_message;
-}
-
-QGstreamerMessage& QGstreamerMessage::operator=(QGstreamerMessage const& rhs)
-{
- if (m_message != 0)
- gst_message_unref(m_message);
-
- if ((m_message = rhs.m_message) != 0)
- gst_message_ref(m_message);
-
- return *this;
-}
diff --git a/src/gsttools/qgstutils.cpp b/src/gsttools/qgstutils.cpp
deleted file mode 100644
index 4e501e9..0000000
--- a/src/gsttools/qgstutils.cpp
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstutils_p.h"
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qsize.h>
-
-//internal
-static void addTagToMap(const GstTagList *list,
- const gchar *tag,
- gpointer user_data)
-{
- QMap<QByteArray, QVariant> *map = reinterpret_cast<QMap<QByteArray, QVariant>* >(user_data);
-
- GValue val;
- val.g_type = 0;
- gst_tag_list_copy_value(&val,list,tag);
-
- switch( G_VALUE_TYPE(&val) ) {
- case G_TYPE_STRING:
- {
- const gchar *str_value = g_value_get_string(&val);
- map->insert(QByteArray(tag), QString::fromUtf8(str_value));
- break;
- }
- case G_TYPE_INT:
- map->insert(QByteArray(tag), g_value_get_int(&val));
- break;
- case G_TYPE_UINT:
- map->insert(QByteArray(tag), g_value_get_uint(&val));
- break;
- case G_TYPE_LONG:
- map->insert(QByteArray(tag), qint64(g_value_get_long(&val)));
- break;
- case G_TYPE_BOOLEAN:
- map->insert(QByteArray(tag), g_value_get_boolean(&val));
- break;
- case G_TYPE_CHAR:
- map->insert(QByteArray(tag), g_value_get_char(&val));
- break;
- case G_TYPE_DOUBLE:
- map->insert(QByteArray(tag), g_value_get_double(&val));
- break;
- default:
- // GST_TYPE_DATE is a function, not a constant, so pull it out of the switch
- if (G_VALUE_TYPE(&val) == GST_TYPE_DATE) {
- const GDate *date = gst_value_get_date(&val);
- if (g_date_valid(date)) {
- int year = g_date_get_year(date);
- int month = g_date_get_month(date);
- int day = g_date_get_day(date);
- map->insert(QByteArray(tag), QDate(year,month,day));
- if (!map->contains("year"))
- map->insert("year", year);
- }
- } else if (G_VALUE_TYPE(&val) == GST_TYPE_FRACTION) {
- int nom = gst_value_get_fraction_numerator(&val);
- int denom = gst_value_get_fraction_denominator(&val);
-
- if (denom > 0) {
- map->insert(QByteArray(tag), double(nom)/denom);
- }
- }
- break;
- }
-
- g_value_unset(&val);
-}
-
-/*!
- Convert GstTagList structure to QMap<QByteArray, QVariant>.
-
- Mapping to int, bool, char, string, fractions and date are supported.
- Fraction values are converted to doubles.
-*/
-QMap<QByteArray, QVariant> QGstUtils::gstTagListToMap(const GstTagList *tags)
-{
- QMap<QByteArray, QVariant> res;
- gst_tag_list_foreach(tags, addTagToMap, &res);
-
- return res;
-}
-
-/*!
- Returns resolution of \a caps.
- If caps doesn't have a valid size, and ampty QSize is returned.
-*/
-QSize QGstUtils::capsResolution(const GstCaps *caps)
-{
- QSize size;
-
- if (caps) {
- const GstStructure *structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int(structure, "width", &size.rwidth());
- gst_structure_get_int(structure, "height", &size.rheight());
- }
-
- return size;
-}
-
-/*!
- Returns aspect ratio corrected resolution of \a caps.
- If caps doesn't have a valid size, and ampty QSize is returned.
-*/
-QSize QGstUtils::capsCorrectedResolution(const GstCaps *caps)
-{
- QSize size;
-
- if (caps) {
- const GstStructure *structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int(structure, "width", &size.rwidth());
- gst_structure_get_int(structure, "height", &size.rheight());
-
- gint aspectNum = 0;
- gint aspectDenum = 0;
- if (!size.isEmpty() && gst_structure_get_fraction(
- structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) {
- if (aspectDenum > 0)
- size.setWidth(size.width()*aspectNum/aspectDenum);
- }
- }
-
- return size;
-}
diff --git a/src/gsttools/qgstvideobuffer.cpp b/src/gsttools/qgstvideobuffer.cpp
deleted file mode 100644
index a1a93c0..0000000
--- a/src/gsttools/qgstvideobuffer.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstvideobuffer_p.h"
-
-
-QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine)
- : QAbstractVideoBuffer(NoHandle)
- , m_buffer(buffer)
- , m_bytesPerLine(bytesPerLine)
- , m_mode(NotMapped)
-{
- gst_buffer_ref(m_buffer);
-}
-
-QGstVideoBuffer::QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine,
- QGstVideoBuffer::HandleType handleType,
- const QVariant &handle)
- : QAbstractVideoBuffer(handleType)
- , m_buffer(buffer)
- , m_bytesPerLine(bytesPerLine)
- , m_mode(NotMapped)
- , m_handle(handle)
-{
- gst_buffer_ref(m_buffer);
-}
-
-QGstVideoBuffer::~QGstVideoBuffer()
-{
- gst_buffer_unref(m_buffer);
-}
-
-
-QAbstractVideoBuffer::MapMode QGstVideoBuffer::mapMode() const
-{
- return m_mode;
-}
-
-uchar *QGstVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-{
- if (mode != NotMapped && m_mode == NotMapped) {
- if (numBytes)
- *numBytes = m_buffer->size;
-
- if (bytesPerLine)
- *bytesPerLine = m_bytesPerLine;
-
- m_mode = mode;
-
- return m_buffer->data;
- } else {
- return 0;
- }
-}
-void QGstVideoBuffer::unmap()
-{
- m_mode = NotMapped;
-}
-
diff --git a/src/gsttools/qgstxvimagebuffer.cpp b/src/gsttools/qgstxvimagebuffer.cpp
deleted file mode 100644
index 90ca867..0000000
--- a/src/gsttools/qgstxvimagebuffer.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qvariant.h>
-#include <QtWidgets/qx11info_x11.h>
-
-#include "qgstxvimagebuffer_p.h"
-#include "qvideosurfacegstsink_p.h"
-#include "qgstvideobuffer_p.h"
-
-#ifndef QT_NO_XVIDEO
-
-GstBufferClass *QGstXvImageBuffer::parent_class = NULL;
-
-GType QGstXvImageBuffer::get_type(void)
-{
- static GType buffer_type = 0;
-
- if (buffer_type == 0) {
- static const GTypeInfo buffer_info = {
- sizeof (GstBufferClass),
- NULL,
- NULL,
- QGstXvImageBuffer::class_init,
- NULL,
- NULL,
- sizeof(QGstXvImageBuffer),
- 0,
- (GInstanceInitFunc)QGstXvImageBuffer::buffer_init,
- NULL
- };
- buffer_type = g_type_register_static(GST_TYPE_BUFFER,
- "QGstXvImageBuffer", &buffer_info, GTypeFlags(0));
- }
- return buffer_type;
-}
-
-void QGstXvImageBuffer::class_init(gpointer g_class, gpointer class_data)
-{
- Q_UNUSED(class_data);
- GST_MINI_OBJECT_CLASS(g_class)->finalize =
- (GstMiniObjectFinalizeFunction)buffer_finalize;
- parent_class = (GstBufferClass*)g_type_class_peek_parent(g_class);
-}
-
-void QGstXvImageBuffer::buffer_init(QGstXvImageBuffer *xvImage, gpointer g_class)
-{
- Q_UNUSED(g_class);
- xvImage->pool = 0;
- xvImage->shmInfo.shmaddr = ((char *) -1);
- xvImage->shmInfo.shmid = -1;
- xvImage->markedForDeletion = false;
-}
-
-void QGstXvImageBuffer::buffer_finalize(QGstXvImageBuffer * xvImage)
-{
- if (xvImage->pool) {
- if (xvImage->markedForDeletion)
- xvImage->pool->destroyBuffer(xvImage);
- else
- xvImage->pool->recycleBuffer(xvImage);
- }
-}
-
-
-QGstXvImageBufferPool::QGstXvImageBufferPool(QObject *parent)
- :QObject(parent)
-{
- m_threadId = QThread::currentThreadId();
-}
-
-QGstXvImageBufferPool::~QGstXvImageBufferPool()
-{
-}
-
-bool QGstXvImageBufferPool::isFormatSupported(const QVideoSurfaceFormat &surfaceFormat) const
-{
- bool ok = true;
- surfaceFormat.property("portId").toULongLong(&ok);
- if (!ok)
- return false;
-
- int xvFormatId = surfaceFormat.property("xvFormatId").toInt(&ok);
- if (!ok || xvFormatId < 0)
- return false;
-
- int dataSize = surfaceFormat.property("dataSize").toInt(&ok);
- if (!ok || dataSize<=0)
- return false;
-
- return true;
-}
-
-GType QGstXvImageBufferPool::bufferType() const
-{
- return QGstXvImageBuffer::get_type();
-}
-
-GstBuffer *QGstXvImageBufferPool::takeBuffer(
- const QVideoSurfaceFormat &format, GstCaps *caps)
-{
- m_poolMutex.lock();
-
- m_caps = caps;
- if (format != m_format) {
- doClear();
- m_format = format;
- }
-
-
- if (m_pool.isEmpty()) {
- //qDebug() << "QGstXvImageBufferPool::takeBuffer: no buffer available, allocate the new one" << QThread::currentThreadId() << m_threadId;
- if (QThread::currentThreadId() == m_threadId) {
- doAlloc();
- } else {
- QMetaObject::invokeMethod(this, "queuedAlloc", Qt::QueuedConnection);
- m_allocWaitCondition.wait(&m_poolMutex, 300);
- }
- }
- QGstXvImageBuffer *res = 0;
-
- if (!m_pool.isEmpty()) {
- res = m_pool.takeLast();
- }
-
- m_poolMutex.unlock();
-
- return GST_BUFFER(res);
-}
-
-QAbstractVideoBuffer::HandleType QGstXvImageBufferPool::handleType() const
-{
- return QAbstractVideoBuffer::XvShmImageHandle;
-}
-
-QAbstractVideoBuffer *QGstXvImageBufferPool::prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine)
-{
- QGstXvImageBuffer *xvBuffer = reinterpret_cast<QGstXvImageBuffer *>(buffer);
- QVariant handle = QVariant::fromValue(xvBuffer->xvImage);
- return new QGstVideoBuffer(buffer, bytesPerLine, QAbstractVideoBuffer::XvShmImageHandle, handle);
-}
-
-void QGstXvImageBufferPool::queuedAlloc()
-{
- QMutexLocker lock(&m_poolMutex);
- doAlloc();
- m_allocWaitCondition.wakeOne();
-}
-
-void QGstXvImageBufferPool::doAlloc()
-{
- //should be always called from the main thread with m_poolMutex locked
- //Q_ASSERT(QThread::currentThread() == thread());
-
- XSync(QX11Info::display(), false);
-
- QGstXvImageBuffer *xvBuffer = (QGstXvImageBuffer *)gst_mini_object_new(QGstXvImageBuffer::get_type());
-
- quint64 portId = m_format.property("portId").toULongLong();
- int xvFormatId = m_format.property("xvFormatId").toInt();
-
- xvBuffer->xvImage = XvShmCreateImage(
- QX11Info::display(),
- portId,
- xvFormatId,
- 0,
- m_format.frameWidth(),
- m_format.frameHeight(),
- &xvBuffer->shmInfo
- );
-
- if (!xvBuffer->xvImage) {
- qWarning() << "QGstXvImageBufferPool: XvShmCreateImage failed";
- return;
- }
-
- XSync(QX11Info::display(), false);
-
- xvBuffer->shmInfo.shmid = shmget(IPC_PRIVATE, xvBuffer->xvImage->data_size, IPC_CREAT | 0777);
- xvBuffer->shmInfo.shmaddr = xvBuffer->xvImage->data = (char*)shmat(xvBuffer->shmInfo.shmid, 0, 0);
- xvBuffer->shmInfo.readOnly = False;
-
- if (!XShmAttach(QX11Info::display(), &xvBuffer->shmInfo)) {
- qWarning() << "QGstXvImageBufferPool: XShmAttach failed";
- return;
- }
-
- XSync(QX11Info::display(), false);
-
- shmctl (xvBuffer->shmInfo.shmid, IPC_RMID, NULL);
-
- xvBuffer->pool = this;
- GST_MINI_OBJECT_CAST(xvBuffer)->flags = 0;
- gst_buffer_set_caps(GST_BUFFER_CAST(xvBuffer), m_caps);
- GST_BUFFER_DATA(xvBuffer) = (uchar*)xvBuffer->xvImage->data;
- GST_BUFFER_SIZE(xvBuffer) = xvBuffer->xvImage->data_size;
-
- m_allBuffers.append(xvBuffer);
- m_pool.append(xvBuffer);
-
- XSync(QX11Info::display(), false);
-}
-
-
-void QGstXvImageBufferPool::clear()
-{
- QMutexLocker lock(&m_poolMutex);
- doClear();
-}
-
-void QGstXvImageBufferPool::doClear()
-{
- foreach (QGstXvImageBuffer *xvBuffer, m_allBuffers) {
- xvBuffer->markedForDeletion = true;
- }
- m_allBuffers.clear();
-
- foreach (QGstXvImageBuffer *xvBuffer, m_pool) {
- gst_buffer_unref(GST_BUFFER(xvBuffer));
- }
- m_pool.clear();
-
- m_format = QVideoSurfaceFormat();
-}
-
-void QGstXvImageBufferPool::queuedDestroy()
-{
- QMutexLocker lock(&m_destroyMutex);
-
- XSync(QX11Info::display(), false);
-
- foreach(XvShmImage xvImage, m_imagesToDestroy) {
- if (xvImage.shmInfo.shmaddr != ((void *) -1)) {
- XShmDetach(QX11Info::display(), &xvImage.shmInfo);
- XSync(QX11Info::display(), false);
-
- shmdt(xvImage.shmInfo.shmaddr);
- }
-
- if (xvImage.xvImage)
- XFree(xvImage.xvImage);
- }
-
- m_imagesToDestroy.clear();
-
- XSync(QX11Info::display(), false);
-}
-
-void QGstXvImageBufferPool::recycleBuffer(QGstXvImageBuffer *xvBuffer)
-{
- QMutexLocker lock(&m_poolMutex);
- gst_buffer_ref(GST_BUFFER_CAST(xvBuffer));
- m_pool.append(xvBuffer);
-}
-
-void QGstXvImageBufferPool::destroyBuffer(QGstXvImageBuffer *xvBuffer)
-{
- XvShmImage imageToDestroy;
- imageToDestroy.xvImage = xvBuffer->xvImage;
- imageToDestroy.shmInfo = xvBuffer->shmInfo;
-
- m_destroyMutex.lock();
- m_imagesToDestroy.append(imageToDestroy);
- m_destroyMutex.unlock();
-
- if (m_imagesToDestroy.size() == 1)
- QMetaObject::invokeMethod(this, "queuedDestroy", Qt::QueuedConnection);
-}
-
-#endif //QT_NO_XVIDEO
-
diff --git a/src/gsttools/qvideosurfacegstsink.cpp b/src/gsttools/qvideosurfacegstsink.cpp
deleted file mode 100644
index 3df1401..0000000
--- a/src/gsttools/qvideosurfacegstsink.cpp
+++ /dev/null
@@ -1,791 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qabstractvideosurface.h>
-#include <qvideoframe.h>
-#include <QDebug>
-#include <QMap>
-#include <QDebug>
-#include <QThread>
-
-#include "qgstvideobuffer_p.h"
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-#include <QtWidgets/qx11info_x11.h>
-#include "qgstxvimagebuffer_p.h"
-#endif
-
-#include "qvideosurfacegstsink_p.h"
-
-//#define DEBUG_VIDEO_SURFACE_SINK
-
-
-Q_DECLARE_METATYPE(QVideoSurfaceFormat)
-
-QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
- QAbstractVideoSurface *surface)
- : m_surface(surface)
- , m_pool(0)
- , m_renderReturn(GST_FLOW_ERROR)
- , m_bytesPerLine(0)
- , m_startCanceled(false)
-{
- if (m_surface) {
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
- m_pools.append(new QGstXvImageBufferPool());
-#endif
- updateSupportedFormats();
- connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(updateSupportedFormats()));
- }
-}
-
-QVideoSurfaceGstDelegate::~QVideoSurfaceGstDelegate()
-{
- qDeleteAll(m_pools);
-}
-
-QList<QVideoFrame::PixelFormat> QVideoSurfaceGstDelegate::supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
-{
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
-
- if (!m_surface)
- return QList<QVideoFrame::PixelFormat>();
- else if (handleType == QAbstractVideoBuffer::NoHandle)
- return m_supportedPixelFormats;
- else if (handleType == m_pool->handleType())
- return m_supportedPoolPixelFormats;
- else
- return m_surface->supportedPixelFormats(handleType);
-}
-
-QVideoSurfaceFormat QVideoSurfaceGstDelegate::surfaceFormat() const
-{
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
- return m_format;
-}
-
-bool QVideoSurfaceGstDelegate::start(const QVideoSurfaceFormat &format, int bytesPerLine)
-{
- if (!m_surface)
- return false;
-
- QMutexLocker locker(&m_mutex);
-
- m_format = format;
- m_bytesPerLine = bytesPerLine;
-
- if (QThread::currentThread() == thread()) {
- m_started = !m_surface.isNull() ? m_surface->start(m_format) : false;
- } else {
- m_started = false;
- m_startCanceled = false;
- QMetaObject::invokeMethod(this, "queuedStart", Qt::QueuedConnection);
-
- /*
- Waiting for start() to be invoked in the main thread may block
- if gstreamer blocks the main thread until this call is finished.
- This situation is rare and usually caused by setState(Null)
- while pipeline is being prerolled.
-
- The proper solution to this involves controlling gstreamer pipeline from
- other thread than video surface.
-
- Currently start() fails if wait() timed out.
- */
- if (!m_setupCondition.wait(&m_mutex, 1000)) {
- qWarning() << "Failed to start video surface due to main thread blocked.";
- m_startCanceled = true;
- }
- }
-
- m_format = m_surface->surfaceFormat();
-
- return m_started;
-}
-
-void QVideoSurfaceGstDelegate::stop()
-{
- if (!m_surface)
- return;
-
- QMutexLocker locker(&m_mutex);
-
- if (QThread::currentThread() == thread()) {
- if (!m_surface.isNull())
- m_surface->stop();
- } else {
- QMetaObject::invokeMethod(this, "queuedStop", Qt::QueuedConnection);
-
- // Waiting for stop() to be invoked in the main thread may block
- // if gstreamer blocks the main thread until this call is finished.
- m_setupCondition.wait(&m_mutex, 500);
- }
-
- m_started = false;
-}
-
-bool QVideoSurfaceGstDelegate::isActive()
-{
- QMutexLocker locker(&m_mutex);
- return !m_surface.isNull() && m_surface->isActive();
-}
-
-GstFlowReturn QVideoSurfaceGstDelegate::render(GstBuffer *buffer)
-{
- if (!m_surface) {
- qWarning() << "Rendering video frame to deleted surface, skip.";
- //return GST_FLOW_NOT_NEGOTIATED;
- return GST_FLOW_OK;
- }
-
- QMutexLocker locker(&m_mutex);
-
- QAbstractVideoBuffer *videoBuffer = 0;
-
- if (m_pool && G_TYPE_CHECK_INSTANCE_TYPE(buffer, m_pool->bufferType()))
- videoBuffer = m_pool->prepareVideoBuffer(buffer, m_bytesPerLine);
- else
- videoBuffer = new QGstVideoBuffer(buffer, m_bytesPerLine);
-
- m_frame = QVideoFrame(
- videoBuffer,
- m_format.frameSize(),
- m_format.pixelFormat());
-
- qint64 startTime = GST_BUFFER_TIMESTAMP(buffer);
-
- if (startTime >= 0) {
- m_frame.setStartTime(startTime/G_GINT64_CONSTANT (1000000));
-
- qint64 duration = GST_BUFFER_DURATION(buffer);
-
- if (duration >= 0)
- m_frame.setEndTime((startTime + duration)/G_GINT64_CONSTANT (1000000));
- }
-
- QMetaObject::invokeMethod(this, "queuedRender", Qt::QueuedConnection);
-
- if (!m_renderCondition.wait(&m_mutex, 300)) {
- m_frame = QVideoFrame();
-
- return GST_FLOW_OK;
- } else {
- return m_renderReturn;
- }
-}
-
-void QVideoSurfaceGstDelegate::queuedStart()
-{
- if (!m_startCanceled) {
- QMutexLocker locker(&m_mutex);
- m_started = m_surface->start(m_format);
- m_setupCondition.wakeAll();
- }
-}
-
-void QVideoSurfaceGstDelegate::queuedStop()
-{
- QMutexLocker locker(&m_mutex);
-
- m_surface->stop();
-
- m_setupCondition.wakeAll();
-}
-
-void QVideoSurfaceGstDelegate::queuedRender()
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_surface.isNull()) {
- qWarning() << "Rendering video frame to deleted surface, skip the frame";
- m_renderReturn = GST_FLOW_OK;
- } else if (m_surface->present(m_frame)) {
- m_renderReturn = GST_FLOW_OK;
- } else {
- switch (m_surface->error()) {
- case QAbstractVideoSurface::NoError:
- m_renderReturn = GST_FLOW_OK;
- break;
- case QAbstractVideoSurface::StoppedError:
- //It's likely we are in process of changing video output
- //and the surface is already stopped, ignore the frame
- m_renderReturn = GST_FLOW_OK;
- break;
- default:
- qWarning() << "Failed to render video frame:" << m_surface->error();
- m_renderReturn = GST_FLOW_OK;
- break;
- }
- }
-
- m_renderCondition.wakeAll();
-}
-
-void QVideoSurfaceGstDelegate::updateSupportedFormats()
-{
- QAbstractGstBufferPool *newPool = 0;
- foreach (QAbstractGstBufferPool *pool, m_pools) {
- if (!m_surface->supportedPixelFormats(pool->handleType()).isEmpty()) {
- newPool = pool;
- break;
- }
- }
-
- if (newPool != m_pool) {
- QMutexLocker lock(&m_poolMutex);
-
- if (m_pool)
- m_pool->clear();
- m_pool = newPool;
- }
-
- QMutexLocker locker(&m_mutex);
-
- m_supportedPixelFormats.clear();
- m_supportedPoolPixelFormats.clear();
- if (m_surface) {
- m_supportedPixelFormats = m_surface->supportedPixelFormats();
- if (m_pool)
- m_supportedPoolPixelFormats = m_surface->supportedPixelFormats(m_pool->handleType());
- }
-}
-
-struct YuvFormat
-{
- QVideoFrame::PixelFormat pixelFormat;
- guint32 fourcc;
- int bitsPerPixel;
-};
-
-static const YuvFormat qt_yuvColorLookup[] =
-{
- { QVideoFrame::Format_YUV420P, GST_MAKE_FOURCC('I','4','2','0'), 8 },
- { QVideoFrame::Format_YV12, GST_MAKE_FOURCC('Y','V','1','2'), 8 },
- { QVideoFrame::Format_UYVY, GST_MAKE_FOURCC('U','Y','V','Y'), 16 },
- { QVideoFrame::Format_YUYV, GST_MAKE_FOURCC('Y','U','Y','2'), 16 },
- { QVideoFrame::Format_NV12, GST_MAKE_FOURCC('N','V','1','2'), 8 },
- { QVideoFrame::Format_NV21, GST_MAKE_FOURCC('N','V','2','1'), 8 },
- { QVideoFrame::Format_AYUV444, GST_MAKE_FOURCC('A','Y','U','V'), 32 }
-};
-
-static int indexOfYuvColor(QVideoFrame::PixelFormat format)
-{
- const int count = sizeof(qt_yuvColorLookup) / sizeof(YuvFormat);
-
- for (int i = 0; i < count; ++i)
- if (qt_yuvColorLookup[i].pixelFormat == format)
- return i;
-
- return -1;
-}
-
-static int indexOfYuvColor(guint32 fourcc)
-{
- const int count = sizeof(qt_yuvColorLookup) / sizeof(YuvFormat);
-
- for (int i = 0; i < count; ++i)
- if (qt_yuvColorLookup[i].fourcc == fourcc)
- return i;
-
- return -1;
-}
-
-struct RgbFormat
-{
- QVideoFrame::PixelFormat pixelFormat;
- int bitsPerPixel;
- int depth;
- int endianness;
- int red;
- int green;
- int blue;
- int alpha;
-};
-
-static const RgbFormat qt_rgbColorLookup[] =
-{
- { QVideoFrame::Format_RGB32 , 32, 24, 4321, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x00000000 },
- { QVideoFrame::Format_RGB32 , 32, 24, 1234, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
- { QVideoFrame::Format_BGR32 , 32, 24, 4321, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x00000000 },
- { QVideoFrame::Format_BGR32 , 32, 24, 1234, 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
- { QVideoFrame::Format_ARGB32, 32, 24, 4321, 0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF },
- { QVideoFrame::Format_ARGB32, 32, 24, 1234, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000 },
- { QVideoFrame::Format_RGB24 , 24, 24, 4321, 0x00FF0000, 0x0000FF00, 0x000000FF, 0x00000000 },
- { QVideoFrame::Format_BGR24 , 24, 24, 4321, 0x000000FF, 0x0000FF00, 0x00FF0000, 0x00000000 },
- { QVideoFrame::Format_RGB565, 16, 16, 1234, 0x0000F800, 0x000007E0, 0x0000001F, 0x00000000 }
-};
-
-static int indexOfRgbColor(
- int bits, int depth, int endianness, int red, int green, int blue, int alpha)
-{
- const int count = sizeof(qt_rgbColorLookup) / sizeof(RgbFormat);
-
- for (int i = 0; i < count; ++i) {
- if (qt_rgbColorLookup[i].bitsPerPixel == bits
- && qt_rgbColorLookup[i].depth == depth
- && qt_rgbColorLookup[i].endianness == endianness
- && qt_rgbColorLookup[i].red == red
- && qt_rgbColorLookup[i].green == green
- && qt_rgbColorLookup[i].blue == blue
- && qt_rgbColorLookup[i].alpha == alpha) {
- return i;
- }
- }
- return -1;
-}
-
-static GstVideoSinkClass *sink_parent_class;
-
-#define VO_SINK(s) QVideoSurfaceGstSink *sink(reinterpret_cast<QVideoSurfaceGstSink *>(s))
-
-QVideoSurfaceGstSink *QVideoSurfaceGstSink::createSink(QAbstractVideoSurface *surface)
-{
- QVideoSurfaceGstSink *sink = reinterpret_cast<QVideoSurfaceGstSink *>(
- g_object_new(QVideoSurfaceGstSink::get_type(), 0));
-
- sink->delegate = new QVideoSurfaceGstDelegate(surface);
-
- return sink;
-}
-
-GType QVideoSurfaceGstSink::get_type()
-{
- static GType type = 0;
-
- if (type == 0) {
- static const GTypeInfo info =
- {
- sizeof(QVideoSurfaceGstSinkClass), // class_size
- base_init, // base_init
- NULL, // base_finalize
- class_init, // class_init
- NULL, // class_finalize
- NULL, // class_data
- sizeof(QVideoSurfaceGstSink), // instance_size
- 0, // n_preallocs
- instance_init, // instance_init
- 0 // value_table
- };
-
- type = g_type_register_static(
- GST_TYPE_VIDEO_SINK, "QVideoSurfaceGstSink", &info, GTypeFlags(0));
- }
-
- return type;
-}
-
-void QVideoSurfaceGstSink::class_init(gpointer g_class, gpointer class_data)
-{
- Q_UNUSED(class_data);
-
- sink_parent_class = reinterpret_cast<GstVideoSinkClass *>(g_type_class_peek_parent(g_class));
-
- GstBaseSinkClass *base_sink_class = reinterpret_cast<GstBaseSinkClass *>(g_class);
- base_sink_class->get_caps = QVideoSurfaceGstSink::get_caps;
- base_sink_class->set_caps = QVideoSurfaceGstSink::set_caps;
- base_sink_class->buffer_alloc = QVideoSurfaceGstSink::buffer_alloc;
- base_sink_class->start = QVideoSurfaceGstSink::start;
- base_sink_class->stop = QVideoSurfaceGstSink::stop;
- // base_sink_class->unlock = QVideoSurfaceGstSink::unlock; // Not implemented.
- // base_sink_class->event = QVideoSurfaceGstSink::event; // Not implemented.
- base_sink_class->preroll = QVideoSurfaceGstSink::preroll;
- base_sink_class->render = QVideoSurfaceGstSink::render;
-
- GstElementClass *element_class = reinterpret_cast<GstElementClass *>(g_class);
- element_class->change_state = QVideoSurfaceGstSink::change_state;
-
- GObjectClass *object_class = reinterpret_cast<GObjectClass *>(g_class);
- object_class->finalize = QVideoSurfaceGstSink::finalize;
-}
-
-void QVideoSurfaceGstSink::base_init(gpointer g_class)
-{
- static GstStaticPadTemplate sink_pad_template = GST_STATIC_PAD_TEMPLATE(
- "sink", GST_PAD_SINK, GST_PAD_ALWAYS, GST_STATIC_CAPS(
- "video/x-raw-rgb, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ]; "
- "video/x-raw-yuv, "
- "framerate = (fraction) [ 0, MAX ], "
- "width = (int) [ 1, MAX ], "
- "height = (int) [ 1, MAX ]"));
-
- gst_element_class_add_pad_template(
- GST_ELEMENT_CLASS(g_class), gst_static_pad_template_get(&sink_pad_template));
-}
-
-void QVideoSurfaceGstSink::instance_init(GTypeInstance *instance, gpointer g_class)
-{
- VO_SINK(instance);
-
- Q_UNUSED(g_class);
-
- sink->delegate = 0;
-
- sink->lastRequestedCaps = 0;
- sink->lastBufferCaps = 0;
- sink->lastSurfaceFormat = new QVideoSurfaceFormat;
-}
-
-void QVideoSurfaceGstSink::finalize(GObject *object)
-{
- VO_SINK(object);
-
- delete sink->lastSurfaceFormat;
- sink->lastSurfaceFormat = 0;
-
- if (sink->lastBufferCaps)
- gst_caps_unref(sink->lastBufferCaps);
- sink->lastBufferCaps = 0;
-
- if (sink->lastRequestedCaps)
- gst_caps_unref(sink->lastRequestedCaps);
- sink->lastRequestedCaps = 0;
-}
-
-GstStateChangeReturn QVideoSurfaceGstSink::change_state(
- GstElement *element, GstStateChange transition)
-{
- Q_UNUSED(element);
-
- return GST_ELEMENT_CLASS(sink_parent_class)->change_state(
- element, transition);
-}
-
-GstCaps *QVideoSurfaceGstSink::get_caps(GstBaseSink *base)
-{
- VO_SINK(base);
-
- GstCaps *caps = gst_caps_new_empty();
-
- foreach (QVideoFrame::PixelFormat format, sink->delegate->supportedPixelFormats()) {
- int index = indexOfYuvColor(format);
-
- if (index != -1) {
- gst_caps_append_structure(caps, gst_structure_new(
- "video/x-raw-yuv",
- "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, INT_MAX, 1,
- "width" , GST_TYPE_INT_RANGE, 1, INT_MAX,
- "height" , GST_TYPE_INT_RANGE, 1, INT_MAX,
- "format" , GST_TYPE_FOURCC, qt_yuvColorLookup[index].fourcc,
- NULL));
- continue;
- }
-
- const int count = sizeof(qt_rgbColorLookup) / sizeof(RgbFormat);
-
- for (int i = 0; i < count; ++i) {
- if (qt_rgbColorLookup[i].pixelFormat == format) {
- GstStructure *structure = gst_structure_new(
- "video/x-raw-rgb",
- "framerate" , GST_TYPE_FRACTION_RANGE, 0, 1, INT_MAX, 1,
- "width" , GST_TYPE_INT_RANGE, 1, INT_MAX,
- "height" , GST_TYPE_INT_RANGE, 1, INT_MAX,
- "bpp" , G_TYPE_INT, qt_rgbColorLookup[i].bitsPerPixel,
- "depth" , G_TYPE_INT, qt_rgbColorLookup[i].depth,
- "endianness", G_TYPE_INT, qt_rgbColorLookup[i].endianness,
- "red_mask" , G_TYPE_INT, qt_rgbColorLookup[i].red,
- "green_mask", G_TYPE_INT, qt_rgbColorLookup[i].green,
- "blue_mask" , G_TYPE_INT, qt_rgbColorLookup[i].blue,
- NULL);
-
- if (qt_rgbColorLookup[i].alpha != 0) {
- gst_structure_set(
- structure, "alpha_mask", G_TYPE_INT, qt_rgbColorLookup[i].alpha, NULL);
- }
- gst_caps_append_structure(caps, structure);
- }
- }
- }
-
- return caps;
-}
-
-gboolean QVideoSurfaceGstSink::set_caps(GstBaseSink *base, GstCaps *caps)
-{
- VO_SINK(base);
-
-#ifdef DEBUG_VIDEO_SURFACE_SINK
- qDebug() << "set_caps:";
- qDebug() << gst_caps_to_string(caps);
-#endif
-
- if (!caps) {
- sink->delegate->stop();
-
- return TRUE;
- } else {
- int bytesPerLine = 0;
- QVideoSurfaceFormat format = formatForCaps(caps, &bytesPerLine);
-
- if (sink->delegate->isActive()) {
- QVideoSurfaceFormat surfaceFormst = sink->delegate->surfaceFormat();
-
- if (format.pixelFormat() == surfaceFormst.pixelFormat() &&
- format.frameSize() == surfaceFormst.frameSize())
- return TRUE;
- else
- sink->delegate->stop();
- }
-
- if (sink->lastRequestedCaps)
- gst_caps_unref(sink->lastRequestedCaps);
- sink->lastRequestedCaps = 0;
-
-#ifdef DEBUG_VIDEO_SURFACE_SINK
- qDebug() << "Staring video surface, format:";
- qDebug() << format;
- qDebug() << "bytesPerLine:" << bytesPerLine;
-#endif
-
- if (sink->delegate->start(format, bytesPerLine))
- return TRUE;
- else
- qWarning() << "Failed to start video surface";
- }
-
- return FALSE;
-}
-
-QVideoSurfaceFormat QVideoSurfaceGstSink::formatForCaps(GstCaps *caps, int *bytesPerLine)
-{
- const GstStructure *structure = gst_caps_get_structure(caps, 0);
-
- QVideoFrame::PixelFormat pixelFormat = QVideoFrame::Format_Invalid;
- int bitsPerPixel = 0;
-
- QSize size;
- gst_structure_get_int(structure, "width", &size.rwidth());
- gst_structure_get_int(structure, "height", &size.rheight());
-
- if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) {
- guint32 fourcc = 0;
- gst_structure_get_fourcc(structure, "format", &fourcc);
-
- int index = indexOfYuvColor(fourcc);
- if (index != -1) {
- pixelFormat = qt_yuvColorLookup[index].pixelFormat;
- bitsPerPixel = qt_yuvColorLookup[index].bitsPerPixel;
- }
- } else if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) {
- int depth = 0;
- int endianness = 0;
- int red = 0;
- int green = 0;
- int blue = 0;
- int alpha = 0;
-
- gst_structure_get_int(structure, "bpp", &bitsPerPixel);
- gst_structure_get_int(structure, "depth", &depth);
- gst_structure_get_int(structure, "endianness", &endianness);
- gst_structure_get_int(structure, "red_mask", &red);
- gst_structure_get_int(structure, "green_mask", &green);
- gst_structure_get_int(structure, "blue_mask", &blue);
- gst_structure_get_int(structure, "alpha_mask", &alpha);
-
- int index = indexOfRgbColor(bitsPerPixel, depth, endianness, red, green, blue, alpha);
-
- if (index != -1)
- pixelFormat = qt_rgbColorLookup[index].pixelFormat;
- }
-
- if (pixelFormat != QVideoFrame::Format_Invalid) {
- QVideoSurfaceFormat format(size, pixelFormat);
-
- QPair<int, int> rate;
- gst_structure_get_fraction(structure, "framerate", &rate.first, &rate.second);
-
- if (rate.second)
- format.setFrameRate(qreal(rate.first)/rate.second);
-
- gint aspectNum = 0;
- gint aspectDenum = 0;
- if (gst_structure_get_fraction(
- structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) {
- if (aspectDenum > 0)
- format.setPixelAspectRatio(aspectNum, aspectDenum);
- }
-
- if (bytesPerLine)
- *bytesPerLine = ((size.width() * bitsPerPixel / 8) + 3) & ~3;
-
- return format;
- }
-
- return QVideoSurfaceFormat();
-}
-
-
-GstFlowReturn QVideoSurfaceGstSink::buffer_alloc(
- GstBaseSink *base, guint64 offset, guint size, GstCaps *caps, GstBuffer **buffer)
-{
- VO_SINK(base);
-
- Q_UNUSED(offset);
- Q_UNUSED(size);
-
- if (!buffer)
- return GST_FLOW_ERROR;
-
- *buffer = NULL;
-
- if (!sink->delegate->pool())
- return GST_FLOW_OK;
-
- QMutexLocker poolLock(sink->delegate->poolMutex());
- QAbstractGstBufferPool *pool = sink->delegate->pool();
-
- if (!pool)
- return GST_FLOW_OK;
-
- if (sink->lastRequestedCaps && gst_caps_is_equal(sink->lastRequestedCaps, caps)) {
- //qDebug() << "reusing last caps";
- *buffer = GST_BUFFER(pool->takeBuffer(*sink->lastSurfaceFormat, sink->lastBufferCaps));
- return GST_FLOW_OK;
- }
-
- if (sink->delegate->supportedPixelFormats(pool->handleType()).isEmpty()) {
- //qDebug() << "sink doesn't support native pool buffers, skip buffers allocation";
- return GST_FLOW_OK;
- }
-
- GstCaps *intersection = gst_caps_intersect(get_caps(GST_BASE_SINK(sink)), caps);
-
- if (gst_caps_is_empty (intersection)) {
- gst_caps_unref(intersection);
- return GST_FLOW_NOT_NEGOTIATED;
- }
-
- poolLock.unlock();
-
- if (sink->delegate->isActive()) {
- //if format was changed, restart the surface
- QVideoSurfaceFormat format = formatForCaps(intersection);
- QVideoSurfaceFormat surfaceFormat = sink->delegate->surfaceFormat();
-
- if (format.pixelFormat() != surfaceFormat.pixelFormat() ||
- format.frameSize() != surfaceFormat.frameSize()) {
-#ifdef DEBUG_VIDEO_SURFACE_SINK
- qDebug() << "new format requested, restart video surface";
-#endif
- sink->delegate->stop();
- }
- }
-
- if (!sink->delegate->isActive()) {
- int bytesPerLine = 0;
- QVideoSurfaceFormat format = formatForCaps(intersection, &bytesPerLine);
-
- if (!sink->delegate->start(format, bytesPerLine)) {
- qWarning() << "failed to start video surface";
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- poolLock.relock();
- pool = sink->delegate->pool();
-
- QVideoSurfaceFormat surfaceFormat = sink->delegate->surfaceFormat();
-
- if (!pool->isFormatSupported(surfaceFormat)) {
- //qDebug() << "sink doesn't support native pool format, skip custom buffers allocation";
- return GST_FLOW_OK;
- }
-
- if (sink->lastRequestedCaps)
- gst_caps_unref(sink->lastRequestedCaps);
- sink->lastRequestedCaps = caps;
- gst_caps_ref(sink->lastRequestedCaps);
-
- if (sink->lastBufferCaps)
- gst_caps_unref(sink->lastBufferCaps);
- sink->lastBufferCaps = intersection;
- gst_caps_ref(sink->lastBufferCaps);
-
- *sink->lastSurfaceFormat = surfaceFormat;
-
- *buffer = GST_BUFFER(pool->takeBuffer(surfaceFormat, intersection));
-
- return GST_FLOW_OK;
-}
-
-gboolean QVideoSurfaceGstSink::start(GstBaseSink *base)
-{
- Q_UNUSED(base);
-
- return TRUE;
-}
-
-gboolean QVideoSurfaceGstSink::stop(GstBaseSink *base)
-{
- Q_UNUSED(base);
-
- return TRUE;
-}
-
-gboolean QVideoSurfaceGstSink::unlock(GstBaseSink *base)
-{
- Q_UNUSED(base);
-
- return TRUE;
-}
-
-gboolean QVideoSurfaceGstSink::event(GstBaseSink *base, GstEvent *event)
-{
- Q_UNUSED(base);
- Q_UNUSED(event);
-
- return TRUE;
-}
-
-GstFlowReturn QVideoSurfaceGstSink::preroll(GstBaseSink *base, GstBuffer *buffer)
-{
- VO_SINK(base);
- return sink->delegate->render(buffer);
-}
-
-GstFlowReturn QVideoSurfaceGstSink::render(GstBaseSink *base, GstBuffer *buffer)
-{
- VO_SINK(base);
- return sink->delegate->render(buffer);
-}
-
diff --git a/src/imports/imports.pro b/src/imports/imports.pro
deleted file mode 100644
index 669064b..0000000
--- a/src/imports/imports.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-
-TEMPLATE = subdirs
-
-SUBDIRS += multimedia
-
diff --git a/src/imports/multimedia/multimedia.cpp b/src/imports/multimedia/multimedia.cpp
deleted file mode 100644
index deb47c5..0000000
--- a/src/imports/multimedia/multimedia.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtDeclarative/qdeclarativeextensionplugin.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativeengine.h>
-#include <QtDeclarative/qdeclarativecomponent.h>
-#include "qsoundeffect.h"
-
-#include "qdeclarativemediametadata_p.h"
-#include "qdeclarativeaudio_p.h"
-#include "qdeclarativevideooutput_p.h"
-#include "qdeclarativeradio_p.h"
-#include "qdeclarativeradiodata_p.h"
-#include "qdeclarativebackgroundaudio_p.h"
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecamerapreviewprovider_p.h"
-#include "qdeclarativecameraexposure_p.h"
-#include "qdeclarativecameraflash_p.h"
-#include "qdeclarativecamerafocus_p.h"
-#include "qdeclarativecameraimageprocessing_p.h"
-
-
-QML_DECLARE_TYPE(QSoundEffect)
-
-QT_BEGIN_NAMESPACE
-
-class QMultimediaDeclarativeModule : public QDeclarativeExtensionPlugin
-{
- Q_OBJECT
-public:
- virtual void registerTypes(const char *uri)
- {
- Q_ASSERT(QLatin1String(uri) == QLatin1String("QtMultimedia")
- || QLatin1String(uri) == QLatin1String("Qt.multimediakit"));
-
- qmlRegisterType<QSoundEffect>(uri, 4, 0, "SoundEffect");
- qmlRegisterType<QDeclarativeAudio>(uri, 4, 0, "Audio");
- qmlRegisterType<QDeclarativeAudio>(uri, 4, 0, "MediaPlayer");
- qmlRegisterType<QDeclarativeVideoOutput>(uri, 4, 0, "VideoOutput");
- qmlRegisterType<QDeclarativeRadio>(uri, 4, 0, "Radio");
- qmlRegisterType<QDeclarativeRadioData>(uri, 4, 0, "RadioData");
- qmlRegisterType<QDeclarativeBackgroundAudio>(uri, 4, 0, "BackgroundAudio");
- qmlRegisterType<QDeclarativeCamera>(uri, 4, 0, "Camera");
- qmlRegisterUncreatableType<QDeclarativeCameraCapture>(uri, 4, 0, "CameraCapture",
- trUtf8("CameraCapture is only provided by Camera element"));
- qmlRegisterUncreatableType<QDeclarativeCameraRecorder>(uri, 4, 0, "CameraRecorder",
- trUtf8("CameraRecorder is only provided by Camera element"));
- qmlRegisterUncreatableType<QDeclarativeCameraExposure>(uri, 4, 0, "CameraExposure",
- trUtf8("CameraExposure is only provided by Camera element"));
- qmlRegisterUncreatableType<QDeclarativeCameraFocus>(uri, 4, 0, "CameraFocus",
- trUtf8("CameraFocus is only provided by Camera element"));
- qmlRegisterUncreatableType<QDeclarativeCameraImageProcessing>(uri, 4, 0, "CameraImageProcessing",
- trUtf8("CameraImageProcessing is only provided by Camera element"));
- qmlRegisterType<QDeclarativeMediaMetaData>();
- }
-
- void initializeEngine(QDeclarativeEngine *engine, const char *uri)
- {
- Q_UNUSED(uri);
- engine->addImageProvider("camera", new QDeclarativeCameraPreviewProvider);
- }
-};
-
-QT_END_NAMESPACE
-
-#include "multimedia.moc"
-
-Q_EXPORT_PLUGIN2(qmultimediadeclarativemodule, QT_PREPEND_NAMESPACE(QMultimediaDeclarativeModule));
-
diff --git a/src/imports/multimedia/multimedia.pro b/src/imports/multimedia/multimedia.pro
deleted file mode 100644
index d5b6ae5..0000000
--- a/src/imports/multimedia/multimedia.pro
+++ /dev/null
@@ -1,76 +0,0 @@
-TARGET = declarative_multimedia
-TARGETPATH = QtMultimedia
-
-include(../qimportbase.pri)
-
-QT += declarative network multimedia-private
-
-DESTDIR = $$QT.multimedia.imports/$$TARGETPATH
-target.path = $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-
-HEADERS += \
- qdeclarativeaudio_p.h \
- qdeclarativemediabase_p.h \
- qdeclarativemediametadata_p.h \
- qdeclarativevideooutput_p.h \
- qsgvideonode_p.h \
- qsgvideonode_i420.h \
- qsgvideonode_rgb.h \
- qdeclarativeradio_p.h \
- qdeclarativeradiodata_p.h \
- qdeclarativebackgroundaudio_p.h \
- qdeclarativecamera_p.h \
- qdeclarativecameracapture_p.h \
- qdeclarativecamerarecorder_p.h \
- qdeclarativecameraexposure_p.h \
- qdeclarativecameraflash_p.h \
- qdeclarativecamerafocus_p.h \
- qdeclarativecameraimageprocessing_p.h \
- qdeclarativecamerapreviewprovider_p.h
-
-SOURCES += \
- multimedia.cpp \
- qdeclarativeaudio.cpp \
- qdeclarativemediabase.cpp \
- qdeclarativevideooutput.cpp \
- qsgvideonode.cpp \
- qsgvideonode_i420.cpp \
- qsgvideonode_rgb.cpp \
- qdeclarativeradio.cpp \
- qdeclarativeradiodata.cpp \
- qdeclarativebackgroundaudio.cpp \
- qdeclarativecamera.cpp \
- qdeclarativecameracapture.cpp \
- qdeclarativecamerarecorder.cpp \
- qdeclarativecameraexposure.cpp \
- qdeclarativecameraflash.cpp \
- qdeclarativecamerafocus.cpp \
- qdeclarativecameraimageprocessing.cpp \
- qdeclarativecamerapreviewprovider.cpp
-
-disabled {
- HEADERS += \
- qdeclarativevideo_p.h \
-
-
- SOURCES += \
- qdeclarativevideo.cpp \
-
-}
-
-qmldir.files += $$PWD/qmldir
-qmldir.path += $$[QT_INSTALL_IMPORTS]/$$TARGETPATH
-
-# another copy of the qmldir file so the old import works
-OLDQMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir.qtmultimediakit
-oldcopy2build.input = OLDQMLDIRFILE
-oldcopy2build.output = $$QT.multimedia.imports/Qt/multimediakit/qmldir
-!contains(TEMPLATE_PREFIX, vc):oldcopy2build.variable_out = PRE_TARGETDEPS
-oldcopy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
-oldcopy2build.name = COPY ${QMAKE_FILE_IN}
-oldcopy2build.CONFIG += no_link
-# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir
-oldcopy2build.CONFIG += no_clean
-QMAKE_EXTRA_COMPILERS += oldcopy2build
-
-INSTALLS += target qmldir
diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp
deleted file mode 100644
index c12ef22..0000000
--- a/src/imports/multimedia/qdeclarativeaudio.cpp
+++ /dev/null
@@ -1,699 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeaudio_p.h"
-
-#include <qmediaplayercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \qmlclass Audio QDeclarativeAudio
- \brief The Audio element allows you to add audio playback to a scene.
-
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- \qml
- import Qt 4.7
- import QtMultimedia 4.0
-
- Text {
- text: "Click Me!";
- font.pointSize: 24;
- width: 150; height: 50;
-
- Audio {
- id: playMusic
- source: "music.wav"
- }
- MouseArea {
- id: playArea
- anchors.fill: parent
- onPressed: { playMusic.play() }
- }
- }
- \endqml
-
- \sa Video
-*/
-
-/*!
- \internal
- \class QDeclarativeAudio
- \brief The QDeclarativeAudio class provides an audio item that you can add to a QDeclarativeView.
-*/
-
-void QDeclarativeAudio::_q_error(int errorCode, const QString &errorString)
-{
- m_error = QMediaPlayer::Error(errorCode);
- m_errorString = errorString;
-
- emit error(Error(errorCode), errorString);
- emit errorChanged();
-}
-
-
-QDeclarativeAudio::QDeclarativeAudio(QObject *parent)
- : QObject(parent)
-{
-}
-
-QDeclarativeAudio::~QDeclarativeAudio()
-{
- shutdown();
-}
-
-/*!
- \qmlmethod Audio::play()
-
- Starts playback of the media.
-
- Sets the \l playing property to true, and the \l paused property to false.
-*/
-
-void QDeclarativeAudio::play()
-{
- if (!m_complete)
- return;
-
- setPaused(false);
- setPlaying(true);
-}
-
-/*!
- \qmlmethod Audio::pause()
-
- Pauses playback of the media.
-
- Sets the \l playing and \l paused properties to true.
-*/
-
-void QDeclarativeAudio::pause()
-{
- if (!m_complete)
- return;
-
- setPaused(true);
- setPlaying(true);
-}
-
-/*!
- \qmlmethod Audio::stop()
-
- Stops playback of the media.
-
- Sets the \l playing and \l paused properties to false.
-*/
-
-void QDeclarativeAudio::stop()
-{
- if (!m_complete)
- return;
-
- setPlaying(false);
- setPaused(false);
-}
-
-/*!
- \qmlproperty url Audio::source
-
- This property holds the source URL of the media.
-*/
-
-/*!
- \qmlproperty url Audio::autoLoad
-
- This property indicates if loading of media should begin immediately.
-
- Defaults to true, if false media will not be loaded until playback is started.
-*/
-
-/*!
- \qmlproperty bool Audio::playing
-
- This property holds whether the media is playing.
-
- Defaults to false, and can be set to true to start playback.
-*/
-
-/*!
- \qmlproperty bool Audio::paused
-
- This property holds whether the media is paused.
-
- Defaults to false, and can be set to true to pause playback.
-*/
-
-/*!
- \qmlsignal Audio::onStarted()
-
- This handler is called when playback is started.
-*/
-
-/*!
- \qmlsignal Audio::onResumed()
-
- This handler is called when playback is resumed from the paused state.
-*/
-
-/*!
- \qmlsignal Audio::onPaused()
-
- This handler is called when playback is paused.
-*/
-
-/*!
- \qmlsignal Audio::onStopped()
-
- This handler is called when playback is stopped.
-*/
-
-/*!
- \qmlproperty enumeration Audio::status
-
- This property holds the status of media loading. It can be one of:
-
- \list
- \o NoMedia - no media has been set.
- \o Loading - the media is currently being loaded.
- \o Loaded - the media has been loaded.
- \o Buffering - the media is buffering data.
- \o Stalled - playback has been interrupted while the media is buffering data.
- \o Buffered - the media has buffered data.
- \o EndOfMedia - the media has played to the end.
- \o InvalidMedia - the media cannot be played.
- \o UnknownStatus - the status of the media is unknown.
- \endlist
-*/
-
-QDeclarativeAudio::Status QDeclarativeAudio::status() const
-{
- return Status(m_status);
-}
-
-/*!
- \qmlproperty int Audio::duration
-
- This property holds the duration of the media in milliseconds.
-
- If the media doesn't have a fixed duration (a live stream for example) this will be 0.
-*/
-
-/*!
- \qmlproperty int Audio::position
-
- This property holds the current playback position in milliseconds.
-
- If the \l seekable property is true, this property can be set to seek to a new position.
-*/
-
-/*!
- \qmlproperty real Audio::volume
-
- This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
-*/
-
-/*!
- \qmlproperty bool Audio::muted
-
- This property holds whether the audio output is muted.
-*/
-
-/*!
- \qmlproperty real Audio::bufferProgress
-
- This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
- (full).
-*/
-
-/*!
- \qmlproperty bool Audio::seekable
-
- This property holds whether position of the audio can be changed.
-
- If true; setting a \l position value will cause playback to seek to the new position.
-*/
-
-/*!
- \qmlproperty real Audio::playbackRate
-
- This property holds the rate at which audio is played at as a multiple of the normal rate.
-*/
-
-/*!
- \qmlproperty enumeration Audio::error
-
- This property holds the error state of the audio. It can be one of:
-
- \list
- \o NoError - there is no current error.
- \o ResourceError - the audio cannot be played due to a problem allocating resources.
- \o FormatError - the audio format is not supported.
- \o NetworkError - the audio cannot be played due to network issues.
- \o AccessDenied - the audio cannot be played due to insufficient permissions.
- \o ServiceMissing - the audio cannot be played because the media service could not be
- instantiated.
- \endlist
-*/
-
-QDeclarativeAudio::Error QDeclarativeAudio::error() const
-{
- return Error(m_error);
-}
-
-void QDeclarativeAudio::classBegin()
-{
- setObject(this);
- emit mediaObjectChanged();
-}
-
-void QDeclarativeAudio::componentComplete()
-{
- QDeclarativeMediaBase::componentComplete();
-}
-
-
-/*!
- \qmlproperty string Audio::errorString
-
- This property holds a string describing the current error condition in more detail.
-*/
-
-/*!
- \qmlsignal Audio::onError(error, errorString)
-
- This handler is called when an \l {QMediaPlayer::Error}{error} has
- occurred. The errorString parameter may contain more detailed
- information about the error.
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.title
-
- This property holds the tile of the media.
-
- \sa {QtMultimedia::Title}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.subTitle
-
- This property holds the sub-title of the media.
-
- \sa {QtMultimedia::SubTitle}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.author
-
- This property holds the author of the media.
-
- \sa {QtMultimedia::Author}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.comment
-
- This property holds a user comment about the media.
-
- \sa {QtMultimedia::Comment}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.description
-
- This property holds a description of the media.
-
- \sa {QtMultimedia::Description}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.category
-
- This property holds the category of the media
-
- \sa {QtMultimedia::Category}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.genre
-
- This property holds the genre of the media.
-
- \sa {QtMultimedia::Genre}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.year
-
- This property holds the year of release of the media.
-
- \sa {QtMultimedia::Year}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.date
-
- This property holds the date of the media.
-
- \sa {QtMultimedia::Date}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.userRating
-
- This property holds a user rating of the media in the range of 0 to 100.
-
- \sa {QtMultimedia::UserRating}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.keywords
-
- This property holds a list of keywords describing the media.
-
- \sa {QtMultimedia::Keywords}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.language
-
- This property holds the language of the media, as an ISO 639-2 code.
-
- \sa {QtMultimedia::Language}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.publisher
-
- This property holds the publisher of the media.
-
- \sa {QtMultimedia::Publisher}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.copyright
-
- This property holds the media's copyright notice.
-
- \sa {QtMultimedia::Copyright}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.parentalRating
-
- This property holds the parental rating of the media.
-
- \sa {QtMultimedia::ParentalRating}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.ratingOrganisation
-
- This property holds the name of the rating organisation responsible for the
- parental rating of the media.
-
- \sa {QtMultimedia::RatingOrganisation}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.size
-
- This property property holds the size of the media in bytes.
-
- \sa {QtMultimedia::Size}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.mediaType
-
- This property holds the type of the media.
-
- \sa {QtMultimedia::MediaType}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.audioBitRate
-
- This property holds the bit rate of the media's audio stream ni bits per
- second.
-
- \sa {QtMultimedia::AudioBitRate}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.audioCodec
-
- This property holds the encoding of the media audio stream.
-
- \sa {QtMultimedia::AudioCodec}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.averageLevel
-
- This property holds the average volume level of the media.
-
- \sa {QtMultimedia::AverageLevel}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.channelCount
-
- This property holds the number of channels in the media's audio stream.
-
- \sa {QtMultimedia::ChannelCount}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.peakValue
-
- This property holds the peak volume of media's audio stream.
-
- \sa {QtMultimedia::PeakValue}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.sampleRate
-
- This property holds the sample rate of the media's audio stream in hertz.
-
- \sa {QtMultimedia::SampleRate}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.albumTitle
-
- This property holds the title of the album the media belongs to.
-
- \sa {QtMultimedia::AlbumTitle}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.albumArtist
-
- This property holds the name of the principal artist of the album the media
- belongs to.
-
- \sa {QtMultimedia::AlbumArtist}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.contributingArtist
-
- This property holds the names of artists contributing to the media.
-
- \sa {QtMultimedia::ContributingArtist}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.composer
-
- This property holds the composer of the media.
-
- \sa {QtMultimedia::Composer}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.conductor
-
- This property holds the conductor of the media.
-
- \sa {QtMultimedia::Conductor}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.lyrics
-
- This property holds the lyrics to the media.
-
- \sa {QtMultimedia::Lyrics}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.mood
-
- This property holds the mood of the media.
-
- \sa {QtMultimedia::Mood}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.trackNumber
-
- This property holds the track number of the media.
-
- \sa {QtMultimedia::TrackNumber}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.trackCount
-
- This property holds the number of track on the album containing the media.
-
- \sa {QtMultimedia::TrackNumber}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.coverArtUrlSmall
-
- This property holds the URL of a small cover art image.
-
- \sa {QtMultimedia::CoverArtUrlSmall}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.coverArtUrlLarge
-
- This property holds the URL of a large cover art image.
-
- \sa {QtMultimedia::CoverArtUrlLarge}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.resolution
-
- This property holds the dimension of an image or video.
-
- \sa {QtMultimedia::Resolution}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.pixelAspectRatio
-
- This property holds the pixel aspect ratio of an image or video.
-
- \sa {QtMultimedia::PixelAspectRatio}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.videoFrameRate
-
- This property holds the frame rate of the media's video stream.
-
- \sa {QtMultimedia::VideoFrameRate}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.videoBitRate
-
- This property holds the bit rate of the media's video stream in bits per
- second.
-
- \sa {QtMultimedia::VideoBitRate}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.videoCodec
-
- This property holds the encoding of the media's video stream.
-
- \sa {QtMultimedia::VideoCodec}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.posterUrl
-
- This property holds the URL of a poster image.
-
- \sa {QtMultimedia::PosterUrl}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.chapterNumber
-
- This property holds the chapter number of the media.
-
- \sa {QtMultimedia::ChapterNumber}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.director
-
- This property holds the director of the media.
-
- \sa {QtMultimedia::Director}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.leadPerformer
-
- This property holds the lead performer in the media.
-
- \sa {QtMultimedia::LeadPerformer}
-*/
-
-/*!
- \qmlproperty variant Audio::metaData.writer
-
- This property holds the writer of the media.
-
- \sa {QtMultimedia::Writer}
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativeaudio_p.cpp"
-
-
diff --git a/src/imports/multimedia/qdeclarativeaudio_p.h b/src/imports/multimedia/qdeclarativeaudio_p.h
deleted file mode 100644
index 7c50bf9..0000000
--- a/src/imports/multimedia/qdeclarativeaudio_p.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEAUDIO_P_H
-#define QDECLARATIVEAUDIO_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbasictimer.h>
-#include <QtDeclarative/qdeclarativeparserstatus.h>
-#include <QtDeclarative/qdeclarative.h>
-
-#include "qdeclarativemediabase_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QTimerEvent;
-
-class QDeclarativeAudio : public QObject, public QDeclarativeMediaBase, public QDeclarativeParserStatus
-{
- Q_OBJECT
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(bool autoLoad READ isAutoLoad WRITE setAutoLoad NOTIFY autoLoadChanged)
- Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged)
- Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
- Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged)
- Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged)
- Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
- Q_PROPERTY(Error error READ error NOTIFY errorChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
- Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT)
- Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false)
- Q_ENUMS(Status)
- Q_ENUMS(Error)
- Q_ENUMS(Loop)
- Q_INTERFACES(QDeclarativeParserStatus)
-public:
- enum Status
- {
- UnknownStatus = QMediaPlayer::UnknownMediaStatus,
- NoMedia = QMediaPlayer::NoMedia,
- Loading = QMediaPlayer::LoadingMedia,
- Loaded = QMediaPlayer::LoadedMedia,
- Stalled = QMediaPlayer::StalledMedia,
- Buffering = QMediaPlayer::BufferingMedia,
- Buffered = QMediaPlayer::BufferedMedia,
- EndOfMedia = QMediaPlayer::EndOfMedia,
- InvalidMedia = QMediaPlayer::InvalidMedia
- };
-
- enum Error
- {
- NoError = QMediaPlayer::NoError,
- ResourceError = QMediaPlayer::ResourceError,
- FormatError = QMediaPlayer::FormatError,
- NetworkError = QMediaPlayer::NetworkError,
- AccessDenied = QMediaPlayer::AccessDeniedError,
- ServiceMissing = QMediaPlayer::ServiceMissingError
- };
-
- enum Loop
- {
- Infinite = QDeclarativeMediaBase::INFINITE
- };
-
- QDeclarativeAudio(QObject *parent = 0);
- ~QDeclarativeAudio();
-
- Status status() const;
- Error error() const;
-
- void classBegin();
- void componentComplete();
-
- QObject *mediaObject() { return m_mediaObject; }
-
-public Q_SLOTS:
- void play();
- void pause();
- void stop();
-
-Q_SIGNALS:
- void sourceChanged();
- void autoLoadChanged();
- void playingChanged();
- void pausedChanged();
- void loopCountChanged();
-
- void started();
- void resumed();
- void paused();
- void stopped();
-
- void statusChanged();
-
- void durationChanged();
- void positionChanged();
-
- void volumeChanged();
- void mutedChanged();
-
- void bufferProgressChanged();
-
- void seekableChanged();
- void playbackRateChanged();
-
- void errorChanged();
- void error(QDeclarativeAudio::Error error, const QString &errorString);
-
- void mediaObjectChanged();
-
-private Q_SLOTS:
- void _q_error(int, const QString &);
-
-private:
- Q_DISABLE_COPY(QDeclarativeAudio)
- Q_PRIVATE_SLOT(mediaBase(), void _q_statusChanged())
-
- inline QDeclarativeMediaBase *mediaBase() { return this; }
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeAudio))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativebackgroundaudio.cpp b/src/imports/multimedia/qdeclarativebackgroundaudio.cpp
deleted file mode 100644
index cd163d8..0000000
--- a/src/imports/multimedia/qdeclarativebackgroundaudio.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qdeclarativebackgroundaudio_p.h"
-#include <qmediabackgroundplaybackcontrol.h>
-#include <qmediaservice.h>
-
-void QDeclarativeBackgroundAudio::classBegin()
-{
- setObject(this, Q_MEDIASERVICE_BACKGROUNDMEDIAPLAYER);
- if (m_mediaService) {
- m_backgroundPlaybackControl =
- static_cast<QMediaBackgroundPlaybackControl*>(
- m_mediaService->requestControl(QMediaBackgroundPlaybackControl_iid));
- if (m_backgroundPlaybackControl) {
- connect(m_backgroundPlaybackControl, SIGNAL(acquired()), this, SIGNAL(acquiredChanged()));
- connect(m_backgroundPlaybackControl, SIGNAL(lost()), this, SIGNAL(acquiredChanged()));
- } else {
- qWarning("can not get QMediaBackgroundPlaybackControl!");
- }
- } else {
- qWarning("Unable to get any background mediaplayer!");
- }
- emit mediaObjectChanged();
-
- //Note: we are not calling QDeclarativeAudio::classBegin here,
- //otherwise there will be conflict for setObject().
-}
-
-void QDeclarativeBackgroundAudio::componentComplete()
-{
- QDeclarativeAudio::componentComplete();
-}
-
-QDeclarativeBackgroundAudio::QDeclarativeBackgroundAudio(QObject *parent)
- : QDeclarativeAudio(parent)
- , m_backgroundPlaybackControl(0)
-{
-
-}
-
-QDeclarativeBackgroundAudio::~QDeclarativeBackgroundAudio()
-{
- if (m_backgroundPlaybackControl)
- m_mediaService->releaseControl(m_backgroundPlaybackControl);
-}
-
-/*!
- \qmlproperty string BackgroundAudio::contextId
-
- This property holds the unique contextId for the application
-
- When a new contextId is set, the previously set contextId will be released automatically.
-*/
-QString QDeclarativeBackgroundAudio::contextId() const
-{
- return m_contextId;
-}
-
-void QDeclarativeBackgroundAudio::setContextId(QString contextId)
-{
- if (m_contextId == contextId)
- return;
- m_contextId = contextId;
- if (m_backgroundPlaybackControl)
- m_backgroundPlaybackControl->setContextId(m_contextId);
- emit contextIdChanged();
-}
-
-/*!
- \qmlproperty bool BackgroundAudio::acquired
-
- This property indicates whether the application holds the playback resource in music daemon
-*/
-bool QDeclarativeBackgroundAudio::isAcquired() const
-{
- if (!m_backgroundPlaybackControl)
- return false;
- return m_backgroundPlaybackControl->isAcquired();
-}
-
-/*!
- \qmlmethod BackgroundAudio::acquire()
-
- try to acquire the playback resource in music daemon
-*/
-void QDeclarativeBackgroundAudio::acquire()
-{
- if (isAcquired() || !m_backgroundPlaybackControl)
- return;
- m_backgroundPlaybackControl->acquire();
-}
-
-/*!
- \qmlmethod BackgroundAudio::acquire()
-
- try to release the playback resource in music daemon
-*/
-void QDeclarativeBackgroundAudio::release()
-{
- if (!isAcquired() || !m_backgroundPlaybackControl)
- return;
- m_backgroundPlaybackControl->release();
-}
diff --git a/src/imports/multimedia/qdeclarativebackgroundaudio_p.h b/src/imports/multimedia/qdeclarativebackgroundaudio_p.h
deleted file mode 100644
index f7f6778..0000000
--- a/src/imports/multimedia/qdeclarativebackgroundaudio_p.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#ifndef QDECLARATIVEBACKGROUNDAUDIO_P_H
-#define QDECLARATIVEBACKGROUNDAUDIO_P_H
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qdeclarativeaudio_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QMediaBackgroundPlaybackControl;
-class QDeclarativeBackgroundAudio : public QDeclarativeAudio
-{
- Q_OBJECT
- Q_PROPERTY(QString contextId READ contextId WRITE setContextId NOTIFY contextIdChanged)
- Q_PROPERTY(bool acquired READ isAcquired NOTIFY acquiredChanged)
-public:
- QDeclarativeBackgroundAudio(QObject *parent = 0);
- ~QDeclarativeBackgroundAudio();
-
- void classBegin();
- void componentComplete();
-
- QString contextId() const;
- void setContextId(QString contextId);
- bool isAcquired() const;
-
-public Q_SLOTS:
- void acquire();
- void release();
-
-Q_SIGNALS:
- void contextIdChanged();
- void acquiredChanged();
-
-private:
- Q_DISABLE_COPY(QDeclarativeBackgroundAudio)
- QString m_contextId;
- QMediaBackgroundPlaybackControl *m_backgroundPlaybackControl;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeBackgroundAudio))
-
-QT_END_HEADER
-
-#endif // QDECLARATIVEBACKGROUNDAUDIO_P_H
diff --git a/src/imports/multimedia/qdeclarativecamera.cpp b/src/imports/multimedia/qdeclarativecamera.cpp
deleted file mode 100644
index 71b3b06..0000000
--- a/src/imports/multimedia/qdeclarativecamera.cpp
+++ /dev/null
@@ -1,580 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecamerapreviewprovider_p.h"
-
-#include "qdeclarativecameraexposure_p.h"
-#include "qdeclarativecameraflash_p.h"
-#include "qdeclarativecamerafocus_p.h"
-#include "qdeclarativecameraimageprocessing_p.h"
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <qvideorenderercontrol.h>
-#include <QtDeclarative/qdeclarativeinfo.h>
-
-#include <QtCore/QTimer>
-#include <QtGui/qevent.h>
-
-QT_BEGIN_NAMESPACE
-
-void QDeclarativeCamera::_q_error(int errorCode, const QString &errorString)
-{
- emit error(Error(errorCode), errorString);
- emit errorChanged();
-}
-
-void QDeclarativeCamera::_q_updateState(QCamera::State state)
-{
- emit cameraStateChanged(QDeclarativeCamera::State(state));
-}
-
-/*!
- \qmlclass Camera QDeclarativeCamera
- \since 4.7
- \brief The Camera element allows you to add camera viewfinder to a scene.
- \ingroup qml-multimedia
- \inherits Item
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- \qml
- import Qt 4.7
- import QtMultimedia 4.0
-
- Camera {
- id: camera
-
- imageProcessing.whiteBalanceMode: CameraImageProcessing.WhiteBalanceFlash
-
- exposure {
- exposureCompensation: -1.0
- exposureMode: Camera.ExposurePortrait
- }
-
- flash.mode: Camera.FlashRedEyeReduction
-
- onImageCaptured : {
- photoPreview.source = preview // Show the preview in an Image element
- }
- }
-
- VideoOutput {
- source: camera
- focus : visible // to receive focus and capture key events when visible
- }
-
- Image {
- id: photoPreview
- }
- \endqml
-
- You can use the \c Camera element to capture images from a camera, and manipulate the capture and
- processing settings that get applied to the image.
-*/
-
-/*!
- \class QDeclarativeCamera
- \brief The QDeclarativeCamera class provides a camera item that you can add to a QDeclarativeView.
-*/
-
-/*!
- Construct a declarative camera object using \a parent object.
- */
-QDeclarativeCamera::QDeclarativeCamera(QObject *parent) :
- QObject(parent),
- m_camera(0),
- m_pendingState(ActiveState),
- m_componentComplete(false)
-{
- m_camera = new QCamera(this);
-
- m_imageCapture = new QDeclarativeCameraCapture(m_camera, this);
- m_videoRecorder = new QDeclarativeCameraRecorder(m_camera, this);
- m_exposure = new QDeclarativeCameraExposure(m_camera, this);
- m_flash = new QDeclarativeCameraFlash(m_camera, this);
- m_focus = new QDeclarativeCameraFocus(m_camera, this);
- m_imageProcessing = new QDeclarativeCameraImageProcessing(m_camera, this);
-
- connect(m_camera, SIGNAL(captureModeChanged(QCamera::CaptureMode)), this, SIGNAL(captureModeChanged()));
- connect(m_camera, SIGNAL(lockStatusChanged(QCamera::LockStatus,QCamera::LockChangeReason)), this, SIGNAL(lockStatusChanged()));
- connect(m_camera, SIGNAL(stateChanged(QCamera::State)), this, SLOT(_q_updateState(QCamera::State)));
-
- connect(m_camera->focus(), SIGNAL(opticalZoomChanged(qreal)), this, SIGNAL(opticalZoomChanged(qreal)));
- connect(m_camera->focus(), SIGNAL(digitalZoomChanged(qreal)), this, SIGNAL(digitalZoomChanged(qreal)));
- connect(m_camera->focus(), SIGNAL(maximumOpticalZoomChanged(qreal)), this, SIGNAL(maximumOpticalZoomChanged(qreal)));
- connect(m_camera->focus(), SIGNAL(maximumDigitalZoomChanged(qreal)), this, SIGNAL(maximumDigitalZoomChanged(qreal)));
-}
-
-/*! Destructor, clean up memory */
-QDeclarativeCamera::~QDeclarativeCamera()
-{
- m_camera->unload();
-}
-
-void QDeclarativeCamera::classBegin()
-{
-}
-
-void QDeclarativeCamera::componentComplete()
-{
- m_componentComplete = true;
- setCameraState(m_pendingState);
-}
-
-/*!
- Returns any camera error.
- \sa QDeclarativeError::Error
-*/
-QDeclarativeCamera::Error QDeclarativeCamera::error() const
-{
- return QDeclarativeCamera::Error(m_camera->error());
-}
-
-/*!
- \qmlproperty string Camera::errorString
-
- A description of the current error, if any.
-*/
-QString QDeclarativeCamera::errorString() const
-{
- return m_camera->errorString();
-}
-
-QDeclarativeCamera::CaptureMode QDeclarativeCamera::captureMode() const
-{
- return QDeclarativeCamera::CaptureMode(m_camera->captureMode());
-}
-
-void QDeclarativeCamera::setCaptureMode(QDeclarativeCamera::CaptureMode mode)
-{
- m_camera->setCaptureMode(QCamera::CaptureMode(mode));
-}
-
-
-/*!
- \qmlproperty enumeration Camera::cameraState
-
- The current state of the camera object.
-
- \table
- \header \o Value \o Description
- \row \o UnloadedState
- \o The initial camera state, with camera not loaded,
- the camera capabilities except of supported capture modes
- are unknown.
- While the supported settings are unknown in this state,
- it's allowed to set the camera capture settings like codec,
- resolution, or frame rate.
-
- \row \o LoadedState
- \o The camera is loaded and ready to be configured.
-
- In the Idle state it's allowed to query camera capabilities,
- set capture resolution, codecs, etc.
-
- The viewfinder is not active in the loaded state.
-
- \row \o ActiveState
- \o In the active state as soon as camera is started
- the viewfinder displays video frames and the
- camera is ready for capture.
- \endtable
-
- The default camera state is ActiveState.
-*/
-/*!
- \enum QDeclarativeCamera::State
- \value UnloadedState
- The initial camera state, with camera not loaded,
- the camera capabilities except of supported capture modes
- are unknown.
- While the supported settings are unknown in this state,
- it's allowed to set the camera capture settings like codec,
- resolution, or frame rate.
-
- \value LoadedState
- The camera is loaded and ready to be configured.
- In the Idle state it's allowed to query camera capabilities,
- set capture resolution, codecs, etc.
- The viewfinder is not active in the loaded state.
-
- \value ActiveState
- In the active state as soon as camera is started
- the viewfinder displays video frames and the
- camera is ready for capture.
-*/
-
-QDeclarativeCamera::State QDeclarativeCamera::cameraState() const
-{
- return m_componentComplete ? QDeclarativeCamera::State(m_camera->state()) : m_pendingState;
-}
-
-void QDeclarativeCamera::setCameraState(QDeclarativeCamera::State state)
-{
- if (!m_componentComplete) {
- m_pendingState = state;
- return;
- }
-
- switch (state) {
- case QDeclarativeCamera::ActiveState:
- m_camera->start();
- break;
- case QDeclarativeCamera::UnloadedState:
- m_camera->unload();
- break;
- case QDeclarativeCamera::LoadedState:
- m_camera->load();
- break;
- }
-}
-
-/*!
- \qmlmethod Camera::start()
- \fn QDeclarativeCamera::start()
-
- Starts the camera.
-*/
-void QDeclarativeCamera::start()
-{
- setCameraState(QDeclarativeCamera::ActiveState);
-}
-
-/*!
- \qmlmethod Camera::stop()
- \fn QDeclarativeCamera::stop()
-
- Stops the camera.
-*/
-void QDeclarativeCamera::stop()
-{
- setCameraState(QDeclarativeCamera::LoadedState);
-}
-
-
-/*!
- \qmlproperty enumeration Camera::lockStatus
-
- The overall status for all the requested camera locks.
-
- \table
- \header \o Value \o Description
- \row \o Unlocked
- \o The application is not interested in camera settings value.
- The camera may keep this parameter without changes, this is common with camera focus,
- or adjust exposure and white balance constantly to keep the viewfinder image nice.
-
- \row \o Searching
- \o The application has requested the camera focus, exposure or white balance lock with
- searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
-
- \row \o Locked
- \o The camera focus, exposure or white balance is locked.
- The camera is ready to capture, application may check the exposure parameters.
-
- The locked state usually means the requested parameter stays the same,
- except in the cases when the parameter is requested to be constantly updated.
- For example in continuous focusing mode, the focus is considered locked as long
- and the object is in focus, even while the actual focusing distance may be constantly changing.
- \endtable
-*/
-/*!
- \property QDeclarativeCamera::lockStatus
-
- The overall status for all the requested camera locks.
-
- \table
- \header \o Value \o Description
- \row \o Unlocked
- \o The application is not interested in camera settings value.
- The camera may keep this parameter without changes, this is common with camera focus,
- or adjust exposure and white balance constantly to keep the viewfinder image nice.
-
- \row \o Searching
- \o The application has requested the camera focus, exposure or white balance lock with
- searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
-
- \row \o Locked
- \o The camera focus, exposure or white balance is locked.
- The camera is ready to capture, application may check the exposure parameters.
-
- The locked state usually means the requested parameter stays the same,
- except in the cases when the parameter is requested to be constantly updated.
- For example in continuous focusing mode, the focus is considered locked as long
- and the object is in focus, even while the actual focusing distance may be constantly changing.
- \endtable
-*/
-/*!
- \enum QDeclarativeCamera::LockStatus
- \value Unlocked
- The application is not interested in camera settings value.
- The camera may keep this parameter without changes, this is common with camera focus,
- or adjust exposure and white balance constantly to keep the viewfinder image nice.
-
- \value Searching
- The application has requested the camera focus, exposure or white balance lock with
- searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
-
- \value Locked
- The camera focus, exposure or white balance is locked.
- The camera is ready to capture, application may check the exposure parameters.
-
- The locked state usually means the requested parameter stays the same,
- except in the cases when the parameter is requested to be constantly updated.
- For example in continuous focusing mode, the focus is considered locked as long
- and the object is in focus, even while the actual focusing distance may be constantly changing.
-*/
-QDeclarativeCamera::LockStatus QDeclarativeCamera::lockStatus() const
-{
- return QDeclarativeCamera::LockStatus(m_camera->lockStatus());
-}
-
-/*!
- \qmlmethod Camera::searchAndLock()
- \fn QDeclarativeCamera::searchAndLock()
-
- Start focusing, exposure and white balance calculation.
- If the camera has keyboard focus, searchAndLock() is called
- automatically when the camera focus button is pressed.
-*/
-void QDeclarativeCamera::searchAndLock()
-{
- m_camera->searchAndLock();
-}
-
-/*!
- \qmlmethod Camera::unlock()
- \fn QDeclarativeCamera::unlock()
-
- Unlock focus.
-
- If the camera has keyboard focus, unlock() is called automatically
- when the camera focus button is released.
- */
-void QDeclarativeCamera::unlock()
-{
- m_camera->unlock();
-}
-
-/*!
- \qmlproperty real Camera::maximumOpticalZoom
- \property QDeclarativeCamera::maximumOpticalZoom
-
- The maximum optical zoom factor, or 1.0 if optical zoom is not supported.
-*/
-qreal QDeclarativeCamera::maximumOpticalZoom() const
-{
- return m_camera->focus()->maximumOpticalZoom();
-}
-
-/*!
- \qmlproperty real Camera::maximumDigitalZoom
- \property QDeclarativeCamera::maximumDigitalZoom
-
- The maximum digital zoom factor, or 1.0 if digital zoom is not supported.
-*/
-qreal QDeclarativeCamera::maximumDigitalZoom() const
-{
- return m_camera->focus()->maximumDigitalZoom();
-}
-
-/*!
- \qmlproperty real Camera::opticalZoom
- \property QDeclarativeCamera::opticalZoom
-
- The current optical zoom factor.
-*/
-qreal QDeclarativeCamera::opticalZoom() const
-{
- return m_camera->focus()->opticalZoom();
-}
-
-void QDeclarativeCamera::setOpticalZoom(qreal value)
-{
- m_camera->focus()->zoomTo(value, digitalZoom());
-}
-
-/*!
- \qmlproperty real Camera::digitalZoom
- \property QDeclarativeCamera::digitalZoom
-
- The current digital zoom factor.
-*/
-qreal QDeclarativeCamera::digitalZoom() const
-{
- return m_camera->focus()->digitalZoom();
-}
-
-void QDeclarativeCamera::setDigitalZoom(qreal value)
-{
- m_camera->focus()->zoomTo(opticalZoom(), value);
-}
-
-
-/*!
- \qmlsignal Camera::onError(error, errorString)
-
-
- This handler is called when an error occurs. The enumeration value \a error is one of the
- values defined below, and a descriptive string value is available in \a errorString.
-
- \table
- \header \o Value \o Description
- \row \o NoError \o No errors have occurred.
- \row \o CameraError \o An error has occurred.
- \row \o InvalidRequestError \o System resource doesn't support requested functionality.
- \row \o ServiceMissingError \o No camera service available.
- \row \o NotSupportedFeatureError \o The feature is not supported.
- \endtable
-*/
-
-/*!
- \fn void QDeclarativeCamera::lockStatusChanged()
-
- \qmlsignal Camera::lockStatusChanged()
-*/
-
-/*!
- \fn void QDeclarativeCamera::stateChanged(QDeclarativeCamera::State)
-
- \qmlsignal Camera::stateChanged(Camera::State)
-*/
-
-/*!
- \fn void QDeclarativeCamera::imageCaptured(const QString &)
-
- \qmlsignal Camera::imageCaptured(string)
-*/
-
-/*!
- \fn void QDeclarativeCamera::imageSaved(const QString &)
-
- \qmlsignal Camera::imageSaved(string)
-*/
-
-/*!
- \fn void QDeclarativeCamera::error(QDeclarativeCamera::Error , const QString &)
-
- \qmlsignal Camera::error(Camera::Error, string)
-*/
-
-/*!
- \fn void QDeclarativeCamera::errorChanged()
-
-*/
-/*!
- \qmlsignal Camera::errorChanged()
-*/
-
-/*!
- \fn void QDeclarativeCamera::isoSensitivityChanged(int)
-*/
-/*!
- \qmlsignal Camera::isoSensitivityChanged(int)
-*/
-
-/*!
- \fn void QDeclarativeCamera::apertureChanged(qreal)
-
- \qmlsignal Camera::apertureChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera::shutterSpeedChanged(qreal)
-
-*/
-/*!
- \qmlsignal Camera::shutterSpeedChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera::exposureCompensationChanged(qreal)
-
-*/
-/*!
- \qmlsignal Camera::exposureCompensationChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera:opticalZoomChanged(qreal zoom)
-
- Optical zoom changed to \a zoom.
-*/
-/*!
- \qmlsignal Camera::opticalZoomChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera::digitalZoomChanged(qreal)
-
- \qmlsignal Camera::digitalZoomChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera::maximumOpticalZoomChanged(qreal)
-
- \qmlsignal Camera::maximumOpticalZoomChanged(real)
-*/
-
-/*!
- \fn void QDeclarativeCamera::maximumDigitalZoomChanged(qreal)
-
- \qmlsignal Camera::maximumDigitalZoomChanged(real)
-*/
-
-
-/*!
- \fn void QDeclarativeCamera::captureResolutionChanged(const QSize &)
-
- \qmlsignal Camera::captureResolutionChanged(Item)
-*/
-
-/*!
- \fn QDeclarativeCamera::cameraStateChanged(QDeclarativeCamera::State)
-
-*/
-
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecamera_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecamera_p.h b/src/imports/multimedia/qdeclarativecamera_p.h
deleted file mode 100644
index 7004f7e..0000000
--- a/src/imports/multimedia/qdeclarativecamera_p.h
+++ /dev/null
@@ -1,276 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERA_H
-#define QDECLARATIVECAMERA_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qdeclarativecameracapture_p.h"
-#include "qdeclarativecamerarecorder_p.h"
-
-#include <qcamera.h>
-#include <qcameraimageprocessing.h>
-#include <qcameraimagecapture.h>
-
-#include <QtCore/qbasictimer.h>
-#include <QtCore/qdatetime.h>
-#include <QtDeclarative/qdeclarative.h>
-#include <QtDeclarative/qdeclarativeparserstatus.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCameraExposure;
-class QDeclarativeCameraFocus;
-class QDeclarativeCameraFlash;
-class QDeclarativeCameraImageProcessing;
-
-class QDeclarativeCamera : public QObject, public QDeclarativeParserStatus
-{
- Q_OBJECT
- Q_INTERFACES(QDeclarativeParserStatus)
-
- Q_PROPERTY(CaptureMode captureMode READ captureMode WRITE setCaptureMode NOTIFY captureModeChanged)
- Q_PROPERTY(State cameraState READ cameraState WRITE setCameraState NOTIFY cameraStateChanged)
- Q_PROPERTY(LockStatus lockStatus READ lockStatus NOTIFY lockStatusChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
-
- Q_PROPERTY(qreal opticalZoom READ opticalZoom WRITE setOpticalZoom NOTIFY opticalZoomChanged)
- Q_PROPERTY(qreal maximumOpticalZoom READ maximumOpticalZoom NOTIFY maximumOpticalZoomChanged)
- Q_PROPERTY(qreal digitalZoom READ digitalZoom WRITE setDigitalZoom NOTIFY digitalZoomChanged)
- Q_PROPERTY(qreal maximumDigitalZoom READ maximumDigitalZoom NOTIFY maximumDigitalZoomChanged)
-
- Q_PROPERTY(QObject *mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false)
- Q_PROPERTY(QDeclarativeCameraCapture* imageCapture READ imageCapture CONSTANT)
- Q_PROPERTY(QDeclarativeCameraRecorder* videoRecorder READ videoRecorder CONSTANT)
- Q_PROPERTY(QDeclarativeCameraExposure* exposure READ exposure CONSTANT)
- Q_PROPERTY(QDeclarativeCameraFlash* flash READ flash CONSTANT)
- Q_PROPERTY(QDeclarativeCameraFocus* focus READ focus CONSTANT)
- Q_PROPERTY(QDeclarativeCameraImageProcessing* imageProcessing READ imageProcessing CONSTANT)
-
- Q_ENUMS(CaptureMode)
- Q_ENUMS(State)
- Q_ENUMS(LockStatus)
- Q_ENUMS(Error)
-
- Q_ENUMS(FlashMode)
- Q_ENUMS(ExposureMode)
-
- Q_ENUMS(FocusMode)
- Q_ENUMS(FocusPointMode)
- Q_ENUMS(FocusAreaStatus)
-public:
- enum CaptureMode {
- CaptureStillImage = QCamera::CaptureStillImage,
- CaptureVideo = QCamera::CaptureVideo
- };
-
- enum State
- {
- ActiveState = QCamera::ActiveState,
- LoadedState = QCamera::LoadedState,
- UnloadedState = QCamera::UnloadedState
- };
-
- enum LockStatus
- {
- Unlocked = QCamera::Unlocked,
- Searching = QCamera::Searching,
- Locked = QCamera::Locked
- };
-
- enum Error
- {
- NoError = QCamera::NoError,
- CameraError = QCamera::CameraError,
- InvalidRequestError = QCamera::InvalidRequestError,
- ServiceMissingError = QCamera::ServiceMissingError,
- NotSupportedFeatureError = QCamera::NotSupportedFeatureError
- };
-
- enum FlashMode {
- FlashAuto = QCameraExposure::FlashAuto,
- FlashOff = QCameraExposure::FlashOff,
- FlashOn = QCameraExposure::FlashOn,
- FlashRedEyeReduction = QCameraExposure::FlashRedEyeReduction,
- FlashFill = QCameraExposure::FlashFill,
- FlashTorch = QCameraExposure::FlashTorch,
- FlashSlowSyncFrontCurtain = QCameraExposure::FlashSlowSyncFrontCurtain,
- FlashSlowSyncRearCurtain = QCameraExposure::FlashSlowSyncRearCurtain,
- FlashManual = QCameraExposure::FlashManual
- };
-
- enum ExposureMode {
- ExposureAuto = QCameraExposure::ExposureAuto,
- ExposureManual = QCameraExposure::ExposureManual,
- ExposurePortrait = QCameraExposure::ExposurePortrait,
- ExposureNight = QCameraExposure::ExposureNight,
- ExposureBacklight = QCameraExposure::ExposureBacklight,
- ExposureSpotlight = QCameraExposure::ExposureSpotlight,
- ExposureSports = QCameraExposure::ExposureSports,
- ExposureSnow = QCameraExposure::ExposureSnow,
- ExposureBeach = QCameraExposure::ExposureBeach,
- ExposureLargeAperture = QCameraExposure::ExposureLargeAperture,
- ExposureSmallAperture = QCameraExposure::ExposureSmallAperture,
- ExposureModeVendor = QCameraExposure::ExposureModeVendor
- };
-
- enum FocusMode {
- FocusManual = QCameraFocus::ManualFocus,
- FocusHyperfocal = QCameraFocus::HyperfocalFocus,
- FocusInfinity = QCameraFocus::InfinityFocus,
- FocusAuto = QCameraFocus::AutoFocus,
- FocusContinuous = QCameraFocus::ContinuousFocus,
- FocusMacro = QCameraFocus::MacroFocus
- };
- Q_DECLARE_FLAGS(FocusModes, FocusMode)
-
- enum FocusPointMode {
- FocusPointAuto = QCameraFocus::FocusPointAuto,
- FocusPointCenter = QCameraFocus::FocusPointCenter,
- FocusPointFaceDetection = QCameraFocus::FocusPointFaceDetection,
- FocusPointCustom = QCameraFocus::FocusPointCustom
- };
-
- enum FocusAreaStatus {
- FocusAreaUnused = QCameraFocusZone::Unused,
- FocusAreaSelected = QCameraFocusZone::Selected,
- FocusAreaFocused = QCameraFocusZone::Focused
- };
-
-
- QDeclarativeCamera(QObject *parent = 0);
- ~QDeclarativeCamera();
-
- QObject *mediaObject() { return m_camera; }
-
- QDeclarativeCameraCapture *imageCapture() { return m_imageCapture; }
- QDeclarativeCameraRecorder *videoRecorder() { return m_videoRecorder; }
- QDeclarativeCameraExposure *exposure() { return m_exposure; }
- QDeclarativeCameraFlash *flash() { return m_flash; }
- QDeclarativeCameraFocus *focus() { return m_focus; }
- QDeclarativeCameraImageProcessing *imageProcessing() { return m_imageProcessing; }
-
- CaptureMode captureMode() const;
- State cameraState() const;
-
- Error error() const;
- QString errorString() const;
-
- LockStatus lockStatus() const;
-
- qreal maximumOpticalZoom() const;
- qreal maximumDigitalZoom() const;
-
- qreal opticalZoom() const;
- qreal digitalZoom() const;
-
-public Q_SLOTS:
- void setCaptureMode(CaptureMode mode);
-
- void start();
- void stop();
-
- void setCameraState(State state);
-
- void searchAndLock();
- void unlock();
-
- void setOpticalZoom(qreal);
- void setDigitalZoom(qreal);
-
-Q_SIGNALS:
- void errorChanged();
- void error(QDeclarativeCamera::Error error, const QString &errorString);
-
- void captureModeChanged();
- void cameraStateChanged(QDeclarativeCamera::State);
-
- void lockStatusChanged();
-
- void opticalZoomChanged(qreal);
- void digitalZoomChanged(qreal);
- void maximumOpticalZoomChanged(qreal);
- void maximumDigitalZoomChanged(qreal);
-
- void mediaObjectChanged();
-
-private Q_SLOTS:
- void _q_updateState(QCamera::State);
- void _q_error(int, const QString &);
-
-protected:
- void classBegin();
- void componentComplete();
-
-private:
- Q_DISABLE_COPY(QDeclarativeCamera)
- QCamera *m_camera;
-
- QDeclarativeCameraCapture *m_imageCapture;
- QDeclarativeCameraRecorder *m_videoRecorder;
- QDeclarativeCameraExposure *m_exposure;
- QDeclarativeCameraFlash *m_flash;
- QDeclarativeCameraFocus *m_focus;
- QDeclarativeCameraImageProcessing *m_imageProcessing;
-
- State m_pendingState;
- bool m_componentComplete;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCamera))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameracapture.cpp b/src/imports/multimedia/qdeclarativecameracapture.cpp
deleted file mode 100644
index c3d16bb..0000000
--- a/src/imports/multimedia/qdeclarativecameracapture.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecameracapture_p.h"
-#include "qdeclarativecamerapreviewprovider_p.h"
-
-#include <QtCore/qurl.h>
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeCameraCapture::QDeclarativeCameraCapture(QCamera *camera, QObject *parent) :
- QObject(parent),
- m_camera(camera)
-{
- m_capture = new QCameraImageCapture(camera, this);
-
- connect(m_capture, SIGNAL(readyForCaptureChanged(bool)), this, SIGNAL(readyForCaptureChanged(bool)));
- connect(m_capture, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed()));
- connect(m_capture, SIGNAL(imageCaptured(int,QImage)), this, SLOT(_q_imageCaptured(int, QImage)));
- connect(m_capture, SIGNAL(imageMetadataAvailable(int,QString,QVariant)), this,
- SLOT(_q_imageMetadataAvailable(int,QString,QVariant)));
- connect(m_capture, SIGNAL(imageSaved(int,QString)), this, SLOT(_q_imageSaved(int, QString)));
- connect(m_capture, SIGNAL(error(int,QCameraImageCapture::Error,QString)),
- this, SLOT(_q_captureFailed(int,QCameraImageCapture::Error,QString)));
-}
-
-QDeclarativeCameraCapture::~QDeclarativeCameraCapture()
-{
-}
-
-/*!
- \qmlproperty string CameraCapture::ready
- \property QDeclarativeCameraCapture::ready
-
- Indicates camera is ready to capture photo.
-*/
-bool QDeclarativeCameraCapture::isReadyForCapture() const
-{
- return m_capture->isReadyForCapture();
-}
-
-/*!
- \qmlmethod CameraCapture::capture()
- \fn QDeclarativeCameraCapture::capture()
-
- Start image capture. The \l onImageCaptured() and \l onImageSaved() signals will
- be emitted when the capture is complete.
-*/
-void QDeclarativeCameraCapture::capture()
-{
- m_capture->capture();
-}
-
-/*!
- \qmlmethod CameraCapture::captureToLocation()
- \fn QDeclarativeCameraCapture::captureToLocation()
-
- Start image capture to specified \a location. The \l onImageCaptured() and \l onImageSaved() signals will
- be emitted when the capture is complete.
-*/
-void QDeclarativeCameraCapture::captureToLocation(const QString &location)
-{
- m_capture->capture(location);
-}
-
-/*!
- \qmlmethod CameraCapture::cancelCapture()
- \fn QDeclarativeCameraCapture::cancelCapture()
-
- Cancel pendig image capture requests.
-*/
-
-void QDeclarativeCameraCapture::cancelCapture()
-{
- m_capture->cancelCapture();
-}
-
-/*!
- \qmlproperty string CameraCapture::capturedImagePath
- \property QDeclarativeCameraCapture::capturedImagePath
-
- The path to the captured image.
-*/
-QString QDeclarativeCameraCapture::capturedImagePath() const
-{
- return m_capturedImagePath;
-}
-
-void QDeclarativeCameraCapture::_q_imageCaptured(int id, const QImage &preview)
-{
- QString previewId = QString("preview_%1").arg(id);
- QDeclarativeCameraPreviewProvider::registerPreview(previewId, preview);
-
- emit imageCaptured(QLatin1String("image://camera/")+previewId);
-}
-
-void QDeclarativeCameraCapture::_q_imageSaved(int id, const QString &fileName)
-{
- Q_UNUSED(id);
- m_capturedImagePath = fileName;
- emit imageSaved(fileName);
-}
-
-void QDeclarativeCameraCapture::_q_imageMetadataAvailable(int id, const QString &key, const QVariant &value)
-{
- Q_UNUSED(id);
- emit imageMetadataAvailable(key, value);
-}
-
-
-void QDeclarativeCameraCapture::_q_captureFailed(int id, QCameraImageCapture::Error error, const QString &message)
-{
- Q_UNUSED(id);
- Q_UNUSED(error);
- qWarning() << "QCameraImageCapture error:" << message;
- emit captureFailed(message);
-}
-
-/*!
- \qmlproperty size CameraCapture::resolution
- \property QDeclarativeCameraCapture::resolution
-
- The resolution to capture the image at. If empty, the system will pick
- a good size.
-*/
-
-QSize QDeclarativeCameraCapture::resolution()
-{
- return m_imageSettings.resolution();
-}
-
-void QDeclarativeCameraCapture::setResolution(const QSize &captureResolution)
-{
- if (captureResolution != resolution()) {
- m_imageSettings.setResolution(captureResolution);
- m_capture->setEncodingSettings(m_imageSettings);
- emit resolutionChanged(captureResolution);
- }
-}
-
-QCameraImageCapture::Error QDeclarativeCameraCapture::error() const
-{
- return m_capture->error();
-}
-
-
-/*!
- \qmlproperty size CameraCapture::errorString
- \property QDeclarativeCameraCapture::errorString
-
- The last capture related error message.
-*/
-QString QDeclarativeCameraCapture::errorString() const
-{
- return m_capture->errorString();
-}
-
-void QDeclarativeCameraCapture::setMetadata(const QString &key, const QVariant &value)
-{
- Q_UNUSED(key);
- Q_UNUSED(value);
- //m_capture->setExtendedMetaData(key, value);
-}
-
-/*!
- \qmlsignal CameraCapture::onCaptureFailed(message)
- \fn QDeclarativeCameraCapture::captureFailed(const QString &message)
-
- This handler is called when an error occurs during capture. A descriptive message is available in \a message.
-*/
-
-/*!
- \qmlsignal CameraCapture::onImageCaptured(preview)
- \fn QDeclarativeCameraCapture::imageCaptured(const QString &preview)
-
- This handler is called when an image has been captured but not yet saved to the filesystem. The \a preview
- parameter can be used as the URL supplied to an Image element.
-
- \sa onImageSaved
-*/
-
-/*!
- \qmlsignal CameraCapture::onImageSaved(path)
- \fn QDeclarativeCameraCapture::imageSaved(const QString &path)
-
- This handler is called after the image has been written to the filesystem. The \a path is a local file path, not a URL.
-
- \sa onImageCaptured
-*/
-
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameracapture_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameracapture_p.h b/src/imports/multimedia/qdeclarativecameracapture_p.h
deleted file mode 100644
index 6effa74..0000000
--- a/src/imports/multimedia/qdeclarativecameracapture_p.h
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERACAPTURE_H
-#define QDECLARATIVECAMERACAPTURE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcamera.h>
-#include <qcameraimagecapture.h>
-#include <qmediaencodersettings.h>
-
-#include <QtDeclarative/qdeclarative.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraCapture : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool ready READ isReadyForCapture NOTIFY readyForCaptureChanged)
- Q_PROPERTY(QString capturedImagePath READ capturedImagePath NOTIFY imageSaved)
- Q_PROPERTY(QSize resolution READ resolution WRITE setResolution NOTIFY resolutionChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY captureFailed)
-
-public:
- ~QDeclarativeCameraCapture();
-
- bool isReadyForCapture() const;
-
- QSize resolution();
-
- QString capturedImagePath() const;
- QCameraImageCapture::Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void capture();
- void captureToLocation(const QString &location);
- void cancelCapture();
-
- void setResolution(const QSize &resolution);
- void setMetadata(const QString &key, const QVariant &value);
-
-Q_SIGNALS:
- void readyForCaptureChanged(bool);
-
- void imageExposed();
- void imageCaptured(const QString &preview);
- void imageMetadataAvailable(const QString &key, const QVariant &value);
- void imageSaved(const QString &path);
- void captureFailed(const QString &message);
-
- void resolutionChanged(const QSize &);
-
-private slots:
- void _q_imageCaptured(int, const QImage&);
- void _q_imageSaved(int, const QString&);
- void _q_imageMetadataAvailable(int, const QString &, const QVariant &);
- void _q_captureFailed(int, QCameraImageCapture::Error, const QString&);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraCapture(QCamera *camera, QObject *parent = 0);
-
- QCamera *m_camera;
- QCameraImageCapture *m_capture;
- QImageEncoderSettings m_imageSettings;
- QString m_capturedImagePath;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraCapture))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameraexposure.cpp b/src/imports/multimedia/qdeclarativecameraexposure.cpp
deleted file mode 100644
index 2dc9224..0000000
--- a/src/imports/multimedia/qdeclarativecameraexposure.cpp
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecameraexposure_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass CameraExposure QDeclarativeCameraExposure
- \since 4.0
- \brief The CameraExposure element provides interface for exposure related camera settings.
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- It should not be constructed separately but provided by Camera.exposure.
-
- \qml
- import QtQuick 2.0
- import QtMultimedia 4.0
-
- Camera {
- id: camera
-
- exposure.exposureCompensation: -1.0
- exposure.exposureMode: Camera.ExposurePortrait
- }
-
- \endqml
-*/
-
-/*!
- \class QDeclarativeCameraExposure
- \brief The CameraExposure element provides interface for exposure related camera settings.
-*/
-
-/*!
- Construct a declarative camera exposure object using \a parent object.
- */
-QDeclarativeCameraExposure::QDeclarativeCameraExposure(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_exposure = camera->exposure();
-
- connect(m_exposure, SIGNAL(isoSensitivityChanged(int)), this, SIGNAL(isoSensitivityChanged(int)));
- connect(m_exposure, SIGNAL(apertureChanged(qreal)), this, SIGNAL(apertureChanged(qreal)));
- connect(m_exposure, SIGNAL(shutterSpeedChanged(qreal)), this, SIGNAL(shutterSpeedChanged(qreal)));
-
- connect(m_exposure, SIGNAL(exposureCompensationChanged(qreal)), this, SIGNAL(exposureCompensationChanged(qreal)));
-}
-
-QDeclarativeCameraExposure::~QDeclarativeCameraExposure()
-{
-}
-
-/*!
- \qmlproperty real CameraExposure::exposureCompensation
- \property QDeclarativeCameraExposure::exposureCompensation
-
- Adjustment for the automatically calculated exposure. The value is
- in EV units.
- */
-qreal QDeclarativeCameraExposure::exposureCompensation() const
-{
- return m_exposure->exposureCompensation();
-}
-
-void QDeclarativeCameraExposure::setExposureCompensation(qreal ev)
-{
- m_exposure->setExposureCompensation(ev);
-}
-
-/*!
- \qmlproperty real CameraExposure::isoSensitivity
- \property QDeclarativeCameraExposure::iso
-
- The sensor's ISO sensitivity.
- */
-int QDeclarativeCameraExposure::isoSensitivity() const
-{
- return m_exposure->isoSensitivity();
-}
-
-/*!
- \qmlproperty real CameraExposure::shutterSpeed
- \property QDeclarativeCameraExposure::shutterSpeed
-
- The camera's shutter speed, in seconds.
-*/
-qreal QDeclarativeCameraExposure::shutterSpeed() const
-{
- return m_exposure->shutterSpeed();
-}
-
-/*!
- \qmlproperty real CameraExposure::aperture
- \property QDeclarativeCameraExposure::aperture
-
- The lens aperture as an F number (the ratio of the focal length to effective aperture diameter).
-*/
-qreal QDeclarativeCameraExposure::aperture() const
-{
- return m_exposure->aperture();
-}
-
-int QDeclarativeCameraExposure::manualIsoSensitivity() const
-{
- return m_manualIso;
-}
-
-void QDeclarativeCameraExposure::setManualIsoSensitivity(int iso)
-{
- m_manualIso = iso;
- if (iso > 0)
- m_exposure->setManualIsoSensitivity(iso);
- else
- m_exposure->setAutoIsoSensitivity();
-
- emit manualIsoSensitivityChanged(iso);
-}
-
-qreal QDeclarativeCameraExposure::manualShutterSpeed() const
-{
- return m_manualShutterSpeed;
-}
-
-void QDeclarativeCameraExposure::setManualShutterSpeed(qreal speed)
-{
- m_manualShutterSpeed = speed;
- if (speed > 0)
- m_exposure->setManualShutterSpeed(speed);
- else
- m_exposure->setAutoShutterSpeed();
-
- emit manualShutterSpeedChanged(speed);
-}
-
-qreal QDeclarativeCameraExposure::manualAperture() const
-{
- return m_manualAperture;
-}
-
-void QDeclarativeCameraExposure::setManualAperture(qreal aperture)
-{
- m_manualAperture = aperture;
- if (aperture > 0)
- m_exposure->setManualAperture(aperture);
- else
- m_exposure->setAutoAperture();
-
- emit manualApertureChanged(aperture);
-}
-
-/*!
- Turn on auto aperture. The manual aperture value is reset to -1.0
- */
-void QDeclarativeCameraExposure::setAutoAperture()
-{
- setManualAperture(-1.0);
-}
-
-/*!
- Turn on auto shutter speed. The manual shutter speed value is reset to -1.0
- */
-void QDeclarativeCameraExposure::setAutoShutterSpeed()
-{
- setManualShutterSpeed(-1.0);
-}
-
-/*!
- Turn on auto ISO sensitivity. The manual ISO value is reset to -1.
- */
-void QDeclarativeCameraExposure::setAutoIsoSensitivity()
-{
- setManualIsoSensitivity(-1);
-}
-
-/*!
- \qmlproperty enumeration CameraExposure::exposureMode
- \property QDeclarativeCameraExposure::exposureMode
-
- \table
- \header \o Value \o Description
- \row \o Camera.ExposureManual \o Manual mode.
- \row \o Camera.ExposureAuto \o Automatic mode.
- \row \o Camera.ExposureNight \o Night mode.
- \row \o Camera.ExposureBacklight \o Backlight exposure mode.
- \row \o Camera.ExposureSpotlight \o Spotlight exposure mode.
- \row \o Camera.ExposureSports \o Spots exposure mode.
- \row \o Camera.ExposureSnow \o Snow exposure mode.
- \row \o Camera.ExposureBeach \o Beach exposure mode.
- \row \o Camera.ExposureLargeAperture \o Use larger aperture with small depth of field.
- \row \o Camera.ExposureSmallAperture \o Use smaller aperture.
- \row \o Camera.ExposurePortrait \o Portrait exposure mode.
- \row \o Camera.ExposureModeVendor \o The base value for device specific exposure modes.
- \endtable
-*/
-
-QDeclarativeCamera::ExposureMode QDeclarativeCameraExposure::exposureMode() const
-{
- return QDeclarativeCamera::ExposureMode(m_exposure->exposureMode());
-}
-
-void QDeclarativeCameraExposure::setExposureMode(QDeclarativeCamera::ExposureMode mode)
-{
- if (exposureMode() != mode) {
- m_exposure->setExposureMode(QCameraExposure::ExposureMode(mode));
- emit exposureModeChanged(exposureMode());
- }
-}
-
-/*!
- \qmlsignal CameraExposure::exposureModeChanged(CameraExposure::ExposureMode)
- \fn void QDeclarativeCameraExposure::exposureModeChanged(QDeclarativeCamera::ExposureMode)
-*/
-
-
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraexposure_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraexposure_p.h b/src/imports/multimedia/qdeclarativecameraexposure_p.h
deleted file mode 100644
index 677d963..0000000
--- a/src/imports/multimedia/qdeclarativecameraexposure_p.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERAEXPOSURE_H
-#define QDECLARATIVECAMERAEXPOSURE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qdeclarativecamera_p.h"
-#include <qcamera.h>
-#include <qcameraexposure.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraExposure : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged)
-
- Q_PROPERTY(int iso READ isoSensitivity NOTIFY isoSensitivityChanged)
- Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged)
- Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged)
-
- Q_PROPERTY(qreal manualShutterSpeed READ manualShutterSpeed WRITE setManualShutterSpeed NOTIFY manualShutterSpeedChanged)
- Q_PROPERTY(qreal manualAperture READ manualAperture WRITE setManualAperture NOTIFY manualApertureChanged)
- Q_PROPERTY(qreal manualIso READ manualIsoSensitivity WRITE setManualIsoSensitivity NOTIFY manualIsoSensitivityChanged)
-
- Q_PROPERTY(QDeclarativeCamera::ExposureMode exposureMode READ exposureMode WRITE setExposureMode NOTIFY exposureModeChanged)
-
-public:
- ~QDeclarativeCameraExposure();
-
- QDeclarativeCamera::ExposureMode exposureMode() const;
- qreal exposureCompensation() const;
-
- int isoSensitivity() const;
- qreal shutterSpeed() const;
- qreal aperture() const;
-
- int manualIsoSensitivity() const;
- qreal manualShutterSpeed() const;
- qreal manualAperture() const;
-
-public Q_SLOTS:
- void setExposureMode(QDeclarativeCamera::ExposureMode);
- void setExposureCompensation(qreal ev);
-
- void setManualAperture(qreal);
- void setManualShutterSpeed(qreal);
- void setManualIsoSensitivity(int iso);
-
- void setAutoAperture();
- void setAutoShutterSpeed();
- void setAutoIsoSensitivity();
-
-Q_SIGNALS:
- void isoSensitivityChanged(int);
- void apertureChanged(qreal);
- void shutterSpeedChanged(qreal);
-
- void manualIsoSensitivityChanged(int);
- void manualApertureChanged(qreal);
- void manualShutterSpeedChanged(qreal);
-
- void exposureCompensationChanged(qreal);
- void exposureModeChanged(QDeclarativeCamera::ExposureMode);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraExposure(QCamera *camera, QObject *parent = 0);
-
- QCameraExposure *m_exposure;
- int m_manualIso;
- qreal m_manualAperture;
- qreal m_manualShutterSpeed;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraExposure))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameraflash.cpp b/src/imports/multimedia/qdeclarativecameraflash.cpp
deleted file mode 100644
index 13f21d6..0000000
--- a/src/imports/multimedia/qdeclarativecameraflash.cpp
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecameraflash_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass CameraFlash QDeclarativeCameraFlash
- \since 4.0
- \brief The CameraFlash element provides interface for flash related camera settings.
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- It should not be constructed separately but provided by Camera.flash.
-
- \qml
- import QtQuick 2.0
- import QtMultimedia 4.0
-
- Camera {
- id: camera
-
- exposure.exposureCompensation: -1.0
- flash.mode: Camera.FlashRedEyeReduction
- }
-
- \endqml
-*/
-
-/*!
- \class QDeclarativeCameraFlash
- \internal
- \brief The CameraFlash element provides interface for flash related camera settings.
-*/
-
-/*!
- Construct a declarative camera flash object using \a parent object.
- */
-QDeclarativeCameraFlash::QDeclarativeCameraFlash(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_exposure = camera->exposure();
- connect(m_exposure, SIGNAL(flashReady(bool)), this, SIGNAL(flashReady(bool)));
-}
-
-QDeclarativeCameraFlash::~QDeclarativeCameraFlash()
-{
-}
-
-/*!
- \qmlproperty bool QDeclarativeCameraFlash::ready
- \property bool QDeclarativeCameraFlash::ready
-
- Indicates flash is charged.
-*/
-bool QDeclarativeCameraFlash::isFlashReady() const
-{
- return m_exposure->isFlashReady();
-}
-
-/*!
- \qmlproperty enumeration CameraExposure::flashMode
- \property QDeclarativeCameraFlash::flashMode
-
- \table
- \header \o Value \o Description
- \row \o Camera.FlashOff \o Flash is Off.
- \row \o Camera.FlashOn \o Flash is On.
- \row \o Camera.FlashAuto \o Automatic flash.
- \row \o Camera.FlashRedEyeReduction \o Red eye reduction flash.
- \row \o Camera.FlashFill \o Use flash to fillin shadows.
- \row \o Camera.FlashTorch \o Constant light source, useful for focusing and video capture.
- \row \o Camera.FlashSlowSyncFrontCurtain
- \o Use the flash in conjunction with a slow shutter speed.
- This mode allows better exposure of distant objects and/or motion blur effect.
- \row \o Camera.FlashSlowSyncRearCurtain
- \o The similar mode to FlashSlowSyncFrontCurtain but flash is fired at the end of exposure.
- \row \o Camera.FlashManual \o Flash power is manually set.
- \endtable
-
-*/
-int QDeclarativeCameraFlash::flashMode() const
-{
- return m_exposure->flashMode();
-}
-
-void QDeclarativeCameraFlash::setFlashMode(int mode)
-{
- if (m_exposure->flashMode() != mode) {
- m_exposure->setFlashMode(QCameraExposure::FlashModes(mode));
- emit flashModeChanged(mode);
- }
-}
-
-/*!
- \qmlsignal CameraExposure::flashModeChanged(int)
- \fn void QDeclarativeCameraFlash::flashModeChanged(int)
-*/
-
-/*!
- \qmlsignal CameraExposure::flashReady(bool)
- \fn void QDeclarativeCameraFlash::flashReady(bool)
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraflash_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraflash_p.h b/src/imports/multimedia/qdeclarativecameraflash_p.h
deleted file mode 100644
index 893c77d..0000000
--- a/src/imports/multimedia/qdeclarativecameraflash_p.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERAFLASH_H
-#define QDECLARATIVECAMERAFLASH_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcamera.h>
-#include <qcameraexposure.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraFlash : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(bool ready READ isFlashReady NOTIFY flashReady)
- Q_PROPERTY(int mode READ flashMode WRITE setFlashMode NOTIFY flashModeChanged)
-public:
- ~QDeclarativeCameraFlash();
-
- int flashMode() const;
- bool isFlashReady() const;
-
-public Q_SLOTS:
- void setFlashMode(int);
-
-Q_SIGNALS:
- void flashReady(bool status);
- void flashModeChanged(int);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraFlash(QCamera *camera, QObject *parent = 0);
-
- QCameraExposure *m_exposure;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFlash))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecamerafocus.cpp b/src/imports/multimedia/qdeclarativecamerafocus.cpp
deleted file mode 100644
index 03460bf..0000000
--- a/src/imports/multimedia/qdeclarativecamerafocus.cpp
+++ /dev/null
@@ -1,259 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecamerafocus_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass CameraFocus QDeclarativeCameraFocus
- \since 4.0
- \brief The CameraFocus element provides interface for focus related camera settings.
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- It should not be constructed separately but provided by Camera.focus.
-
- \qml
- import QtQuick 2.0
- import QtMultimedia 4.0
-
- Camera {
- id: camera
-
- focus {
- focusMode: Camera.FocusMacro
- focusPointMode: Camera.FocusPointCustom
- customFocusPoint: Qt.point(0.2, 0.2) //focus to top-left corner
- }
- }
-
- \endqml
-*/
-
-/*!
- \class QDeclarativeCameraFocus
- \brief The CameraFocus element provides interface for focus related camera settings.
-*/
-
-/*!
- Construct a declarative camera focus object using \a parent object.
- */
-
-QDeclarativeCameraFocus::QDeclarativeCameraFocus(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_focus = camera->focus();
- m_focusZones = new FocusZonesModel(this);
-
- updateFocusZones();
-
- connect(m_focus, SIGNAL(focusZonesChanged()), SLOT(updateFocusZones()));
-}
-
-QDeclarativeCameraFocus::~QDeclarativeCameraFocus()
-{
-}
-
-
-/*!
- \qmlproperty Camera::FocusModes CameraFocus::focusMode
- \property QDeclarativeCameraFocus::focusMode
-
- The current camera focus mode.
-
- It's possible to combine multiple Camera::FocusMode values,
- for example Camera.FocusMacro + Camera.FocusContinuous.
-*/
-QDeclarativeCamera::FocusModes QDeclarativeCameraFocus::focusMode() const
-{
- return QDeclarativeCamera::FocusModes(m_focus->focusMode());
-}
-
-bool QDeclarativeCameraFocus::isFocusModeSupported(QDeclarativeCamera::FocusModes mode) const
-{
- return m_focus->isFocusModeSupported(QCameraFocus::FocusMode(int(mode)));
-}
-
-void QDeclarativeCameraFocus::setFocusMode(QDeclarativeCamera::FocusModes mode)
-{
- m_focus->setFocusMode(QCameraFocus::FocusMode(int(mode)));
-}
-
-/*!
- \qmlproperty CameraFocus::FocusPointMode CameraFocus::focusPointMode
- \property QDeclarativeCameraFocus::focusPointMode
-
- The current camera focus point mode.
-*/
-QDeclarativeCamera::FocusPointMode QDeclarativeCameraFocus::focusPointMode() const
-{
- return QDeclarativeCamera::FocusPointMode(m_focus->focusPointMode());
-}
-
-void QDeclarativeCameraFocus::setFocusPointMode(QDeclarativeCamera::FocusPointMode mode)
-{
- if (mode != focusPointMode()) {
- m_focus->setFocusPointMode(QCameraFocus::FocusPointMode(mode));
- emit focusPointModeChanged(focusPointMode());
- }
-}
-
-bool QDeclarativeCameraFocus::isFocusPointModeSupported(QDeclarativeCamera::FocusPointMode mode) const
-{
- return m_focus->isFocusPointModeSupported(QCameraFocus::FocusPointMode(mode));
-}
-
-/*!
- \qmlproperty QPointF CameraFocus::customFocusPoint
- \property QDeclarativeCameraFocus::customFocusPoint
-
- Position of custom focus point, in relative frame coordinates:
- QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center.
-
- Custom focus point is used only in FocusPointCustom focus mode.
-*/
-
-QPointF QDeclarativeCameraFocus::customFocusPoint() const
-{
- return m_focus->customFocusPoint();
-}
-
-void QDeclarativeCameraFocus::setCustomFocusPoint(const QPointF &point)
-{
- if (point != customFocusPoint()) {
- m_focus->setCustomFocusPoint(point);
- emit customFocusPointChanged(customFocusPoint());
- }
-}
-
-/*!
- \qmlproperty QPointF CameraFocus::focusZones
- \property QDeclarativeCameraFocus::focusZones
-
- List of current camera focus zones,
- each including area specified in the same coordinates as \l customFocusPoint
- and zone status.
-
- \qml
-
- VideoOutput {
- id: viewfinder
- source: camera
-
- //display focus areas on camera viewfinder:
- Repeater {
- model: camera.focus.focusZones
-
- Rectangle {
- border {
- width: 2
- color: status == CameraFocus.Focused ? "green" : "white"
- }
- color: "transparent"
-
- x: area.x * viewfinder.width
- y: area.y * viewfinder.height
- width: area.width * viewfinder.width
- height: area.height * viewfinder.height
- }
- }
- }
- \endqml
-*/
-
-QAbstractListModel *QDeclarativeCameraFocus::focusZones() const
-{
- return m_focusZones;
-}
-
-/*! \internal */
-void QDeclarativeCameraFocus::updateFocusZones()
-{
- m_focusZones->setFocusZones(m_focus->focusZones());
-}
-
-
-FocusZonesModel::FocusZonesModel(QObject *parent)
- :QAbstractListModel(parent)
-{
- QHash<int, QByteArray> roles;
- roles[StatusRole] = "status";
- roles[AreaRole] = "area";
- setRoleNames(roles);
-}
-
-int FocusZonesModel::rowCount(const QModelIndex &parent) const
-{
- if (parent == QModelIndex())
- return m_focusZones.count();
-
- return 0;
-}
-
-QVariant FocusZonesModel::data(const QModelIndex &index, int role) const
-{
- if (index.row() < 0 || index.row() > m_focusZones.count())
- return QVariant();
-
- QCameraFocusZone zone = m_focusZones.value(index.row());
-
- if (role == StatusRole)
- return zone.status();
-
- if (role == AreaRole)
- return zone.area();
-
- return QVariant();
-}
-
-void FocusZonesModel::setFocusZones(const QCameraFocusZoneList &zones)
-{
- beginResetModel();
- m_focusZones = zones;
- endResetModel();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecamerafocus_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecamerafocus_p.h b/src/imports/multimedia/qdeclarativecamerafocus_p.h
deleted file mode 100644
index f6dd872..0000000
--- a/src/imports/multimedia/qdeclarativecamerafocus_p.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERAFOCUS_H
-#define QDECLARATIVECAMERAFOCUS_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qabstractitemmodel.h>
-#include <qcamera.h>
-#include <qcamerafocus.h>
-#include "qdeclarativecamera_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class FocusZonesModel;
-class QDeclarativeCamera;
-
-class QDeclarativeCameraFocus : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QDeclarativeCamera::FocusModes focusMode READ focusMode WRITE setFocusMode NOTIFY focusModeChanged)
- Q_PROPERTY(QDeclarativeCamera::FocusPointMode focusPointMode READ focusPointMode WRITE setFocusPointMode NOTIFY focusPointModeChanged)
- Q_PROPERTY(QPointF customFocusPoint READ customFocusPoint WRITE setCustomFocusPoint NOTIFY customFocusPointChanged)
- Q_PROPERTY(QObject *focusZones READ focusZones CONSTANT)
-public:
- ~QDeclarativeCameraFocus();
-
- QDeclarativeCamera::FocusModes focusMode() const;
- QDeclarativeCamera::FocusPointMode focusPointMode() const;
- QPointF customFocusPoint() const;
-
- QAbstractListModel *focusZones() const;
-
- Q_INVOKABLE bool isFocusModeSupported(QDeclarativeCamera::FocusModes mode) const;
- Q_INVOKABLE bool isFocusPointModeSupported(QDeclarativeCamera::FocusPointMode) const;
-
-public Q_SLOTS:
- void setFocusMode(QDeclarativeCamera::FocusModes);
- void setFocusPointMode(QDeclarativeCamera::FocusPointMode mode);
- void setCustomFocusPoint(const QPointF &point);
-
-Q_SIGNALS:
- void focusModeChanged(QDeclarativeCamera::FocusModes);
- void focusPointModeChanged(QDeclarativeCamera::FocusPointMode);
- void customFocusPointChanged(const QPointF &);
-
-private Q_SLOTS:
- void updateFocusZones();
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraFocus(QCamera *camera, QObject *parent = 0);
-
- QCameraFocus *m_focus;
- FocusZonesModel *m_focusZones;
-};
-
-class FocusZonesModel : public QAbstractListModel
-{
-Q_OBJECT
-public:
- enum FocusZoneRoles {
- StatusRole = Qt::UserRole + 1,
- AreaRole
- };
-
- FocusZonesModel(QObject *parent = 0);
-
- int rowCount(const QModelIndex &parent = QModelIndex()) const;
- QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
-
-public slots:
- void setFocusZones(const QCameraFocusZoneList &zones);
-
-private:
- QCameraFocusZoneList m_focusZones;
-};
-
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraFocus))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp b/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
deleted file mode 100644
index 75e942d..0000000
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecameraimageprocessing_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeCameraImageProcessing::QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_imageProcessing = camera->imageProcessing();
-}
-
-QDeclarativeCameraImageProcessing::~QDeclarativeCameraImageProcessing()
-{
-}
-
-/*!
- \qmlproperty enumeration CameraImageProcessing::whiteBalanceMode
-
- \table
- \header \o Value \o Description
- \row \o WhiteBalanceManual \o Manual white balance. In this mode the manual white balance property value is used.
- \row \o WhiteBalanceAuto \o Auto white balance mode.
- \row \o WhiteBalanceSunlight \o Sunlight white balance mode.
- \row \o WhiteBalanceCloudy \o Cloudy white balance mode.
- \row \o WhiteBalanceShade \o Shade white balance mode.
- \row \o WhiteBalanceTungsten \o Tungsten white balance mode.
- \row \o WhiteBalanceFluorescent \o Fluorescent white balance mode.
- \row \o WhiteBalanceFlash \o Flash white balance mode.
- \row \o WhiteBalanceSunset \o Sunset white balance mode.
- \row \o WhiteBalanceVendor \o Vendor defined white balance mode.
- \endtable
-
- \sa manualWhiteBalance
-*/
-/*!
- \property QDeclarativeCameraImageProcessing::whiteBalanceMode
-
- \sa WhiteBalanceMode
-*/
-QDeclarativeCameraImageProcessing::WhiteBalanceMode QDeclarativeCameraImageProcessing::whiteBalanceMode() const
-{
- return WhiteBalanceMode(m_imageProcessing->whiteBalanceMode());
-}
-
-void QDeclarativeCameraImageProcessing::setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const
-{
- if (whiteBalanceMode() != mode) {
- m_imageProcessing->setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode(mode));
- emit whiteBalanceModeChanged(whiteBalanceMode());
- }
-}
-
-/*!
- \qmlproperty int CameraImageProcessing::manualWhiteBalance
-
- The color temperature used when in manual white balance mode (WhiteBalanceManual).
-
- \sa whiteBalanceMode
-*/
-int QDeclarativeCameraImageProcessing::manualWhiteBalance() const
-{
- return m_imageProcessing->manualWhiteBalance();
-}
-
-void QDeclarativeCameraImageProcessing::setManualWhiteBalance(int colorTemp) const
-{
- if (manualWhiteBalance() != colorTemp) {
- m_imageProcessing->setManualWhiteBalance(colorTemp);
- emit manualWhiteBalanceChanged(manualWhiteBalance());
- }
-}
-
-/*!
- \qmlproperty int CameraImageProcessing::contrast
-
- Image contrast.
- Valid contrast values range between -100 and 100, the default is 0.
-*/
-int QDeclarativeCameraImageProcessing::contrast() const
-{
- return m_imageProcessing->contrast();
-}
-
-void QDeclarativeCameraImageProcessing::setContrast(int value)
-{
- if (value != contrast()) {
- m_imageProcessing->setContrast(value);
- emit contrastChanged(contrast());
- }
-}
-
-/*!
- \qmlproperty int CameraImageProcessing::saturation
-
- Image saturation.
- Valid saturation values range between -100 and 100, the default is 0.
-*/
-int QDeclarativeCameraImageProcessing::saturation() const
-{
- return m_imageProcessing->saturation();
-}
-
-void QDeclarativeCameraImageProcessing::setSaturation(int value)
-{
- if (value != saturation()) {
- m_imageProcessing->setSaturation(value);
- emit saturationChanged(saturation());
- }
-}
-
-/*!
- \qmlproperty int CameraImageProcessing::sharpeningLevel
-
- Level of sharpening applied to image.
-
- Valid sharpening level values range between -1 for default sharpening level,
- 0 for sharpening disabled and 100 for maximum sharpening applied.
-*/
-int QDeclarativeCameraImageProcessing::sharpeningLevel() const
-{
- return m_imageProcessing->sharpeningLevel();
-}
-
-void QDeclarativeCameraImageProcessing::setSharpeningLevel(int value)
-{
- if (value != sharpeningLevel()) {
- m_imageProcessing->setSharpeningLevel(value);
- emit sharpeningLevelChanged(sharpeningLevel());
- }
-}
-
-/*!
- \qmlproperty int CameraImageProcessing::denoisingLevel
-
- Level of denoising applied to image.
-
- Valid denoising level values range between -1 for default denoising level,
- 0 for denoising disabled and 100 for maximum denoising applied.
-*/
-int QDeclarativeCameraImageProcessing::denoisingLevel() const
-{
- return m_imageProcessing->denoisingLevel();
-}
-
-void QDeclarativeCameraImageProcessing::setDenoisingLevel(int value)
-{
- if (value != denoisingLevel()) {
- m_imageProcessing->setDenoisingLevel(value);
- emit denoisingLevelChanged(denoisingLevel());
- }
-}
-
-/*!
- \qmlsignal Camera::whiteBalanceModeChanged(Camera::WhiteBalanceMode)
-*/
-
-/*!
- \qmlsignal Camera::manualWhiteBalanceChanged(int)
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecameraimageprocessing_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h b/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
deleted file mode 100644
index b861835..0000000
--- a/src/imports/multimedia/qdeclarativecameraimageprocessing_p.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERAIMAGEPROCESSING_H
-#define QDECLARATIVECAMERAIMAGEPROCESSING_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcamera.h>
-#include <qcameraimageprocessing.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraImageProcessing : public QObject
-{
- Q_OBJECT
- Q_ENUMS(WhiteBalanceMode)
-
- Q_PROPERTY(WhiteBalanceMode whiteBalanceMode READ whiteBalanceMode WRITE setWhiteBalanceMode NOTIFY whiteBalanceModeChanged)
- Q_PROPERTY(int manualWhiteBalance READ manualWhiteBalance WRITE setManualWhiteBalance NOTIFY manualWhiteBalanceChanged)
- Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
- Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
- Q_PROPERTY(int sharpeningLevel READ sharpeningLevel WRITE setSharpeningLevel NOTIFY sharpeningLevelChanged)
- Q_PROPERTY(int denoisingLevel READ denoisingLevel WRITE setDenoisingLevel NOTIFY denoisingLevelChanged)
-
-public:
- enum WhiteBalanceMode {
- WhiteBalanceAuto = QCameraImageProcessing::WhiteBalanceAuto,
- WhiteBalanceManual = QCameraImageProcessing::WhiteBalanceManual,
- WhiteBalanceSunlight = QCameraImageProcessing::WhiteBalanceSunlight,
- WhiteBalanceCloudy = QCameraImageProcessing::WhiteBalanceCloudy,
- WhiteBalanceShade = QCameraImageProcessing::WhiteBalanceShade,
- WhiteBalanceTungsten = QCameraImageProcessing::WhiteBalanceTungsten,
- WhiteBalanceFluorescent = QCameraImageProcessing::WhiteBalanceFluorescent,
- WhiteBalanceFlash = QCameraImageProcessing::WhiteBalanceFlash,
- WhiteBalanceSunset = QCameraImageProcessing::WhiteBalanceSunset,
- WhiteBalanceVendor = QCameraImageProcessing::WhiteBalanceVendor
- };
-
- ~QDeclarativeCameraImageProcessing();
-
- WhiteBalanceMode whiteBalanceMode() const;
- int manualWhiteBalance() const;
-
- int contrast() const;
- int saturation() const;
- int sharpeningLevel() const;
- int denoisingLevel() const;
-
-public Q_SLOTS:
- void setWhiteBalanceMode(QDeclarativeCameraImageProcessing::WhiteBalanceMode mode) const;
- void setManualWhiteBalance(int colorTemp) const;
-
- void setContrast(int value);
- void setSaturation(int value);
- void setSharpeningLevel(int value);
- void setDenoisingLevel(int value);
-
-Q_SIGNALS:
- void whiteBalanceModeChanged(QDeclarativeCameraImageProcessing::WhiteBalanceMode) const;
- void manualWhiteBalanceChanged(int) const;
-
- void contrastChanged(int);
- void saturationChanged(int);
- void sharpeningLevelChanged(int);
- void denoisingLevelChanged(int);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraImageProcessing(QCamera *camera, QObject *parent = 0);
-
- QCameraImageProcessing *m_imageProcessing;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraImageProcessing))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp b/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp
deleted file mode 100644
index 16d528b..0000000
--- a/src/imports/multimedia/qdeclarativecamerapreviewprovider.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamerapreviewprovider_p.h"
-#include <QtCore/qmutex.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-struct QDeclarativeCameraPreviewProviderPrivate
-{
- QString id;
- QImage image;
- QMutex mutex;
-};
-
-Q_GLOBAL_STATIC(QDeclarativeCameraPreviewProviderPrivate, qDeclarativeCameraPreviewProviderPrivate)
-
-QDeclarativeCameraPreviewProvider::QDeclarativeCameraPreviewProvider()
-: QDeclarativeImageProvider(QDeclarativeImageProvider::Image)
-{
-}
-
-QDeclarativeCameraPreviewProvider::~QDeclarativeCameraPreviewProvider()
-{
- QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate();
- QMutexLocker lock(&d->mutex);
- d->id.clear();
- d->image = QImage();
-}
-
-QImage QDeclarativeCameraPreviewProvider::requestImage(const QString &id, QSize *size, const QSize& requestedSize)
-{
- QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate();
- QMutexLocker lock(&d->mutex);
-
- if (d->id != id)
- return QImage();
-
- QImage res = d->image;
- if (!requestedSize.isEmpty())
- res = res.scaled(requestedSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
-
- if (size)
- *size = res.size();
-
- return res;
-}
-
-void QDeclarativeCameraPreviewProvider::registerPreview(const QString &id, const QImage &preview)
-{
- //only the last preview is kept
- QDeclarativeCameraPreviewProviderPrivate *d = qDeclarativeCameraPreviewProviderPrivate();
- QMutexLocker lock(&d->mutex);
- d->id = id;
- d->image = preview;
-}
-
-QT_END_NAMESPACE
diff --git a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h b/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h
deleted file mode 100644
index 8f5ecc0..0000000
--- a/src/imports/multimedia/qdeclarativecamerapreviewprovider_p.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERAPREVIEWPROVIDER_H
-#define QDECLARATIVECAMERAPREVIEWPROVIDER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtDeclarative/qdeclarativeimageprovider.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCameraPreviewProvider : public QDeclarativeImageProvider
-{
-public:
- QDeclarativeCameraPreviewProvider();
- ~QDeclarativeCameraPreviewProvider();
-
- virtual QImage requestImage(const QString &id, QSize *size, const QSize& requestedSize);
- static void registerPreview(const QString &id, const QImage &preview);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativecamerarecorder.cpp b/src/imports/multimedia/qdeclarativecamerarecorder.cpp
deleted file mode 100644
index 7328b04..0000000
--- a/src/imports/multimedia/qdeclarativecamerarecorder.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativecamera_p.h"
-#include "qdeclarativecamerarecorder_p.h"
-
-#include <QtCore/qurl.h>
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeCameraRecorder::QDeclarativeCameraRecorder(QCamera *camera, QObject *parent) :
- QObject(parent)
-{
- m_recorder = new QMediaRecorder(camera, this);
- connect(m_recorder, SIGNAL(stateChanged(QMediaRecorder::State)),
- SLOT(updateRecorderState(QMediaRecorder::State)));
- connect(m_recorder, SIGNAL(error(QMediaRecorder::Error)),
- SLOT(updateRecorderError(QMediaRecorder::Error)));
- connect(m_recorder, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(m_recorder, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
-}
-
-QDeclarativeCameraRecorder::~QDeclarativeCameraRecorder()
-{
-}
-
-QSize QDeclarativeCameraRecorder::captureResolution()
-{
- return m_videoSettings.resolution();
-}
-
-QString QDeclarativeCameraRecorder::audioCodec() const
-{
- return m_audioSettings.codec();
-}
-
-QString QDeclarativeCameraRecorder::videoCodec() const
-{
- return m_videoSettings.codec();
-}
-
-QString QDeclarativeCameraRecorder::mediaContainer() const
-{
- return m_mediaContainer;
-}
-
-void QDeclarativeCameraRecorder::setCaptureResolution(const QSize &resolution)
-{
- if (resolution != captureResolution()) {
- m_videoSettings.setResolution(resolution);
- applySettings();
- emit captureResolutionChanged(resolution);
- }
-}
-
-void QDeclarativeCameraRecorder::setAudioCodec(const QString &codec)
-{
- if (codec != audioCodec()) {
- m_audioSettings.setCodec(codec);
- applySettings();
- emit audioCodecChanged(codec);
- }
-}
-
-void QDeclarativeCameraRecorder::setVideoCodec(const QString &codec)
-{
- if (codec != videoCodec()) {
- m_videoSettings.setCodec(codec);
- applySettings();
- emit videoCodecChanged(codec);
- }
-}
-
-void QDeclarativeCameraRecorder::setMediaContainer(const QString &container)
-{
- if (container != m_mediaContainer) {
- m_mediaContainer = container;
- applySettings();
- emit mediaContainerChanged(container);
- }
-}
-
-void QDeclarativeCameraRecorder::applySettings()
-{
- m_recorder->setEncodingSettings(m_audioSettings,
- m_videoSettings,
- m_mediaContainer);
-}
-
-QMediaRecorder::Error QDeclarativeCameraRecorder::error() const
-{
- return m_recorder->error();
-}
-
-QString QDeclarativeCameraRecorder::errorString() const
-{
- return m_recorder->errorString();
-}
-
-QDeclarativeCameraRecorder::RecorderState QDeclarativeCameraRecorder::recorderState() const
-{
- //paused state is not supported for camera
- QMediaRecorder::State state = m_recorder->state();
-
- if (state == QMediaRecorder::PausedState)
- state = QMediaRecorder::StoppedState;
-
- return RecorderState(state);
-}
-
-void QDeclarativeCameraRecorder::record()
-{
- setRecorderState(RecordingState);
-}
-
-void QDeclarativeCameraRecorder::stop()
-{
- setRecorderState(StoppedState);
-}
-
-void QDeclarativeCameraRecorder::setRecorderState(QDeclarativeCameraRecorder::RecorderState state)
-{
- if (!m_recorder)
- return;
-
- switch (state) {
- case QDeclarativeCameraRecorder::RecordingState:
- m_recorder->record();
- break;
- case QDeclarativeCameraRecorder::StoppedState:
- m_recorder->stop();
- break;
- }
-}
-
-QString QDeclarativeCameraRecorder::outputLocation() const
-{
- return m_recorder->outputLocation().toString();
-}
-
-void QDeclarativeCameraRecorder::setOutputLocation(const QUrl &location)
-{
- m_recorder->setOutputLocation(location);
-}
-
-qint64 QDeclarativeCameraRecorder::duration() const
-{
- return m_recorder->duration();
-}
-
-bool QDeclarativeCameraRecorder::isMuted() const
-{
- return m_recorder->isMuted();
-}
-
-void QDeclarativeCameraRecorder::setMuted(bool muted)
-{
- m_recorder->setMuted(muted);
-}
-
-void QDeclarativeCameraRecorder::setMetadata(const QString &key, const QVariant &value)
-{
- m_recorder->setExtendedMetaData(key, value);
-}
-
-void QDeclarativeCameraRecorder::updateRecorderState(QMediaRecorder::State state)
-{
- if (state == QMediaRecorder::PausedState)
- state = QMediaRecorder::StoppedState;
-
- if (state == QMediaRecorder::StoppedState) {
- QString location = outputLocation();
- if (!location.isEmpty())
- emit outputLocationChanged(location);
- }
-
- emit recorderStateChanged(RecorderState(state));
-}
-
-void QDeclarativeCameraRecorder::updateRecorderError(QMediaRecorder::Error errorCode)
-{
- qWarning() << "QMediaRecorder error:" << errorString();
- emit error(errorCode);
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qdeclarativecamerarecorder_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativecamerarecorder_p.h b/src/imports/multimedia/qdeclarativecamerarecorder_p.h
deleted file mode 100644
index 9164af9..0000000
--- a/src/imports/multimedia/qdeclarativecamerarecorder_p.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the plugins of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVECAMERARECORDER_H
-#define QDECLARATIVECAMERARECORDER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qcamera.h>
-#include <qmediarecorder.h>
-#include <qmediaencodersettings.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeCamera;
-
-class QDeclarativeCameraRecorder : public QObject
-{
- Q_OBJECT
- Q_ENUMS(RecorderState)
-
- Q_PROPERTY(RecorderState recorderState READ recorderState WRITE setRecorderState NOTIFY recorderStateChanged)
- Q_PROPERTY(QSize resolution READ captureResolution WRITE setCaptureResolution NOTIFY captureResolutionChanged)
-
- Q_PROPERTY(QString videoCodec READ videoCodec WRITE setVideoCodec NOTIFY videoCodecChanged)
- Q_PROPERTY(QString audioCodec READ audioCodec WRITE setAudioCodec NOTIFY audioCodecChanged)
- Q_PROPERTY(QString mediaContainer READ mediaContainer WRITE setMediaContainer NOTIFY mediaContainerChanged)
-
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(QString outputLocation READ outputLocation WRITE setOutputLocation NOTIFY outputLocationChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY error)
-
-public:
- enum RecorderState
- {
- StoppedState = QMediaRecorder::StoppedState,
- RecordingState = QMediaRecorder::RecordingState
- };
-
- ~QDeclarativeCameraRecorder();
-
- RecorderState recorderState() const;
-
- QSize captureResolution();
-
- QString outputLocation() const;
- qint64 duration() const;
- bool isMuted() const;
-
- QString audioCodec() const;
- QString videoCodec() const;
- QString mediaContainer() const;
-
- QMediaRecorder::Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void setOutputLocation(const QUrl &location);
-
- void record();
- void stop();
- void setRecorderState(QDeclarativeCameraRecorder::RecorderState state);
-
- void setMuted(bool muted);
- void setMetadata(const QString &key, const QVariant &value);
-
- void setCaptureResolution(const QSize &resolution);
- void setAudioCodec(const QString &codec);
- void setVideoCodec(const QString &codec);
- void setMediaContainer(const QString &container);
-
-Q_SIGNALS:
- void recorderStateChanged(QDeclarativeCameraRecorder::RecorderState state);
- void durationChanged(qint64 duration);
- void mutedChanged(bool muted);
- void outputLocationChanged(const QString &location);
-
- void error(QMediaRecorder::Error errorCode);
-
- void metaDataAvailableChanged(bool available);
- void metaDataWritableChanged(bool writable);
- void metaDataChanged();
-
- void captureResolutionChanged(const QSize &);
- void audioCodecChanged(const QString &codec);
- void videoCodecChanged(const QString &codec);
- void mediaContainerChanged(const QString &container);
-
-private slots:
- void updateRecorderState(QMediaRecorder::State);
- void updateRecorderError(QMediaRecorder::Error);
-
-private:
- friend class QDeclarativeCamera;
- QDeclarativeCameraRecorder(QCamera *camera, QObject *parent = 0);
-
- void applySettings();
-
- QMediaRecorder *m_recorder;
-
- QAudioEncoderSettings m_audioSettings;
- QVideoEncoderSettings m_videoSettings;
- QString m_mediaContainer;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeCameraRecorder))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativemediabase.cpp b/src/imports/multimedia/qdeclarativemediabase.cpp
deleted file mode 100644
index b206862..0000000
--- a/src/imports/multimedia/qdeclarativemediabase.cpp
+++ /dev/null
@@ -1,571 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativemediabase_p.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qurl.h>
-#include <QtDeclarative/qdeclarativeinfo.h>
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <qmediaserviceprovider.h>
-#include <qmetadatareadercontrol.h>
-
-#include "qdeclarativemediametadata_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-class QDeclarativeMediaBaseObject : public QMediaObject
-{
-public:
- QDeclarativeMediaBaseObject(QMediaService *service)
- : QMediaObject(0, service)
- {
- }
-};
-
-class QDeclarativeMediaBasePlayerControl : public QMediaPlayerControl
-{
-public:
- QDeclarativeMediaBasePlayerControl(QObject *parent)
- : QMediaPlayerControl(parent)
- {
- }
-
- QMediaPlayer::State state() const { return QMediaPlayer::StoppedState; }
- QMediaPlayer::MediaStatus mediaStatus() const { return QMediaPlayer::NoMedia; }
-
- qint64 duration() const { return 0; }
- qint64 position() const { return 0; }
- void setPosition(qint64) {}
- int volume() const { return 0; }
- void setVolume(int) {}
- bool isMuted() const { return false; }
- void setMuted(bool) {}
- int bufferStatus() const { return 0; }
- bool isAudioAvailable() const { return false; }
- bool isVideoAvailable() const { return false; }
- bool isSeekable() const { return false; }
- QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); }
- qreal playbackRate() const { return 1; }
- void setPlaybackRate(qreal) {}
- QMediaContent media() const { return QMediaContent(); }
- const QIODevice *mediaStream() const { return 0; }
- void setMedia(const QMediaContent &, QIODevice *) {}
-
- void play() {}
- void pause() {}
- void stop() {}
-};
-
-
-class QDeclarativeMediaBaseMetaDataControl : public QMetaDataReaderControl
-{
-public:
- QDeclarativeMediaBaseMetaDataControl(QObject *parent)
- : QMetaDataReaderControl(parent)
- {
- }
-
- bool isMetaDataAvailable() const { return false; }
-
- QVariant metaData(QtMultimedia::MetaData) const { return QVariant(); }
- QList<QtMultimedia::MetaData> availableMetaData() const {
- return QList<QtMultimedia::MetaData>(); }
-
- QVariant extendedMetaData(const QString &) const { return QVariant(); }
- QStringList availableExtendedMetaData() const { return QStringList(); }
-};
-
-class QDeclarativeMediaBaseAnimation : public QObject
-{
-public:
- QDeclarativeMediaBaseAnimation(QDeclarativeMediaBase *media)
- : m_media(media)
- {
- }
-
- void start() { if (!m_timer.isActive()) m_timer.start(500, this); }
- void stop() { m_timer.stop(); }
-
-protected:
- void timerEvent(QTimerEvent *event)
- {
- if (event->timerId() == m_timer.timerId()) {
- event->accept();
-
- if (m_media->m_playing && !m_media->m_paused)
- emit m_media->positionChanged();
- if (m_media->m_status == QMediaPlayer::BufferingMedia || QMediaPlayer::StalledMedia)
- emit m_media->bufferProgressChanged();
- } else {
- QObject::timerEvent(event);
- }
- }
-
-private:
- QDeclarativeMediaBase *m_media;
- QBasicTimer m_timer;
-};
-
-void QDeclarativeMediaBase::_q_statusChanged()
-{
- if (m_playerControl->mediaStatus() == QMediaPlayer::EndOfMedia && m_runningCount != 0) {
- m_runningCount -= 1;
- m_playerControl->play();
- }
-
- const QMediaPlayer::MediaStatus oldStatus = m_status;
- const bool wasPlaying = m_playing;
- const bool wasPaused = m_paused;
-
- const QMediaPlayer::State state = m_playerControl->state();
-
- m_status = m_playerControl->mediaStatus();
-
- if (m_complete)
- m_playing = state != QMediaPlayer::StoppedState;
-
- if (state == QMediaPlayer::PausedState)
- m_paused = true;
- else if (state == QMediaPlayer::PlayingState)
- m_paused = false;
-
- if (m_status != oldStatus)
- emit statusChanged();
-
- switch (state) {
- case QMediaPlayer::StoppedState:
- if (wasPlaying) {
- emit stopped();
-
- if (!m_playing)
- emit playingChanged();
- }
- break;
- case QMediaPlayer::PausedState:
- if (!wasPlaying) {
- emit started();
- if (m_playing)
- emit playingChanged();
- }
- if ((!wasPaused || !wasPlaying) && m_paused)
- emit paused();
- if (!wasPaused && m_paused)
- emit pausedChanged();
-
- break;
-
- case QMediaPlayer::PlayingState:
- if (wasPaused && wasPlaying)
- emit resumed();
- else
- emit started();
-
- if (wasPaused && !m_paused)
- emit pausedChanged();
- if (!wasPlaying && m_playing)
- emit playingChanged();
- break;
- }
-
- // Check
- if ((m_playing && !m_paused)
- || m_status == QMediaPlayer::BufferingMedia
- || m_status == QMediaPlayer::StalledMedia) {
- m_animation->start();
- }
- else {
- m_animation->stop();
- }
-}
-
-QDeclarativeMediaBase::QDeclarativeMediaBase()
- : m_paused(false)
- , m_playing(false)
- , m_autoLoad(true)
- , m_loaded(false)
- , m_muted(false)
- , m_complete(false)
- , m_loopCount(1)
- , m_runningCount(0)
- , m_position(0)
- , m_vol(1.0)
- , m_playbackRate(1.0)
- , m_mediaService(0)
- , m_playerControl(0)
- , m_qmlObject(0)
- , m_mediaObject(0)
- , m_mediaProvider(0)
- , m_metaDataControl(0)
- , m_animation(0)
- , m_status(QMediaPlayer::NoMedia)
- , m_error(QMediaPlayer::ServiceMissingError)
-{
-}
-
-QDeclarativeMediaBase::~QDeclarativeMediaBase()
-{
-}
-
-void QDeclarativeMediaBase::shutdown()
-{
- delete m_mediaObject;
- m_metaData.reset();
-
- if (m_mediaProvider)
- m_mediaProvider->releaseService(m_mediaService);
-
- delete m_animation;
-
-}
-
-void QDeclarativeMediaBase::setObject(QObject *object, const QByteArray &type)
-{
- m_qmlObject = object;
-
- if ((m_mediaProvider = QMediaServiceProvider::defaultServiceProvider()) != 0) {
- m_mediaService = m_mediaProvider->requestService(type);
- if (m_mediaService != 0) {
- m_playerControl = qobject_cast<QMediaPlayerControl *>(
- m_mediaService->requestControl(QMediaPlayerControl_iid));
- m_metaDataControl = qobject_cast<QMetaDataReaderControl *>(
- m_mediaService->requestControl(QMetaDataReaderControl_iid));
- m_mediaObject = new QDeclarativeMediaBaseObject(m_mediaService);
- }
- }
-
- if (m_playerControl) {
- QObject::connect(m_playerControl, SIGNAL(stateChanged(QMediaPlayer::State)),
- object, SLOT(_q_statusChanged()));
- QObject::connect(m_playerControl, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- object, SLOT(_q_statusChanged()));
- QObject::connect(m_playerControl, SIGNAL(mediaChanged(QMediaContent)),
- object, SIGNAL(sourceChanged()));
- QObject::connect(m_playerControl, SIGNAL(durationChanged(qint64)),
- object, SIGNAL(durationChanged()));
- QObject::connect(m_playerControl, SIGNAL(positionChanged(qint64)),
- object, SIGNAL(positionChanged()));
- QObject::connect(m_playerControl, SIGNAL(volumeChanged(int)),
- object, SIGNAL(volumeChanged()));
- QObject::connect(m_playerControl, SIGNAL(mutedChanged(bool)),
- object, SIGNAL(mutedChanged()));
- QObject::connect(m_playerControl, SIGNAL(bufferStatusChanged(int)),
- object, SIGNAL(bufferProgressChanged()));
- QObject::connect(m_playerControl, SIGNAL(seekableChanged(bool)),
- object, SIGNAL(seekableChanged()));
- QObject::connect(m_playerControl, SIGNAL(playbackRateChanged(qreal)),
- object, SIGNAL(playbackRateChanged()));
- QObject::connect(m_playerControl, SIGNAL(error(int,QString)),
- object, SLOT(_q_error(int,QString)));
-
- m_animation = new QDeclarativeMediaBaseAnimation(this);
- m_error = QMediaPlayer::NoError;
- } else {
- m_playerControl = new QDeclarativeMediaBasePlayerControl(object);
- }
-
- if (!m_metaDataControl)
- m_metaDataControl = new QDeclarativeMediaBaseMetaDataControl(object);
-
- m_metaData.reset(new QDeclarativeMediaMetaData(m_metaDataControl));
-
- QObject::connect(m_metaDataControl, SIGNAL(metaDataChanged()),
- m_metaData.data(), SIGNAL(metaDataChanged()));
-}
-
-void QDeclarativeMediaBase::componentComplete()
-{
- if (!qFuzzyCompare(m_vol, qreal(1.0)))
- m_playerControl->setVolume(m_vol * 100);
- if (m_muted)
- m_playerControl->setMuted(m_muted);
- if (!qFuzzyCompare(m_playbackRate, qreal(1.0)))
- m_playerControl->setPlaybackRate(m_playbackRate);
-
- if (!m_source.isEmpty() && (m_autoLoad || m_playing)) // Override autoLoad if playing set
- m_playerControl->setMedia(m_source, 0);
-
- m_complete = true;
-
- if (m_playing) {
- if (m_position > 0)
- m_playerControl->setPosition(m_position);
-
- if (m_source.isEmpty()) {
- m_playing = false;
-
- emit playingChanged();
- } else if (m_paused) {
- m_playerControl->pause();
- } else {
- m_playerControl->play();
- }
- }
-}
-
-// Properties
-
-QUrl QDeclarativeMediaBase::source() const
-{
- return m_source;
-}
-
-void QDeclarativeMediaBase::setSource(const QUrl &url)
-{
- if (url == m_source)
- return;
-
- m_source = url;
- m_loaded = false;
- if (m_complete && (m_autoLoad || url.isEmpty())) {
- if (m_error != QMediaPlayer::ServiceMissingError && m_error != QMediaPlayer::NoError) {
- m_error = QMediaPlayer::NoError;
- m_errorString = QString();
-
- emit errorChanged();
- }
-
- m_playerControl->setMedia(m_source, 0);
- m_loaded = true;
- }
- else
- emit sourceChanged();
-}
-
-bool QDeclarativeMediaBase::isAutoLoad() const
-{
- return m_autoLoad;
-}
-
-void QDeclarativeMediaBase::setAutoLoad(bool autoLoad)
-{
- if (m_autoLoad == autoLoad)
- return;
-
- m_autoLoad = autoLoad;
- emit autoLoadChanged();
-}
-
-int QDeclarativeMediaBase::loopCount() const
-{
- return m_loopCount;
-}
-
-void QDeclarativeMediaBase::setLoopCount(int loopCount)
-{
- if (loopCount == 0)
- loopCount = 1;
- else if (loopCount < -1)
- loopCount = -1;
-
- if (m_loopCount == loopCount) {
- return;
- }
- m_loopCount = loopCount;
- emit loopCountChanged();
-}
-
-bool QDeclarativeMediaBase::isPlaying() const
-{
- return m_playing;
-}
-
-void QDeclarativeMediaBase::setPlaying(bool playing)
-{
- if (playing == m_playing)
- return;
-
- if (m_complete) {
- if (playing) {
- if (!m_autoLoad && !m_loaded) {
- m_playerControl->setMedia(m_source, 0);
- m_playerControl->setPosition(m_position);
- m_loaded = true;
- }
-
- m_runningCount = m_loopCount - 1;
-
- if (!m_paused)
- m_playerControl->play();
- else
- m_playerControl->pause();
- } else {
- m_playerControl->stop();
- }
- } else {
- m_playing = playing;
- emit playingChanged();
- }
-}
-
-bool QDeclarativeMediaBase::isPaused() const
-{
- return m_paused;
-}
-
-void QDeclarativeMediaBase::setPaused(bool paused)
-{
- if (m_paused == paused)
- return;
-
- if (m_complete && m_playing) {
- if (!m_autoLoad && !m_loaded) {
- m_playerControl->setMedia(m_source, 0);
- m_playerControl->setPosition(m_position);
- m_loaded = true;
- }
-
- if (!paused)
- m_playerControl->play();
- else
- m_playerControl->pause();
- } else {
- m_paused = paused;
- emit pausedChanged();
- }
-}
-
-int QDeclarativeMediaBase::duration() const
-{
- return !m_complete ? 0 : m_playerControl->duration();
-}
-
-int QDeclarativeMediaBase::position() const
-{
- return !m_complete ? m_position : m_playerControl->position();
-}
-
-void QDeclarativeMediaBase::setPosition(int position)
-{
- if (this->position() == position)
- return;
-
- m_position = position;
- if (m_complete)
- m_playerControl->setPosition(m_position);
- else
- emit positionChanged();
-}
-
-qreal QDeclarativeMediaBase::volume() const
-{
- return !m_complete ? m_vol : qreal(m_playerControl->volume()) / 100;
-}
-
-void QDeclarativeMediaBase::setVolume(qreal volume)
-{
- if (volume < 0 || volume > 1) {
- qmlInfo(m_qmlObject) << m_qmlObject->tr("volume should be between 0.0 and 1.0");
- return;
- }
-
- if (m_vol == volume)
- return;
-
- m_vol = volume;
-
- if (m_complete)
- m_playerControl->setVolume(qRound(volume * 100));
- else
- emit volumeChanged();
-}
-
-bool QDeclarativeMediaBase::isMuted() const
-{
- return !m_complete ? m_muted : m_playerControl->isMuted();
-}
-
-void QDeclarativeMediaBase::setMuted(bool muted)
-{
- if (m_muted == muted)
- return;
-
- m_muted = muted;
-
- if (m_complete)
- m_playerControl->setMuted(muted);
- else
- emit mutedChanged();
-}
-
-qreal QDeclarativeMediaBase::bufferProgress() const
-{
- return !m_complete ? 0 : qreal(m_playerControl->bufferStatus()) / 100;
-}
-
-bool QDeclarativeMediaBase::isSeekable() const
-{
- return !m_complete ? false : m_playerControl->isSeekable();
-}
-
-qreal QDeclarativeMediaBase::playbackRate() const
-{
- return m_playbackRate;
-}
-
-void QDeclarativeMediaBase::setPlaybackRate(qreal rate)
-{
- if (m_playbackRate == rate)
- return;
-
- m_playbackRate = rate;
-
- if (m_complete)
- m_playerControl->setPlaybackRate(m_playbackRate);
- else
- emit playbackRateChanged();
-}
-
-QString QDeclarativeMediaBase::errorString() const
-{
- return m_errorString;
-}
-
-QDeclarativeMediaMetaData *QDeclarativeMediaBase::metaData() const
-{
- return m_metaData.data();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/imports/multimedia/qdeclarativemediabase_p.h b/src/imports/multimedia/qdeclarativemediabase_p.h
deleted file mode 100644
index 964bb07..0000000
--- a/src/imports/multimedia/qdeclarativemediabase_p.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEMEDIABASE_P_H
-#define QDECLARATIVEMEDIABASE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbasictimer.h>
-#include <qmediaplayer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlayerControl;
-class QMediaService;
-class QMediaServiceProvider;
-class QMetaDataReaderControl;
-class QDeclarativeMediaBaseAnimation;
-class QDeclarativeMediaMetaData;
-
-class QDeclarativeMediaBase
-{
-public:
- enum Loop {
- INFINITE = -1
- };
-
- QDeclarativeMediaBase();
- virtual ~QDeclarativeMediaBase();
-
- QUrl source() const;
- void setSource(const QUrl &url);
-
- bool isAutoLoad() const;
- void setAutoLoad(bool autoLoad);
-
- int loopCount() const;
- void setLoopCount(int loopCount);
-
- bool isPlaying() const;
- void setPlaying(bool playing);
-
- bool isPaused() const;
- void setPaused(bool paused);
-
- int duration() const;
-
- int position() const;
- void setPosition(int position);
-
- qreal volume() const;
- void setVolume(qreal volume);
-
- bool isMuted() const;
- void setMuted(bool muted);
-
- qreal bufferProgress() const;
-
- bool isSeekable() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
- QString errorString() const;
-
- QDeclarativeMediaMetaData *metaData() const;
-
- void _q_statusChanged();
-
- void _q_metaDataChanged();
-
- void componentComplete();
-
-protected:
- void shutdown();
-
- void setObject(QObject *object, const QByteArray &type = Q_MEDIASERVICE_MEDIAPLAYER);
-
- virtual void sourceChanged() = 0;
- virtual void autoLoadChanged() = 0;
- virtual void playingChanged() = 0;
- virtual void pausedChanged() = 0;
- virtual void loopCountChanged() = 0;
-
- virtual void started() = 0;
- virtual void resumed() = 0;
- virtual void paused() = 0;
- virtual void stopped() = 0;
-
- virtual void statusChanged() = 0;
-
- virtual void durationChanged() = 0;
- virtual void positionChanged() = 0;
-
- virtual void volumeChanged() = 0;
- virtual void mutedChanged() = 0;
-
- virtual void bufferProgressChanged() = 0;
-
- virtual void seekableChanged() = 0;
- virtual void playbackRateChanged() = 0;
-
- virtual void errorChanged() = 0;
-
- bool m_paused;
- bool m_playing;
- bool m_autoLoad;
- bool m_loaded;
- bool m_muted;
- bool m_complete;
- int m_loopCount;
- int m_runningCount;
- int m_position;
- qreal m_vol;
- qreal m_playbackRate;
- QMediaService *m_mediaService;
- QMediaPlayerControl *m_playerControl;
-
- QObject *m_qmlObject;
- QMediaObject *m_mediaObject;
- QMediaServiceProvider *m_mediaProvider;
- QMetaDataReaderControl *m_metaDataControl;
- QDeclarativeMediaBaseAnimation *m_animation;
- QScopedPointer<QDeclarativeMediaMetaData> m_metaData;
-
- QMediaPlayer::MediaStatus m_status;
- QMediaPlayer::Error m_error;
- QString m_errorString;
- QUrl m_source;
-
- friend class QDeclarativeMediaBaseAnimation;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativemediametadata_p.h b/src/imports/multimedia/qdeclarativemediametadata_p.h
deleted file mode 100644
index 4a73705..0000000
--- a/src/imports/multimedia/qdeclarativemediametadata_p.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEMEDIAMETADATA_P_H
-#define QDECLARATIVEMEDIAMETADATA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qmetadatareadercontrol.h>
-
-#include <qdeclarative.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeMediaMetaData : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QVariant title READ title NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant subTitle READ subTitle NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant author READ author NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant comment READ comment NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant description READ description NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant category READ category NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant genre READ genre NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant year READ year NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant date READ date NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant userRating READ userRating NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant keywords READ keywords NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant language READ language NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant publisher READ publisher NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant copyright READ copyright NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant parentalRating READ parentalRating NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant ratingOrganisation READ ratingOrganisation NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant size READ size NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant mediaType READ mediaType NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant duration READ duration NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant audioBitRate READ audioBitRate NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant audioCodec READ audioCodec NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant averageLevel READ averageLevel NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant channelCount READ channelCount NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant peakValue READ peakValue NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant sampleRate READ sampleRate NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant albumTitle READ albumTitle NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant albumArtist READ albumArtist NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant contributingArtist READ contributingArtist NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant composer READ composer NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant conductor READ conductor NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant lyrics READ lyrics NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant mood READ mood NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant trackNumber READ trackNumber NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant trackCount READ trackCount NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant coverArtUrlSmall READ coverArtUrlSmall NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant coverArtUrlLarge READ coverArtUrlLarge NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant resolution READ resolution NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant pixelAspectRatio READ pixelAspectRatio NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant videoFrameRate READ videoFrameRate NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant videoBitRate READ videoBitRate NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant videoCodec READ videoCodec NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant posterUrl READ posterUrl NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant chapterNumber READ chapterNumber NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant director READ director NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant leadPerformer READ leadPerformer NOTIFY metaDataChanged)
- Q_PROPERTY(QVariant writer READ writer NOTIFY metaDataChanged)
-public:
- QDeclarativeMediaMetaData(QMetaDataReaderControl *control, QObject *parent = 0)
- : QObject(parent)
- , m_control(control)
- {
- }
-
- QVariant title() const { return m_control->metaData(QtMultimedia::Title); }
- QVariant subTitle() const { return m_control->metaData(QtMultimedia::SubTitle); }
- QVariant author() const { return m_control->metaData(QtMultimedia::Author); }
- QVariant comment() const { return m_control->metaData(QtMultimedia::Comment); }
- QVariant description() const { return m_control->metaData(QtMultimedia::Description); }
- QVariant category() const { return m_control->metaData(QtMultimedia::Category); }
- QVariant genre() const { return m_control->metaData(QtMultimedia::Genre); }
- QVariant year() const { return m_control->metaData(QtMultimedia::Year); }
- QVariant date() const { return m_control->metaData(QtMultimedia::Date); }
- QVariant userRating() const { return m_control->metaData(QtMultimedia::UserRating); }
- QVariant keywords() const { return m_control->metaData(QtMultimedia::Keywords); }
- QVariant language() const { return m_control->metaData(QtMultimedia::Language); }
- QVariant publisher() const { return m_control->metaData(QtMultimedia::Publisher); }
- QVariant copyright() const { return m_control->metaData(QtMultimedia::Copyright); }
- QVariant parentalRating() const { return m_control->metaData(QtMultimedia::ParentalRating); }
- QVariant ratingOrganisation() const {
- return m_control->metaData(QtMultimedia::RatingOrganisation); }
- QVariant size() const { return m_control->metaData(QtMultimedia::Size); }
- QVariant mediaType() const { return m_control->metaData(QtMultimedia::MediaType); }
- QVariant duration() const { return m_control->metaData(QtMultimedia::Duration); }
- QVariant audioBitRate() const { return m_control->metaData(QtMultimedia::AudioBitRate); }
- QVariant audioCodec() const { return m_control->metaData(QtMultimedia::AudioCodec); }
- QVariant averageLevel() const { return m_control->metaData(QtMultimedia::AverageLevel); }
- QVariant channelCount() const { return m_control->metaData(QtMultimedia::ChannelCount); }
- QVariant peakValue() const { return m_control->metaData(QtMultimedia::PeakValue); }
- QVariant sampleRate() const { return m_control->metaData(QtMultimedia::SampleRate); }
- QVariant albumTitle() const { return m_control->metaData(QtMultimedia::AlbumTitle); }
- QVariant albumArtist() const { return m_control->metaData(QtMultimedia::AlbumArtist); }
- QVariant contributingArtist() const {
- return m_control->metaData(QtMultimedia::ContributingArtist); }
- QVariant composer() const { return m_control->metaData(QtMultimedia::Composer); }
- QVariant conductor() const { return m_control->metaData(QtMultimedia::Conductor); }
- QVariant lyrics() const { return m_control->metaData(QtMultimedia::Lyrics); }
- QVariant mood() const { return m_control->metaData(QtMultimedia::Mood); }
- QVariant trackNumber() const { return m_control->metaData(QtMultimedia::TrackNumber); }
- QVariant trackCount() const { return m_control->metaData(QtMultimedia::TrackCount); }
- QVariant coverArtUrlSmall() const {
- return m_control->metaData(QtMultimedia::CoverArtUrlSmall); }
- QVariant coverArtUrlLarge() const {
- return m_control->metaData(QtMultimedia::CoverArtUrlLarge); }
- QVariant resolution() const { return m_control->metaData(QtMultimedia::Resolution); }
- QVariant pixelAspectRatio() const {
- return m_control->metaData(QtMultimedia::PixelAspectRatio); }
- QVariant videoFrameRate() const { return m_control->metaData(QtMultimedia::VideoFrameRate); }
- QVariant videoBitRate() const { return m_control->metaData(QtMultimedia::VideoBitRate); }
- QVariant videoCodec() const { return m_control->metaData(QtMultimedia::VideoCodec); }
- QVariant posterUrl() const { return m_control->metaData(QtMultimedia::PosterUrl); }
- QVariant chapterNumber() const { return m_control->metaData(QtMultimedia::ChapterNumber); }
- QVariant director() const { return m_control->metaData(QtMultimedia::Director); }
- QVariant leadPerformer() const { return m_control->metaData(QtMultimedia::LeadPerformer); }
- QVariant writer() const { return m_control->metaData(QtMultimedia::Writer); }
-
-Q_SIGNALS:
- void metaDataChanged();
-
-private:
- QMetaDataReaderControl *m_control;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeMediaMetaData))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativeradio.cpp b/src/imports/multimedia/qdeclarativeradio.cpp
deleted file mode 100644
index e2b495d..0000000
--- a/src/imports/multimedia/qdeclarativeradio.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeradio_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeRadio::QDeclarativeRadio(QObject *parent) :
- QObject(parent),
- m_radioTuner(0)
-{
- m_radioTuner = new QRadioTuner(this);
-
- connect(m_radioTuner, SIGNAL(stateChanged(QRadioTuner::State)), this, SLOT(_q_stateChanged(QRadioTuner::State)));
- connect(m_radioTuner, SIGNAL(bandChanged(QRadioTuner::Band)), this, SLOT(_q_bandChanged(QRadioTuner::Band)));
-
- connect(m_radioTuner, SIGNAL(frequencyChanged(int)), this, SIGNAL(frequencyChanged(int)));
- connect(m_radioTuner, SIGNAL(stereoStatusChanged(bool)), this, SIGNAL(stereoStatusChanged(bool)));
- connect(m_radioTuner, SIGNAL(searchingChanged(bool)), this, SIGNAL(searchingChanged(bool)));
- connect(m_radioTuner, SIGNAL(signalStrengthChanged(int)), this, SIGNAL(signalStrengthChanged(int)));
- connect(m_radioTuner, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int)));
- connect(m_radioTuner, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool)));
- connect(m_radioTuner, SIGNAL(stationFound(int, QString)), this, SIGNAL(stationFound(int, QString)));
-
- connect(m_radioTuner, SIGNAL(error(QRadioTuner::Error)), this, SLOT(_q_error(QRadioTuner::Error)));
-}
-
-QDeclarativeRadio::~QDeclarativeRadio()
-{
-}
-
-QDeclarativeRadio::State QDeclarativeRadio::state() const
-{
- return static_cast<QDeclarativeRadio::State>(m_radioTuner->state());
-}
-
-QDeclarativeRadio::Band QDeclarativeRadio::band() const
-{
- return static_cast<QDeclarativeRadio::Band>(m_radioTuner->band());
-}
-
-int QDeclarativeRadio::frequency() const
-{
- return m_radioTuner->frequency();
-}
-
-QDeclarativeRadio::StereoMode QDeclarativeRadio::stereoMode() const
-{
- return static_cast<QDeclarativeRadio::StereoMode>(m_radioTuner->stereoMode());
-}
-
-int QDeclarativeRadio::volume() const
-{
- return m_radioTuner->volume();
-}
-
-bool QDeclarativeRadio::muted() const
-{
- return m_radioTuner->isMuted();
-}
-
-bool QDeclarativeRadio::stereo() const
-{
- return m_radioTuner->isStereo();
-}
-
-int QDeclarativeRadio::signalStrength() const
-{
- return m_radioTuner->signalStrength();
-}
-
-bool QDeclarativeRadio::searching() const
-{
- return m_radioTuner->isSearching();
-}
-
-int QDeclarativeRadio::frequencyStep() const
-{
- return m_radioTuner->frequencyStep(m_radioTuner->band());
-}
-
-int QDeclarativeRadio::minimumFrequency() const
-{
- return m_radioTuner->frequencyRange(m_radioTuner->band()).first;
-}
-
-int QDeclarativeRadio::maximumFrequency() const
-{
- return m_radioTuner->frequencyRange(m_radioTuner->band()).second;
-}
-
-bool QDeclarativeRadio::isAvailable() const
-{
- return m_radioTuner->isAvailable();
-}
-
-void QDeclarativeRadio::setBand(QDeclarativeRadio::Band band)
-{
- m_radioTuner->setBand(static_cast<QRadioTuner::Band>(band));
-}
-
-void QDeclarativeRadio::setFrequency(int frequency)
-{
- m_radioTuner->setFrequency(frequency);
-}
-
-void QDeclarativeRadio::setStereoMode(QDeclarativeRadio::StereoMode stereoMode)
-{
- m_radioTuner->setStereoMode(static_cast<QRadioTuner::StereoMode>(stereoMode));
-}
-
-void QDeclarativeRadio::setVolume(int volume)
-{
- m_radioTuner->setVolume(volume);
-}
-
-void QDeclarativeRadio::setMuted(bool muted)
-{
- m_radioTuner->setMuted(muted);
-}
-
-void QDeclarativeRadio::cancelScan()
-{
- m_radioTuner->cancelSearch();
-}
-
-void QDeclarativeRadio::scanDown()
-{
- m_radioTuner->searchBackward();
-}
-
-void QDeclarativeRadio::scanUp()
-{
- m_radioTuner->searchForward();
-}
-
-void QDeclarativeRadio::searchAllStations(QDeclarativeRadio::SearchMode searchMode)
-{
- m_radioTuner->searchAllStations(static_cast<QRadioTuner::SearchMode>(searchMode));
-}
-
-void QDeclarativeRadio::tuneDown()
-{
- int f = frequency();
- f = f - frequencyStep();
- setFrequency(f);
-}
-
-void QDeclarativeRadio::tuneUp()
-{
- int f = frequency();
- f = f + frequencyStep();
- setFrequency(f);
-}
-
-void QDeclarativeRadio::start()
-{
- m_radioTuner->start();
-}
-
-void QDeclarativeRadio::stop()
-{
- m_radioTuner->stop();
-}
-
-void QDeclarativeRadio::_q_stateChanged(QRadioTuner::State state)
-{
- emit stateChanged(static_cast<QDeclarativeRadio::State>(state));
-}
-
-void QDeclarativeRadio::_q_bandChanged(QRadioTuner::Band band)
-{
- emit bandChanged(static_cast<QDeclarativeRadio::Band>(band));
-}
-
-void QDeclarativeRadio::_q_error(QRadioTuner::Error errorCode)
-{
- emit error(static_cast<QDeclarativeRadio::Error>(errorCode));
- emit errorChanged();
-}
diff --git a/src/imports/multimedia/qdeclarativeradio_p.h b/src/imports/multimedia/qdeclarativeradio_p.h
deleted file mode 100644
index d719f6f..0000000
--- a/src/imports/multimedia/qdeclarativeradio_p.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVERADIO_P_H
-#define QDECLARATIVERADIO_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtDeclarative/qdeclarative.h>
-#include <qradiotuner.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeRadio : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged)
- Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged)
- Q_PROPERTY(bool stereo READ stereo NOTIFY stereoStatusChanged)
- Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode)
- Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged)
- Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ muted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(bool searching READ searching NOTIFY searchingChanged)
- Q_PROPERTY(int frequencyStep READ frequencyStep NOTIFY bandChanged)
- Q_PROPERTY(int minimumFrequency READ minimumFrequency NOTIFY bandChanged)
- Q_PROPERTY(int maximumFrequency READ maximumFrequency NOTIFY bandChanged)
- Q_ENUMS(State)
- Q_ENUMS(Band)
- Q_ENUMS(Error)
- Q_ENUMS(StereoMode)
- Q_ENUMS(SearchMode)
-
-public:
- enum State {
- ActiveState = QRadioTuner::ActiveState,
- StoppedState = QRadioTuner::StoppedState
- };
-
- enum Band {
- AM = QRadioTuner::AM,
- FM = QRadioTuner::FM,
- SW = QRadioTuner::SW,
- LW = QRadioTuner::LW,
- FM2 = QRadioTuner::FM2
- };
-
- enum Error {
- NoError = QRadioTuner::NoError,
- ResourceError = QRadioTuner::ResourceError,
- OpenError = QRadioTuner::OpenError,
- OutOfRangeError = QRadioTuner::OutOfRangeError
- };
-
- enum StereoMode {
- ForceStereo = QRadioTuner::ForceStereo,
- ForceMono = QRadioTuner::ForceMono,
- Auto = QRadioTuner::Auto
- };
-
- enum SearchMode {
- SearchFast = QRadioTuner::SearchFast,
- SearchGetStationId = QRadioTuner::SearchGetStationId
- };
-
- QDeclarativeRadio(QObject *parent = 0);
- ~QDeclarativeRadio();
-
- QDeclarativeRadio::State state() const;
- QDeclarativeRadio::Band band() const;
- int frequency() const;
- QDeclarativeRadio::StereoMode stereoMode() const;
- int volume() const;
- bool muted() const;
-
- bool stereo() const;
- int signalStrength() const;
- bool searching() const;
-
- int frequencyStep() const;
- int minimumFrequency() const;
- int maximumFrequency() const;
-
- Q_INVOKABLE bool isAvailable() const;
-
-public Q_SLOTS:
- void setBand(QDeclarativeRadio::Band band);
- void setFrequency(int frequency);
- void setStereoMode(QDeclarativeRadio::StereoMode stereoMode);
- void setVolume(int volume);
- void setMuted(bool muted);
-
- void cancelScan();
- void scanDown();
- void scanUp();
- void tuneUp();
- void tuneDown();
- void searchAllStations(QDeclarativeRadio::SearchMode searchMode = QDeclarativeRadio::SearchFast );
-
- void start();
- void stop();
-
-Q_SIGNALS:
- void stateChanged(QDeclarativeRadio::State state);
- void bandChanged(QDeclarativeRadio::Band band);
- void frequencyChanged(int frequency);
- void stereoStatusChanged(bool stereo);
- void searchingChanged(bool searching);
- void signalStrengthChanged(int signalStrength);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void stationFound(int frequency, QString stationId);
-
- void errorChanged();
- void error(QDeclarativeRadio::Error errorCode);
-
-private Q_SLOTS:
- void _q_stateChanged(QRadioTuner::State state);
- void _q_bandChanged(QRadioTuner::Band band);
- void _q_error(QRadioTuner::Error errorCode);
-
-private:
- Q_DISABLE_COPY(QDeclarativeRadio)
-
- QRadioTuner *m_radioTuner;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadio))
-
-QT_END_HEADER
-
-#endif // QDECLARATIVERADIO_P_H
diff --git a/src/imports/multimedia/qdeclarativeradiodata.cpp b/src/imports/multimedia/qdeclarativeradiodata.cpp
deleted file mode 100644
index debea99..0000000
--- a/src/imports/multimedia/qdeclarativeradiodata.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativeradiodata_p.h"
-
-QT_BEGIN_NAMESPACE
-
-QDeclarativeRadioData::QDeclarativeRadioData(QObject *parent) :
- QObject(parent),
- m_radioData(0)
-{
- m_radioData = new QRadioData(this);
-
- connect(m_radioData, SIGNAL(programTypeChanged(QRadioData::ProgramType)), this,
- SLOT(_q_programTypeChanged(QRadioData::ProgramType)));
-
- connect(m_radioData, SIGNAL(stationIdChanged(QString)), this, SIGNAL(stationIdChanged(QString)));
- connect(m_radioData, SIGNAL(programTypeNameChanged(QString)), this, SIGNAL(programTypeNameChanged(QString)));
- connect(m_radioData, SIGNAL(stationNameChanged(QString)), this, SIGNAL(stationNameChanged(QString)));
- connect(m_radioData, SIGNAL(radioTextChanged(QString)), this, SIGNAL(radioTextChanged(QString)));
- connect(m_radioData, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), this,
- SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
-
- connect(m_radioData, SIGNAL(error(QRadioData::Error)), this, SLOT(_q_error(QRadioData::Error)));
-}
-
-QDeclarativeRadioData::~QDeclarativeRadioData()
-{
-}
-
-bool QDeclarativeRadioData::isAvailable() const
-{
- return m_radioData->isAvailable();
-}
-
-QString QDeclarativeRadioData::stationId() const
-{
- return m_radioData->stationId();
-}
-
-QDeclarativeRadioData::ProgramType QDeclarativeRadioData::programType() const
-{
- return static_cast<QDeclarativeRadioData::ProgramType>(m_radioData->programType());
-}
-
-QString QDeclarativeRadioData::programTypeName() const
-{
- return m_radioData->programTypeName();
-}
-
-QString QDeclarativeRadioData::stationName() const
-{
- return m_radioData->stationName();
-}
-
-QString QDeclarativeRadioData::radioText() const
-{
- return m_radioData->radioText();
-}
-
-bool QDeclarativeRadioData::alternativeFrequenciesEnabled() const
-{
- return m_radioData->isAlternativeFrequenciesEnabled();
-}
-
-void QDeclarativeRadioData::setAlternativeFrequenciesEnabled(bool enabled)
-{
- m_radioData->setAlternativeFrequenciesEnabled(enabled);
-}
-
-void QDeclarativeRadioData::_q_programTypeChanged(QRadioData::ProgramType programType)
-{
- emit programTypeChanged(static_cast<QDeclarativeRadioData::ProgramType>(programType));
-}
-
-void QDeclarativeRadioData::_q_error(QRadioData::Error errorCode)
-{
- emit error(static_cast<QDeclarativeRadioData::Error>(errorCode));
- emit errorChanged();
-}
diff --git a/src/imports/multimedia/qdeclarativeradiodata_p.h b/src/imports/multimedia/qdeclarativeradiodata_p.h
deleted file mode 100644
index fc43563..0000000
--- a/src/imports/multimedia/qdeclarativeradiodata_p.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVERADIODATA_P_H
-#define QDECLARATIVERADIODATA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtDeclarative/qdeclarative.h>
-#include <qradiodata.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QDeclarativeRadioData : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString stationId READ stationId NOTIFY stationIdChanged)
- Q_PROPERTY(QDeclarativeRadioData::ProgramType programType READ programType NOTIFY programTypeChanged)
- Q_PROPERTY(QString programTypeName READ programTypeName NOTIFY programTypeNameChanged)
- Q_PROPERTY(QString stationName READ stationName NOTIFY stationNameChanged)
- Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged)
- Q_PROPERTY(bool alternativeFrequenciesEnabled READ alternativeFrequenciesEnabled
- WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged)
- Q_ENUMS(Error)
- Q_ENUMS(ProgramType)
-
-public:
-
- enum Error {
- NoError = QRadioData::NoError,
- ResourceError = QRadioData::ResourceError,
- OpenError = QRadioData::OpenError,
- OutOfRangeError = QRadioData::OutOfRangeError
- };
-
- enum ProgramType {
- Undefined = QRadioData::Undefined,
- News = QRadioData::News,
- CurrentAffairs = QRadioData::CurrentAffairs,
- Information = QRadioData::Information,
- Sport = QRadioData::Sport,
- Education = QRadioData::Education,
- Drama = QRadioData::Drama,
- Culture = QRadioData::Culture,
- Science = QRadioData::Science,
- Varied = QRadioData::Varied,
- PopMusic = QRadioData::PopMusic,
- RockMusic = QRadioData::RockMusic,
- EasyListening = QRadioData::EasyListening,
- LightClassical = QRadioData::LightClassical,
- SeriousClassical = QRadioData::SeriousClassical,
- OtherMusic = QRadioData::OtherMusic,
- Weather = QRadioData::Weather,
- Finance = QRadioData::Finance,
- ChildrensProgrammes = QRadioData::ChildrensProgrammes,
- SocialAffairs = QRadioData::SocialAffairs,
- Religion = QRadioData::Religion,
- PhoneIn = QRadioData::PhoneIn,
- Travel = QRadioData::Travel,
- Leisure = QRadioData::Leisure,
- JazzMusic = QRadioData::JazzMusic,
- CountryMusic = QRadioData::CountryMusic,
- NationalMusic = QRadioData::NationalMusic,
- OldiesMusic = QRadioData::OldiesMusic,
- FolkMusic = QRadioData::FolkMusic,
- Documentary = QRadioData::Documentary,
- AlarmTest = QRadioData::AlarmTest,
- Alarm = QRadioData::Alarm,
- Talk = QRadioData::Talk,
- ClassicRock = QRadioData::ClassicRock,
- AdultHits = QRadioData::AdultHits,
- SoftRock = QRadioData::SoftRock,
- Top40 = QRadioData::Top40,
- Soft = QRadioData::Soft,
- Nostalgia = QRadioData::Nostalgia,
- Classical = QRadioData::Classical,
- RhythmAndBlues = QRadioData::RhythmAndBlues,
- SoftRhythmAndBlues = QRadioData::SoftRhythmAndBlues,
- Language = QRadioData::Language,
- ReligiousMusic = QRadioData::ReligiousMusic,
- ReligiousTalk = QRadioData::ReligiousTalk,
- Personality = QRadioData::Personality,
- Public = QRadioData::Public,
- College = QRadioData::College,
- };
-
- QDeclarativeRadioData(QObject *parent = 0);
- ~QDeclarativeRadioData();
-
- Q_INVOKABLE bool isAvailable() const;
-
- QString stationId() const;
- QDeclarativeRadioData::ProgramType programType() const;
- QString programTypeName() const;
- QString stationName() const;
- QString radioText() const;
- bool alternativeFrequenciesEnabled() const;
-
-public Q_SLOTS:
- void setAlternativeFrequenciesEnabled(bool enabled);
-
-Q_SIGNALS:
- void stationIdChanged(QString stationId);
- void programTypeChanged(QDeclarativeRadioData::ProgramType programType);
- void programTypeNameChanged(QString programTypeName);
- void stationNameChanged(QString stationName);
- void radioTextChanged(QString radioText);
- void alternativeFrequenciesEnabledChanged(bool enabled);
-
- void errorChanged();
- void error(QDeclarativeRadioData::Error errorCode);
-
-private Q_SLOTS:
- void _q_programTypeChanged(QRadioData::ProgramType programType);
- void _q_error(QRadioData::Error errorCode);
-
-private:
- Q_DISABLE_COPY(QDeclarativeRadioData)
-
- QRadioData *m_radioData;
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeRadioData))
-
-QT_END_HEADER
-
-#endif // QDECLARATIVERADIODATA_P_H
diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp
deleted file mode 100644
index 956d1d7..0000000
--- a/src/imports/multimedia/qdeclarativevideo.cpp
+++ /dev/null
@@ -1,951 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qdeclarativevideo_p.h"
-
-#include <qmediaplayercontrol.h>
-#include <qmediaservice.h>
-#include <private/qpaintervideosurface_p.h>
-#include <qvideorenderercontrol.h>
-
-
-QT_BEGIN_NAMESPACE
-
-
-void QDeclarativeVideo::_q_nativeSizeChanged(const QSizeF &size)
-{
- setImplicitWidth(size.width());
- setImplicitHeight(size.height());
-}
-
-void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString)
-{
- m_error = QMediaPlayer::Error(errorCode);
- m_errorString = errorString;
-
- emit error(Error(errorCode), errorString);
- emit errorChanged();
-}
-
-
-/*!
- \qmlclass Video QDeclarativeVideo
- \brief The Video element allows you to add videos to a scene.
- \inherits Item
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- \qml
- import Qt 4.7
- import QtMultimedia 4.0
-
- Video {
- id: video
- width : 800
- height : 600
- source: "video.avi"
-
- MouseArea {
- anchors.fill: parent
- onClicked: {
- video.play()
- }
- }
-
- focus: true
- Keys.onSpacePressed: video.paused = !video.paused
- Keys.onLeftPressed: video.position -= 5000
- Keys.onRightPressed: video.position += 5000
- }
- \endqml
-
- The Video item supports untransformed, stretched, and uniformly scaled video presentation.
- For a description of stretched uniformly scaled presentation, see the \l fillMode property
- description.
-
- The Video item is only visible when the \l hasVideo property is true and the video is playing.
-
- \sa Audio
-*/
-
-/*!
- \internal
- \class QDeclarativeVideo
- \brief The QDeclarativeVideo class provides a video item that you can add to a QDeclarativeView.
-*/
-
-QDeclarativeVideo::QDeclarativeVideo(QDeclarativeItem *parent)
- : QDeclarativeItem(parent)
- , m_graphicsItem(0)
-
-{
-}
-
-QDeclarativeVideo::~QDeclarativeVideo()
-{
- shutdown();
-
- delete m_graphicsItem;
-}
-
-/*!
- \qmlproperty url Video::source
-
- This property holds the source URL of the media.
-*/
-
-/*!
- \qmlproperty url Video::autoLoad
-
- This property indicates if loading of media should begin immediately.
-
- Defaults to true, if false media will not be loaded until playback is started.
-*/
-
-/*!
- \qmlproperty bool Video::playing
-
- This property holds whether the media is playing.
-
- Defaults to false, and can be set to true to start playback.
-*/
-
-/*!
- \qmlproperty bool Video::paused
-
- This property holds whether the media is paused.
-
- Defaults to false, and can be set to true to pause playback.
-*/
-
-/*!
- \qmlsignal Video::onStarted()
-
- This handler is called when playback is started.
-*/
-
-/*!
- \qmlsignal Video::onResumed()
-
- This handler is called when playback is resumed from the paused state.
-*/
-
-/*!
- \qmlsignal Video::onPaused()
-
- This handler is called when playback is paused.
-*/
-
-/*!
- \qmlsignal Video::onStopped()
-
- This handler is called when playback is stopped.
-*/
-
-/*!
- \qmlproperty enumeration Video::status
-
- This property holds the status of media loading. It can be one of:
-
- \list
- \o NoMedia - no media has been set.
- \o Loading - the media is currently being loaded.
- \o Loaded - the media has been loaded.
- \o Buffering - the media is buffering data.
- \o Stalled - playback has been interrupted while the media is buffering data.
- \o Buffered - the media has buffered data.
- \o EndOfMedia - the media has played to the end.
- \o InvalidMedia - the media cannot be played.
- \o UnknownStatus - the status of the media is cannot be determined.
- \endlist
-*/
-
-QDeclarativeVideo::Status QDeclarativeVideo::status() const
-{
- return Status(m_status);
-}
-
-/*!
- \qmlproperty int Video::duration
-
- This property holds the duration of the media in milliseconds.
-
- If the media doesn't have a fixed duration (a live stream for example) this will be 0.
-*/
-
-/*!
- \qmlproperty int Video::position
-
- This property holds the current playback position in milliseconds.
-*/
-
-/*!
- \qmlproperty real Video::volume
-
- This property holds the volume of the audio output, from 0.0 (silent) to 1.0 (maximum volume).
-*/
-
-/*!
- \qmlproperty bool Video::muted
-
- This property holds whether the audio output is muted.
-*/
-
-/*!
- \qmlproperty bool Video::hasAudio
-
- This property holds whether the media contains audio.
-*/
-
-bool QDeclarativeVideo::hasAudio() const
-{
- return !m_complete ? false : m_playerControl->isAudioAvailable();
-}
-
-/*!
- \qmlproperty bool Video::hasVideo
-
- This property holds whether the media contains video.
-*/
-
-bool QDeclarativeVideo::hasVideo() const
-{
- return !m_complete ? false : m_playerControl->isVideoAvailable();
-}
-
-/*!
- \qmlproperty real Video::bufferProgress
-
- This property holds how much of the data buffer is currently filled, from 0.0 (empty) to 1.0
- (full).
-*/
-
-/*!
- \qmlproperty bool Video::seekable
-
- This property holds whether position of the video can be changed.
-*/
-
-/*!
- \qmlproperty real Video::playbackRate
-
- This property holds the rate at which video is played at as a multiple of the normal rate.
-*/
-
-/*!
- \qmlproperty enumeration Video::error
-
- This property holds the error state of the video. It can be one of:
-
- \list
- \o NoError - there is no current error.
- \o ResourceError - the video cannot be played due to a problem allocating resources.
- \o FormatError - the video format is not supported.
- \o NetworkError - the video cannot be played due to network issues.
- \o AccessDenied - the video cannot be played due to insufficient permissions.
- \o ServiceMissing - the video cannot be played because the media service could not be
- instantiated.
- \endlist
-*/
-
-
-QDeclarativeVideo::Error QDeclarativeVideo::error() const
-{
- return Error(m_error);
-}
-
-/*!
- \qmlproperty string Video::errorString
-
- This property holds a string describing the current error condition in more detail.
-*/
-
-/*!
- \qmlsignal Video::onError(error, errorString)
-
- This handler is called when an \l {QMediaPlayer::Error}{error} has
- occurred. The errorString parameter may contain more detailed
- information about the error.
-*/
-
-/*!
- \qmlproperty enumeration Video::fillMode
-
- Set this property to define how the video is scaled to fit the target area.
-
- \list
- \o Stretch - the video is scaled to fit.
- \o PreserveAspectFit - the video is scaled uniformly to fit without cropping
- \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary
- \endlist
-
- The default fill mode is PreserveAspectFit.
-*/
-
-QDeclarativeVideo::FillMode QDeclarativeVideo::fillMode() const
-{
- return FillMode(m_graphicsItem->aspectRatioMode());
-}
-
-void QDeclarativeVideo::setFillMode(FillMode mode)
-{
- m_graphicsItem->setAspectRatioMode(Qt::AspectRatioMode(mode));
-}
-
-/*!
- \qmlmethod Video::play()
-
- Starts playback of the media.
-
- Sets the \l playing property to true, and the \l paused property to false.
-*/
-
-void QDeclarativeVideo::play()
-{
- if (!m_complete)
- return;
-
- setPaused(false);
- setPlaying(true);
-}
-
-/*!
- \qmlmethod Video::pause()
-
- Pauses playback of the media.
-
- Sets the \l playing and \l paused properties to true.
-*/
-
-void QDeclarativeVideo::pause()
-{
- if (!m_complete)
- return;
-
- setPaused(true);
- setPlaying(true);
-}
-
-/*!
- \qmlmethod Video::stop()
-
- Stops playback of the media.
-
- Sets the \l playing and \l paused properties to false.
-*/
-
-void QDeclarativeVideo::stop()
-{
- if (!m_complete)
- return;
-
- setPlaying(false);
- setPaused(false);
-}
-
-void QDeclarativeVideo::paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
-{
-}
-
-void QDeclarativeVideo::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
-{
- m_graphicsItem->setSize(newGeometry.size());
-
- QDeclarativeItem::geometryChanged(newGeometry, oldGeometry);
-}
-
-void QDeclarativeVideo::classBegin()
-{
- m_graphicsItem = new QGraphicsVideoItem(this);
- connect(m_graphicsItem, SIGNAL(nativeSizeChanged(QSizeF)),
- this, SLOT(_q_nativeSizeChanged(QSizeF)));
-
- setObject(this);
-
- if (m_mediaService) {
- connect(m_playerControl, SIGNAL(audioAvailableChanged(bool)),
- this, SIGNAL(hasAudioChanged()));
- connect(m_playerControl, SIGNAL(videoAvailableChanged(bool)),
- this, SIGNAL(hasVideoChanged()));
-
- m_mediaObject->bind(m_graphicsItem);
- }
-}
-
-void QDeclarativeVideo::componentComplete()
-{
- QDeclarativeMediaBase::componentComplete();
-}
-
-QT_END_NAMESPACE
-
-// ***************************************
-// Documentation for meta-data properties.
-// ***************************************
-
-/*!
- \qmlproperty variant Video::metaData.title
-
- This property holds the tile of the media.
-
- \sa {QtMultimedia::Title}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.subTitle
-
- This property holds the sub-title of the media.
-
- \sa {QtMultimedia::SubTitle}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.author
-
- This property holds the author of the media.
-
- \sa {QtMultimedia::Author}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.comment
-
- This property holds a user comment about the media.
-
- \sa {QtMultimedia::Comment}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.description
-
- This property holds a description of the media.
-
- \sa {QtMultimedia::Description}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.category
-
- This property holds the category of the media
-
- \sa {QtMultimedia::Category}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.genre
-
- This property holds the genre of the media.
-
- \sa {QtMultimedia::Genre}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.year
-
- This property holds the year of release of the media.
-
- \sa {QtMultimedia::Year}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.date
-
- This property holds the date of the media.
-
- \sa {QtMultimedia::Date}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.userRating
-
- This property holds a user rating of the media in the range of 0 to 100.
-
- \sa {QtMultimedia::UserRating}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.keywords
-
- This property holds a list of keywords describing the media.
-
- \sa {QtMultimedia::Keywords}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.language
-
- This property holds the language of the media, as an ISO 639-2 code.
-
- \sa {QtMultimedia::Language}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.publisher
-
- This property holds the publisher of the media.
-
- \sa {QtMultimedia::Publisher}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.copyright
-
- This property holds the media's copyright notice.
-
- \sa {QtMultimedia::Copyright}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.parentalRating
-
- This property holds the parental rating of the media.
-
- \sa {QtMultimedia::ParentalRating}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.ratingOrganisation
-
- This property holds the name of the rating organisation responsible for the
- parental rating of the media.
-
- \sa {QtMultimedia::RatingOrganisation}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.size
-
- This property property holds the size of the media in bytes.
-
- \sa {QtMultimedia::Size}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.mediaType
-
- This property holds the type of the media.
-
- \sa {QtMultimedia::MediaType}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.audioBitRate
-
- This property holds the bit rate of the media's audio stream ni bits per
- second.
-
- \sa {QtMultimedia::AudioBitRate}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.audioCodec
-
- This property holds the encoding of the media audio stream.
-
- \sa {QtMultimedia::AudioCodec}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.averageLevel
-
- This property holds the average volume level of the media.
-
- \sa {QtMultimedia::AverageLevel}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.channelCount
-
- This property holds the number of channels in the media's audio stream.
-
- \sa {QtMultimedia::ChannelCount}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.peakValue
-
- This property holds the peak volume of media's audio stream.
-
- \sa {QtMultimedia::PeakValue}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.sampleRate
-
- This property holds the sample rate of the media's audio stream in hertz.
-
- \sa {QtMultimedia::SampleRate}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.albumTitle
-
- This property holds the title of the album the media belongs to.
-
- \sa {QtMultimedia::AlbumTitle}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.albumArtist
-
- This property holds the name of the principal artist of the album the media
- belongs to.
-
- \sa {QtMultimedia::AlbumArtist}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.contributingArtist
-
- This property holds the names of artists contributing to the media.
-
- \sa {QtMultimedia::ContributingArtist}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.composer
-
- This property holds the composer of the media.
-
- \sa {QtMultimedia::Composer}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.conductor
-
- This property holds the conductor of the media.
-
- \sa {QtMultimedia::Conductor}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.lyrics
-
- This property holds the lyrics to the media.
-
- \sa {QtMultimedia::Lyrics}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.mood
-
- This property holds the mood of the media.
-
- \sa {QtMultimedia::Mood}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.trackNumber
-
- This property holds the track number of the media.
-
- \sa {QtMultimedia::TrackNumber}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.trackCount
-
- This property holds the number of track on the album containing the media.
-
- \sa {QtMultimedia::TrackNumber}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.coverArtUrlSmall
-
- This property holds the URL of a small cover art image.
-
- \sa {QtMultimedia::CoverArtUrlSmall}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.coverArtUrlLarge
-
- This property holds the URL of a large cover art image.
-
- \sa {QtMultimedia::CoverArtUrlLarge}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.resolution
-
- This property holds the dimension of an image or video.
-
- \sa {QtMultimedia::Resolution}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.pixelAspectRatio
-
- This property holds the pixel aspect ratio of an image or video.
-
- \sa {QtMultimedia::PixelAspectRatio}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.videoFrameRate
-
- This property holds the frame rate of the media's video stream.
-
- \sa {QtMultimedia::VideoFrameRate}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.videoBitRate
-
- This property holds the bit rate of the media's video stream in bits per
- second.
-
- \sa {QtMultimedia::VideoBitRate}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.videoCodec
-
- This property holds the encoding of the media's video stream.
-
- \sa {QtMultimedia::VideoCodec}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.posterUrl
-
- This property holds the URL of a poster image.
-
- \sa {QtMultimedia::PosterUrl}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.chapterNumber
-
- This property holds the chapter number of the media.
-
- \sa {QtMultimedia::ChapterNumber}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.director
-
- This property holds the director of the media.
-
- \sa {QtMultimedia::Director}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.leadPerformer
-
- This property holds the lead performer in the media.
-
- \sa {QtMultimedia::LeadPerformer}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.writer
-
- This property holds the writer of the media.
-
- \sa {QtMultimedia::Writer}
-*/
-
-// The remaining properties are related to photos, and are technically
-// available but will certainly never have values.
-#ifndef Q_QDOC
-
-/*!
- \qmlproperty variant Video::metaData.cameraManufacturer
-
- \sa {QtMultimedia::CameraManufacturer}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.cameraModel
-
- \sa {QtMultimedia::CameraModel}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.event
-
- \sa {QtMultimedia::Event}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.subject
-
- \sa {QtMultimedia::Subject}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.orientation
-
- \sa {QtMultimedia::Orientation}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.exposureTime
-
- \sa {QtMultimedia::ExposureTime}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.fNumber
-
- \sa {QtMultimedia::FNumber}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.exposureProgram
-
- \sa {QtMultimedia::ExposureProgram}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.isoSpeedRatings
-
- \sa {QtMultimedia::ISOSpeedRatings}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.exposureBiasValue
-
- \sa {QtMultimedia::ExposureBiasValue}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.dateTimeDigitized
-
- \sa {QtMultimedia::DateTimeDigitized}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.subjectDistance
-
- \sa {QtMultimedia::SubjectDistance}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.meteringMode
-
- \sa {QtMultimedia::MeteringMode}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.lightSource
-
- \sa {QtMultimedia::LightSource}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.flash
-
- \sa {QtMultimedia::Flash}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.focalLength
-
- \sa {QtMultimedia::FocalLength}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.exposureMode
-
- \sa {QtMultimedia::ExposureMode}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.whiteBalance
-
- \sa {QtMultimedia::WhiteBalance}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.DigitalZoomRatio
-
- \sa {QtMultimedia::DigitalZoomRatio}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.focalLengthIn35mmFilm
-
- \sa {QtMultimedia::FocalLengthIn35mmFile}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.sceneCaptureType
-
- \sa {QtMultimedia::SceneCaptureType}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.gainControl
-
- \sa {QtMultimedia::GainControl}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.contrast
-
- \sa {QtMultimedia::contrast}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.saturation
-
- \sa {QtMultimedia::Saturation}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.sharpness
-
- \sa {QtMultimedia::Sharpness}
-*/
-
-/*!
- \qmlproperty variant Video::metaData.deviceSettingDescription
-
- \sa {QtMultimedia::DeviceSettingDescription}
-*/
-
-#endif
-
-#include "moc_qdeclarativevideo_p.cpp"
diff --git a/src/imports/multimedia/qdeclarativevideo_p.h b/src/imports/multimedia/qdeclarativevideo_p.h
deleted file mode 100644
index 2375825..0000000
--- a/src/imports/multimedia/qdeclarativevideo_p.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIDEO_H
-#define QDECLARATIVEVIDEO_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qdeclarativemediabase_p.h"
-
-#include <qgraphicsvideoitem.h>
-
-#include <QtCore/qbasictimer.h>
-#include <QtQuick1/qdeclarativeitem.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class QTimerEvent;
-class QVideoSurfaceFormat;
-
-
-class QDeclarativeVideo : public QDeclarativeItem, public QDeclarativeMediaBase
-{
- Q_OBJECT
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(bool autoLoad READ isAutoLoad WRITE setAutoLoad NOTIFY autoLoadChanged)
- Q_PROPERTY(bool playing READ isPlaying WRITE setPlaying NOTIFY playingChanged)
- Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(int duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(int position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(bool hasAudio READ hasAudio NOTIFY hasAudioChanged)
- Q_PROPERTY(bool hasVideo READ hasVideo NOTIFY hasVideoChanged)
- Q_PROPERTY(int bufferProgress READ bufferProgress NOTIFY bufferProgressChanged)
- Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged)
- Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
- Q_PROPERTY(Error error READ error NOTIFY errorChanged)
- Q_PROPERTY(QString errorString READ errorString NOTIFY errorChanged)
- Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode)
- Q_PROPERTY(QDeclarativeMediaMetaData *metaData READ metaData CONSTANT)
- Q_ENUMS(FillMode)
- Q_ENUMS(Status)
- Q_ENUMS(Error)
-public:
- enum FillMode
- {
- Stretch = Qt::IgnoreAspectRatio,
- PreserveAspectFit = Qt::KeepAspectRatio,
- PreserveAspectCrop = Qt::KeepAspectRatioByExpanding
- };
-
- enum Status
- {
- UnknownStatus = QMediaPlayer::UnknownMediaStatus,
- NoMedia = QMediaPlayer::NoMedia,
- Loading = QMediaPlayer::LoadingMedia,
- Loaded = QMediaPlayer::LoadedMedia,
- Stalled = QMediaPlayer::StalledMedia,
- Buffering = QMediaPlayer::BufferingMedia,
- Buffered = QMediaPlayer::BufferedMedia,
- EndOfMedia = QMediaPlayer::EndOfMedia,
- InvalidMedia = QMediaPlayer::InvalidMedia
- };
-
- enum Error
- {
- NoError = QMediaPlayer::NoError,
- ResourceError = QMediaPlayer::ResourceError,
- FormatError = QMediaPlayer::FormatError,
- NetworkError = QMediaPlayer::NetworkError,
- AccessDenied = QMediaPlayer::AccessDeniedError,
- ServiceMissing = QMediaPlayer::ServiceMissingError
- };
-
- QDeclarativeVideo(QDeclarativeItem *parent = 0);
- ~QDeclarativeVideo();
-
- bool hasAudio() const;
- bool hasVideo() const;
-
- FillMode fillMode() const;
- void setFillMode(FillMode mode);
-
- Status status() const;
- Error error() const;
-
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
-
- void classBegin();
- void componentComplete();
-
-public Q_SLOTS:
- void play();
- void pause();
- void stop();
-
-Q_SIGNALS:
- void sourceChanged();
- void autoLoadChanged();
- void playingChanged();
- void pausedChanged();
- void loopCountChanged();
-
- void started();
- void resumed();
- void paused();
- void stopped();
-
- void statusChanged();
-
- void durationChanged();
- void positionChanged();
-
- void volumeChanged();
- void mutedChanged();
- void hasAudioChanged();
- void hasVideoChanged();
-
- void bufferProgressChanged();
-
- void seekableChanged();
- void playbackRateChanged();
-
- void errorChanged();
- void error(QDeclarativeVideo::Error error, const QString &errorString);
-
-protected:
- void geometryChanged(const QRectF &geometry, const QRectF &);
-
-private Q_SLOTS:
- void _q_nativeSizeChanged(const QSizeF &size);
- void _q_error(int, const QString &);
-
-private:
- Q_DISABLE_COPY(QDeclarativeVideo)
-
- QGraphicsVideoItem *m_graphicsItem;
-
- Q_PRIVATE_SLOT(mediaBase(), void _q_statusChanged())
-
- inline QDeclarativeMediaBase *mediaBase() { return this; }
-};
-
-QT_END_NAMESPACE
-
-QML_DECLARE_TYPE(QT_PREPEND_NAMESPACE(QDeclarativeVideo))
-
-QT_END_HEADER
-
-#endif
diff --git a/src/imports/multimedia/qdeclarativevideooutput.cpp b/src/imports/multimedia/qdeclarativevideooutput.cpp
deleted file mode 100644
index 2371fdb..0000000
--- a/src/imports/multimedia/qdeclarativevideooutput.cpp
+++ /dev/null
@@ -1,366 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qdeclarativevideooutput_p.h"
-
-#include "qsgvideonode_p.h"
-#include "qsgvideonode_i420.h"
-#include "qsgvideonode_rgb.h"
-
-#include <QtDeclarative/qquickitem.h>
-
-#include <QtMultimedia/QAbstractVideoSurface>
-#include <QtMultimedia/qmediaservice.h>
-#include <QtMultimedia/qvideorenderercontrol.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-
-#include <QtCore/qmetaobject.h>
-
-//#define DEBUG_VIDEOITEM
-
-class QSGVideoItemSurface : public QAbstractVideoSurface
-{
-public:
- QSGVideoItemSurface(QDeclarativeVideoOutput *item, QObject *parent = 0) :
- QAbstractVideoSurface(parent),
- m_item(item)
- {
- }
-
- ~QSGVideoItemSurface()
- {
- }
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const
- {
- QList<QVideoFrame::PixelFormat> formats;
-
- foreach (QSGVideoNodeFactory* factory, m_item->m_videoNodeFactories) {
- formats.append(factory->supportedPixelFormats(handleType));
- }
-
- return formats;
- }
-
- bool start(const QVideoSurfaceFormat &format)
- {
-#ifdef DEBUG_VIDEOITEM
- qDebug() << Q_FUNC_INFO << format;
-#endif
-
- if (!supportedPixelFormats(format.handleType()).contains(format.pixelFormat()))
- return false;
-
- return QAbstractVideoSurface::start(format);
- }
-
- virtual bool present(const QVideoFrame &frame)
- {
- if (!frame.isValid()) {
- qWarning() << Q_FUNC_INFO << "I'm getting bad frames here...";
- return false;
- }
- m_item->present(frame);
- return true;
- }
-
-private:
- QDeclarativeVideoOutput *m_item;
-};
-
-/*!
- \qmlclass VideoOutput QDeclarativeVideoOutput
- \brief The VideoOutput element allows you to render video or camera viewfinder.
-
- \ingroup qml-multimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- \qml
- import QtQuick 2.0
- import QtMultimedia 4.0
-
- Rectangle {
- width: 800
- height: 600
- color: "black"
-
- MediaPlayer {
- id: player
- source: "file://video.webm"
- playing: true
- }
-
- VideoOutput {
- id: videoOutput
- source: player
- anchors.fill: parent
- }
- }
-
- \endqml
-
- The VideoOutput item supports untransformed, stretched, and uniformly scaled video presentation.
- For a description of stretched uniformly scaled presentation, see the \l fillMode property
- description.
-
- \sa MediaPlayer, Camera
-*/
-
-/*!
- \internal
- \class QDeclarativeVideoOutput
- \brief The QDeclarativeVideoOutput class provides a video output item.
-*/
-
-QDeclarativeVideoOutput::QDeclarativeVideoOutput(QQuickItem *parent) :
- QQuickItem(parent),
- m_fillMode(PreserveAspectFit)
-{
- setFlag(ItemHasContents, true);
- m_surface = new QSGVideoItemSurface(this);
- connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SLOT(_q_updateNativeSize(QVideoSurfaceFormat)), Qt::QueuedConnection);
-
- m_videoNodeFactories.append(new QSGVideoNodeFactory_I420);
- m_videoNodeFactories.append(new QSGVideoNodeFactory_RGB);
-}
-
-QDeclarativeVideoOutput::~QDeclarativeVideoOutput()
-{
- m_source.clear();
- _q_updateMediaObject();
- delete m_surface;
- qDeleteAll(m_videoNodeFactories);
-}
-
-/*!
- \qmlproperty variant VideoOutput::source
-
- This property holds the source item providing the video frames like MediaPlayer or Camera.
-*/
-
-void QDeclarativeVideoOutput::setSource(QObject *source)
-{
-#ifdef DEBUG_VIDEOITEM
- qDebug() << Q_FUNC_INFO << source;
-#endif
-
- if (source == m_source.data())
- return;
-
- if (m_source)
- disconnect(0, m_source.data(), SLOT(_q_updateMediaObject()));
-
- m_source = source;
-
- if (m_source) {
- const QMetaObject *metaObject = m_source.data()->metaObject();
- const QMetaProperty mediaObjectProperty = metaObject->property(
- metaObject->indexOfProperty("mediaObject"));
-
- if (mediaObjectProperty.hasNotifySignal()) {
- QMetaMethod method = mediaObjectProperty.notifySignal();
- QMetaObject::connect(m_source.data(), method.methodIndex(),
- this, this->metaObject()->indexOfSlot("updateMediaObject()"),
- Qt::DirectConnection, 0);
-
- }
- }
-
- _q_updateMediaObject();
- emit sourceChanged();
-}
-
-void QDeclarativeVideoOutput::_q_updateMediaObject()
-{
- QMediaObject *mediaObject = 0;
-
- if (m_source)
- mediaObject = qobject_cast<QMediaObject*>(m_source.data()->property("mediaObject").value<QObject*>());
-
-#ifdef DEBUG_VIDEOITEM
- qDebug() << Q_FUNC_INFO << mediaObject;
-#endif
-
- if (m_mediaObject.data() == mediaObject)
- return;
-
- if (m_rendererControl) {
- m_rendererControl.data()->setSurface(0);
- m_service.data()->releaseControl(m_rendererControl.data());
- }
-
- m_mediaObject = mediaObject;
- m_mediaObject.clear();
- m_service.clear();
- m_rendererControl.clear();
-
- if (mediaObject) {
- if (QMediaService *service = mediaObject->service()) {
- if (QMediaControl *control = service->requestControl(QVideoRendererControl_iid)) {
- if ((m_rendererControl = qobject_cast<QVideoRendererControl *>(control))) {
- m_service = service;
- m_mediaObject = mediaObject;
- m_rendererControl.data()->setSurface(m_surface);
- } else {
- qWarning() << Q_FUNC_INFO << "Media service has no renderer control available";
- service->releaseControl(control);
- }
- }
- }
- }
-}
-
-void QDeclarativeVideoOutput::present(const QVideoFrame &frame)
-{
- m_frame = frame;
- update();
-}
-
-/*!
- \qmlproperty enumeration VideoOutput::fillMode
-
- Set this property to define how the video is scaled to fit the target area.
-
- \list
- \o Stretch - the video is scaled to fit.
- \o PreserveAspectFit - the video is scaled uniformly to fit without cropping
- \o PreserveAspectCrop - the video is scaled uniformly to fill, cropping if necessary
- \endlist
-
- The default fill mode is PreserveAspectFit.
-*/
-
-QDeclarativeVideoOutput::FillMode QDeclarativeVideoOutput::fillMode() const
-{
- return m_fillMode;
-}
-
-void QDeclarativeVideoOutput::setFillMode(FillMode mode)
-{
- if (mode == m_fillMode)
- return;
-
- m_fillMode = mode;
- update();
-
- emit fillModeChanged(mode);
-}
-
-void QDeclarativeVideoOutput::_q_updateNativeSize(const QVideoSurfaceFormat &format)
-{
- const QSize &size = format.sizeHint();
- if (m_nativeSize != size) {
- m_nativeSize = size;
-
- setImplicitWidth(size.width());
- setImplicitHeight(size.height());
- }
-}
-
-void QDeclarativeVideoOutput::_q_updateGeometry()
-{
- QRectF rect(0, 0, width(), height());
-
- if (m_nativeSize.isEmpty()) {
- //this is necessary for item to receive the
- //first paint event and configure video surface.
- m_boundingRect = rect;
- m_sourceRect = QRectF(0, 0, 1, 1);
- } else if (m_fillMode == Stretch) {
- m_boundingRect = rect;
- m_sourceRect = QRectF(0, 0, 1, 1);
- } else if (m_fillMode == PreserveAspectFit) {
- QSizeF size = m_nativeSize;
- size.scale(rect.size(), Qt::KeepAspectRatio);
-
- m_boundingRect = QRectF(0, 0, size.width(), size.height());
- m_boundingRect.moveCenter(rect.center());
-
- m_sourceRect = QRectF(0, 0, 1, 1);
- } else if (m_fillMode == PreserveAspectCrop) {
- m_boundingRect = rect;
-
- QSizeF size = rect.size();
- size.scale(m_nativeSize, Qt::KeepAspectRatio);
-
- m_sourceRect = QRectF(
- 0, 0, size.width() / m_nativeSize.width(), size.height() / m_nativeSize.height());
- m_sourceRect.moveCenter(QPointF(0.5, 0.5));
- }
-}
-
-QSGNode *QDeclarativeVideoOutput::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
-{
- QSGVideoNode *videoNode = static_cast<QSGVideoNode *>(oldNode);
-
- if (videoNode && videoNode->pixelFormat() != m_frame.pixelFormat()) {
-#ifdef DEBUG_VIDEOITEM
- qDebug() << "updatePaintNode: deleting old video node because frame format changed...";
-#endif
- delete videoNode;
- videoNode = 0;
- }
-
- if (!m_frame.isValid()) {
-#ifdef DEBUG_VIDEOITEM
- qDebug() << "updatePaintNode: no frames yet... aborting...";
-#endif
- return 0;
- }
-
- if (videoNode == 0) {
- foreach (QSGVideoNodeFactory* factory, m_videoNodeFactories) {
- videoNode = factory->createNode(m_surface->surfaceFormat());
- if (videoNode)
- break;
- }
- }
-
- if (videoNode == 0)
- return 0;
-
- _q_updateGeometry();
- videoNode->setTexturedRectGeometry(m_boundingRect, m_sourceRect);
- videoNode->setCurrentFrame(m_frame);
- return videoNode;
-}
diff --git a/src/imports/multimedia/qdeclarativevideooutput_p.h b/src/imports/multimedia/qdeclarativevideooutput_p.h
deleted file mode 100644
index 80170f1..0000000
--- a/src/imports/multimedia/qdeclarativevideooutput_p.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QDECLARATIVEVIDEOOUTPUT_P_H
-#define QDECLARATIVEVIDEOOUTPUT_P_H
-
-#include <qquickitem.h>
-
-#include <QtMultimedia/qvideoframe.h>
-#include <QtMultimedia/qmediaobject.h>
-
-#include <QtCore/qsharedpointer.h>
-
-#include "qsgvideonode_p.h"
-
-class QSGVideoItemSurface;
-class QVideoRendererControl;
-class QMediaService;
-class QVideoSurfaceFormat;
-
-class QDeclarativeVideoOutput : public QQuickItem
-{
- Q_OBJECT
- Q_DISABLE_COPY(QDeclarativeVideoOutput)
- Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(FillMode fillMode READ fillMode WRITE setFillMode NOTIFY fillModeChanged)
- Q_ENUMS(FillMode)
-
-public:
- enum FillMode
- {
- Stretch = Qt::IgnoreAspectRatio,
- PreserveAspectFit = Qt::KeepAspectRatio,
- PreserveAspectCrop = Qt::KeepAspectRatioByExpanding
- };
-
- QDeclarativeVideoOutput(QQuickItem *parent = 0);
- ~QDeclarativeVideoOutput();
-
- QObject *source() const { return m_source.data(); }
- void setSource(QObject *source);
-
- FillMode fillMode() const;
- void setFillMode(FillMode mode);
-
-Q_SIGNALS:
- void sourceChanged();
- void fillModeChanged(QDeclarativeVideoOutput::FillMode);
-
-protected:
- QSGNode *updatePaintNode(QSGNode *, UpdatePaintNodeData *);
-
-private Q_SLOTS:
- void _q_updateMediaObject();
- void _q_updateNativeSize(const QVideoSurfaceFormat&);
- void _q_updateGeometry();
-
-private:
- void present(const QVideoFrame &frame);
-
- friend class QSGVideoItemSurface;
-
- QWeakPointer<QObject> m_source;
- QWeakPointer<QMediaObject> m_mediaObject;
- QWeakPointer<QMediaService> m_service;
- QWeakPointer<QVideoRendererControl> m_rendererControl;
-
- QList<QSGVideoNodeFactory*> m_videoNodeFactories;
- QSGVideoItemSurface *m_surface;
- QVideoFrame m_frame;
- FillMode m_fillMode;
- QSize m_nativeSize;
- QRectF m_boundingRect;
- QRectF m_sourceRect;
-};
-
-#endif // QDECLARATIVEVIDEOOUTPUT_H
diff --git a/src/imports/multimedia/qmldir b/src/imports/multimedia/qmldir
deleted file mode 100644
index 91caaba..0000000
--- a/src/imports/multimedia/qmldir
+++ /dev/null
@@ -1 +0,0 @@
-plugin declarative_multimedia
diff --git a/src/imports/multimedia/qmldir.qtmultimediakit b/src/imports/multimedia/qmldir.qtmultimediakit
deleted file mode 100644
index 4942048..0000000
--- a/src/imports/multimedia/qmldir.qtmultimediakit
+++ /dev/null
@@ -1 +0,0 @@
-plugin declarative_multimedia ../../QtMultimedia
diff --git a/src/imports/multimedia/qsgvideonode.cpp b/src/imports/multimedia/qsgvideonode.cpp
deleted file mode 100644
index 712caff..0000000
--- a/src/imports/multimedia/qsgvideonode.cpp
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsgvideonode_p.h"
-
-QSGVideoNode::QSGVideoNode()
-{
-}
-
-void QSGVideoNode::setTexturedRectGeometry(const QRectF &rect, const QRectF &textureRect)
-{
- if (rect == m_rect && textureRect == m_textureRect)
- return;
-
- m_rect = rect;
- m_textureRect = textureRect;
-
- QSGGeometry *g = geometry();
-
- if (g == 0) {
- g = new QSGGeometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4);
- QSGGeometry::updateTexturedRectGeometry(g, rect, textureRect);
- setGeometry(g);
- } else {
- QSGGeometry::updateTexturedRectGeometry(g, rect, textureRect);
- }
-
- markDirty(DirtyGeometry);
-}
diff --git a/src/imports/multimedia/qsgvideonode_i420.cpp b/src/imports/multimedia/qsgvideonode_i420.cpp
deleted file mode 100644
index 11135c1..0000000
--- a/src/imports/multimedia/qsgvideonode_i420.cpp
+++ /dev/null
@@ -1,296 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qsgvideonode_i420.h"
-#include <QtDeclarative/qsgtexturematerial.h>
-#include <QtDeclarative/qsgmaterial.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-#include <QtOpenGL/qglshaderprogram.h>
-
-QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_I420::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- QList<QVideoFrame::PixelFormat> formats;
-
- if (handleType == QAbstractVideoBuffer::NoHandle)
- formats << QVideoFrame::Format_YUV420P << QVideoFrame::Format_YV12;
-
- return formats;
-}
-
-QSGVideoNode *QSGVideoNodeFactory_I420::createNode(const QVideoSurfaceFormat &format)
-{
- if (supportedPixelFormats(format.handleType()).contains(format.pixelFormat()))
- return new QSGVideoNode_I420(format);
-
- return 0;
-}
-
-
-class QSGVideoMaterialShader_YUV420 : public QSGMaterialShader
-{
-public:
- void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
-
- virtual char const *const *attributeNames() const {
- static const char *names[] = {
- "qt_VertexPosition",
- "qt_VertexTexCoord",
- 0
- };
- return names;
- }
-
-protected:
-
- virtual const char *vertexShader() const {
- const char *shader =
- "uniform highp mat4 qt_Matrix; \n"
- "attribute highp vec4 qt_VertexPosition; \n"
- "attribute highp vec2 qt_VertexTexCoord; \n"
- "varying highp vec2 qt_TexCoord; \n"
- "void main() { \n"
- " qt_TexCoord = qt_VertexTexCoord; \n"
- " gl_Position = qt_Matrix * qt_VertexPosition; \n"
- "}";
- return shader;
- }
-
- virtual const char *fragmentShader() const {
- static const char *shader =
- "uniform sampler2D yTexture;"
- "uniform sampler2D uTexture;"
- "uniform sampler2D vTexture;"
- "uniform mediump mat4 colorMatrix;"
- "uniform lowp float opacity;"
- ""
- "varying highp vec2 qt_TexCoord;"
- ""
- "void main()"
- "{"
- " mediump float Y = texture2D(yTexture, qt_TexCoord).r;"
- " mediump float U = texture2D(uTexture, qt_TexCoord).r;"
- " mediump float V = texture2D(vTexture, qt_TexCoord).r;"
- " mediump vec4 color = vec4(Y, U, V, 1.);"
- " gl_FragColor = colorMatrix * color * opacity;"
- "}";
- return shader;
- }
-
- virtual void initialize() {
- m_id_matrix = program()->uniformLocation("qt_Matrix");
- m_id_yTexture = program()->uniformLocation("yTexture");
- m_id_uTexture = program()->uniformLocation("uTexture");
- m_id_vTexture = program()->uniformLocation("vTexture");
- m_id_colorMatrix = program()->uniformLocation("colorMatrix");
- m_id_opacity = program()->uniformLocation("opacity");
- }
-
- int m_id_matrix;
- int m_id_yTexture;
- int m_id_uTexture;
- int m_id_vTexture;
- int m_id_colorMatrix;
- int m_id_opacity;
-};
-
-
-class QSGVideoMaterial_YUV420 : public QSGMaterial
-{
-public:
- QSGVideoMaterial_YUV420(const QVideoSurfaceFormat &format)
- {
- switch (format.yCbCrColorSpace()) {
- case QVideoSurfaceFormat::YCbCr_JPEG:
- colorMatrix = QMatrix4x4(
- 1.0, 0.000, 1.402, -0.701,
- 1.0, -0.344, -0.714, 0.529,
- 1.0, 1.772, 0.000, -0.886,
- 0.0, 0.000, 0.000, 1.0000);
- break;
- case QVideoSurfaceFormat::YCbCr_BT709:
- case QVideoSurfaceFormat::YCbCr_xvYCC709:
- colorMatrix = QMatrix4x4(
- 1.164, 0.000, 1.793, -0.5727,
- 1.164, -0.534, -0.213, 0.3007,
- 1.164, 2.115, 0.000, -1.1302,
- 0.0, 0.000, 0.000, 1.0000);
- break;
- default: //BT 601:
- colorMatrix = QMatrix4x4(
- 1.164, 0.000, 1.596, -0.8708,
- 1.164, -0.392, -0.813, 0.5296,
- 1.164, 2.017, 0.000, -1.081,
- 0.0, 0.000, 0.000, 1.0000);
- }
-
- setFlag(Blending, false);
- }
-
- virtual QSGMaterialType *type() const {
- static QSGMaterialType theType;
- return &theType;
- }
-
- virtual QSGMaterialShader *createShader() const {
- return new QSGVideoMaterialShader_YUV420;
- }
-
- virtual int compare(const QSGMaterial *other) const {
- const QSGVideoMaterial_YUV420 *m = static_cast<const QSGVideoMaterial_YUV420 *>(other);
- int d = idY - m->idY;
- if (d)
- return d;
- else if ((d = idU - m->idU) != 0)
- return d;
- else
- return idV - m->idV;
- }
-
- void updateBlending() {
- setFlag(Blending, qFuzzyCompare(opacity, 1.0) ? false : true);
- }
-
- GLuint idY;
- GLuint idU;
- GLuint idV;
- qreal opacity;
- QMatrix4x4 colorMatrix;
-};
-
-
-QSGVideoNode_I420::QSGVideoNode_I420(const QVideoSurfaceFormat &format) :
- m_width(0),
- m_height(0),
- m_format(format)
-{
- m_material = new QSGVideoMaterial_YUV420(format);
- setMaterial(m_material);
- m_material->opacity = 1;
-}
-
-QSGVideoNode_I420::~QSGVideoNode_I420()
-{
- if (m_width != 0 && m_height != 0)
- glDeleteTextures(3, m_id);
-}
-
-void QSGVideoNode_I420::setCurrentFrame(const QVideoFrame &frame)
-{
- m_frame = frame;
-
- m_frame.map(QAbstractVideoBuffer::ReadOnly);
-
- int fw = frame.width();
- int fh = frame.height();
-
- // Frame has changed size, recreate textures...
- if (fw != m_width || fh != m_height) {
- if (m_width != 0 && m_height != 0)
- glDeleteTextures(3, m_id);
- glGenTextures(3, m_id);
- m_width = fw;
- m_height = fh;
-
- m_material->idY = m_id[0];
- m_material->idU = m_id[1];
- m_material->idV = m_id[2];
- }
-
- const uchar *bits = frame.bits();
- int bpl = frame.bytesPerLine();
- int bpl2 = (bpl / 2 + 3) & ~3;
- int offsetU = bpl * fh;
- int offsetV = bpl * fh + bpl2 * fh / 2;
-
- if (m_frame.pixelFormat() == QVideoFrame::Format_YV12)
- qSwap(offsetU, offsetV);
-
- bindTexture(m_id[0], GL_TEXTURE0, fw, fh, bits);
- bindTexture(m_id[1], GL_TEXTURE1, fw/2, fh / 2, bits + offsetU);
- bindTexture(m_id[2], GL_TEXTURE2, fw/2, fh / 2, bits + offsetV);
-
- m_frame.unmap();
-
- markDirty(DirtyMaterial);
-}
-
-void QSGVideoNode_I420::bindTexture(int id, int unit, int w, int h, const uchar *bits)
-{
- QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
- functions->glActiveTexture(unit);
- glBindTexture(GL_TEXTURE_2D, id);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, w, h, 0, GL_LUMINANCE, GL_UNSIGNED_BYTE, bits);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-}
-
-
-void QSGVideoMaterialShader_YUV420::updateState(const RenderState &state,
- QSGMaterial *newMaterial,
- QSGMaterial *oldMaterial)
-{
- Q_UNUSED(oldMaterial);
-
- QOpenGLFunctions *functions = state.context()->functions();
- QSGVideoMaterial_YUV420 *mat = static_cast<QSGVideoMaterial_YUV420 *>(newMaterial);
- program()->setUniformValue(m_id_yTexture, 0);
- program()->setUniformValue(m_id_uTexture, 1);
- program()->setUniformValue(m_id_vTexture, 2);
-
- functions->glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, mat->idY);
- functions->glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, mat->idU);
- functions->glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D, mat->idV);
-
- program()->setUniformValue(m_id_colorMatrix, mat->colorMatrix);
- if (state.isOpacityDirty()) {
- mat->opacity = state.opacity();
- program()->setUniformValue(m_id_opacity, GLfloat(mat->opacity));
- }
-
- if (state.isMatrixDirty())
- program()->setUniformValue(m_id_matrix, state.combinedMatrix());
-}
diff --git a/src/imports/multimedia/qsgvideonode_i420.h b/src/imports/multimedia/qsgvideonode_i420.h
deleted file mode 100644
index b02864a..0000000
--- a/src/imports/multimedia/qsgvideonode_i420.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGVIDEONODE_I420_H
-#define QSGVIDEONODE_I420_H
-
-#include "qsgvideonode_p.h"
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-class QSGVideoMaterial_YUV420;
-class QSGVideoNode_I420 : public QSGVideoNode
-{
-public:
- QSGVideoNode_I420(const QVideoSurfaceFormat &format);
- ~QSGVideoNode_I420();
-
- virtual QVideoFrame::PixelFormat pixelFormat() const {
- return m_format.pixelFormat();
- }
- void setCurrentFrame(const QVideoFrame &frame);
-
-private:
- void bindTexture(int id, int unit, int w, int h, const uchar *bits);
-
- int m_width;
- int m_height;
- GLuint m_id[3];
-
- QVideoSurfaceFormat m_format;
- QSGVideoMaterial_YUV420 *m_material;
- QVideoFrame m_frame;
-};
-
-class QSGVideoNodeFactory_I420 : public QSGVideoNodeFactory {
-public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
- QSGVideoNode *createNode(const QVideoSurfaceFormat &format);
-};
-
-
-#endif // QSGVIDEONODE_I420_H
diff --git a/src/imports/multimedia/qsgvideonode_p.h b/src/imports/multimedia/qsgvideonode_p.h
deleted file mode 100644
index 466b456..0000000
--- a/src/imports/multimedia/qsgvideonode_p.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGVIDEONODE_P_H
-#define QSGVIDEONODE_P_H
-
-#include <QtDeclarative/qsgnode.h>
-
-#include <QtMultimedia/qvideoframe.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-#include <QtOpenGL/qglfunctions.h>
-
-class QSGVideoNode : public QSGGeometryNode
-{
-public:
- QSGVideoNode();
-
- virtual void setCurrentFrame(const QVideoFrame &frame) = 0;
- virtual QVideoFrame::PixelFormat pixelFormat() const = 0;
-
- void setTexturedRectGeometry(const QRectF &boundingRect, const QRectF &textureRect);
-
-private:
- QRectF m_rect;
- QRectF m_textureRect;
-};
-
-class QSGVideoNodeFactory {
-public:
- virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const = 0;
- virtual QSGVideoNode *createNode(const QVideoSurfaceFormat &format) = 0;
-};
-
-#endif // QSGVIDEONODE_H
diff --git a/src/imports/multimedia/qsgvideonode_rgb.cpp b/src/imports/multimedia/qsgvideonode_rgb.cpp
deleted file mode 100644
index 41d778e..0000000
--- a/src/imports/multimedia/qsgvideonode_rgb.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "qsgvideonode_rgb.h"
-#include <QtDeclarative/qsgtexturematerial.h>
-#include <QtDeclarative/qsgmaterial.h>
-#include <QtGui/QOpenGLContext>
-#include <QtGui/QOpenGLFunctions>
-#include <QtOpenGL/qglshaderprogram.h>
-
-QList<QVideoFrame::PixelFormat> QSGVideoNodeFactory_RGB::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- QList<QVideoFrame::PixelFormat> pixelFormats;
-
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- pixelFormats.append(QVideoFrame::Format_RGB565);
- pixelFormats.append(QVideoFrame::Format_RGB32);
- pixelFormats.append(QVideoFrame::Format_ARGB32);
- pixelFormats.append(QVideoFrame::Format_BGR32);
- pixelFormats.append(QVideoFrame::Format_BGRA32);
- }
-
- return pixelFormats;
-}
-
-QSGVideoNode *QSGVideoNodeFactory_RGB::createNode(const QVideoSurfaceFormat &format)
-{
- if (supportedPixelFormats(format.handleType()).contains(format.pixelFormat()))
- return new QSGVideoNode_RGB(format);
-
- return 0;
-}
-
-
-class QSGVideoMaterialShader_RGB : public QSGMaterialShader
-{
-public:
- QSGVideoMaterialShader_RGB(QVideoFrame::PixelFormat pixelFormat)
- : QSGMaterialShader(),
- m_pixelFormat(pixelFormat)
- {
- }
-
- void updateState(const RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial);
-
- virtual char const *const *attributeNames() const {
- static const char *names[] = {
- "qt_VertexPosition",
- "qt_VertexTexCoord",
- 0
- };
- return names;
- }
-
-protected:
-
- virtual const char *vertexShader() const {
- const char *shader =
- "uniform highp mat4 qt_Matrix; \n"
- "attribute highp vec4 qt_VertexPosition; \n"
- "attribute highp vec2 qt_VertexTexCoord; \n"
- "varying highp vec2 qt_TexCoord; \n"
- "void main() { \n"
- " qt_TexCoord = qt_VertexTexCoord; \n"
- " gl_Position = qt_Matrix * qt_VertexPosition; \n"
- "}";
- return shader;
- }
-
- virtual const char *fragmentShader() const {
- static const char *shader =
- "uniform sampler2D rgbTexture;"
- "uniform lowp float opacity;"
- ""
- "varying highp vec2 qt_TexCoord;"
- ""
- "void main()"
- "{"
- " gl_FragColor = texture2D(rgbTexture, qt_TexCoord) * opacity;"
- "}";
-
- static const char *colorsSwapShader =
- "uniform sampler2D rgbTexture;"
- "uniform lowp float opacity;"
- ""
- "varying highp vec2 qt_TexCoord;"
- ""
- "void main()"
- "{"
- " gl_FragColor = vec4(texture2D(rgbTexture, qt_TexCoord).bgr, 1.0) * opacity;"
- "}";
-
-
- switch (m_pixelFormat) {
- case QVideoFrame::Format_RGB32:
- case QVideoFrame::Format_ARGB32:
- return colorsSwapShader;
- default:
- return shader;
- }
- }
-
- virtual void initialize() {
- m_id_matrix = program()->uniformLocation("qt_Matrix");
- m_id_rgbTexture = program()->uniformLocation("rgbTexture");
- m_id_opacity = program()->uniformLocation("opacity");
- }
-
- int m_id_matrix;
- int m_id_rgbTexture;
- int m_id_opacity;
- QVideoFrame::PixelFormat m_pixelFormat;
-};
-
-
-class QSGVideoMaterial_RGB : public QSGMaterial
-{
-public:
- QSGVideoMaterial_RGB(const QVideoSurfaceFormat &format) :
- m_format(format),
- m_textureId(0),
- m_opacity(1.0)
- {
- setFlag(Blending, false);
- }
-
- ~QSGVideoMaterial_RGB()
- {
- if (m_textureId)
- glDeleteTextures(1, &m_textureId);
- }
-
- virtual QSGMaterialType *type() const {
- static QSGMaterialType theType;
- return &theType;
- }
-
- virtual QSGMaterialShader *createShader() const {
- return new QSGVideoMaterialShader_RGB(m_format.pixelFormat());
- }
-
- virtual int compare(const QSGMaterial *other) const {
- const QSGVideoMaterial_RGB *m = static_cast<const QSGVideoMaterial_RGB *>(other);
- return m_textureId - m->m_textureId;
- }
-
- void updateBlending() {
- setFlag(Blending, qFuzzyCompare(m_opacity, qreal(1.0)) ? false : true);
- }
-
- void setVideoFrame(const QVideoFrame &frame) {
- m_frame = frame;
- }
-
- void bind()
- {
- QOpenGLFunctions *functions = QOpenGLContext::currentContext()->functions();
-
- if (m_frame.isValid() && m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
- if (m_textureSize != m_frame.size()) {
- if (!m_textureSize.isEmpty())
- glDeleteTextures(1, &m_textureId);
- glGenTextures(1, &m_textureId);
- m_textureSize = m_frame.size();
- }
-
- GLint dataType = GL_UNSIGNED_BYTE;
- GLint dataFormat = GL_RGBA;
-
- if (m_frame.pixelFormat() == QVideoFrame::Format_RGB565) {
- dataType = GL_UNSIGNED_SHORT_5_6_5;
- dataFormat = GL_RGB;
- }
-
- functions->glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_textureId);
- glTexImage2D(GL_TEXTURE_2D, 0, dataFormat,
- m_textureSize.width(), m_textureSize.height(),
- 0, dataFormat, dataType, m_frame.bits());
-
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
-
- m_frame.unmap();
- m_frame = QVideoFrame();
- } else {
- functions->glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_textureId);
- }
- }
-
- QVideoFrame m_frame;
- QSize m_textureSize;
- QVideoSurfaceFormat m_format;
- GLuint m_textureId;
- qreal m_opacity;
-};
-
-
-QSGVideoNode_RGB::QSGVideoNode_RGB(const QVideoSurfaceFormat &format) :
- m_format(format)
-{
- m_material = new QSGVideoMaterial_RGB(format);
- setMaterial(m_material);
-}
-
-QSGVideoNode_RGB::~QSGVideoNode_RGB()
-{
-}
-
-void QSGVideoNode_RGB::setCurrentFrame(const QVideoFrame &frame)
-{
- m_material->setVideoFrame(frame);
- markDirty(DirtyMaterial);
-}
-
-void QSGVideoMaterialShader_RGB::updateState(const RenderState &state,
- QSGMaterial *newMaterial,
- QSGMaterial *oldMaterial)
-{
- Q_UNUSED(oldMaterial);
- QSGVideoMaterial_RGB *mat = static_cast<QSGVideoMaterial_RGB *>(newMaterial);
- program()->setUniformValue(m_id_rgbTexture, 0);
-
- mat->bind();
-
- if (state.isOpacityDirty()) {
- mat->m_opacity = state.opacity();
- mat->updateBlending();
- program()->setUniformValue(m_id_opacity, GLfloat(mat->m_opacity));
- }
-
- if (state.isMatrixDirty())
- program()->setUniformValue(m_id_matrix, state.combinedMatrix());
-}
diff --git a/src/imports/multimedia/qsgvideonode_rgb.h b/src/imports/multimedia/qsgvideonode_rgb.h
deleted file mode 100644
index cd82adc..0000000
--- a/src/imports/multimedia/qsgvideonode_rgb.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSGVIDEONODE_RGB_H
-#define QSGVIDEONODE_RGB_H
-
-#include "qsgvideonode_p.h"
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-class QSGVideoMaterial_RGB;
-
-class QSGVideoNode_RGB : public QSGVideoNode
-{
-public:
- QSGVideoNode_RGB(const QVideoSurfaceFormat &format);
- ~QSGVideoNode_RGB();
-
- virtual QVideoFrame::PixelFormat pixelFormat() const {
- return m_format.pixelFormat();
- }
- void setCurrentFrame(const QVideoFrame &frame);
-
-private:
- QVideoSurfaceFormat m_format;
- QSGVideoMaterial_RGB *m_material;
- QVideoFrame m_frame;
-};
-
-class QSGVideoNodeFactory_RGB : public QSGVideoNodeFactory {
-public:
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(QAbstractVideoBuffer::HandleType handleType) const;
- QSGVideoNode *createNode(const QVideoSurfaceFormat &format);
-};
-
-
-#endif // QSGVIDEONODE_RGB_H
diff --git a/src/imports/qimportbase.pri b/src/imports/qimportbase.pri
deleted file mode 100644
index 999bc5c..0000000
--- a/src/imports/qimportbase.pri
+++ /dev/null
@@ -1,30 +0,0 @@
-load(qt_module)
-
-TEMPLATE = lib
-CONFIG += qt plugin
-
-win32|mac:!win32-msvc:!macx-xcode:CONFIG += debug_and_release
-
-isEmpty(TARGETPATH) {
- error("qimportbase.pri: You must provide a TARGETPATH!")
-}
-isEmpty(TARGET) {
- error("qimportbase.pri: You must provide a TARGET!")
-}
-
-QMLDIRFILE = $${_PRO_FILE_PWD_}/qmldir
-copy2build.input = QMLDIRFILE
-copy2build.output = $$QT.multimedia.imports/$$TARGETPATH/qmldir
-!contains(TEMPLATE_PREFIX, vc):copy2build.variable_out = PRE_TARGETDEPS
-copy2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
-copy2build.name = COPY ${QMAKE_FILE_IN}
-copy2build.CONFIG += no_link
-# `clean' should leave the build in a runnable state, which means it shouldn't delete qmldir
-copy2build.CONFIG += no_clean
-QMAKE_EXTRA_COMPILERS += copy2build
-
-TARGET = $$qtLibraryTarget($$TARGET)
-contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
-
-load(qt_targets)
-
diff --git a/src/multimedia/audio/audio.pri b/src/multimedia/audio/audio.pri
deleted file mode 100644
index 86c379d..0000000
--- a/src/multimedia/audio/audio.pri
+++ /dev/null
@@ -1,60 +0,0 @@
-INCLUDEPATH += audio
-
-PUBLIC_HEADERS += audio/qaudio.h \
- audio/qaudioformat.h \
- audio/qaudioinput.h \
- audio/qaudiooutput.h \
- audio/qaudiodeviceinfo.h \
- audio/qaudiosystemplugin.h \
- audio/qaudiosystem.h
-
-PRIVATE_HEADERS += audio/qaudiodevicefactory_p.h audio/qaudiopluginloader_p.h
-
-
-SOURCES += audio/qaudio.cpp \
- audio/qaudioformat.cpp \
- audio/qaudiodeviceinfo.cpp \
- audio/qaudiooutput.cpp \
- audio/qaudioinput.cpp \
- audio/qaudiosystemplugin.cpp \
- audio/qaudiosystem.cpp \
- audio/qaudiodevicefactory.cpp \
- audio/qaudiopluginloader.cpp
-
-mac {
- PRIVATE_HEADERS += audio/qaudioinput_mac_p.h \
- audio/qaudiooutput_mac_p.h \
- audio/qaudiodeviceinfo_mac_p.h \
- audio/qaudio_mac_p.h
-
- SOURCES += audio/qaudiodeviceinfo_mac_p.cpp \
- audio/qaudiooutput_mac_p.cpp \
- audio/qaudioinput_mac_p.cpp \
- audio/qaudio_mac.cpp
-
- LIBS += -framework ApplicationServices -framework CoreAudio -framework AudioUnit -framework AudioToolbox
-}
-
-win32 {
- PRIVATE_HEADERS += audio/qaudioinput_win32_p.h audio/qaudiooutput_win32_p.h audio/qaudiodeviceinfo_win32_p.h
- SOURCES += audio/qaudiodeviceinfo_win32_p.cpp \
- audio/qaudiooutput_win32_p.cpp \
- audio/qaudioinput_win32_p.cpp
- LIBS += -lwinmm -lstrmiids -lole32 -loleaut32
-}
-
-unix:!mac {
- contains(config_test_pulseaudio, yes) {
- DEFINES += QT_NO_AUDIO_BACKEND
- }
- else:contains(config_test_alsa, yes) {
- linux-*|freebsd-*|openbsd-* {
- DEFINES += HAS_ALSA
- PRIVATE_HEADERS += audio/qaudiooutput_alsa_p.h audio/qaudioinput_alsa_p.h audio/qaudiodeviceinfo_alsa_p.h
- SOURCES += audio/qaudiodeviceinfo_alsa_p.cpp \
- audio/qaudiooutput_alsa_p.cpp \
- audio/qaudioinput_alsa_p.cpp
- LIBS_PRIVATE += -lasound
- }
- }
-}
diff --git a/src/multimedia/audio/qaudio.cpp b/src/multimedia/audio/qaudio.cpp
deleted file mode 100644
index bb18f84..0000000
--- a/src/multimedia/audio/qaudio.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include <qaudio.h>
-
-
-QT_BEGIN_NAMESPACE
-
-namespace QAudio
-{
-
-class RegisterMetaTypes
-{
-public:
- RegisterMetaTypes()
- {
- qRegisterMetaType<QAudio::Error>();
- qRegisterMetaType<QAudio::State>();
- qRegisterMetaType<QAudio::Mode>();
- }
-
-} _register;
-
-}
-
-/*
- \namespace QAudio
- \brief The QAudio namespace contains enums used by the audio classes.
- \inmodule QtMultimedia
- \ingroup multimedia
-*/
-
-/*
- \enum QAudio::Error
-
- \value NoError No errors have occurred
- \value OpenError An error occurred opening the audio device
- \value IOError An error occurred during read/write of audio device
- \value UnderrunError Audio data is not being fed to the audio device at a fast enough rate
- \value FatalError A non-recoverable error has occurred, the audio device is not usable at this time.
-*/
-
-/*
- \enum QAudio::State
-
- \value ActiveState Audio data is being processed, this state is set after start() is called
- and while audio data is available to be processed.
- \value SuspendedState The audio device is in a suspended state, this state will only be entered
- after suspend() is called.
- \value StoppedState The audio device is closed, and is not processing any audio data
- \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
- is set after start() is called and while no audio data is available to be processed.
-*/
-
-/*
- \enum QAudio::Mode
-
- \value AudioOutput audio output device
- \value AudioInput audio input device
-*/
-
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudio.h b/src/multimedia/audio/qaudio.h
deleted file mode 100644
index fff1094..0000000
--- a/src/multimedia/audio/qaudio.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIO_H
-#define QAUDIO_H
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-//QTM_SYNC_HEADER_EXPORT QAudio
-
-namespace QAudio
-{
- enum Error { NoError, OpenError, IOError, UnderrunError, FatalError };
- enum State { ActiveState, SuspendedState, StoppedState, IdleState };
- enum Mode { AudioInput, AudioOutput };
-}
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-Q_DECLARE_METATYPE(QAudio::Error)
-Q_DECLARE_METATYPE(QAudio::State)
-Q_DECLARE_METATYPE(QAudio::Mode)
-
-#endif // QAUDIO_H
diff --git a/src/multimedia/audio/qaudio_mac.cpp b/src/multimedia/audio/qaudio_mac.cpp
deleted file mode 100644
index 4615083..0000000
--- a/src/multimedia/audio/qaudio_mac.cpp
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaudio_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-// Debugging
-QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat)
-{
- dbg.nospace() << "QAudioFormat(" <<
- audioFormat.frequency() << "," <<
- audioFormat.channels() << "," <<
- audioFormat.sampleSize()<< "," <<
- audioFormat.codec() << "," <<
- audioFormat.byteOrder() << "," <<
- audioFormat.sampleType() << ")";
-
- return dbg.space();
-}
-
-
-// Conversion
-QAudioFormat toQAudioFormat(AudioStreamBasicDescription const& sf)
-{
- QAudioFormat audioFormat;
-
- audioFormat.setFrequency(sf.mSampleRate);
- audioFormat.setChannels(sf.mChannelsPerFrame);
- audioFormat.setSampleSize(sf.mBitsPerChannel);
- audioFormat.setCodec(QString::fromLatin1("audio/pcm"));
- audioFormat.setByteOrder((sf.mFormatFlags & kAudioFormatFlagIsBigEndian) != 0 ? QAudioFormat::BigEndian : QAudioFormat::LittleEndian);
- QAudioFormat::SampleType type = QAudioFormat::UnSignedInt;
- if ((sf.mFormatFlags & kAudioFormatFlagIsSignedInteger) != 0)
- type = QAudioFormat::SignedInt;
- else if ((sf.mFormatFlags & kAudioFormatFlagIsFloat) != 0)
- type = QAudioFormat::Float;
- audioFormat.setSampleType(type);
-
- return audioFormat;
-}
-
-AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& audioFormat)
-{
- AudioStreamBasicDescription sf;
-
- sf.mFormatFlags = kAudioFormatFlagIsPacked;
- sf.mSampleRate = audioFormat.frequency();
- sf.mFramesPerPacket = 1;
- sf.mChannelsPerFrame = audioFormat.channels();
- sf.mBitsPerChannel = audioFormat.sampleSize();
- sf.mBytesPerFrame = sf.mChannelsPerFrame * (sf.mBitsPerChannel / 8);
- sf.mBytesPerPacket = sf.mFramesPerPacket * sf.mBytesPerFrame;
- sf.mFormatID = kAudioFormatLinearPCM;
-
- switch (audioFormat.sampleType()) {
- case QAudioFormat::SignedInt: sf.mFormatFlags |= kAudioFormatFlagIsSignedInteger; break;
- case QAudioFormat::UnSignedInt: /* default */ break;
- case QAudioFormat::Float: sf.mFormatFlags |= kAudioFormatFlagIsFloat; break;
- case QAudioFormat::Unknown: default: break;
- }
-
- if (audioFormat.byteOrder() == QAudioFormat::BigEndian)
- sf.mFormatFlags |= kAudioFormatFlagIsBigEndian;
-
- return sf;
-}
-
-// QAudioRingBuffer
-QAudioRingBuffer::QAudioRingBuffer(int bufferSize):
- m_bufferSize(bufferSize)
-{
- m_buffer = new char[m_bufferSize];
- reset();
-}
-
-QAudioRingBuffer::~QAudioRingBuffer()
-{
- delete m_buffer;
-}
-
-int QAudioRingBuffer::used() const
-{
- return m_bufferUsed;
-}
-
-int QAudioRingBuffer::free() const
-{
- return m_bufferSize - m_bufferUsed;
-}
-
-int QAudioRingBuffer::size() const
-{
- return m_bufferSize;
-}
-
-void QAudioRingBuffer::reset()
-{
- m_readPos = 0;
- m_writePos = 0;
- m_bufferUsed = 0;
-}
-
-QT_END_NAMESPACE
-
-
diff --git a/src/multimedia/audio/qaudio_mac_p.h b/src/multimedia/audio/qaudio_mac_p.h
deleted file mode 100644
index 06ce430..0000000
--- a/src/multimedia/audio/qaudio_mac_p.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QAUDIO_MAC_P_H
-#define QAUDIO_MAC_P_H
-
-#include <CoreAudio/CoreAudio.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qatomic.h>
-
-#include <qaudioformat.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-extern QDebug operator<<(QDebug dbg, const QAudioFormat& audioFormat);
-
-extern QAudioFormat toQAudioFormat(const AudioStreamBasicDescription& streamFormat);
-extern AudioStreamBasicDescription toAudioStreamBasicDescription(QAudioFormat const& audioFormat);
-
-class QAudioRingBuffer
-{
-public:
- typedef QPair<char*, int> Region;
-
- QAudioRingBuffer(int bufferSize);
- ~QAudioRingBuffer();
-
- Region acquireReadRegion(int size)
- {
- const int used = m_bufferUsed.fetchAndAddAcquire(0);
-
- if (used > 0) {
- const int readSize = qMin(size, qMin(m_bufferSize - m_readPos, used));
-
- return readSize > 0 ? Region(m_buffer + m_readPos, readSize) : Region(0, 0);
- }
-
- return Region(0, 0);
- }
-
- void releaseReadRegion(Region const& region)
- {
- m_readPos = (m_readPos + region.second) % m_bufferSize;
-
- m_bufferUsed.fetchAndAddRelease(-region.second);
- }
-
- Region acquireWriteRegion(int size)
- {
- const int free = m_bufferSize - m_bufferUsed.fetchAndAddAcquire(0);
-
- if (free > 0) {
- const int writeSize = qMin(size, qMin(m_bufferSize - m_writePos, free));
-
- return writeSize > 0 ? Region(m_buffer + m_writePos, writeSize) : Region(0, 0);
- }
-
- return Region(0, 0);
- }
-
- void releaseWriteRegion(Region const& region)
- {
- m_writePos = (m_writePos + region.second) % m_bufferSize;
-
- m_bufferUsed.fetchAndAddRelease(region.second);
- }
-
- int used() const;
- int free() const;
- int size() const;
-
- void reset();
-
-private:
- int m_bufferSize;
- int m_readPos;
- int m_writePos;
- char* m_buffer;
- QAtomicInt m_bufferUsed;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIO_MAC_P_H
-
-
diff --git a/src/multimedia/audio/qaudiodevicefactory.cpp b/src/multimedia/audio/qaudiodevicefactory.cpp
deleted file mode 100644
index 19071e7..0000000
--- a/src/multimedia/audio/qaudiodevicefactory.cpp
+++ /dev/null
@@ -1,288 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-
-#include "qaudiosystem.h"
-#include "qaudiosystemplugin.h"
-
-#include "qaudiopluginloader_p.h"
-#include "qaudiodevicefactory_p.h"
-
-#ifndef QT_NO_AUDIO_BACKEND
-#if defined(Q_OS_WIN)
-#include "qaudiodeviceinfo_win32_p.h"
-#include "qaudiooutput_win32_p.h"
-#include "qaudioinput_win32_p.h"
-#elif defined(Q_OS_MAC)
-#include "qaudiodeviceinfo_mac_p.h"
-#include "qaudiooutput_mac_p.h"
-#include "qaudioinput_mac_p.h"
-#elif defined(HAS_ALSA)
-#include "qaudiodeviceinfo_alsa_p.h"
-#include "qaudiooutput_alsa_p.h"
-#include "qaudioinput_alsa_p.h"
-#endif
-#endif
-
-QT_BEGIN_NAMESPACE
-
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
-Q_GLOBAL_STATIC_WITH_ARGS(QAudioPluginLoader, audioLoader,
- (QAudioSystemFactoryInterface_iid, QLatin1String("/audio"), Qt::CaseInsensitive))
-#endif
-
-class QNullDeviceInfo : public QAbstractAudioDeviceInfo
-{
-public:
- QAudioFormat preferredFormat() const { qWarning()<<"using null deviceinfo, none available"; return QAudioFormat(); }
- bool isFormatSupported(const QAudioFormat& ) const { return false; }
- QAudioFormat nearestFormat(const QAudioFormat& ) const { return QAudioFormat(); }
- QString deviceName() const { return QString(); }
- QStringList supportedCodecs() { return QStringList(); }
- QList<int> supportedSampleRates() { return QList<int>(); }
- QList<int> supportedChannelCounts() { return QList<int>(); }
- QList<int> supportedSampleSizes() { return QList<int>(); }
- QList<QAudioFormat::Endian> supportedByteOrders() { return QList<QAudioFormat::Endian>(); }
- QList<QAudioFormat::SampleType> supportedSampleTypes() { return QList<QAudioFormat::SampleType>(); }
-};
-
-class QNullInputDevice : public QAbstractAudioInput
-{
-public:
- void start(QIODevice*) { qWarning()<<"using null input device, none available";}
- QIODevice* start() { qWarning()<<"using null input device, none available"; return 0; }
- void stop() {}
- void reset() {}
- void suspend() {}
- void resume() {}
- int bytesReady() const { return 0; }
- int periodSize() const { return 0; }
- void setBufferSize(int ) {}
- int bufferSize() const { return 0; }
- void setNotifyInterval(int ) {}
- int notifyInterval() const { return 0; }
- qint64 processedUSecs() const { return 0; }
- qint64 elapsedUSecs() const { return 0; }
- QAudio::Error error() const { return QAudio::OpenError; }
- QAudio::State state() const { return QAudio::StoppedState; }
- void setFormat(const QAudioFormat&) {}
- QAudioFormat format() const { return QAudioFormat(); }
-};
-
-class QNullOutputDevice : public QAbstractAudioOutput
-{
-public:
- void start(QIODevice*) {qWarning()<<"using null output device, none available";}
- QIODevice* start() { qWarning()<<"using null output device, none available"; return 0; }
- void stop() {}
- void reset() {}
- void suspend() {}
- void resume() {}
- int bytesFree() const { return 0; }
- int periodSize() const { return 0; }
- void setBufferSize(int ) {}
- int bufferSize() const { return 0; }
- void setNotifyInterval(int ) {}
- int notifyInterval() const { return 0; }
- qint64 processedUSecs() const { return 0; }
- qint64 elapsedUSecs() const { return 0; }
- QAudio::Error error() const { return QAudio::OpenError; }
- QAudio::State state() const { return QAudio::StoppedState; }
- void setFormat(const QAudioFormat&) {}
- QAudioFormat format() const { return QAudioFormat(); }
-};
-
-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))
- foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
- devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
-#endif
-#endif
-
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioPluginLoader* l = audioLoader();
- foreach (const QString& key, l->keys()) {
- QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(l->instance(key));
- if (plugin) {
- foreach (QByteArray const& handle, plugin->availableDevices(mode))
- devices << QAudioDeviceInfo(key, handle, mode);
- }
-
- delete plugin;
- }
-#endif
-
- return devices;
-}
-
-QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
-{
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(QLatin1String("default")));
-
- if (plugin) {
- QList<QByteArray> list = plugin->availableDevices(QAudio::AudioInput);
- if (list.size() > 0)
- return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioInput);
- }
-#endif
-
-#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
- return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
-#endif
-#endif
- return QAudioDeviceInfo();
-}
-
-QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
-{
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioSystemFactoryInterface* plugin = qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(QLatin1String("default")));
-
- if (plugin) {
- QList<QByteArray> list = plugin->availableDevices(QAudio::AudioOutput);
- if (list.size() > 0)
- return QAudioDeviceInfo(QLatin1String("default"), list.at(0), QAudio::AudioOutput);
- }
-#endif
-
-#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
- return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
-#endif
-#endif
- return QAudioDeviceInfo();
-}
-
-QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode)
-{
- QAbstractAudioDeviceInfo *rc = 0;
-
-#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
- if (realm == QLatin1String("builtin"))
- return new QAudioDeviceInfoInternal(handle, mode);
-#endif
-#endif
-
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioSystemFactoryInterface* plugin =
- qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(realm));
-
- if (plugin)
- rc = plugin->createDeviceInfo(handle, mode);
-#endif
-
- return rc == 0 ? new QNullDeviceInfo() : rc;
-}
-
-QAbstractAudioInput* QAudioDeviceFactory::createDefaultInputDevice(QAudioFormat const &format)
-{
- return createInputDevice(defaultInputDevice(), format);
-}
-
-QAbstractAudioOutput* QAudioDeviceFactory::createDefaultOutputDevice(QAudioFormat const &format)
-{
- return createOutputDevice(defaultOutputDevice(), format);
-}
-
-QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
-{
- if (deviceInfo.isNull())
- return new QNullInputDevice();
-#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
- if (deviceInfo.realm() == QLatin1String("builtin")) {
- QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle());
- if (p) p->setFormat(format);
- return p;
- }
-#endif
-#endif
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioSystemFactoryInterface* plugin =
- qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(deviceInfo.realm()));
-
- if (plugin) {
- QAbstractAudioInput* p = plugin->createInput(deviceInfo.handle());
- if (p) p->setFormat(format);
- return p;
- }
-#endif
-
- return new QNullInputDevice();
-}
-
-QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo const& deviceInfo, QAudioFormat const &format)
-{
- if (deviceInfo.isNull())
- return new QNullOutputDevice();
-#ifndef QT_NO_AUDIO_BACKEND
-#if (defined(Q_OS_WIN) || defined(Q_OS_MAC) || defined(HAS_ALSA))
- if (deviceInfo.realm() == QLatin1String("builtin")) {
- QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle());
- if (p) p->setFormat(format);
- return p;
- }
-#endif
-#endif
-
-#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
- QAudioSystemFactoryInterface* plugin =
- qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(deviceInfo.realm()));
-
- if (plugin) {
- QAbstractAudioOutput* p = plugin->createOutput(deviceInfo.handle());
- if (p) p->setFormat(format);
- return p;
- }
-#endif
-
- return new QNullOutputDevice();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudiodevicefactory_p.h b/src/multimedia/audio/qaudiodevicefactory_p.h
deleted file mode 100644
index 26b3a48..0000000
--- a/src/multimedia/audio/qaudiodevicefactory_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIODEVICEFACTORY_P_H
-#define QAUDIODEVICEFACTORY_P_H
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include "qaudiodeviceinfo.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractAudioInput;
-class QAbstractAudioOutput;
-class QAbstractAudioDeviceInfo;
-
-class QAudioDeviceFactory
-{
-public:
- static QList<QAudioDeviceInfo> availableDevices(QAudio::Mode mode);
-
- static QAudioDeviceInfo defaultInputDevice();
- static QAudioDeviceInfo defaultOutputDevice();
-
- static QAbstractAudioDeviceInfo* audioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode);
-
- static QAbstractAudioInput* createDefaultInputDevice(QAudioFormat const &format);
- static QAbstractAudioOutput* createDefaultOutputDevice(QAudioFormat const &format);
-
- static QAbstractAudioInput* createInputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format);
- static QAbstractAudioOutput* createOutputDevice(QAudioDeviceInfo const &device, QAudioFormat const &format);
-
- static QAbstractAudioInput* createNullInput();
- static QAbstractAudioOutput* createNullOutput();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIODEVICEFACTORY_P_H
-
diff --git a/src/multimedia/audio/qaudiodeviceinfo.cpp b/src/multimedia/audio/qaudiodeviceinfo.cpp
deleted file mode 100644
index f45805d..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudiodevicefactory_p.h"
-#include "qaudiosystem.h"
-#include "qaudiodeviceinfo.h"
-
-#include <QtCore/qmap.h>
-
-QT_BEGIN_NAMESPACE
-
-class QAudioDeviceInfoPrivate : public QSharedData
-{
-public:
- QAudioDeviceInfoPrivate():info(0) {}
- QAudioDeviceInfoPrivate(const QString &r, const QByteArray &h, QAudio::Mode m):
- realm(r), handle(h), mode(m)
- {
- if (!handle.isEmpty())
- info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode);
- else
- info = NULL;
- }
-
- QAudioDeviceInfoPrivate(const QAudioDeviceInfoPrivate &other):
- QSharedData(other),
- realm(other.realm), handle(other.handle), mode(other.mode)
- {
- info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode);
- }
-
- QAudioDeviceInfoPrivate& operator=(const QAudioDeviceInfoPrivate &other)
- {
- delete info;
-
- realm = other.realm;
- handle = other.handle;
- mode = other.mode;
- info = QAudioDeviceFactory::audioDeviceInfo(realm, handle, mode);
- return *this;
- }
-
- ~QAudioDeviceInfoPrivate()
- {
- delete info;
- }
-
- QString realm;
- QByteArray handle;
- QAudio::Mode mode;
- QAbstractAudioDeviceInfo* info;
-};
-
-
-/*!
- \class QAudioDeviceInfo
- \brief The QAudioDeviceInfo class provides an interface to query audio devices and their functionality.
- \inmodule QtMultimedia
- \ingroup multimedia
-
- QAudioDeviceInfo lets you query for audio devices--such as sound
- cards and USB headsets--that are currently available on the system.
- The audio devices available are dependent on the platform or audio plugins installed.
-
- A QAudioDeviceInfo is used by Qt to construct
- classes that communicate with the device--such as
- QAudioInput, and QAudioOutput.
-
- You can also query each device for the formats it supports. A
- format in this context is a set consisting of a specific byte
- order, channel, codec, frequency, sample rate, and sample type. A
- format is represented by the QAudioFormat class.
-
- The values supported by the the device for each of these
- parameters can be fetched with
- supportedByteOrders(), supportedChannelCounts(), supportedCodecs(),
- supportedSampleRates(), supportedSampleSizes(), and
- supportedSampleTypes(). The combinations supported are dependent on the platform,
- audio plugins installed and the audio device capabilities. If you need a
- specific format, you can check if
- the device supports it with isFormatSupported(), or fetch a
- supported format that is as close as possible to the format with
- nearestFormat(). For instance:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Setting audio format
-
- The static
- functions defaultInputDevice(), defaultOutputDevice(), and
- availableDevices() let you get a list of all available
- devices. Devices are fetched according to the value of mode
- this is specified by the \l {QAudio}::Mode enum.
- The QAudioDeviceInfo returned are only valid for the \l {QAudio}::Mode.
-
- For instance:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Dumping audio formats
-
- In this code sample, we loop through all devices that are able to output
- sound, i.e., play an audio stream in a supported format. For each device we
- find, we simply print the deviceName().
-
- \sa QAudioOutput, QAudioInput
-*/
-
-/*!
- Constructs an empty QAudioDeviceInfo object.
-*/
-QAudioDeviceInfo::QAudioDeviceInfo():
- d(new QAudioDeviceInfoPrivate)
-{
-}
-
-/*!
- Constructs a copy of \a other.
- \since 1.0
-*/
-QAudioDeviceInfo::QAudioDeviceInfo(const QAudioDeviceInfo& other):
- d(other.d)
-{
-}
-
-/*!
- Destroy this audio device info.
-*/
-QAudioDeviceInfo::~QAudioDeviceInfo()
-{
-}
-
-/*!
- Sets the QAudioDeviceInfo object to be equal to \a other.
- \since 1.0
-*/
-QAudioDeviceInfo& QAudioDeviceInfo::operator=(const QAudioDeviceInfo &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Returns whether this QAudioDeviceInfo object holds a device definition.
- \since 1.0
-*/
-bool QAudioDeviceInfo::isNull() const
-{
- return d->info == 0;
-}
-
-/*!
- Returns the human readable name of the audio device.
-
- Device names vary depending on the platform/audio plugin being used.
-
- They are a unique string identifier for the audio device.
-
- eg. default, Intel, U0x46d0x9a4
- \since 1.0
-*/
-QString QAudioDeviceInfo::deviceName() const
-{
- return isNull() ? QString() : d->info->deviceName();
-}
-
-/*!
- Returns true if the supplied \a settings are supported by the audio
- device described by this QAudioDeviceInfo.
- \since 1.0
-*/
-bool QAudioDeviceInfo::isFormatSupported(const QAudioFormat &settings) const
-{
- return isNull() ? false : d->info->isFormatSupported(settings);
-}
-
-/*!
- Returns the default audio format settings for this device.
-
- These settings are provided by the platform/audio plugin being used.
-
- They are also dependent on the \l {QAudio}::Mode being used.
-
- A typical audio system would provide something like:
- \list
- \o Input settings: 8000Hz mono 8 bit.
- \o Output settings: 44100Hz stereo 16 bit little endian.
- \endlist
- \since 1.0
-*/
-QAudioFormat QAudioDeviceInfo::preferredFormat() const
-{
- return isNull() ? QAudioFormat() : d->info->preferredFormat();
-}
-
-/*!
- Returns the closest QAudioFormat to the supplied \a settings that the system supports.
-
- These settings are provided by the platform/audio plugin being used.
-
- They are also dependent on the \l {QAudio}::Mode being used.
- \since 1.0
-*/
-QAudioFormat QAudioDeviceInfo::nearestFormat(const QAudioFormat &settings) const
-{
- if (isFormatSupported(settings))
- return settings;
-
- QAudioFormat nearest = settings;
-
- QList<QString> testCodecs = supportedCodecs();
- QList<int> testChannels = supportedChannels();
- QList<QAudioFormat::Endian> testByteOrders = supportedByteOrders();
- QList<QAudioFormat::SampleType> testSampleTypes;
- QList<QAudioFormat::SampleType> sampleTypesAvailable = supportedSampleTypes();
- QMap<int,int> testFrequencies;
- QList<int> frequenciesAvailable = supportedFrequencies();
- QMap<int,int> testSampleSizes;
- QList<int> sampleSizesAvailable = supportedSampleSizes();
-
- // Get sorted lists for checking
- if (testCodecs.contains(settings.codec())) {
- testCodecs.removeAll(settings.codec());
- testCodecs.insert(0, settings.codec());
- }
- testChannels.removeAll(settings.channels());
- testChannels.insert(0, settings.channels());
- testByteOrders.removeAll(settings.byteOrder());
- testByteOrders.insert(0, settings.byteOrder());
-
- if (sampleTypesAvailable.contains(settings.sampleType()))
- testSampleTypes.append(settings.sampleType());
- if (sampleTypesAvailable.contains(QAudioFormat::SignedInt))
- testSampleTypes.append(QAudioFormat::SignedInt);
- if (sampleTypesAvailable.contains(QAudioFormat::UnSignedInt))
- testSampleTypes.append(QAudioFormat::UnSignedInt);
- if (sampleTypesAvailable.contains(QAudioFormat::Float))
- testSampleTypes.append(QAudioFormat::Float);
-
- if (sampleSizesAvailable.contains(settings.sampleSize()))
- testSampleSizes.insert(0,settings.sampleSize());
- sampleSizesAvailable.removeAll(settings.sampleSize());
- foreach (int size, sampleSizesAvailable) {
- int larger = (size > settings.sampleSize()) ? size : settings.sampleSize();
- int smaller = (size > settings.sampleSize()) ? settings.sampleSize() : size;
- bool isMultiple = ( 0 == (larger % smaller));
- int diff = larger - smaller;
- testSampleSizes.insert((isMultiple ? diff : diff+100000), size);
- }
- if (frequenciesAvailable.contains(settings.frequency()))
- testFrequencies.insert(0,settings.frequency());
- frequenciesAvailable.removeAll(settings.frequency());
- foreach (int frequency, frequenciesAvailable) {
- int larger = (frequency > settings.frequency()) ? frequency : settings.frequency();
- int smaller = (frequency > settings.frequency()) ? settings.frequency() : frequency;
- bool isMultiple = ( 0 == (larger % smaller));
- int diff = larger - smaller;
- testFrequencies.insert((isMultiple ? diff : diff+100000), frequency);
- }
-
- // Try to find nearest
- foreach (QString codec, testCodecs) {
- nearest.setCodec(codec);
- foreach (QAudioFormat::Endian order, testByteOrders) {
- nearest.setByteOrder(order);
- foreach (QAudioFormat::SampleType sample, testSampleTypes) {
- nearest.setSampleType(sample);
- QMapIterator<int, int> sz(testSampleSizes);
- while (sz.hasNext()) {
- sz.next();
- nearest.setSampleSize(sz.value());
- foreach (int channel, testChannels) {
- nearest.setChannels(channel);
- QMapIterator<int, int> i(testFrequencies);
- while (i.hasNext()) {
- i.next();
- nearest.setFrequency(i.value());
- if (isFormatSupported(nearest))
- return nearest;
- }
- }
- }
- }
- }
- }
- //Fallback
- return preferredFormat();
-}
-
-/*!
- Returns a list of supported codecs.
-
- All platform and plugin implementations should provide support for:
-
- "audio/pcm" - Linear PCM
-
- For writing plugins to support additional codecs refer to:
-
- http://www.iana.org/assignments/media-types/audio/
- \since 1.0
-*/
-QStringList QAudioDeviceInfo::supportedCodecs() const
-{
- return isNull() ? QStringList() : d->info->supportedCodecs();
-}
-
-/*!
- Returns a list of supported sample rates (in Hertz).
-
- \since 1.0
-*/
-QList<int> QAudioDeviceInfo::supportedSampleRates() const
-{
- return supportedFrequencies();
-}
-
-/*!
- \obsolete
-
- Use supportedSampleRates() instead.
- \since 1.0
-*/
-QList<int> QAudioDeviceInfo::supportedFrequencies() const
-{
- return isNull() ? QList<int>() : d->info->supportedSampleRates();
-}
-
-/*!
- Returns a list of supported channel counts.
-
- This is typically 1 for mono sound, or 2 for stereo sound.
-
- \since 1.0
-*/
-QList<int> QAudioDeviceInfo::supportedChannelCounts() const
-{
- return supportedChannels();
-}
-
-/*!
- \obsolete
-
- Use supportedChannelCount() instead.
- \since 1.0
-*/
-QList<int> QAudioDeviceInfo::supportedChannels() const
-{
- return isNull() ? QList<int>() : d->info->supportedChannelCounts();
-}
-
-/*!
- Returns a list of supported sample sizes (in bits).
-
- Typically this will include 8 and 16 bit sample sizes.
-
- \since 1.0
-*/
-QList<int> QAudioDeviceInfo::supportedSampleSizes() const
-{
- return isNull() ? QList<int>() : d->info->supportedSampleSizes();
-}
-
-/*!
- Returns a list of supported byte orders.
- \since 1.0
-*/
-QList<QAudioFormat::Endian> QAudioDeviceInfo::supportedByteOrders() const
-{
- return isNull() ? QList<QAudioFormat::Endian>() : d->info->supportedByteOrders();
-}
-
-/*!
- Returns a list of supported sample types.
- \since 1.0
-*/
-QList<QAudioFormat::SampleType> QAudioDeviceInfo::supportedSampleTypes() const
-{
- return isNull() ? QList<QAudioFormat::SampleType>() : d->info->supportedSampleTypes();
-}
-
-/*!
- Returns the information for the default input audio device.
- All platform and audio plugin implementations provide a default audio device to use.
- \since 1.0
-*/
-QAudioDeviceInfo QAudioDeviceInfo::defaultInputDevice()
-{
- return QAudioDeviceFactory::defaultInputDevice();
-}
-
-/*!
- Returns the information for the default output audio device.
- All platform and audio plugin implementations provide a default audio device to use.
- \since 1.0
-*/
-QAudioDeviceInfo QAudioDeviceInfo::defaultOutputDevice()
-{
- return QAudioDeviceFactory::defaultOutputDevice();
-}
-
-/*!
- Returns a list of audio devices that support \a mode.
- \since 1.0
-*/
-QList<QAudioDeviceInfo> QAudioDeviceInfo::availableDevices(QAudio::Mode mode)
-{
- return QAudioDeviceFactory::availableDevices(mode);
-}
-
-
-/*!
- \internal
- \since 1.0
-*/
-QAudioDeviceInfo::QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode):
- d(new QAudioDeviceInfoPrivate(realm, handle, mode))
-{
-}
-
-/*!
- \internal
- \since 1.0
-*/
-QString QAudioDeviceInfo::realm() const
-{
- return d->realm;
-}
-
-/*!
- \internal
- \since 1.0
-*/
-QByteArray QAudioDeviceInfo::handle() const
-{
- return d->handle;
-}
-
-
-/*!
- \internal
- \since 1.0
-*/
-QAudio::Mode QAudioDeviceInfo::mode() const
-{
- return d->mode;
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudiodeviceinfo.h b/src/multimedia/audio/qaudiodeviceinfo.h
deleted file mode 100644
index f16122b..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIODEVICEINFO_H
-#define QAUDIODEVICEINFO_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include <qaudio.h>
-#include <qaudioformat.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioDeviceFactory;
-
-class QAudioDeviceInfoPrivate;
-class Q_MULTIMEDIA_EXPORT QAudioDeviceInfo
-{
- friend class QAudioDeviceFactory;
-
-public:
- QAudioDeviceInfo();
- QAudioDeviceInfo(const QAudioDeviceInfo& other);
- ~QAudioDeviceInfo();
-
- QAudioDeviceInfo& operator=(const QAudioDeviceInfo& other);
-
- bool isNull() const;
-
- QString deviceName() const;
-
- bool isFormatSupported(const QAudioFormat &format) const;
- QAudioFormat preferredFormat() const;
- QAudioFormat nearestFormat(const QAudioFormat &format) const;
-
- QStringList supportedCodecs() const;
- QList<int> supportedFrequencies() const;
- QList<int> supportedSampleRates() const;
- QList<int> supportedChannels() const;
- QList<int> supportedChannelCounts() const;
- QList<int> supportedSampleSizes() const;
- QList<QAudioFormat::Endian> supportedByteOrders() const;
- QList<QAudioFormat::SampleType> supportedSampleTypes() const;
-
- static QAudioDeviceInfo defaultInputDevice();
- static QAudioDeviceInfo defaultOutputDevice();
-
- static QList<QAudioDeviceInfo> availableDevices(QAudio::Mode mode);
-
-private:
- QAudioDeviceInfo(const QString &realm, const QByteArray &handle, QAudio::Mode mode);
- QString realm() const;
- QByteArray handle() const;
- QAudio::Mode mode() const;
-
- QSharedDataPointer<QAudioDeviceInfoPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-Q_DECLARE_METATYPE(QAudioDeviceInfo)
-
-#endif // QAUDIODEVICEINFO_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
deleted file mode 100644
index 113b330..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.cpp
+++ /dev/null
@@ -1,535 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include "qaudiodeviceinfo_alsa_p.h"
-
-#include <alsa/version.h>
-
-QT_BEGIN_NAMESPACE
-
-QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
-{
- handle = 0;
-
- device = QLatin1String(dev);
- this->mode = mode;
-
- checkSurround();
-}
-
-QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal()
-{
- close();
-}
-
-bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const
-{
- return testSettings(format);
-}
-
-QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
-{
- QAudioFormat nearest;
- if(mode == QAudio::AudioOutput) {
- nearest.setFrequency(44100);
- nearest.setChannels(2);
- nearest.setByteOrder(QAudioFormat::LittleEndian);
- nearest.setSampleType(QAudioFormat::SignedInt);
- nearest.setSampleSize(16);
- nearest.setCodec(QLatin1String("audio/pcm"));
- } else {
- nearest.setFrequency(8000);
- nearest.setChannels(1);
- nearest.setSampleType(QAudioFormat::UnSignedInt);
- nearest.setSampleSize(8);
- nearest.setCodec(QLatin1String("audio/pcm"));
- if(!testSettings(nearest)) {
- nearest.setChannels(2);
- nearest.setSampleSize(16);
- nearest.setSampleType(QAudioFormat::SignedInt);
- }
- }
- return nearest;
-}
-
-QString QAudioDeviceInfoInternal::deviceName() const
-{
- return device;
-}
-
-QStringList QAudioDeviceInfoInternal::supportedCodecs()
-{
- updateLists();
- return codecz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
-{
- updateLists();
- return freqz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
-{
- updateLists();
- return channelz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
-{
- updateLists();
- return sizez;
-}
-
-QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
-{
- updateLists();
- return byteOrderz;
-}
-
-QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
-{
- updateLists();
- return typez;
-}
-
-bool QAudioDeviceInfoInternal::open()
-{
- int err = 0;
- QString dev = device;
- QList<QByteArray> devices = availableDevices(mode);
-
- if(dev.compare(QLatin1String("default")) == 0) {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- if (devices.size() > 0)
- dev = QLatin1String(devices.first().constData());
- else
- return false;
-#else
- dev = QLatin1String("hw:0,0");
-#endif
- } else {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- dev = device;
-#else
- int idx = 0;
- char *name;
-
- QString shortName = device.mid(device.indexOf(QLatin1String("="),0)+1);
-
- while(snd_card_get_name(idx,&name) == 0) {
- if(dev.contains(QLatin1String(name)))
- break;
- idx++;
- }
- dev = QString(QLatin1String("hw:%1,0")).arg(idx);
-#endif
- }
- if(mode == QAudio::AudioOutput) {
- err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
- } else {
- err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
- }
- if(err < 0) {
- handle = 0;
- return false;
- }
- return true;
-}
-
-void QAudioDeviceInfoInternal::close()
-{
- if(handle)
- snd_pcm_close(handle);
- handle = 0;
-}
-
-bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
-{
- // Set nearest to closest settings that do work.
- // See if what is in settings will work (return value).
- int err = 0;
- snd_pcm_t* handle;
- snd_pcm_hw_params_t *params;
- QString dev = device;
-
- QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
-
- if(dev.compare(QLatin1String("default")) == 0) {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- dev = QLatin1String(devices.first().constData());
-#else
- dev = QLatin1String("hw:0,0");
-#endif
- } else {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- dev = device;
-#else
- int idx = 0;
- char *name;
-
- QString shortName = device.mid(device.indexOf(QLatin1String("="),0)+1);
-
- while(snd_card_get_name(idx,&name) == 0) {
- if(shortName.compare(QLatin1String(name)) == 0)
- break;
- idx++;
- }
- dev = QString(QLatin1String("hw:%1,0")).arg(idx);
-#endif
- }
- if(mode == QAudio::AudioOutput) {
- err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
- } else {
- err=snd_pcm_open( &handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
- }
- if(err < 0) {
- handle = 0;
- return false;
- }
-
- bool testChannel = false;
- bool testCodec = false;
- bool testFreq = false;
- bool testType = false;
- bool testSize = false;
-
- int dir = 0;
-
- snd_pcm_nonblock( handle, 0 );
- snd_pcm_hw_params_alloca( &params );
- snd_pcm_hw_params_any( handle, params );
-
- // set the values!
- snd_pcm_hw_params_set_channels(handle,params,format.channels());
- snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
-
- err = -1;
-
- switch(format.sampleSize()) {
- case 8:
- if(format.sampleType() == QAudioFormat::SignedInt)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8);
- else if(format.sampleType() == QAudioFormat::UnSignedInt)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8);
- break;
- case 16:
- if(format.sampleType() == QAudioFormat::SignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
- } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE);
- }
- break;
- case 32:
- if(format.sampleType() == QAudioFormat::SignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE);
- } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE);
- }
- }
-
- // For now, just accept only audio/pcm codec
- if(!format.codec().startsWith(QLatin1String("audio/pcm"))) {
- err=-1;
- } else
- testCodec = true;
-
- if(err>=0 && format.channels() != -1) {
- err = snd_pcm_hw_params_test_channels(handle,params,format.channels());
- if(err>=0)
- err = snd_pcm_hw_params_set_channels(handle,params,format.channels());
- if(err>=0)
- testChannel = true;
- }
-
- if(err>=0 && format.frequency() != -1) {
- err = snd_pcm_hw_params_test_rate(handle,params,format.frequency(),0);
- if(err>=0)
- err = snd_pcm_hw_params_set_rate(handle,params,format.frequency(),dir);
- if(err>=0)
- testFreq = true;
- }
-
- if((err>=0 && format.sampleSize() != -1) &&
- (format.sampleType() != QAudioFormat::Unknown)) {
- switch(format.sampleSize()) {
- case 8:
- if(format.sampleType() == QAudioFormat::SignedInt)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S8);
- else if(format.sampleType() == QAudioFormat::UnSignedInt)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U8);
- break;
- case 16:
- if(format.sampleType() == QAudioFormat::SignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S16_BE);
- } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U16_BE);
- }
- break;
- case 32:
- if(format.sampleType() == QAudioFormat::SignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_S32_BE);
- } else if(format.sampleType() == QAudioFormat::UnSignedInt) {
- if(format.byteOrder() == QAudioFormat::LittleEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_LE);
- else if(format.byteOrder() == QAudioFormat::BigEndian)
- err = snd_pcm_hw_params_set_format(handle,params,SND_PCM_FORMAT_U32_BE);
- }
- }
- if(err>=0) {
- testSize = true;
- testType = true;
- }
- }
- if(err>=0)
- err = snd_pcm_hw_params(handle, params);
-
- if(err == 0) {
- // settings work
- // close()
- if(handle)
- snd_pcm_close(handle);
- return true;
- }
- if(handle)
- snd_pcm_close(handle);
-
- return false;
-}
-
-void QAudioDeviceInfoInternal::updateLists()
-{
- // redo all lists based on current settings
- freqz.clear();
- channelz.clear();
- sizez.clear();
- byteOrderz.clear();
- typez.clear();
- codecz.clear();
-
- if(!handle)
- open();
-
- if(!handle)
- return;
-
- for(int i=0; i<(int)MAX_SAMPLE_RATES; i++) {
- //if(snd_pcm_hw_params_test_rate(handle, params, SAMPLE_RATES[i], dir) == 0)
- freqz.append(SAMPLE_RATES[i]);
- }
- channelz.append(1);
- channelz.append(2);
- if (surround40) channelz.append(4);
- if (surround51) channelz.append(6);
- if (surround71) channelz.append(8);
- sizez.append(8);
- sizez.append(16);
- sizez.append(32);
- byteOrderz.append(QAudioFormat::LittleEndian);
- byteOrderz.append(QAudioFormat::BigEndian);
- typez.append(QAudioFormat::SignedInt);
- typez.append(QAudioFormat::UnSignedInt);
- typez.append(QAudioFormat::Float);
- codecz.append(QLatin1String("audio/pcm"));
- close();
-}
-
-QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
-{
- QList<QByteArray> allDevices;
- QList<QByteArray> devices;
- QByteArray filter;
-
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- // Create a list of all current audio devices that support mode
- void **hints, **n;
- char *name, *descr, *io;
-
- if(snd_device_name_hint(-1, "pcm", &hints) < 0) {
- qWarning() << "no alsa devices available";
- return devices;
- }
- n = hints;
-
- if(mode == QAudio::AudioInput) {
- filter = "Input";
- } else {
- filter = "Output";
- }
-
- while (*n != NULL) {
- name = snd_device_name_get_hint(*n, "NAME");
- if (name != 0 && qstrcmp(name, "null") != 0) {
- descr = snd_device_name_get_hint(*n, "DESC");
- io = snd_device_name_get_hint(*n, "IOID");
-
- if ((descr != NULL) && ((io == NULL) || (io == filter))) {
- QString deviceName = QLatin1String(name);
- QString deviceDescription = QLatin1String(descr);
- allDevices.append(deviceName.toLocal8Bit().constData());
- if (deviceDescription.contains(QLatin1String("Default Audio Device")))
- devices.append(deviceName.toLocal8Bit().constData());
- }
-
- free(name);
- if (descr != NULL)
- free(descr);
- if (io != NULL)
- free(io);
- }
- ++n;
- }
- snd_device_name_free_hint(hints);
-
- if(devices.size() > 0) {
- devices.append("default");
- }
-#else
- int idx = 0;
- char* name;
-
- while(snd_card_get_name(idx,&name) == 0) {
- devices.append(name);
- idx++;
- }
- if (idx > 0)
- devices.append("default");
-#endif
-#if !defined(Q_WS_MAEMO_6)
- if (devices.size() == 0 && allDevices.size() > 0)
- return allDevices;
-#endif
-
- return devices;
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
-{
- QList<QByteArray> devices = availableDevices(QAudio::AudioInput);
- if(devices.size() == 0)
- return QByteArray();
-
- return devices.first();
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
-{
- QList<QByteArray> devices = availableDevices(QAudio::AudioOutput);
- if(devices.size() == 0)
- return QByteArray();
-
- return devices.first();
-}
-
-void QAudioDeviceInfoInternal::checkSurround()
-{
- QList<QByteArray> devices;
- surround40 = false;
- surround51 = false;
- surround71 = false;
-
- void **hints, **n;
- char *name, *descr, *io;
-
- if(snd_device_name_hint(-1, "pcm", &hints) < 0)
- return;
-
- n = hints;
-
- while (*n != NULL) {
- name = snd_device_name_get_hint(*n, "NAME");
- descr = snd_device_name_get_hint(*n, "DESC");
- io = snd_device_name_get_hint(*n, "IOID");
- if((name != NULL) && (descr != NULL)) {
- QString deviceName = QLatin1String(name);
- if (mode == QAudio::AudioOutput) {
- if(deviceName.contains(QLatin1String("surround40")))
- surround40 = true;
- if(deviceName.contains(QLatin1String("surround51")))
- surround51 = true;
- if(deviceName.contains(QLatin1String("surround71")))
- surround71 = true;
- }
- }
- if(name != NULL)
- free(name);
- if(descr != NULL)
- free(descr);
- if(io != NULL)
- free(io);
- ++n;
- }
- snd_device_name_free_hint(hints);
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h b/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
deleted file mode 100644
index cf19d25..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_alsa_p.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QAUDIODEVICEINFOALSA_H
-#define QAUDIODEVICEINFOALSA_H
-
-#include <alsa/asoundlib.h>
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qdebug.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-const unsigned int MAX_SAMPLE_RATES = 5;
-const unsigned int SAMPLE_RATES[] =
- { 8000, 11025, 22050, 44100, 48000 };
-
-class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
-{
- Q_OBJECT
-public:
- QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode);
- ~QAudioDeviceInfoInternal();
-
- bool testSettings(const QAudioFormat& format) const;
- void updateLists();
- QAudioFormat preferredFormat() const;
- bool isFormatSupported(const QAudioFormat& format) const;
- QString deviceName() const;
- QStringList supportedCodecs();
- QList<int> supportedSampleRates();
- QList<int> supportedChannelCounts();
- QList<int> supportedSampleSizes();
- QList<QAudioFormat::Endian> supportedByteOrders();
- QList<QAudioFormat::SampleType> supportedSampleTypes();
- static QByteArray defaultInputDevice();
- static QByteArray defaultOutputDevice();
- static QList<QByteArray> availableDevices(QAudio::Mode);
-
-private:
- bool open();
- void close();
-
- void checkSurround();
- bool surround40;
- bool surround51;
- bool surround71;
-
- QString device;
- QAudio::Mode mode;
- QAudioFormat nearest;
- QList<int> freqz;
- QList<int> channelz;
- QList<int> sizez;
- QList<QAudioFormat::Endian> byteOrderz;
- QStringList codecz;
- QList<QAudioFormat::SampleType> typez;
- snd_pcm_t* handle;
- snd_pcm_hw_params_t *params;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
-
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
deleted file mode 100644
index 4c7779f..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qdatastream.h>
-#include <QtCore/qdebug.h>
-
-#include <qaudiodeviceinfo.h>
-#include "qaudio_mac_p.h"
-#include "qaudiodeviceinfo_mac_p.h"
-
-
-
-QT_BEGIN_NAMESPACE
-
-// XXX: remove at some future date
-static inline QString cfStringToQString(CFStringRef str)
-{
- CFIndex length = CFStringGetLength(str);
- const UniChar *chars = CFStringGetCharactersPtr(str);
- if (chars)
- return QString(reinterpret_cast<const QChar *>(chars), length);
-
- UniChar buffer[length];
- CFStringGetCharacters(str, CFRangeMake(0, length), buffer);
- return QString(reinterpret_cast<const QChar *>(buffer), length);
-}
-
-QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode)
-{
- QDataStream ds(handle);
- quint32 did, tm;
-
- ds >> did >> tm >> name;
- deviceId = AudioDeviceID(did);
- mode = QAudio::Mode(tm);
-}
-
-bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const
-{
- QAudioDeviceInfoInternal *self = const_cast<QAudioDeviceInfoInternal*>(this);
-
- return format.isValid()
- && format.codec() == QString::fromLatin1("audio/pcm")
- && self->supportedSampleRates().contains(format.sampleRate())
- && self->supportedChannelCounts().contains(format.channelCount())
- && self->supportedSampleSizes().contains(format.sampleSize());
-}
-
-QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
-{
- QAudioFormat rc;
-
- UInt32 propSize = 0;
-
- if (AudioDeviceGetPropertyInfo(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyStreams,
- &propSize,
- 0) == noErr) {
-
- const int sc = propSize / sizeof(AudioStreamID);
-
- if (sc > 0) {
- AudioStreamID* streams = new AudioStreamID[sc];
-
- if (AudioDeviceGetProperty(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyStreams,
- &propSize,
- streams) == noErr) {
-
- for (int i = 0; i < sc; ++i) {
- if (AudioStreamGetPropertyInfo(streams[i],
- 0,
- kAudioStreamPropertyPhysicalFormat,
- &propSize,
- 0) == noErr) {
-
- AudioStreamBasicDescription sf;
-
- if (AudioStreamGetProperty(streams[i],
- 0,
- kAudioStreamPropertyPhysicalFormat,
- &propSize,
- &sf) == noErr) {
- rc = toQAudioFormat(sf);
- break;
- }
- }
- }
- }
-
- delete streams;
- }
- }
-
- return rc;
-}
-
-QString QAudioDeviceInfoInternal::deviceName() const
-{
- return name;
-}
-
-QStringList QAudioDeviceInfoInternal::supportedCodecs()
-{
- return QStringList() << QString::fromLatin1("audio/pcm");
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
-{
- QSet<int> rc;
-
- // Add some common frequencies
- rc << 8000 << 11025 << 22050 << 44100;
-
- //
- UInt32 propSize = 0;
-
- if (AudioDeviceGetPropertyInfo(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyAvailableNominalSampleRates,
- &propSize,
- 0) == noErr) {
-
- const int pc = propSize / sizeof(AudioValueRange);
-
- if (pc > 0) {
- AudioValueRange* vr = new AudioValueRange[pc];
-
- if (AudioDeviceGetProperty(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyAvailableNominalSampleRates,
- &propSize,
- vr) == noErr) {
-
- for (int i = 0; i < pc; ++i)
- rc << vr[i].mMaximum;
- }
-
- delete vr;
- }
- }
-
- return rc.toList();
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
-{
- QList<int> rc;
-
- // Can mix down to 1 channel
- rc << 1;
-
- UInt32 propSize = 0;
- int channels = 0;
-
- if (AudioDeviceGetPropertyInfo(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyStreamConfiguration,
- &propSize,
- 0) == noErr) {
-
- AudioBufferList* audioBufferList = static_cast<AudioBufferList*>(qMalloc(propSize));
-
- if (audioBufferList != 0) {
- if (AudioDeviceGetProperty(deviceId,
- 0,
- mode == QAudio::AudioInput,
- kAudioDevicePropertyStreamConfiguration,
- &propSize,
- audioBufferList) == noErr) {
-
- for (int i = 0; i < int(audioBufferList->mNumberBuffers); ++i) {
- channels += audioBufferList->mBuffers[i].mNumberChannels;
- rc << channels;
- }
- }
-
- qFree(audioBufferList);
- }
- }
-
- return rc;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
-{
- return QList<int>() << 8 << 16 << 24 << 32 << 64;
-}
-
-QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
-{
- return QList<QAudioFormat::Endian>() << QAudioFormat::LittleEndian << QAudioFormat::BigEndian;
-}
-
-QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
-{
- return QList<QAudioFormat::SampleType>() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float;
-}
-
-static QByteArray get_device_info(AudioDeviceID audioDevice, QAudio::Mode mode)
-{
- UInt32 size;
- QByteArray device;
- QDataStream ds(&device, QIODevice::WriteOnly);
- AudioStreamBasicDescription sf;
- CFStringRef name;
- Boolean isInput = mode == QAudio::AudioInput;
-
- // Id
- ds << quint32(audioDevice);
-
- // Mode
- size = sizeof(AudioStreamBasicDescription);
- if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioDevicePropertyStreamFormat,
- &size, &sf) != noErr) {
- return QByteArray();
- }
- ds << quint32(mode);
-
- // Name
- size = sizeof(CFStringRef);
- if (AudioDeviceGetProperty(audioDevice, 0, isInput, kAudioObjectPropertyName,
- &size, &name) != noErr) {
- qWarning() << "QAudioDeviceInfo: Unable to find device name";
- return QByteArray();
- }
- ds << cfStringToQString(name);
-
- CFRelease(name);
-
- return device;
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
-{
- AudioDeviceID audioDevice;
- UInt32 size = sizeof(audioDevice);
-
- if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultInputDevice, &size,
- &audioDevice) != noErr) {
- qWarning() << "QAudioDeviceInfo: Unable to find default input device";
- return QByteArray();
- }
-
- return get_device_info(audioDevice, QAudio::AudioInput);
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
-{
- AudioDeviceID audioDevice;
- UInt32 size = sizeof(audioDevice);
-
- if (AudioHardwareGetProperty(kAudioHardwarePropertyDefaultOutputDevice, &size,
- &audioDevice) != noErr) {
- qWarning() << "QAudioDeviceInfo: Unable to find default output device";
- return QByteArray();
- }
-
- return get_device_info(audioDevice, QAudio::AudioOutput);
-}
-
-QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
-{
- QList<QByteArray> devices;
-
- UInt32 propSize = 0;
-
- if (AudioHardwareGetPropertyInfo(kAudioHardwarePropertyDevices, &propSize, 0) == noErr) {
-
- const int dc = propSize / sizeof(AudioDeviceID);
-
- if (dc > 0) {
- AudioDeviceID* audioDevices = new AudioDeviceID[dc];
-
- if (AudioHardwareGetProperty(kAudioHardwarePropertyDevices, &propSize, audioDevices) == noErr) {
- for (int i = 0; i < dc; ++i) {
- QByteArray info = get_device_info(audioDevices[i], mode);
- if (!info.isNull())
- devices << info;
- }
- }
-
- delete audioDevices;
- }
- }
-
- return devices;
-}
-
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h b/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
deleted file mode 100644
index 3b9ca46..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_mac_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QDEVICEINFO_MAC_P_H
-#define QDEVICEINFO_MAC_P_H
-
-#include <CoreAudio/CoreAudio.h>
-
-#include <qaudiosystem.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
-{
-public:
- AudioDeviceID deviceId;
- QString name;
- QAudio::Mode mode;
-
- QAudioDeviceInfoInternal(QByteArray const& handle, QAudio::Mode mode);
-
- bool isFormatSupported(const QAudioFormat& format) const;
- QAudioFormat preferredFormat() const;
-
- QString deviceName() const;
-
- QStringList supportedCodecs();
- QList<int> supportedSampleRates();
- QList<int> supportedChannelCounts();
- QList<int> supportedSampleSizes();
- QList<QAudioFormat::Endian> supportedByteOrders();
- QList<QAudioFormat::SampleType> supportedSampleTypes();
-
- static QByteArray defaultInputDevice();
- static QByteArray defaultOutputDevice();
-
- static QList<QByteArray> availableDevices(QAudio::Mode mode);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QDEVICEINFO_MAC_P_H
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp b/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
deleted file mode 100644
index 10b9b77..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.cpp
+++ /dev/null
@@ -1,465 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-
-#include <windows.h>
-#include <mmsystem.h>
-#include "qaudiodeviceinfo_win32_p.h"
-#include <dshow.h>
-
-#if defined(Q_CC_MINGW)
-
-extern GUID CLSID_AudioInputDeviceCategory;
-
-#ifndef __IErrorLog_INTERFACE_DEFINED__
-#define __IErrorLog_INTERFACE_DEFINED__
-
-DECLARE_INTERFACE_(IErrorLog, IUnknown)
-{
- STDMETHOD(AddError)(THIS_ LPCOLESTR, EXCEPINFO *) PURE;
-};
-
-#endif /* __IErrorLog_INTERFACE_DEFINED__ */
-
-#ifndef __IPropertyBag_INTERFACE_DEFINED__
-#define __IPropertyBag_INTERFACE_DEFINED__
-
-const GUID IID_IPropertyBag = {0x55272A00, 0x42CB, 0x11CE, {0x81, 0x35, 0x00, 0xAA, 0x00, 0x4B, 0xB8, 0x51}};
-
-DECLARE_INTERFACE_(IPropertyBag, IUnknown)
-{
- STDMETHOD(Read)(THIS_ LPCOLESTR, VARIANT *, IErrorLog *) PURE;
- STDMETHOD(Write)(THIS_ LPCOLESTR, VARIANT *) PURE;
-};
-
-#endif /* __IPropertyBag_INTERFACE_DEFINED__ */
-
-#endif//Q_CC_MINGW
-
-QT_BEGIN_NAMESPACE
-
-// For mingw toolchain mmsystem.h only defines half the defines, so add if needed.
-#ifndef WAVE_FORMAT_44M08
-#define WAVE_FORMAT_44M08 0x00000100
-#define WAVE_FORMAT_44S08 0x00000200
-#define WAVE_FORMAT_44M16 0x00000400
-#define WAVE_FORMAT_44S16 0x00000800
-#define WAVE_FORMAT_48M08 0x00001000
-#define WAVE_FORMAT_48S08 0x00002000
-#define WAVE_FORMAT_48M16 0x00004000
-#define WAVE_FORMAT_48S16 0x00008000
-#define WAVE_FORMAT_96M08 0x00010000
-#define WAVE_FORMAT_96S08 0x00020000
-#define WAVE_FORMAT_96M16 0x00040000
-#define WAVE_FORMAT_96S16 0x00080000
-#endif
-
-
-QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
-{
- QDataStream ds(&dev, QIODevice::ReadOnly);
- ds >> devId >> device;
- this->mode = mode;
-
- updateLists();
-}
-
-QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal()
-{
- close();
-}
-
-bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const
-{
- return testSettings(format);
-}
-
-QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
-{
- QAudioFormat nearest;
- if(mode == QAudio::AudioOutput) {
- nearest.setFrequency(44100);
- nearest.setChannelCount(2);
- nearest.setByteOrder(QAudioFormat::LittleEndian);
- nearest.setSampleType(QAudioFormat::SignedInt);
- nearest.setSampleSize(16);
- nearest.setCodec(QLatin1String("audio/pcm"));
- } else {
- nearest.setFrequency(11025);
- nearest.setChannelCount(1);
- nearest.setByteOrder(QAudioFormat::LittleEndian);
- nearest.setSampleType(QAudioFormat::SignedInt);
- nearest.setSampleSize(8);
- nearest.setCodec(QLatin1String("audio/pcm"));
- }
- return nearest;
-}
-
-QString QAudioDeviceInfoInternal::deviceName() const
-{
- return device;
-}
-
-QStringList QAudioDeviceInfoInternal::supportedCodecs()
-{
- updateLists();
- return codecz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
-{
- updateLists();
- return freqz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
-{
- updateLists();
- return channelz;
-}
-
-QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
-{
- updateLists();
- return sizez;
-}
-
-QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
-{
- updateLists();
- return byteOrderz;
-}
-
-QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
-{
- updateLists();
- return typez;
-}
-
-
-bool QAudioDeviceInfoInternal::open()
-{
- return true;
-}
-
-void QAudioDeviceInfoInternal::close()
-{
-}
-
-bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
-{
- // Set nearest to closest settings that do work.
- // See if what is in settings will work (return value).
-
- bool failed = false;
- bool match = false;
-
- // check codec
- for( int i = 0; i < codecz.count(); i++) {
- if (format.codec() == codecz.at(i))
- match = true;
- }
- if (!match) failed = true;
-
- // check channel
- match = false;
- if (!failed) {
- for( int i = 0; i < channelz.count(); i++) {
- if (format.channels() == channelz.at(i)) {
- match = true;
- break;
- }
- }
- if (!match)
- failed = true;
- }
-
- // check frequency
- match = false;
- if (!failed) {
- for( int i = 0; i < freqz.count(); i++) {
- if (format.frequency() == freqz.at(i)) {
- match = true;
- break;
- }
- }
- if (!match)
- failed = true;
- }
-
- // check sample size
- match = false;
- if (!failed) {
- for( int i = 0; i < sizez.count(); i++) {
- if (format.sampleSize() == sizez.at(i)) {
- match = true;
- break;
- }
- }
- if (!match)
- failed = true;
- }
-
- // check byte order
- match = false;
- if (!failed) {
- for( int i = 0; i < byteOrderz.count(); i++) {
- if (format.byteOrder() == byteOrderz.at(i)) {
- match = true;
- break;
- }
- }
- if (!match)
- failed = true;
- }
-
- // check sample type
- match = false;
- if (!failed) {
- for( int i = 0; i < typez.count(); i++) {
- if (format.sampleType() == typez.at(i)) {
- match = true;
- break;
- }
- }
- if (!match)
- failed = true;
- }
-
- if(!failed) {
- // settings work
- return true;
- }
- return false;
-}
-
-void QAudioDeviceInfoInternal::updateLists()
-{
- // redo all lists based on current settings
- bool match = false;
- DWORD fmt = NULL;
-
- if(mode == QAudio::AudioOutput) {
- WAVEOUTCAPS woc;
- if (waveOutGetDevCaps(devId, &woc, sizeof(WAVEOUTCAPS)) == MMSYSERR_NOERROR) {
- match = true;
- fmt = woc.dwFormats;
- }
- } else {
- WAVEINCAPS woc;
- if (waveInGetDevCaps(devId, &woc, sizeof(WAVEINCAPS)) == MMSYSERR_NOERROR) {
- match = true;
- fmt = woc.dwFormats;
- }
- }
- sizez.clear();
- freqz.clear();
- channelz.clear();
- byteOrderz.clear();
- typez.clear();
- codecz.clear();
-
- if(match) {
- if((fmt && WAVE_FORMAT_1M08)
- || (fmt && WAVE_FORMAT_1S08)
- || (fmt && WAVE_FORMAT_2M08)
- || (fmt && WAVE_FORMAT_2S08)
- || (fmt && WAVE_FORMAT_4M08)
- || (fmt && WAVE_FORMAT_4S08)
- || (fmt && WAVE_FORMAT_48M08)
- || (fmt && WAVE_FORMAT_48S08)
- || (fmt && WAVE_FORMAT_96M08)
- || (fmt && WAVE_FORMAT_96S08)
- ) {
- sizez.append(8);
- }
- if((fmt && WAVE_FORMAT_1M16)
- || (fmt && WAVE_FORMAT_1S16)
- || (fmt && WAVE_FORMAT_2M16)
- || (fmt && WAVE_FORMAT_2S16)
- || (fmt && WAVE_FORMAT_4M16)
- || (fmt && WAVE_FORMAT_4S16)
- || (fmt && WAVE_FORMAT_48M16)
- || (fmt && WAVE_FORMAT_48S16)
- || (fmt && WAVE_FORMAT_96M16)
- || (fmt && WAVE_FORMAT_96S16)
- ) {
- sizez.append(16);
- }
- if((fmt && WAVE_FORMAT_1M08)
- || (fmt && WAVE_FORMAT_1S08)
- || (fmt && WAVE_FORMAT_1M16)
- || (fmt && WAVE_FORMAT_1S16)) {
- freqz.append(11025);
- }
- if((fmt && WAVE_FORMAT_2M08)
- || (fmt && WAVE_FORMAT_2S08)
- || (fmt && WAVE_FORMAT_2M16)
- || (fmt && WAVE_FORMAT_2S16)) {
- freqz.append(22050);
- }
- if((fmt && WAVE_FORMAT_4M08)
- || (fmt && WAVE_FORMAT_4S08)
- || (fmt && WAVE_FORMAT_4M16)
- || (fmt && WAVE_FORMAT_4S16)) {
- freqz.append(44100);
- }
- if((fmt && WAVE_FORMAT_48M08)
- || (fmt && WAVE_FORMAT_48S08)
- || (fmt && WAVE_FORMAT_48M16)
- || (fmt && WAVE_FORMAT_48S16)) {
- freqz.append(48000);
- }
- if((fmt && WAVE_FORMAT_96M08)
- || (fmt && WAVE_FORMAT_96S08)
- || (fmt && WAVE_FORMAT_96M16)
- || (fmt && WAVE_FORMAT_96S16)) {
- freqz.append(96000);
- }
- channelz.append(1);
- channelz.append(2);
- if (mode == QAudio::AudioOutput) {
- channelz.append(4);
- channelz.append(6);
- channelz.append(8);
- }
-
- byteOrderz.append(QAudioFormat::LittleEndian);
-
- typez.append(QAudioFormat::SignedInt);
- typez.append(QAudioFormat::UnSignedInt);
-
- codecz.append(QLatin1String("audio/pcm"));
- }
- if (freqz.count() > 0)
- freqz.prepend(8000);
-}
-
-QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
-{
- Q_UNUSED(mode)
-
- QList<QByteArray> devices;
- //enumerate device fullnames through directshow api
- CoInitialize(NULL);
- ICreateDevEnum *pDevEnum = NULL;
- IEnumMoniker *pEnum = NULL;
- // Create the System device enumerator
- HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
- CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
- reinterpret_cast<void **>(&pDevEnum));
-
- unsigned long iNumDevs = mode == QAudio::AudioOutput ? waveOutGetNumDevs() : waveInGetNumDevs();
- if (SUCCEEDED(hr)) {
- // Create the enumerator for the audio input/output category
- if (pDevEnum->CreateClassEnumerator(
- mode == QAudio::AudioOutput ? CLSID_AudioRendererCategory : CLSID_AudioInputDeviceCategory,
- &pEnum, 0) == S_OK) {
- pEnum->Reset();
- // go through and find all audio devices
- IMoniker *pMoniker = NULL;
- while (pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag;
- hr = pMoniker->BindToStorage(0,0,IID_IPropertyBag,
- reinterpret_cast<void **>(&pPropBag));
- if (FAILED(hr)) {
- pMoniker->Release();
- continue; // skip this one
- }
- // Find if it is a wave device
- VARIANT var;
- VariantInit(&var);
- hr = pPropBag->Read(mode == QAudio::AudioOutput ? L"WaveOutID" : L"WaveInID", &var, 0);
- if (SUCCEEDED(hr)) {
- LONG waveID = var.lVal;
- if (waveID >= 0 && waveID < LONG(iNumDevs)) {
- VariantClear(&var);
- // Find the description
- hr = pPropBag->Read(L"FriendlyName", &var, 0);
- if (SUCCEEDED(hr)) {
- QByteArray device;
- QDataStream ds(&device, QIODevice::WriteOnly);
- ds << quint32(waveID) << QString::fromWCharArray(var.bstrVal);
- devices.append(device);
- }
- }
- }
-
- pPropBag->Release();
- pMoniker->Release();
- }
- }
- }
- CoUninitialize();
-
- return devices;
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
-{
- QList<QByteArray> list = availableDevices(QAudio::AudioOutput);
- if (list.size() > 0)
- return list.at(0);
- else
- return QByteArray();
-}
-
-QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
-{
- QList<QByteArray> list = availableDevices(QAudio::AudioInput);
- if (list.size() > 0)
- return list.at(0);
- else
- return QByteArray();
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h b/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
deleted file mode 100644
index 2d4e271..0000000
--- a/src/multimedia/audio/qaudiodeviceinfo_win32_p.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QAUDIODEVICEINFOWIN_H
-#define QAUDIODEVICEINFOWIN_H
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qdebug.h>
-
-#include <qaudiodeviceinfo.h>
-#include <qaudiosystem.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-const unsigned int MAX_SAMPLE_RATES = 5;
-const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 };
-
-class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
-{
- Q_OBJECT
-
-public:
- QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode);
- ~QAudioDeviceInfoInternal();
-
- bool open();
- void close();
-
- bool testSettings(const QAudioFormat& format) const;
- void updateLists();
- QAudioFormat preferredFormat() const;
- bool isFormatSupported(const QAudioFormat& format) const;
- QString deviceName() const;
- QStringList supportedCodecs();
- QList<int> supportedSampleRates();
- QList<int> supportedChannelCounts();
- QList<int> supportedSampleSizes();
- QList<QAudioFormat::Endian> supportedByteOrders();
- QList<QAudioFormat::SampleType> supportedSampleTypes();
- static QByteArray defaultInputDevice();
- static QByteArray defaultOutputDevice();
- static QList<QByteArray> availableDevices(QAudio::Mode);
-
-private:
- QAudio::Mode mode;
- QString device;
- quint32 devId;
- QAudioFormat nearest;
- QList<int> freqz;
- QList<int> channelz;
- QList<int> sizez;
- QList<QAudioFormat::Endian> byteOrderz;
- QStringList codecz;
- QList<QAudioFormat::SampleType> typez;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/audio/qaudioformat.cpp b/src/multimedia/audio/qaudioformat.cpp
deleted file mode 100644
index 6ed7251..0000000
--- a/src/multimedia/audio/qaudioformat.cpp
+++ /dev/null
@@ -1,407 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <QDebug>
-#include <qaudioformat.h>
-
-
-QT_BEGIN_NAMESPACE
-
-
-class QAudioFormatPrivate : public QSharedData
-{
-public:
- QAudioFormatPrivate()
- {
- frequency = -1;
- channels = -1;
- sampleSize = -1;
- byteOrder = QAudioFormat::Endian(QSysInfo::ByteOrder);
- sampleType = QAudioFormat::Unknown;
- }
-
- QAudioFormatPrivate(const QAudioFormatPrivate &other):
- QSharedData(other),
- codec(other.codec),
- byteOrder(other.byteOrder),
- sampleType(other.sampleType),
- frequency(other.frequency),
- channels(other.channels),
- sampleSize(other.sampleSize)
- {
- }
-
- QAudioFormatPrivate& operator=(const QAudioFormatPrivate &other)
- {
- codec = other.codec;
- byteOrder = other.byteOrder;
- sampleType = other.sampleType;
- frequency = other.frequency;
- channels = other.channels;
- sampleSize = other.sampleSize;
-
- return *this;
- }
-
- QString codec;
- QAudioFormat::Endian byteOrder;
- QAudioFormat::SampleType sampleType;
- int frequency;
- int channels;
- int sampleSize;
-};
-
-/*!
- \class QAudioFormat
- \brief The QAudioFormat class stores audio stream parameter information.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- An audio format specifies how data in an audio stream is arranged,
- i.e, how the stream is to be interpreted. The encoding itself is
- specified by the codec() used for the stream.
-
- In addition to the encoding, QAudioFormat contains other
- parameters that further specify how the audio sample data is arranged.
- These are the frequency, the number of channels, the sample size,
- the sample type, and the byte order. The following table describes
- these in more detail.
-
- \table
- \header
- \o Parameter
- \o Description
- \row
- \o Sample Rate
- \o Samples per second of audio data in Hertz.
- \row
- \o Number of channels
- \o The number of audio channels (typically one for mono
- or two for stereo)
- \row
- \o Sample size
- \o How much data is stored in each sample (typically 8
- or 16 bits)
- \row
- \o Sample type
- \o Numerical representation of sample (typically signed integer,
- unsigned integer or float)
- \row
- \o Byte order
- \o Byte ordering of sample (typically little endian, big endian)
- \endtable
-
- This class is typically used in conjunction with QAudioInput or
- QAudioOutput to allow you to specify the parameters of the audio
- stream being read or written.
-
- You can obtain audio formats compatible with the audio device used
- through functions in QAudioDeviceInfo. This class also lets you
- query available parameter values for a device, so that you can set
- the parameters yourself. See the \l QAudioDeviceInfo class
- description for details. You need to know the format of the audio
- streams you wish to play or record.
-*/
-
-/*!
- Construct a new audio format.
-
- Values are initialized as follows:
- \list
- \o sampleRate() = -1
- \o channelCount() = -1
- \o sampleSize() = -1
- \o byteOrder() = QAudioFormat::Endian(QSysInfo::ByteOrder)
- \o sampleType() = QAudioFormat::Unknown
- \c codec() = ""
- \endlist
-*/
-QAudioFormat::QAudioFormat():
- d(new QAudioFormatPrivate)
-{
-}
-
-/*!
- Construct a new audio format using \a other.
- \since 1.0
-*/
-QAudioFormat::QAudioFormat(const QAudioFormat &other):
- d(other.d)
-{
-}
-
-/*!
- Destroy this audio format.
-*/
-QAudioFormat::~QAudioFormat()
-{
-}
-
-/*!
- Assigns \a other to this QAudioFormat implementation.
- \since 1.0
-*/
-QAudioFormat& QAudioFormat::operator=(const QAudioFormat &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Returns true if this QAudioFormat is equal to the \a other
- QAudioFormat; otherwise returns false.
-
- All elements of QAudioFormat are used for the comparison.
- \since 1.0
-*/
-bool QAudioFormat::operator==(const QAudioFormat &other) const
-{
- return d->frequency == other.d->frequency &&
- d->channels == other.d->channels &&
- d->sampleSize == other.d->sampleSize &&
- d->byteOrder == other.d->byteOrder &&
- d->codec == other.d->codec &&
- d->sampleType == other.d->sampleType;
-}
-
-/*!
- Returns true if this QAudioFormat is not equal to the \a other
- QAudioFormat; otherwise returns false.
-
- All elements of QAudioFormat are used for the comparison.
- \since 1.0
-*/
-bool QAudioFormat::operator!=(const QAudioFormat& other) const
-{
- return !(*this == other);
-}
-
-/*!
- Returns true if all of the parameters are valid.
- \since 1.0
-*/
-bool QAudioFormat::isValid() const
-{
- return d->frequency != -1 && d->channels != -1 && d->sampleSize != -1 &&
- d->sampleType != QAudioFormat::Unknown && !d->codec.isEmpty();
-}
-
-/*!
- Sets the sample rate to \a samplerate Hertz.
-
- \since 1.0
-*/
-void QAudioFormat::setSampleRate(int samplerate)
-{
- d->frequency = samplerate;
-}
-
-/*!
- \obsolete
-
- Use setSampleRate() instead.
-*/
-void QAudioFormat::setFrequency(int frequency)
-{
- d->frequency = frequency;
-}
-
-/*!
- Returns the current sample rate in Hertz.
-
- \since 1.0
-*/
-int QAudioFormat::sampleRate() const
-{
- return d->frequency;
-}
-
-/*!
- \obsolete
-
- Use sampleRate() instead.
-*/
-int QAudioFormat::frequency() const
-{
- return d->frequency;
-}
-
-/*!
- Sets the channel count to \a channels.
-
- \since 1.0
-*/
-void QAudioFormat::setChannelCount(int channels)
-{
- d->channels = channels;
-}
-
-/*!
- \obsolete
-
- Use setChannelCount() instead.
-*/
-void QAudioFormat::setChannels(int channels)
-{
- d->channels = channels;
-}
-
-/*!
- Returns the current channel count value.
-
- \since 1.0
-*/
-int QAudioFormat::channelCount() const
-{
- return d->channels;
-}
-
-/*!
- \obsolete
-
- Use channelCount() instead.
-*/
-int QAudioFormat::channels() const
-{
- return d->channels;
-}
-
-/*!
- Sets the sample size to the \a sampleSize specified, in bits.
-
- This is typically 8 or 16, but some systems may support higher sample sizes.
- \since 1.0
-*/
-void QAudioFormat::setSampleSize(int sampleSize)
-{
- d->sampleSize = sampleSize;
-}
-
-/*!
- Returns the current sample size value, in bits.
- \since 1.0
-*/
-int QAudioFormat::sampleSize() const
-{
- return d->sampleSize;
-}
-
-/*!
- Sets the codec to \a codec.
-
- The parameter to this function should be one of the types
- reported by the QAudioDeviceInfo::supportedCodecs() function
- for the audio device you are working with.
-
- \since 1.0
- \sa QAudioDeviceInfo::supportedCodecs()
-*/
-void QAudioFormat::setCodec(const QString &codec)
-{
- d->codec = codec;
-}
-
-/*!
- Returns the current codec identifier.
-
- \since 1.0
- \sa QAudioDeviceInfo::supportedCodecs()
-*/
-QString QAudioFormat::codec() const
-{
- return d->codec;
-}
-
-/*!
- Sets the byteOrder to \a byteOrder.
- \since 1.0
-*/
-void QAudioFormat::setByteOrder(QAudioFormat::Endian byteOrder)
-{
- d->byteOrder = byteOrder;
-}
-
-/*!
- Returns the current byteOrder value.
- \since 1.0
-*/
-QAudioFormat::Endian QAudioFormat::byteOrder() const
-{
- return d->byteOrder;
-}
-
-/*!
- Sets the sampleType to \a sampleType.
- \since 1.0
-*/
-void QAudioFormat::setSampleType(QAudioFormat::SampleType sampleType)
-{
- d->sampleType = sampleType;
-}
-
-/*!
- Returns the current SampleType value.
- \since 1.0
-*/
-QAudioFormat::SampleType QAudioFormat::sampleType() const
-{
- return d->sampleType;
-}
-
-/*!
- \enum QAudioFormat::SampleType
-
- \value Unknown Not Set
- \value SignedInt Samples are signed integers
- \value UnSignedInt Samples are unsigned intergers
- \value Float Samples are floats
-*/
-
-/*!
- \enum QAudioFormat::Endian
-
- \value BigEndian Samples are big endian byte order
- \value LittleEndian Samples are little endian byte order
-*/
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudioformat.h b/src/multimedia/audio/qaudioformat.h
deleted file mode 100644
index 087a16a..0000000
--- a/src/multimedia/audio/qaudioformat.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIOFORMAT_H
-#define QAUDIOFORMAT_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qshareddata.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QAudioFormatPrivate;
-
-class Q_MULTIMEDIA_EXPORT QAudioFormat
-{
-public:
- enum SampleType { Unknown, SignedInt, UnSignedInt, Float };
- enum Endian { BigEndian = QSysInfo::BigEndian, LittleEndian = QSysInfo::LittleEndian };
-
- QAudioFormat();
- QAudioFormat(const QAudioFormat &other);
- ~QAudioFormat();
-
- QAudioFormat& operator=(const QAudioFormat &other);
- bool operator==(const QAudioFormat &other) const;
- bool operator!=(const QAudioFormat &other) const;
-
- bool isValid() const;
-
- void setFrequency(int frequency);
- int frequency() const;
- void setSampleRate(int sampleRate);
- int sampleRate() const;
-
- void setChannels(int channels);
- int channels() const;
- void setChannelCount(int channelCount);
- int channelCount() const;
-
- void setSampleSize(int sampleSize);
- int sampleSize() const;
-
- void setCodec(const QString &codec);
- QString codec() const;
-
- void setByteOrder(QAudioFormat::Endian byteOrder);
- QAudioFormat::Endian byteOrder() const;
-
- void setSampleType(QAudioFormat::SampleType sampleType);
- QAudioFormat::SampleType sampleType() const;
-
-private:
- QSharedDataPointer<QAudioFormatPrivate> d;
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIOFORMAT_H
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
deleted file mode 100644
index 2a5cefc..0000000
--- a/src/multimedia/audio/qaudioinput.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-#include "qaudioinput.h"
-
-#include "qaudiodevicefactory_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAudioInput
- \brief The QAudioInput class provides an interface for receiving audio data from an audio input device.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- You can construct an audio input with the system's
- \l{QAudioDeviceInfo::defaultInputDevice()}{default audio input
- device}. It is also possible to create QAudioInput with a
- specific QAudioDeviceInfo. When you create the audio input, you
- should also send in the QAudioFormat to be used for the recording
- (see the QAudioFormat class description for details).
-
- To record to a file:
-
- QAudioInput lets you record audio with an audio input device. The
- default constructor of this class will use the systems default
- audio device, but you can also specify a QAudioDeviceInfo for a
- specific device. You also need to pass in the QAudioFormat in
- which you wish to record.
-
- Starting up the QAudioInput is simply a matter of calling start()
- with a QIODevice opened for writing. For instance, to record to a
- file, you can:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio input class members
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio input setup
-
- This will start recording if the format specified is supported by
- the input device (you can check this with
- QAudioDeviceInfo::isFormatSupported(). In case there are any
- snags, use the error() function to check what went wrong. We stop
- recording in the \c stopRecording() slot.
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio input stop recording
-
- At any point in time, QAudioInput will be in one of four states:
- active, suspended, stopped, or idle. These states are specified by
- the QAudio::State enum. You can request a state change directly through
- suspend(), resume(), stop(), reset(), and start(). The current
- state is reported by state(). QAudioOutput will also signal you
- when the state changes (stateChanged()).
-
- QAudioInput provides several ways of measuring the time that has
- passed since the start() of the recording. The \c processedUSecs()
- function returns the length of the stream in microseconds written,
- i.e., it leaves out the times the audio input was suspended or idle.
- The elapsedUSecs() function returns the time elapsed since start() was called regardless of
- which states the QAudioInput has been in.
-
- If an error should occur, you can fetch its reason with error().
- The possible error reasons are described by the QAudio::Error
- enum. The QAudioInput will enter the \l{QAudio::}{StoppedState} when
- an error is encountered. Connect to the stateChanged() signal to
- handle the error:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio input state changed
-
- \sa QAudioOutput, QAudioDeviceInfo
-*/
-
-/*!
- Construct a new audio input and attach it to \a parent.
- The default audio input device is used with the output
- \a format parameters.
- \since 1.0
-*/
-
-QAudioInput::QAudioInput(const QAudioFormat &format, QObject *parent):
- QObject(parent)
-{
- d = QAudioDeviceFactory::createDefaultInputDevice(format);
- connect(d, SIGNAL(notify()), SIGNAL(notify()));
- connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
-}
-
-/*!
- Construct a new audio input and attach it to \a parent.
- The device referenced by \a audioDevice is used with the input
- \a format parameters.
- \since 1.0
-*/
-
-QAudioInput::QAudioInput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent):
- QObject(parent)
-{
- d = QAudioDeviceFactory::createInputDevice(audioDevice, format);
- connect(d, SIGNAL(notify()), SIGNAL(notify()));
- connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
-}
-
-/*!
- Destroy this audio input.
-*/
-
-QAudioInput::~QAudioInput()
-{
- delete d;
-}
-
-/*!
- Uses the \a device as the QIODevice to transfer data.
- Passing a QIODevice allows the data to be transferred without any extra code.
- All that is required is to open the QIODevice.
-
- If able to successfully get audio data from the systems audio device the
- state() is set to either QAudio::ActiveState or QAudio::IdleState,
- error() is set to QAudio::NoError and the stateChanged() signal is emitted.
-
- If a problem occurs during this process the error() is set to QAudio::OpenError,
- state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
-
- \since 1.0
- \sa QIODevice
-*/
-
-void QAudioInput::start(QIODevice* device)
-{
- d->start(device);
-}
-
-/*!
- Returns a pointer to the QIODevice being used to handle the data
- transfer. This QIODevice can be used to read() audio data
- directly.
-
- If able to access the systems audio device the state() is set to
- QAudio::IdleState, error() is set to QAudio::NoError
- and the stateChanged() signal is emitted.
-
- If a problem occurs during this process the error() is set to QAudio::OpenError,
- state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
-
- \since 1.0
- \sa QIODevice
-*/
-
-QIODevice* QAudioInput::start()
-{
- return d->start();
-}
-
-/*!
- Returns the QAudioFormat being used.
- \since 1.0
-*/
-
-QAudioFormat QAudioInput::format() const
-{
- return d->format();
-}
-
-/*!
- Stops the audio input, detaching from the system resource.
-
- Sets error() to QAudio::NoError, state() to QAudio::StoppedState and
- emit stateChanged() signal.
- \since 1.0
-*/
-
-void QAudioInput::stop()
-{
- d->stop();
-}
-
-/*!
- Drops all audio data in the buffers, resets buffers to zero.
- \since 1.0
-*/
-
-void QAudioInput::reset()
-{
- d->reset();
-}
-
-/*!
- Stops processing audio data, preserving buffered audio data.
-
- Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and
- emit stateChanged() signal.
- \since 1.0
-*/
-
-void QAudioInput::suspend()
-{
- d->suspend();
-}
-
-/*!
- Resumes processing audio data after a suspend().
-
- Sets error() to QAudio::NoError.
- Sets state() to QAudio::ActiveState if you previously called start(QIODevice*).
- Sets state() to QAudio::IdleState if you previously called start().
- emits stateChanged() signal.
- \since 1.0
-*/
-
-void QAudioInput::resume()
-{
- d->resume();
-}
-
-/*!
- Sets the audio buffer size to \a value milliseconds.
-
- Note: This function can be called anytime before start(), calls to this
- are ignored after start(). It should not be assumed that the buffer size
- set is the actual buffer size used, calling bufferSize() anytime after start()
- will return the actual buffer size being used.
-
- \since 1.0
-*/
-
-void QAudioInput::setBufferSize(int value)
-{
- d->setBufferSize(value);
-}
-
-/*!
- Returns the audio buffer size in milliseconds.
-
- If called before start(), returns platform default value.
- If called before start() but setBufferSize() was called prior, returns value set by setBufferSize().
- If called after start(), returns the actual buffer size being used. This may not be what was set previously
- by setBufferSize().
-
- \since 1.0
-*/
-
-int QAudioInput::bufferSize() const
-{
- return d->bufferSize();
-}
-
-/*!
- Returns the amount of audio data available to read in bytes.
-
- NOTE: returned value is only valid while in QAudio::ActiveState or QAudio::IdleState
- state, otherwise returns zero.
- \since 1.0
-*/
-
-int QAudioInput::bytesReady() const
-{
- /*
- -If not ActiveState|IdleState, return 0
- -return amount of audio data available to read
- */
- return d->bytesReady();
-}
-
-/*!
- Returns the period size in bytes.
-
- Note: This is the recommended read size in bytes.
- \since 1.0
-*/
-
-int QAudioInput::periodSize() const
-{
- return d->periodSize();
-}
-
-/*!
- Sets the interval for notify() signal to be emitted.
- This is based on the \a ms of audio data processed
- not on actual real-time.
- The minimum resolution of the timer is platform specific and values
- should be checked with notifyInterval() to confirm actual value
- being used.
- \since 1.0
-*/
-
-void QAudioInput::setNotifyInterval(int ms)
-{
- d->setNotifyInterval(ms);
-}
-
-/*!
- Returns the notify interval in milliseconds.
- \since 1.0
-*/
-
-int QAudioInput::notifyInterval() const
-{
- return d->notifyInterval();
-}
-
-/*!
- Returns the amount of audio data processed since start()
- was called in microseconds.
- \since 1.0
-*/
-
-qint64 QAudioInput::processedUSecs() const
-{
- return d->processedUSecs();
-}
-
-/*!
- Returns the microseconds since start() was called, including time in Idle and
- Suspend states.
- \since 1.0
-*/
-
-qint64 QAudioInput::elapsedUSecs() const
-{
- return d->elapsedUSecs();
-}
-
-/*!
- Returns the error state.
- \since 1.0
-*/
-
-QAudio::Error QAudioInput::error() const
-{
- return d->error();
-}
-
-/*!
- Returns the state of audio processing.
- \since 1.0
-*/
-
-QAudio::State QAudioInput::state() const
-{
- return d->state();
-}
-
-/*!
- \fn QAudioInput::stateChanged(QAudio::State state)
- This signal is emitted when the device \a state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QAudioInput::notify()
- This signal is emitted when x ms of audio data has been processed
- the interval set by setNotifyInterval(x).
- \since 1.0
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qaudioinput.cpp"
-
diff --git a/src/multimedia/audio/qaudioinput.h b/src/multimedia/audio/qaudioinput.h
deleted file mode 100644
index 9c893ce..0000000
--- a/src/multimedia/audio/qaudioinput.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIOINPUT_H
-#define QAUDIOINPUT_H
-
-#include <QtCore/qiodevice.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include <qaudio.h>
-#include <qaudioformat.h>
-#include <qaudiodeviceinfo.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QAbstractAudioInput;
-
-class Q_MULTIMEDIA_EXPORT QAudioInput : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QAudioInput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
- explicit QAudioInput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
- ~QAudioInput();
-
- QAudioFormat format() const;
-
- void start(QIODevice *device);
- QIODevice* start();
-
- void stop();
- void reset();
- void suspend();
- void resume();
-
- void setBufferSize(int bytes);
- int bufferSize() const;
-
- int bytesReady() const;
- int periodSize() const;
-
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
-
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
-
- QAudio::Error error() const;
- QAudio::State state() const;
-
-Q_SIGNALS:
- void stateChanged(QAudio::State);
- void notify();
-
-private:
- Q_DISABLE_COPY(QAudioInput)
-
- QAbstractAudioInput* d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIOINPUT_H
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.cpp b/src/multimedia/audio/qaudioinput_alsa_p.cpp
deleted file mode 100644
index 044458c..0000000
--- a/src/multimedia/audio/qaudioinput_alsa_p.cpp
+++ /dev/null
@@ -1,867 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <QtCore/qcoreapplication.h>
-#include "qaudioinput_alsa_p.h"
-#include "qaudiodeviceinfo_alsa_p.h"
-
-QT_BEGIN_NAMESPACE
-
-//#define DEBUG_AUDIO 1
-
-QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
-{
- bytesAvailable = 0;
- handle = 0;
- ahandler = 0;
- access = SND_PCM_ACCESS_RW_INTERLEAVED;
- pcmformat = SND_PCM_FORMAT_S16;
- buffer_size = 0;
- period_size = 0;
- buffer_time = 100000;
- period_time = 20000;
- totalTimeValue = 0;
- intervalTime = 1000;
- errorState = QAudio::NoError;
- deviceState = QAudio::StoppedState;
- audioSource = 0;
- pullMode = true;
- resuming = false;
-
- m_device = device;
-
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
-}
-
-QAudioInputPrivate::~QAudioInputPrivate()
-{
- close();
- disconnect(timer, SIGNAL(timeout()));
- QCoreApplication::processEvents();
- delete timer;
-}
-
-QAudio::Error QAudioInputPrivate::error() const
-{
- return errorState;
-}
-
-QAudio::State QAudioInputPrivate::state() const
-{
- return deviceState;
-}
-
-void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (deviceState == QAudio::StoppedState)
- settings = fmt;
-}
-
-QAudioFormat QAudioInputPrivate::format() const
-{
- return settings;
-}
-
-int QAudioInputPrivate::xrun_recovery(int err)
-{
- int count = 0;
- bool reset = false;
-
- if(err == -EPIPE) {
- errorState = QAudio::UnderrunError;
- err = snd_pcm_prepare(handle);
- if(err < 0)
- reset = true;
- else {
- bytesAvailable = checkBytesReady();
- if (bytesAvailable <= 0)
- reset = true;
- }
-
- } else if((err == -ESTRPIPE)||(err == -EIO)) {
- errorState = QAudio::IOError;
- while((err = snd_pcm_resume(handle)) == -EAGAIN){
- usleep(100);
- count++;
- if(count > 5) {
- reset = true;
- break;
- }
- }
- if(err < 0) {
- err = snd_pcm_prepare(handle);
- if(err < 0)
- reset = true;
- }
- }
- if(reset) {
- close();
- open();
- snd_pcm_prepare(handle);
- return 0;
- }
- return err;
-}
-
-int QAudioInputPrivate::setFormat()
-{
- snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN;
-
- if(settings.sampleSize() == 8) {
- format = SND_PCM_FORMAT_U8;
- } else if(settings.sampleSize() == 16) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_S16_LE;
- else
- format = SND_PCM_FORMAT_S16_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_U16_LE;
- else
- format = SND_PCM_FORMAT_U16_BE;
- }
- } else if(settings.sampleSize() == 24) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_S24_LE;
- else
- format = SND_PCM_FORMAT_S24_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_U24_LE;
- else
- format = SND_PCM_FORMAT_U24_BE;
- }
- } else if(settings.sampleSize() == 32) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_S32_LE;
- else
- format = SND_PCM_FORMAT_S32_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_U32_LE;
- else
- format = SND_PCM_FORMAT_U32_BE;
- } else if(settings.sampleType() == QAudioFormat::Float) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_FLOAT_LE;
- else
- format = SND_PCM_FORMAT_FLOAT_BE;
- }
- } else if(settings.sampleSize() == 64) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- format = SND_PCM_FORMAT_FLOAT64_LE;
- else
- format = SND_PCM_FORMAT_FLOAT64_BE;
- }
-
- return format != SND_PCM_FORMAT_UNKNOWN
- ? snd_pcm_hw_params_set_format( handle, hwparams, format)
- : -1;
-}
-
-void QAudioInputPrivate::start(QIODevice* device)
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = true;
- audioSource = device;
-
- deviceState = QAudio::ActiveState;
-
- if( !open() )
- return;
-
- emit stateChanged(deviceState);
-}
-
-QIODevice* QAudioInputPrivate::start()
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = false;
- audioSource = new InputPrivate(this);
- audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
-
- deviceState = QAudio::IdleState;
-
- if( !open() )
- return 0;
-
- emit stateChanged(deviceState);
-
- return audioSource;
-}
-
-void QAudioInputPrivate::stop()
-{
- if(deviceState == QAudio::StoppedState)
- return;
-
- deviceState = QAudio::StoppedState;
-
- close();
- emit stateChanged(deviceState);
-}
-
-bool QAudioInputPrivate::open()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
-#endif
- clockStamp.restart();
- timeStamp.restart();
- elapsedTimeOffset = 0;
-
- int dir;
- int err = 0;
- int count=0;
- unsigned int freakuency=settings.frequency();
-
- if (!settings.isValid()) {
- qWarning("QAudioOutput: open error, invalid format.");
- } else if (settings.sampleRate() <= 0) {
- qWarning("QAudioOutput: open error, invalid sample rate (%d).",
- settings.sampleRate());
- } else {
- err = -1;
- }
-
- if (err == 0) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit errorChanged(errorState);
- return false;
- }
-
-
- QString dev = QString(QLatin1String(m_device.constData()));
- QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput);
- if(dev.compare(QLatin1String("default")) == 0) {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- if (devices.size() > 0)
- dev = QLatin1String(devices.first());
- else
- return false;
-#else
- dev = QLatin1String("hw:0,0");
-#endif
- } else {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- dev = QLatin1String(m_device);
-#else
- int idx = 0;
- char *name;
-
- QString shortName = QLatin1String(m_device.mid(m_device.indexOf('=',0)+1).constData());
-
- while(snd_card_get_name(idx,&name) == 0) {
- if(qstrncmp(shortName.toLocal8Bit().constData(),name,shortName.length()) == 0)
- break;
- idx++;
- }
- dev = QString(QLatin1String("hw:%1,0")).arg(idx);
-#endif
- }
-
- // Step 1: try and open the device
- while((count < 5) && (err < 0)) {
- err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_CAPTURE,0);
- if(err < 0)
- count++;
- }
- if (( err < 0)||(handle == 0)) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
- snd_pcm_nonblock( handle, 0 );
-
- // Step 2: Set the desired HW parameters.
- snd_pcm_hw_params_alloca( &hwparams );
-
- bool fatal = false;
- QString errMessage;
- unsigned int chunks = 8;
-
- err = snd_pcm_hw_params_any( handle, hwparams );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_any: err = %1").arg(err);
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_access( handle, hwparams, access );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_access: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = setFormat();
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_format: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params(handle, hwparams);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioInput: snd_pcm_hw_params: err = %1").arg(err);
- }
- }
- if( err < 0) {
- qWarning()<<errMessage;
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
- snd_pcm_hw_params_get_buffer_size(hwparams,&buffer_frames);
- buffer_size = snd_pcm_frames_to_bytes(handle,buffer_frames);
- snd_pcm_hw_params_get_period_size(hwparams,&period_frames, &dir);
- period_size = snd_pcm_frames_to_bytes(handle,period_frames);
- snd_pcm_hw_params_get_buffer_time(hwparams,&buffer_time, &dir);
- snd_pcm_hw_params_get_period_time(hwparams,&period_time, &dir);
-
- // Step 3: Set the desired SW parameters.
- snd_pcm_sw_params_t *swparams;
- snd_pcm_sw_params_alloca(&swparams);
- snd_pcm_sw_params_current(handle, swparams);
- snd_pcm_sw_params_set_start_threshold(handle,swparams,period_frames);
- snd_pcm_sw_params_set_stop_threshold(handle,swparams,buffer_frames);
- snd_pcm_sw_params_set_avail_min(handle, swparams,period_frames);
- snd_pcm_sw_params(handle, swparams);
-
- // Step 4: Prepare audio
- ringBuffer.resize(buffer_size);
- snd_pcm_prepare( handle );
- snd_pcm_start(handle);
-
- // Step 5: Setup timer
- bytesAvailable = checkBytesReady();
-
- if(pullMode)
- connect(audioSource,SIGNAL(readyRead()),this,SLOT(userFeed()));
-
- // Step 6: Start audio processing
- chunks = buffer_size/period_size;
- timer->start(period_time*chunks/2000);
-
- errorState = QAudio::NoError;
-
- totalTimeValue = 0;
-
- return true;
-}
-
-void QAudioInputPrivate::close()
-{
- timer->stop();
-
- if ( handle ) {
- snd_pcm_drop( handle );
- snd_pcm_close( handle );
- handle = 0;
- }
-}
-
-int QAudioInputPrivate::checkBytesReady()
-{
- if(resuming)
- bytesAvailable = period_size;
- else if(deviceState != QAudio::ActiveState
- && deviceState != QAudio::IdleState)
- bytesAvailable = 0;
- else {
- int frames = snd_pcm_avail_update(handle);
- if (frames < 0) {
- bytesAvailable = frames;
- } else {
- if((int)frames > (int)buffer_frames)
- frames = buffer_frames;
- bytesAvailable = snd_pcm_frames_to_bytes(handle, frames);
- }
- }
- return bytesAvailable;
-}
-
-int QAudioInputPrivate::bytesReady() const
-{
- return qMax(bytesAvailable, 0);
-}
-
-qint64 QAudioInputPrivate::read(char* data, qint64 len)
-{
- // Read in some audio data and write it to QIODevice, pull mode
- if ( !handle )
- return 0;
-
- int bytesRead = 0;
- int bytesInRingbufferBeforeRead = ringBuffer.bytesOfDataInBuffer();
-
- if (ringBuffer.bytesOfDataInBuffer() < len) {
-
- // bytesAvaiable is saved as a side effect of checkBytesReady().
- int bytesToRead = checkBytesReady();
-
- if (bytesToRead < 0) {
- // bytesAvailable as negative is error code, try to recover from it.
- xrun_recovery(bytesToRead);
- bytesToRead = checkBytesReady();
- if (bytesToRead < 0) {
- // recovery failed must stop and set error.
- close();
- errorState = QAudio::IOError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return 0;
- }
- }
-
- bytesToRead = qMin<qint64>(len, bytesToRead);
- bytesToRead = qMin<qint64>(ringBuffer.freeBytes(), bytesToRead);
- bytesToRead -= bytesToRead % period_size;
-
- int count=0;
- int err = 0;
- while(count < 5 && bytesToRead > 0) {
- char buffer[bytesToRead];
- int chunks = bytesToRead / period_size;
- int frames = chunks * period_frames;
- if (frames > (int)buffer_frames)
- frames = buffer_frames;
-
- int readFrames = snd_pcm_readi(handle, buffer, frames);
-
- if (readFrames >= 0) {
- bytesRead = snd_pcm_frames_to_bytes(handle, readFrames);
- ringBuffer.write(buffer, bytesRead);
-#ifdef DEBUG_AUDIO
- qDebug() << QString::fromLatin1("read in bytes = %1 (frames=%2)").arg(bytesRead).arg(readFrames).toLatin1().constData();
-#endif
- break;
- } else if((readFrames == -EAGAIN) || (readFrames == -EINTR)) {
- errorState = QAudio::IOError;
- err = 0;
- break;
- } else {
- if(readFrames == -EPIPE) {
- errorState = QAudio::UnderrunError;
- err = snd_pcm_prepare(handle);
- } else if(readFrames == -ESTRPIPE) {
- err = snd_pcm_prepare(handle);
- }
- if(err != 0) break;
- }
- count++;
- }
-
- }
-
- bytesRead += bytesInRingbufferBeforeRead;
-
- if (bytesRead > 0) {
- // got some send it onward
-#ifdef DEBUG_AUDIO
- qDebug() << "frames to write to QIODevice = " <<
- snd_pcm_bytes_to_frames( handle, (int)bytesRead ) << " (" << bytesRead << ") bytes";
-#endif
- if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
- return 0;
-
- if (pullMode) {
- qint64 l = 0;
- qint64 bytesWritten = 0;
- while (ringBuffer.bytesOfDataInBuffer() > 0) {
- l = audioSource->write(ringBuffer.availableData(), ringBuffer.availableDataBlockSize());
- if (l > 0) {
- ringBuffer.readBytes(l);
- bytesWritten += l;
- } else {
- break;
- }
- }
-
- if (l < 0) {
- close();
- errorState = QAudio::IOError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- } else if (l == 0 && bytesWritten == 0) {
- if (deviceState != QAudio::IdleState) {
- errorState = QAudio::NoError;
- deviceState = QAudio::IdleState;
- emit stateChanged(deviceState);
- }
- } else {
- bytesAvailable -= bytesWritten;
- totalTimeValue += bytesWritten;
- resuming = false;
- if (deviceState != QAudio::ActiveState) {
- errorState = QAudio::NoError;
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- }
-
- return bytesWritten;
- } else {
- while (ringBuffer.bytesOfDataInBuffer() > 0) {
- int size = ringBuffer.availableDataBlockSize();
- memcpy(data, ringBuffer.availableData(), size);
- data += size;
- ringBuffer.readBytes(size);
- }
-
- bytesAvailable -= bytesRead;
- totalTimeValue += bytesRead;
- resuming = false;
- if (deviceState != QAudio::ActiveState) {
- errorState = QAudio::NoError;
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
-
- return bytesRead;
- }
- }
-
- return 0;
-}
-
-void QAudioInputPrivate::resume()
-{
- if(deviceState == QAudio::SuspendedState) {
- int err = 0;
-
- if(handle) {
- err = snd_pcm_prepare( handle );
- if(err < 0)
- xrun_recovery(err);
-
- err = snd_pcm_start(handle);
- if(err < 0)
- xrun_recovery(err);
-
- bytesAvailable = buffer_size;
- }
- resuming = true;
- deviceState = QAudio::ActiveState;
- int chunks = buffer_size/period_size;
- timer->start(period_time*chunks/2000);
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioInputPrivate::setBufferSize(int value)
-{
- buffer_size = value;
-}
-
-int QAudioInputPrivate::bufferSize() const
-{
- return buffer_size;
-}
-
-int QAudioInputPrivate::periodSize() const
-{
- return period_size;
-}
-
-void QAudioInputPrivate::setNotifyInterval(int ms)
-{
- intervalTime = qMax(0, ms);
-}
-
-int QAudioInputPrivate::notifyInterval() const
-{
- return intervalTime;
-}
-
-qint64 QAudioInputPrivate::processedUSecs() const
-{
- qint64 result = qint64(1000000) * totalTimeValue /
- (settings.channels()*(settings.sampleSize()/8)) /
- settings.frequency();
-
- return result;
-}
-
-void QAudioInputPrivate::suspend()
-{
- if(deviceState == QAudio::ActiveState||resuming) {
- timer->stop();
- deviceState = QAudio::SuspendedState;
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioInputPrivate::userFeed()
-{
- if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
- return;
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :userFeed() IN";
-#endif
- deviceReady();
-}
-
-bool QAudioInputPrivate::deviceReady()
-{
- if(pullMode) {
- // reads some audio data and writes it to QIODevice
- read(0, buffer_size);
- } else {
- // emits readyRead() so user will call read() on QIODevice to get some audio data
- InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
- a->trigger();
- }
- bytesAvailable = checkBytesReady();
-
- if(deviceState != QAudio::ActiveState)
- return true;
-
- if (bytesAvailable < 0) {
- // bytesAvailable as negative is error code, try to recover from it.
- xrun_recovery(bytesAvailable);
- bytesAvailable = checkBytesReady();
- if (bytesAvailable < 0) {
- // recovery failed must stop and set error.
- close();
- errorState = QAudio::IOError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return 0;
- }
- }
-
- if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
- emit notify();
- elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
- timeStamp.restart();
- }
- return true;
-}
-
-qint64 QAudioInputPrivate::elapsedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
-
- return clockStamp.elapsed()*1000;
-}
-
-void QAudioInputPrivate::reset()
-{
- if(handle)
- snd_pcm_reset(handle);
- stop();
- bytesAvailable = 0;
-}
-
-void QAudioInputPrivate::drain()
-{
- if(handle)
- snd_pcm_drain(handle);
-}
-
-InputPrivate::InputPrivate(QAudioInputPrivate* audio)
-{
- audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
-}
-
-InputPrivate::~InputPrivate()
-{
-}
-
-qint64 InputPrivate::readData( char* data, qint64 len)
-{
- return 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();
-}
-
-RingBuffer::RingBuffer() :
- m_head(0),
- m_tail(0)
-{
-}
-
-void RingBuffer::resize(int size)
-{
- m_data.resize(size);
-}
-
-int RingBuffer::bytesOfDataInBuffer() const
-{
- if (m_head < m_tail)
- return m_tail - m_head;
- else if (m_tail < m_head)
- return m_data.size() + m_tail - m_head;
- else
- return 0;
-}
-
-int RingBuffer::freeBytes() const
-{
- if (m_head > m_tail)
- return m_head - m_tail - 1;
- else if (m_tail > m_head)
- return m_data.size() - m_tail + m_head - 1;
- else
- return m_data.size() - 1;
-}
-
-const char *RingBuffer::availableData() const
-{
- return (m_data.constData() + m_head);
-}
-
-int RingBuffer::availableDataBlockSize() const
-{
- if (m_head > m_tail)
- return m_data.size() - m_head;
- else if (m_tail > m_head)
- return m_tail - m_head;
- else
- return 0;
-}
-
-void RingBuffer::readBytes(int bytes)
-{
- m_head = (m_head + bytes) % m_data.size();
-}
-
-void RingBuffer::write(char *data, int len)
-{
- if (m_tail + len < m_data.size()) {
- memcpy(m_data.data() + m_tail, data, len);
- m_tail += len;
- } else {
- int bytesUntilEnd = m_data.size() - m_tail;
- memcpy(m_data.data() + m_tail, data, bytesUntilEnd);
- if (len - bytesUntilEnd > 0)
- memcpy(m_data.data(), data + bytesUntilEnd, len - bytesUntilEnd);
- m_tail = len - bytesUntilEnd;
- }
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaudioinput_alsa_p.cpp"
diff --git a/src/multimedia/audio/qaudioinput_alsa_p.h b/src/multimedia/audio/qaudioinput_alsa_p.h
deleted file mode 100644
index a05f695..0000000
--- a/src/multimedia/audio/qaudioinput_alsa_p.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QAUDIOINPUTALSA_H
-#define QAUDIOINPUTALSA_H
-
-#include <alsa/asoundlib.h>
-
-#include <QtCore/qfile.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class InputPrivate;
-
-class RingBuffer
-{
-public:
- RingBuffer();
-
- void resize(int size);
-
- int bytesOfDataInBuffer() const;
- int freeBytes() const;
-
- const char *availableData() const;
- int availableDataBlockSize() const;
- void readBytes(int bytes);
-
- void write(char *data, int len);
-
-private:
- int m_head;
- int m_tail;
-
- QByteArray m_data;
-};
-
-class QAudioInputPrivate : public QAbstractAudioInput
-{
- Q_OBJECT
-public:
- QAudioInputPrivate(const QByteArray &device);
- ~QAudioInputPrivate();
-
- qint64 read(char* data, qint64 len);
-
- void start(QIODevice* device);
- QIODevice* start();
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesReady() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- void setFormat(const QAudioFormat& fmt);
- QAudioFormat format() const;
- bool resuming;
- snd_pcm_t* handle;
- qint64 totalTimeValue;
- QIODevice* audioSource;
- QAudioFormat settings;
- QAudio::Error errorState;
- QAudio::State deviceState;
-
-private slots:
- void userFeed();
- bool deviceReady();
-
-private:
- int checkBytesReady();
- int xrun_recovery(int err);
- int setFormat();
- bool open();
- void close();
- void drain();
-
- QTimer* timer;
- QTime timeStamp;
- QTime clockStamp;
- qint64 elapsedTimeOffset;
- int intervalTime;
- RingBuffer ringBuffer;
- int bytesAvailable;
- QByteArray m_device;
- bool pullMode;
- int buffer_size;
- int period_size;
- unsigned int buffer_time;
- unsigned int period_time;
- snd_pcm_uframes_t buffer_frames;
- snd_pcm_uframes_t period_frames;
- snd_async_handler_t* ahandler;
- snd_pcm_access_t access;
- snd_pcm_format_t pcmformat;
- snd_timestamp_t* timestamp;
- snd_pcm_hw_params_t *hwparams;
-};
-
-class InputPrivate : public QIODevice
-{
- Q_OBJECT
-public:
- InputPrivate(QAudioInputPrivate* audio);
- ~InputPrivate();
-
- qint64 readData( char* data, qint64 len);
- qint64 writeData(const char* data, qint64 len);
-
- void trigger();
-private:
- QAudioInputPrivate *audioDevice;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp
deleted file mode 100644
index 184935a..0000000
--- a/src/multimedia/audio/qaudioinput_mac_p.cpp
+++ /dev/null
@@ -1,989 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <QtCore/qendian.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-
-#include <qaudioinput.h>
-
-#include "qaudio_mac_p.h"
-#include "qaudioinput_mac_p.h"
-#include "qaudiodeviceinfo_mac_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-namespace QtMultimediaInternal
-{
-
-static const int default_buffer_size = 4 * 1024;
-
-class QAudioBufferList
-{
-public:
- QAudioBufferList(AudioStreamBasicDescription const& streamFormat):
- owner(false),
- sf(streamFormat)
- {
- const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
- const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
-
- dataSize = 0;
-
- bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
- (sizeof(AudioBuffer) * numberOfBuffers)));
-
- bfs->mNumberBuffers = numberOfBuffers;
- for (int i = 0; i < numberOfBuffers; ++i) {
- bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
- bfs->mBuffers[i].mDataByteSize = 0;
- bfs->mBuffers[i].mData = 0;
- }
- }
-
- QAudioBufferList(AudioStreamBasicDescription const& streamFormat, char* buffer, int bufferSize):
- owner(false),
- sf(streamFormat),
- bfs(0)
- {
- dataSize = bufferSize;
-
- bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) + sizeof(AudioBuffer)));
-
- bfs->mNumberBuffers = 1;
- bfs->mBuffers[0].mNumberChannels = 1;
- bfs->mBuffers[0].mDataByteSize = dataSize;
- bfs->mBuffers[0].mData = buffer;
- }
-
- QAudioBufferList(AudioStreamBasicDescription const& streamFormat, int framesToBuffer):
- owner(true),
- sf(streamFormat),
- bfs(0)
- {
- const bool isInterleaved = (sf.mFormatFlags & kAudioFormatFlagIsNonInterleaved) == 0;
- const int numberOfBuffers = isInterleaved ? 1 : sf.mChannelsPerFrame;
-
- dataSize = framesToBuffer * sf.mBytesPerFrame;
-
- bfs = reinterpret_cast<AudioBufferList*>(qMalloc(sizeof(AudioBufferList) +
- (sizeof(AudioBuffer) * numberOfBuffers)));
- bfs->mNumberBuffers = numberOfBuffers;
- for (int i = 0; i < numberOfBuffers; ++i) {
- bfs->mBuffers[i].mNumberChannels = isInterleaved ? numberOfBuffers : 1;
- bfs->mBuffers[i].mDataByteSize = dataSize;
- bfs->mBuffers[i].mData = qMalloc(dataSize);
- }
- }
-
- ~QAudioBufferList()
- {
- if (owner) {
- for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i)
- qFree(bfs->mBuffers[i].mData);
- }
-
- qFree(bfs);
- }
-
- AudioBufferList* audioBufferList() const
- {
- return bfs;
- }
-
- char* data(int buffer = 0) const
- {
- return static_cast<char*>(bfs->mBuffers[buffer].mData);
- }
-
- qint64 bufferSize(int buffer = 0) const
- {
- return bfs->mBuffers[buffer].mDataByteSize;
- }
-
- int frameCount(int buffer = 0) const
- {
- return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerFrame;
- }
-
- int packetCount(int buffer = 0) const
- {
- return bfs->mBuffers[buffer].mDataByteSize / sf.mBytesPerPacket;
- }
-
- int packetSize() const
- {
- return sf.mBytesPerPacket;
- }
-
- void reset()
- {
- for (UInt32 i = 0; i < bfs->mNumberBuffers; ++i) {
- bfs->mBuffers[i].mDataByteSize = dataSize;
- bfs->mBuffers[i].mData = 0;
- }
- }
-
-private:
- bool owner;
- int dataSize;
- AudioStreamBasicDescription sf;
- AudioBufferList* bfs;
-};
-
-class QAudioPacketFeeder
-{
-public:
- QAudioPacketFeeder(QAudioBufferList* abl):
- audioBufferList(abl)
- {
- totalPackets = audioBufferList->packetCount();
- position = 0;
- }
-
- bool feed(AudioBufferList& dst, UInt32& packetCount)
- {
- if (position == totalPackets) {
- dst.mBuffers[0].mDataByteSize = 0;
- packetCount = 0;
- return false;
- }
-
- if (totalPackets - position < packetCount)
- packetCount = totalPackets - position;
-
- dst.mBuffers[0].mDataByteSize = packetCount * audioBufferList->packetSize();
- dst.mBuffers[0].mData = audioBufferList->data() + (position * audioBufferList->packetSize());
-
- position += packetCount;
-
- return true;
- }
-
- bool empty() const
- {
- return position == totalPackets;
- }
-
-private:
- UInt32 totalPackets;
- UInt32 position;
- QAudioBufferList* audioBufferList;
-};
-
-class QAudioInputBuffer : public QObject
-{
- Q_OBJECT
-
-public:
- QAudioInputBuffer(int bufferSize,
- int maxPeriodSize,
- AudioStreamBasicDescription const& inputFormat,
- AudioStreamBasicDescription const& outputFormat,
- QObject* parent):
- QObject(parent),
- m_deviceError(false),
- m_audioConverter(0),
- m_inputFormat(inputFormat),
- m_outputFormat(outputFormat)
- {
- m_maxPeriodSize = maxPeriodSize;
- m_periodTime = m_maxPeriodSize / m_outputFormat.mBytesPerFrame * 1000 / m_outputFormat.mSampleRate;
- m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
- m_inputBufferList = new QAudioBufferList(m_inputFormat);
-
- m_flushTimer = new QTimer(this);
- connect(m_flushTimer, SIGNAL(timeout()), SLOT(flushBuffer()));
-
- if (toQAudioFormat(inputFormat) != toQAudioFormat(outputFormat)) {
- if (AudioConverterNew(&m_inputFormat, &m_outputFormat, &m_audioConverter) != noErr) {
- qWarning() << "QAudioInput: Unable to create an Audio Converter";
- m_audioConverter = 0;
- }
- }
- }
-
- ~QAudioInputBuffer()
- {
- delete m_buffer;
- }
-
- qint64 renderFromDevice(AudioUnit audioUnit,
- AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames)
- {
- const bool pullMode = m_device == 0;
-
- OSStatus err;
- qint64 framesRendered = 0;
-
- m_inputBufferList->reset();
- err = AudioUnitRender(audioUnit,
- ioActionFlags,
- inTimeStamp,
- inBusNumber,
- inNumberFrames,
- m_inputBufferList->audioBufferList());
-
- if (m_audioConverter != 0) {
- QAudioPacketFeeder feeder(m_inputBufferList);
-
- int copied = 0;
- const int available = m_buffer->free();
-
- while (err == noErr && !feeder.empty()) {
- QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available);
-
- if (region.second == 0)
- break;
-
- AudioBufferList output;
- output.mNumberBuffers = 1;
- output.mBuffers[0].mNumberChannels = 1;
- output.mBuffers[0].mDataByteSize = region.second;
- output.mBuffers[0].mData = region.first;
-
- UInt32 packetSize = region.second / m_outputFormat.mBytesPerPacket;
- err = AudioConverterFillComplexBuffer(m_audioConverter,
- converterCallback,
- &feeder,
- &packetSize,
- &output,
- 0);
- region.second = output.mBuffers[0].mDataByteSize;
- copied += region.second;
-
- m_buffer->releaseWriteRegion(region);
- }
-
- framesRendered += copied / m_outputFormat.mBytesPerFrame;
- }
- else {
- const int available = m_inputBufferList->bufferSize();
- bool wecan = true;
- int copied = 0;
-
- while (wecan && copied < available) {
- QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(available - copied);
-
- if (region.second > 0) {
- memcpy(region.first, m_inputBufferList->data() + copied, region.second);
- copied += region.second;
- }
- else
- wecan = false;
-
- m_buffer->releaseWriteRegion(region);
- }
-
- framesRendered = copied / m_outputFormat.mBytesPerFrame;
- }
-
- if (pullMode && framesRendered > 0)
- emit readyRead();
-
- return framesRendered;
- }
-
- qint64 readBytes(char* data, qint64 len)
- {
- bool wecan = true;
- qint64 bytesCopied = 0;
-
- len -= len % m_maxPeriodSize;
- while (wecan && bytesCopied < len) {
- QAudioRingBuffer::Region region = m_buffer->acquireReadRegion(len - bytesCopied);
-
- if (region.second > 0) {
- memcpy(data + bytesCopied, region.first, region.second);
- bytesCopied += region.second;
- }
- else
- wecan = false;
-
- m_buffer->releaseReadRegion(region);
- }
-
- return bytesCopied;
- }
-
- void setFlushDevice(QIODevice* device)
- {
- if (m_device != device)
- m_device = device;
- }
-
- void startFlushTimer()
- {
- if (m_device != 0) {
- m_flushTimer->start((m_buffer->size() - (m_maxPeriodSize * 2)) / m_maxPeriodSize * m_periodTime);
- }
- }
-
- void stopFlushTimer()
- {
- m_flushTimer->stop();
- }
-
- void flush(bool all = false)
- {
- if (m_device == 0)
- return;
-
- const int used = m_buffer->used();
- const int readSize = all ? used : used - (used % m_maxPeriodSize);
-
- if (readSize > 0) {
- bool wecan = true;
- int flushed = 0;
-
- while (!m_deviceError && wecan && flushed < readSize) {
- QAudioRingBuffer::Region region = m_buffer->acquireReadRegion(readSize - flushed);
-
- if (region.second > 0) {
- int bytesWritten = m_device->write(region.first, region.second);
- if (bytesWritten < 0) {
- stopFlushTimer();
- m_deviceError = true;
- }
- else {
- region.second = bytesWritten;
- flushed += bytesWritten;
- wecan = bytesWritten != 0;
- }
- }
- else
- wecan = false;
-
- m_buffer->releaseReadRegion(region);
- }
- }
- }
-
- void reset()
- {
- m_buffer->reset();
- m_deviceError = false;
- }
-
- int available() const
- {
- return m_buffer->free();
- }
-
- int used() const
- {
- return m_buffer->used();
- }
-
-signals:
- void readyRead();
-
-private slots:
- void flushBuffer()
- {
- flush();
- }
-
-private:
- bool m_deviceError;
- int m_maxPeriodSize;
- int m_periodTime;
- QIODevice* m_device;
- QTimer* m_flushTimer;
- QAudioRingBuffer* m_buffer;
- QAudioBufferList* m_inputBufferList;
- AudioConverterRef m_audioConverter;
- AudioStreamBasicDescription m_inputFormat;
- AudioStreamBasicDescription m_outputFormat;
-
- const static OSStatus as_empty = 'qtem';
-
- // Converter callback
- static OSStatus converterCallback(AudioConverterRef inAudioConverter,
- UInt32* ioNumberDataPackets,
- AudioBufferList* ioData,
- AudioStreamPacketDescription** outDataPacketDescription,
- void* inUserData)
- {
- Q_UNUSED(inAudioConverter);
- Q_UNUSED(outDataPacketDescription);
-
- QAudioPacketFeeder* feeder = static_cast<QAudioPacketFeeder*>(inUserData);
-
- if (!feeder->feed(*ioData, *ioNumberDataPackets))
- return as_empty;
-
- return noErr;
- }
-};
-
-
-class MacInputDevice : public QIODevice
-{
- Q_OBJECT
-
-public:
- MacInputDevice(QAudioInputBuffer* audioBuffer, QObject* parent):
- QIODevice(parent),
- m_audioBuffer(audioBuffer)
- {
- open(QIODevice::ReadOnly | QIODevice::Unbuffered);
- connect(m_audioBuffer, SIGNAL(readyRead()), SIGNAL(readyRead()));
- }
-
- qint64 readData(char* data, qint64 len)
- {
- return m_audioBuffer->readBytes(data, len);
- }
-
- qint64 writeData(const char* data, qint64 len)
- {
- Q_UNUSED(data);
- Q_UNUSED(len);
-
- return 0;
- }
-
- bool isSequential() const
- {
- return true;
- }
-
-private:
- QAudioInputBuffer* m_audioBuffer;
-};
-
-}
-
-
-QAudioInputPrivate::QAudioInputPrivate(const QByteArray& device)
-{
- QDataStream ds(device);
- quint32 did, mode;
-
- ds >> did >> mode;
-
- if (QAudio::Mode(mode) == QAudio::AudioOutput)
- errorCode = QAudio::OpenError;
- else {
- audioDeviceInfo = new QAudioDeviceInfoInternal(device, QAudio::AudioInput);
- isOpen = false;
- audioDeviceId = AudioDeviceID(did);
- audioUnit = 0;
- startTime = 0;
- totalFrames = 0;
- audioBuffer = 0;
- internalBufferSize = QtMultimediaInternal::default_buffer_size;
- clockFrequency = AudioGetHostClockFrequency() / 1000;
- errorCode = QAudio::NoError;
- stateCode = QAudio::StoppedState;
-
- intervalTimer = new QTimer(this);
- intervalTimer->setInterval(1000);
- connect(intervalTimer, SIGNAL(timeout()), SIGNAL(notify()));
- }
-}
-
-QAudioInputPrivate::~QAudioInputPrivate()
-{
- close();
- delete audioDeviceInfo;
-}
-
-bool QAudioInputPrivate::open()
-{
- UInt32 size = 0;
-
- if (isOpen)
- return true;
-
- ComponentDescription cd;
- cd.componentType = kAudioUnitType_Output;
- cd.componentSubType = kAudioUnitSubType_HALOutput;
- cd.componentManufacturer = kAudioUnitManufacturer_Apple;
- cd.componentFlags = 0;
- cd.componentFlagsMask = 0;
-
- // Open
- Component cp = FindNextComponent(NULL, &cd);
- if (cp == 0) {
- qWarning() << "QAudioInput: Failed to find HAL Output component";
- return false;
- }
-
- if (OpenAComponent(cp, &audioUnit) != noErr) {
- qWarning() << "QAudioInput: Unable to Open Output Component";
- return false;
- }
-
- // Set mode
- // switch to input mode
- UInt32 enable = 1;
- if (AudioUnitSetProperty(audioUnit,
- kAudioOutputUnitProperty_EnableIO,
- kAudioUnitScope_Input,
- 1,
- &enable,
- sizeof(enable)) != noErr) {
- qWarning() << "QAudioInput: Unable to switch to input mode (Enable Input)";
- return false;
- }
-
- enable = 0;
- if (AudioUnitSetProperty(audioUnit,
- kAudioOutputUnitProperty_EnableIO,
- kAudioUnitScope_Output,
- 0,
- &enable,
- sizeof(enable)) != noErr) {
- qWarning() << "QAudioInput: Unable to switch to input mode (Disable output)";
- return false;
- }
-
- // register callback
- AURenderCallbackStruct cb;
- cb.inputProc = inputCallback;
- cb.inputProcRefCon = this;
-
- if (AudioUnitSetProperty(audioUnit,
- kAudioOutputUnitProperty_SetInputCallback,
- kAudioUnitScope_Global,
- 0,
- &cb,
- sizeof(cb)) != noErr) {
- qWarning() << "QAudioInput: Failed to set AudioUnit callback";
- return false;
- }
-
- // Set Audio Device
- if (AudioUnitSetProperty(audioUnit,
- kAudioOutputUnitProperty_CurrentDevice,
- kAudioUnitScope_Global,
- 0,
- &audioDeviceId,
- sizeof(audioDeviceId)) != noErr) {
- qWarning() << "QAudioInput: Unable to use configured device";
- return false;
- }
-
- // Set format
- // Wanted
- streamFormat = toAudioStreamBasicDescription(audioFormat);
-
- // Required on unit
- if (audioFormat == audioDeviceInfo->preferredFormat()) {
- deviceFormat = streamFormat;
- AudioUnitSetProperty(audioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Output,
- 1,
- &deviceFormat,
- sizeof(deviceFormat));
- }
- else {
- size = sizeof(deviceFormat);
- if (AudioUnitGetProperty(audioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Input,
- 1,
- &deviceFormat,
- &size) != noErr) {
- qWarning() << "QAudioInput: Unable to retrieve device format";
- return false;
- }
-
- if (AudioUnitSetProperty(audioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Output,
- 1,
- &deviceFormat,
- sizeof(deviceFormat)) != noErr) {
- qWarning() << "QAudioInput: Unable to set device format";
- return false;
- }
- }
-
- // Setup buffers
- UInt32 numberOfFrames;
- size = sizeof(UInt32);
- if (AudioUnitGetProperty(audioUnit,
- kAudioDevicePropertyBufferFrameSize,
- kAudioUnitScope_Global,
- 0,
- &numberOfFrames,
- &size) != noErr) {
- qWarning() << "QAudioInput: Failed to get audio period size";
- return false;
- }
-
- // Allocate buffer
- periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame;
-
- if (internalBufferSize < periodSizeBytes * 2)
- internalBufferSize = periodSizeBytes * 2;
- else
- internalBufferSize -= internalBufferSize % streamFormat.mBytesPerFrame;
-
- audioBuffer = new QtMultimediaInternal::QAudioInputBuffer(internalBufferSize,
- periodSizeBytes,
- deviceFormat,
- streamFormat,
- this);
-
- audioIO = new QtMultimediaInternal::MacInputDevice(audioBuffer, this);
-
- // Init
- if (AudioUnitInitialize(audioUnit) != noErr) {
- qWarning() << "QAudioInput: Failed to initialize AudioUnit";
- return false;
- }
-
- isOpen = true;
-
- return isOpen;
-}
-
-void QAudioInputPrivate::close()
-{
- if (audioUnit != 0) {
- AudioOutputUnitStop(audioUnit);
- AudioUnitUninitialize(audioUnit);
- CloseComponent(audioUnit);
- }
-
- delete audioBuffer;
-}
-
-QAudioFormat QAudioInputPrivate::format() const
-{
- return audioFormat;
-}
-
-void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (stateCode == QAudio::StoppedState)
- audioFormat = fmt;
-}
-
-void QAudioInputPrivate::start(QIODevice* device)
-{
- QIODevice* op = device;
-
- if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) {
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::OpenError;
- return;
- }
-
- reset();
- audioBuffer->reset();
- audioBuffer->setFlushDevice(op);
-
- if (op == 0)
- op = audioIO;
-
- // Start
- startTime = AudioGetCurrentHostTime();
- totalFrames = 0;
-
- audioThreadStart();
-
- stateCode = QAudio::ActiveState;
- errorCode = QAudio::NoError;
- emit stateChanged(stateCode);
-}
-
-QIODevice* QAudioInputPrivate::start()
-{
- QIODevice* op = 0;
-
- if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) {
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::OpenError;
- return audioIO;
- }
-
- reset();
- audioBuffer->reset();
- audioBuffer->setFlushDevice(op);
-
- if (op == 0)
- op = audioIO;
-
- // Start
- startTime = AudioGetCurrentHostTime();
- totalFrames = 0;
-
- audioThreadStart();
-
- stateCode = QAudio::ActiveState;
- errorCode = QAudio::NoError;
- emit stateChanged(stateCode);
-
- return op;
-}
-
-void QAudioInputPrivate::stop()
-{
- QMutexLocker lock(&mutex);
- if (stateCode != QAudio::StoppedState) {
- audioThreadStop();
- audioBuffer->flush(true);
-
- errorCode = QAudio::NoError;
- stateCode = QAudio::StoppedState;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioInputPrivate::reset()
-{
- QMutexLocker lock(&mutex);
- if (stateCode != QAudio::StoppedState) {
- audioThreadStop();
-
- errorCode = QAudio::NoError;
- stateCode = QAudio::StoppedState;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioInputPrivate::suspend()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) {
- audioThreadStop();
-
- errorCode = QAudio::NoError;
- stateCode = QAudio::SuspendedState;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioInputPrivate::resume()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::SuspendedState) {
- audioThreadStart();
-
- errorCode = QAudio::NoError;
- stateCode = QAudio::ActiveState;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-int QAudioInputPrivate::bytesReady() const
-{
- return audioBuffer->used();
-}
-
-int QAudioInputPrivate::periodSize() const
-{
- return periodSizeBytes;
-}
-
-void QAudioInputPrivate::setBufferSize(int bs)
-{
- internalBufferSize = bs;
-}
-
-int QAudioInputPrivate::bufferSize() const
-{
- return internalBufferSize;
-}
-
-void QAudioInputPrivate::setNotifyInterval(int milliSeconds)
-{
- if (intervalTimer->interval() == milliSeconds)
- return;
-
- if (milliSeconds <= 0)
- milliSeconds = 0;
-
- intervalTimer->setInterval(milliSeconds);
-}
-
-int QAudioInputPrivate::notifyInterval() const
-{
- return intervalTimer->interval();
-}
-
-qint64 QAudioInputPrivate::processedUSecs() const
-{
- return totalFrames * 1000000 / audioFormat.frequency();
-}
-
-qint64 QAudioInputPrivate::elapsedUSecs() const
-{
- if (stateCode == QAudio::StoppedState)
- return 0;
-
- return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000);
-}
-
-QAudio::Error QAudioInputPrivate::error() const
-{
- return errorCode;
-}
-
-QAudio::State QAudioInputPrivate::state() const
-{
- return stateCode;
-}
-
-void QAudioInputPrivate::audioThreadStop()
-{
- stopTimers();
- if (audioThreadState.testAndSetAcquire(Running, Stopped))
- threadFinished.wait(&mutex);
-}
-
-void QAudioInputPrivate::audioThreadStart()
-{
- startTimers();
- audioThreadState = Running;
- AudioOutputUnitStart(audioUnit);
-}
-
-void QAudioInputPrivate::audioDeviceStop()
-{
- AudioOutputUnitStop(audioUnit);
- audioThreadState = Stopped;
- threadFinished.wakeOne();
-}
-
-void QAudioInputPrivate::audioDeviceFull()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState) {
- audioDeviceStop();
-
- errorCode = QAudio::UnderrunError;
- stateCode = QAudio::IdleState;
- QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
- }
-}
-
-void QAudioInputPrivate::audioDeviceError()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState) {
- audioDeviceStop();
-
- errorCode = QAudio::IOError;
- stateCode = QAudio::StoppedState;
- QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
- }
-}
-
-void QAudioInputPrivate::startTimers()
-{
- audioBuffer->startFlushTimer();
- if (intervalTimer->interval() > 0)
- intervalTimer->start();
-}
-
-void QAudioInputPrivate::stopTimers()
-{
- audioBuffer->stopFlushTimer();
- intervalTimer->stop();
-}
-
-void QAudioInputPrivate::deviceStopped()
-{
- stopTimers();
- emit stateChanged(stateCode);
-}
-
-// Input callback
-OSStatus QAudioInputPrivate::inputCallback(void* inRefCon,
- AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList* ioData)
-{
- Q_UNUSED(ioData);
-
- QAudioInputPrivate* d = static_cast<QAudioInputPrivate*>(inRefCon);
-
- const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
- if (threadState == Stopped)
- d->audioDeviceStop();
- else {
- qint64 framesWritten;
-
- framesWritten = d->audioBuffer->renderFromDevice(d->audioUnit,
- ioActionFlags,
- inTimeStamp,
- inBusNumber,
- inNumberFrames);
-
- if (framesWritten > 0)
- d->totalFrames += framesWritten;
- else if (framesWritten == 0)
- d->audioDeviceFull();
- else if (framesWritten < 0)
- d->audioDeviceError();
- }
-
- return noErr;
-}
-
-
-QT_END_NAMESPACE
-
-#include "qaudioinput_mac_p.moc"
diff --git a/src/multimedia/audio/qaudioinput_mac_p.h b/src/multimedia/audio/qaudioinput_mac_p.h
deleted file mode 100644
index 99aaba9..0000000
--- a/src/multimedia/audio/qaudioinput_mac_p.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#ifndef QAUDIOINPUT_MAC_P_H
-#define QAUDIOINPUT_MAC_P_H
-
-#include <CoreServices/CoreServices.h>
-#include <CoreAudio/CoreAudio.h>
-#include <AudioUnit/AudioUnit.h>
-#include <AudioToolbox/AudioToolbox.h>
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qwaitcondition.h>
-#include <QtCore/qatomic.h>
-
-#include <qaudio.h>
-#include <qaudioformat.h>
-#include <qaudiosystem.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QTimer;
-class QIODevice;
-class QAbstractAudioDeviceInfo;
-
-namespace QtMultimediaInternal
-{
-class QAudioInputBuffer;
-}
-
-class QAudioInputPrivate : public QAbstractAudioInput
-{
- Q_OBJECT
-
-public:
- bool isOpen;
- int periodSizeBytes;
- int internalBufferSize;
- qint64 totalFrames;
- QAudioFormat audioFormat;
- QIODevice* audioIO;
- AudioUnit audioUnit;
- AudioDeviceID audioDeviceId;
- Float64 clockFrequency;
- UInt64 startTime;
- QAudio::Error errorCode;
- QAudio::State stateCode;
- QtMultimediaInternal::QAudioInputBuffer* audioBuffer;
- QMutex mutex;
- QWaitCondition threadFinished;
- QAtomicInt audioThreadState;
- QTimer* intervalTimer;
- AudioStreamBasicDescription streamFormat;
- AudioStreamBasicDescription deviceFormat;
- QAbstractAudioDeviceInfo *audioDeviceInfo;
-
- QAudioInputPrivate(const QByteArray& device);
- ~QAudioInputPrivate();
-
- bool open();
- void close();
-
- QAudioFormat format() const;
- void setFormat(const QAudioFormat& fmt);
-
- QIODevice* start();
- void start(QIODevice* device);
- void stop();
- void reset();
- void suspend();
- void resume();
- void idle();
-
- int bytesReady() const;
- int periodSize() const;
-
- void setBufferSize(int value);
- int bufferSize() const;
-
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
-
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
-
- QAudio::Error error() const;
- QAudio::State state() const;
-
- void audioThreadStart();
- void audioThreadStop();
-
- void audioDeviceStop();
- void audioDeviceFull();
- void audioDeviceError();
-
- void startTimers();
- void stopTimers();
-
-private slots:
- void deviceStopped();
-
-private:
- enum { Running, Stopped };
-
- // Input callback
- static OSStatus inputCallback(void* inRefCon,
- AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList* ioData);
-};
-
-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
deleted file mode 100644
index 718656b..0000000
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ /dev/null
@@ -1,642 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-
-#include "qaudioinput_win32_p.h"
-
-QT_BEGIN_NAMESPACE
-
-//#define DEBUG_AUDIO 1
-
-QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
-{
- bytesAvailable = 0;
- buffer_size = 0;
- period_size = 0;
- m_device = device;
- totalTimeValue = 0;
- intervalTime = 1000;
- errorState = QAudio::NoError;
- deviceState = QAudio::StoppedState;
- audioSource = 0;
- pullMode = true;
- resuming = false;
- finished = false;
- waveBlockOffset = 0;
-}
-
-QAudioInputPrivate::~QAudioInputPrivate()
-{
- stop();
-}
-
-void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
-{
- Q_UNUSED(dwParam1)
- Q_UNUSED(dwParam2)
- Q_UNUSED(hWaveIn)
-
- QAudioInputPrivate* qAudio;
- qAudio = (QAudioInputPrivate*)(dwInstance);
- if(!qAudio)
- return;
-
- QMutexLocker(&qAudio->mutex);
-
- switch(uMsg) {
- case WIM_OPEN:
- break;
- case WIM_DATA:
- if(qAudio->waveFreeBlockCount > 0)
- qAudio->waveFreeBlockCount--;
- qAudio->feedback();
- break;
- case WIM_CLOSE:
- qAudio->finished = true;
- break;
- default:
- return;
- }
-}
-
-WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count)
-{
- int i;
- unsigned char* buffer;
- WAVEHDR* blocks;
- DWORD totalBufferSize = (size + sizeof(WAVEHDR))*count;
-
- if((buffer=(unsigned char*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
- totalBufferSize)) == 0) {
- qWarning("QAudioInput: Memory allocation error");
- return 0;
- }
- blocks = (WAVEHDR*)buffer;
- buffer += sizeof(WAVEHDR)*count;
- for(i = 0; i < count; i++) {
- blocks[i].dwBufferLength = size;
- blocks[i].lpData = (LPSTR)buffer;
- blocks[i].dwBytesRecorded=0;
- blocks[i].dwUser = 0L;
- blocks[i].dwFlags = 0L;
- blocks[i].dwLoops = 0L;
- result = waveInPrepareHeader(hWaveIn,&blocks[i], sizeof(WAVEHDR));
- if(result != MMSYSERR_NOERROR) {
- qWarning("QAudioInput: Can't prepare block %d",i);
- return 0;
- }
- buffer += size;
- }
- return blocks;
-}
-
-void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray)
-{
- WAVEHDR* blocks = blockArray;
-
- int count = buffer_size/period_size;
-
- for(int i = 0; i < count; i++) {
- waveInUnprepareHeader(hWaveIn,blocks, sizeof(WAVEHDR));
- blocks++;
- }
- HeapFree(GetProcessHeap(), 0, blockArray);
-}
-
-QAudio::Error QAudioInputPrivate::error() const
-{
- return errorState;
-}
-
-QAudio::State QAudioInputPrivate::state() const
-{
- return deviceState;
-}
-
-void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (deviceState == QAudio::StoppedState)
- settings = fmt;
-}
-
-QAudioFormat QAudioInputPrivate::format() const
-{
- return settings;
-}
-
-void QAudioInputPrivate::start(QIODevice* device)
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = true;
- audioSource = device;
-
- deviceState = QAudio::ActiveState;
-
- if(!open())
- return;
-
- emit stateChanged(deviceState);
-}
-
-QIODevice* QAudioInputPrivate::start()
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = false;
- audioSource = new InputPrivate(this);
- audioSource->open(QIODevice::ReadOnly | QIODevice::Unbuffered);
-
- deviceState = QAudio::IdleState;
-
- if(!open())
- return 0;
-
- emit stateChanged(deviceState);
-
- return audioSource;
-}
-
-void QAudioInputPrivate::stop()
-{
- if(deviceState == QAudio::StoppedState)
- return;
-
- close();
- emit stateChanged(deviceState);
-}
-
-bool QAudioInputPrivate::open()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
-#endif
- header = 0;
-
- period_size = 0;
-
- if (!settings.isValid()) {
- qWarning("QAudioInput: open error, invalid format.");
- } else if (settings.channelCount() <= 0) {
- qWarning("QAudioInput: open error, invalid number of channels (%d).",
- settings.channelCount());
- } else if (settings.sampleSize() <= 0) {
- qWarning("QAudioInput: open error, invalid sample size (%d).",
- settings.sampleSize());
- } else if (settings.frequency() < 8000 || settings.frequency() > 48000) {
- qWarning("QAudioInput: open error, frequency out of range (%d).", settings.frequency());
- } else if (buffer_size == 0) {
-
- buffer_size
- = (settings.frequency()
- * settings.channelCount()
- * settings.sampleSize()
- + 39) / 40;
- period_size = buffer_size / 5;
- } else {
- period_size = buffer_size / 5;
- }
-
- if (period_size == 0) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
-
- timeStamp.restart();
- elapsedTimeOffset = 0;
- wfx.nSamplesPerSec = settings.frequency();
- wfx.wBitsPerSample = settings.sampleSize();
- wfx.nChannels = settings.channels();
- wfx.cbSize = 0;
-
- wfx.wFormatTag = WAVE_FORMAT_PCM;
- wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
- wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
-
- QDataStream ds(&m_device, QIODevice::ReadOnly);
- quint32 deviceId;
- ds >> deviceId;
-
- if (waveInOpen(&hWaveIn, UINT_PTR(deviceId), &wfx,
- (DWORD_PTR)&waveInProc,
- (DWORD_PTR) this,
- CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- qWarning("QAudioInput: failed to open audio device");
- return false;
- }
- waveBlocks = allocateBlocks(period_size, buffer_size/period_size);
- waveBlockOffset = 0;
-
- if(waveBlocks == 0) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- qWarning("QAudioInput: failed to allocate blocks. open failed");
- return false;
- }
-
- mutex.lock();
- waveFreeBlockCount = buffer_size/period_size;
- mutex.unlock();
-
- for(int i=0; i<buffer_size/period_size; i++) {
- result = waveInAddBuffer(hWaveIn, &waveBlocks[i], sizeof(WAVEHDR));
- if(result != MMSYSERR_NOERROR) {
- qWarning("QAudioInput: failed to setup block %d,err=%d",i,result);
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
- }
- result = waveInStart(hWaveIn);
- if(result) {
- qWarning("QAudioInput: failed to start audio input");
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
- timeStampOpened.restart();
- elapsedTimeOffset = 0;
- totalTimeValue = 0;
- errorState = QAudio::NoError;
- return true;
-}
-
-void QAudioInputPrivate::close()
-{
- if(deviceState == QAudio::StoppedState)
- return;
-
- deviceState = QAudio::StoppedState;
- waveInReset(hWaveIn);
- waveInClose(hWaveIn);
-
- int count = 0;
- while(!finished && count < 500) {
- count++;
- Sleep(10);
- }
-
- mutex.lock();
- for(int i=0; i<waveFreeBlockCount; i++)
- waveInUnprepareHeader(hWaveIn,&waveBlocks[i],sizeof(WAVEHDR));
- freeBlocks(waveBlocks);
- mutex.unlock();
-}
-
-int QAudioInputPrivate::bytesReady() const
-{
- if(period_size == 0 || buffer_size == 0)
- return 0;
-
- int buf = ((buffer_size/period_size)-waveFreeBlockCount)*period_size;
- if(buf < 0)
- buf = 0;
- return buf;
-}
-
-qint64 QAudioInputPrivate::read(char* data, qint64 len)
-{
- bool done = false;
-
- char* p = data;
- qint64 l = 0;
- qint64 written = 0;
- while(!done) {
- // Read in some audio data
- if(waveBlocks[header].dwBytesRecorded > 0 && waveBlocks[header].dwFlags & WHDR_DONE) {
- if(pullMode) {
- l = audioSource->write(waveBlocks[header].lpData + waveBlockOffset,
- waveBlocks[header].dwBytesRecorded - waveBlockOffset);
-#ifdef DEBUG_AUDIO
- qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
-#endif
- if(l < 0) {
- // error
- qWarning("QAudioInput: IOError");
- errorState = QAudio::IOError;
-
- } else if(l == 0) {
- // cant write to IODevice
- qWarning("QAudioInput: IOError, can't write to QIODevice");
- errorState = QAudio::IOError;
-
- } else {
- totalTimeValue += l;
- errorState = QAudio::NoError;
- if (deviceState != QAudio::ActiveState) {
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- resuming = false;
- }
- } else {
- l = qMin<qint64>(len, waveBlocks[header].dwBytesRecorded - waveBlockOffset);
- // push mode
- memcpy(p, waveBlocks[header].lpData + waveBlockOffset, l);
-
- len -= l;
-
-#ifdef DEBUG_AUDIO
- qDebug()<<"IN: "<<waveBlocks[header].dwBytesRecorded<<", OUT: "<<l;
-#endif
- totalTimeValue += l;
- errorState = QAudio::NoError;
- if (deviceState != QAudio::ActiveState) {
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- resuming = false;
- }
- } else {
- //no data, not ready yet, next time
- break;
- }
-
- if (l < waveBlocks[header].dwBytesRecorded - waveBlockOffset) {
- waveBlockOffset += l;
- done = true;
- } else {
- waveBlockOffset = 0;
-
- waveInUnprepareHeader(hWaveIn,&waveBlocks[header], sizeof(WAVEHDR));
-
- mutex.lock();
- waveFreeBlockCount++;
- mutex.unlock();
-
- waveBlocks[header].dwBytesRecorded=0;
- waveBlocks[header].dwFlags = 0L;
- result = waveInPrepareHeader(hWaveIn,&waveBlocks[header], sizeof(WAVEHDR));
- if(result != MMSYSERR_NOERROR) {
- result = waveInPrepareHeader(hWaveIn,&waveBlocks[header], sizeof(WAVEHDR));
- qWarning("QAudioInput: failed to prepare block %d,err=%d",header,result);
- errorState = QAudio::IOError;
-
- mutex.lock();
- waveFreeBlockCount--;
- mutex.unlock();
-
- return 0;
- }
- result = waveInAddBuffer(hWaveIn, &waveBlocks[header], sizeof(WAVEHDR));
- if(result != MMSYSERR_NOERROR) {
- qWarning("QAudioInput: failed to setup block %d,err=%d",header,result);
- errorState = QAudio::IOError;
-
- mutex.lock();
- waveFreeBlockCount--;
- mutex.unlock();
-
- return 0;
- }
- header++;
- if(header >= buffer_size/period_size)
- header = 0;
- p+=l;
-
- mutex.lock();
- if(!pullMode) {
- if(len < period_size || waveFreeBlockCount == buffer_size/period_size)
- done = true;
- } else {
- if(waveFreeBlockCount == buffer_size/period_size)
- done = true;
- }
- mutex.unlock();
- }
-
- written+=l;
- }
-#ifdef DEBUG_AUDIO
- qDebug()<<"read in len="<<written;
-#endif
- return written;
-}
-
-void QAudioInputPrivate::resume()
-{
- if(deviceState == QAudio::SuspendedState) {
- deviceState = QAudio::ActiveState;
- for(int i=0; i<buffer_size/period_size; i++) {
- result = waveInAddBuffer(hWaveIn, &waveBlocks[i], sizeof(WAVEHDR));
- if(result != MMSYSERR_NOERROR) {
- qWarning("QAudioInput: failed to setup block %d,err=%d",i,result);
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return;
- }
- }
-
- mutex.lock();
- waveFreeBlockCount = buffer_size/period_size;
- mutex.unlock();
-
- header = 0;
- resuming = true;
- waveBlockOffset = 0;
- waveInStart(hWaveIn);
- QTimer::singleShot(20,this,SLOT(feedback()));
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioInputPrivate::setBufferSize(int value)
-{
- buffer_size = value;
-}
-
-int QAudioInputPrivate::bufferSize() const
-{
- return buffer_size;
-}
-
-int QAudioInputPrivate::periodSize() const
-{
- return period_size;
-}
-
-void QAudioInputPrivate::setNotifyInterval(int ms)
-{
- intervalTime = qMax(0, ms);
-}
-
-int QAudioInputPrivate::notifyInterval() const
-{
- return intervalTime;
-}
-
-qint64 QAudioInputPrivate::processedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
- qint64 result = qint64(1000000) * totalTimeValue /
- (settings.channels()*(settings.sampleSize()/8)) /
- settings.frequency();
-
- return result;
-}
-
-void QAudioInputPrivate::suspend()
-{
- if(deviceState == QAudio::ActiveState) {
- waveInReset(hWaveIn);
- deviceState = QAudio::SuspendedState;
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioInputPrivate::feedback()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback() INPUT "<<this;
-#endif
- if(!(deviceState==QAudio::StoppedState||deviceState==QAudio::SuspendedState))
- QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection);
-}
-
-bool QAudioInputPrivate::deviceReady()
-{
- bytesAvailable = bytesReady();
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :deviceReady() INPUT";
-#endif
- if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
- return true;
-
- if(pullMode) {
- // reads some audio data and writes it to QIODevice
- read(0, buffer_size);
- } else {
- // emits readyRead() so user will call read() on QIODevice to get some audio data
- InputPrivate* a = qobject_cast<InputPrivate*>(audioSource);
- a->trigger();
- }
-
- if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
- emit notify();
- elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
- timeStamp.restart();
- }
- return true;
-}
-
-qint64 QAudioInputPrivate::elapsedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
-
- return timeStampOpened.elapsed()*1000;
-}
-
-void QAudioInputPrivate::reset()
-{
- stop();
- if (period_size > 0)
- waveFreeBlockCount = buffer_size / period_size;
-}
-
-InputPrivate::InputPrivate(QAudioInputPrivate* audio)
-{
- audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
-}
-
-InputPrivate::~InputPrivate() {}
-
-qint64 InputPrivate::readData( char* data, qint64 len)
-{
- // push mode, user read() called
- if(audioDevice->deviceState != QAudio::ActiveState &&
- audioDevice->deviceState != QAudio::IdleState)
- return 0;
- // Read in some audio data
- return audioDevice->read(data,len);
-}
-
-qint64 InputPrivate::writeData(const char* data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
-
- emit readyRead();
- return 0;
-}
-
-void InputPrivate::trigger()
-{
- emit readyRead();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaudioinput_win32_p.cpp"
-
diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h
deleted file mode 100644
index 10d41a5..0000000
--- a/src/multimedia/audio/qaudioinput_win32_p.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIOINPUTWIN_H
-#define QAUDIOINPUTWIN_H
-
-#include <windows.h>
-#include <mmsystem.h>
-
-#include <QtCore/qfile.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qmutex.h>
-
-#include <qaudio.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudiosystem.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-// For compat with 4.6
-#if !defined(QT_WIN_CALLBACK)
-# if defined(Q_CC_MINGW)
-# define QT_WIN_CALLBACK CALLBACK __attribute__ ((force_align_arg_pointer))
-# else
-# define QT_WIN_CALLBACK CALLBACK
-# endif
-#endif
-
-class QAudioInputPrivate : public QAbstractAudioInput
-{
- Q_OBJECT
-public:
- QAudioInputPrivate(const QByteArray &device);
- ~QAudioInputPrivate();
-
- qint64 read(char* data, qint64 len);
-
- void setFormat(const QAudioFormat& fmt);
- QAudioFormat format() const;
- QIODevice* start();
- void start(QIODevice* device);
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesReady() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
-
- QIODevice* audioSource;
- QAudioFormat settings;
- QAudio::Error errorState;
- QAudio::State deviceState;
-
-private:
- qint32 buffer_size;
- qint32 period_size;
- qint32 header;
- QByteArray m_device;
- int bytesAvailable;
- int intervalTime;
- QTime timeStamp;
- qint64 elapsedTimeOffset;
- QTime timeStampOpened;
- qint64 totalTimeValue;
- bool pullMode;
- bool resuming;
- WAVEFORMATEX wfx;
- HWAVEIN hWaveIn;
- MMRESULT result;
- WAVEHDR* waveBlocks;
- volatile bool finished;
- volatile int waveFreeBlockCount;
- int waveBlockOffset;
-
- QMutex mutex;
- static void QT_WIN_CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
-
- WAVEHDR* allocateBlocks(int size, int count);
- void freeBlocks(WAVEHDR* blockArray);
- bool open();
- void close();
-
-private slots:
- void feedback();
- bool deviceReady();
-
-signals:
- void processMore();
-};
-
-class InputPrivate : public QIODevice
-{
- Q_OBJECT
-public:
- InputPrivate(QAudioInputPrivate* audio);
- ~InputPrivate();
-
- qint64 readData( char* data, qint64 len);
- qint64 writeData(const char* data, qint64 len);
-
- void trigger();
-private:
- QAudioInputPrivate *audioDevice;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
deleted file mode 100644
index 05db98b..0000000
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ /dev/null
@@ -1,404 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-#include "qaudiooutput.h"
-
-#include "qaudiodevicefactory_p.h"
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAudioOutput
- \brief The QAudioOutput class provides an interface for sending audio data to an audio output device.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- You can construct an audio output with the system's
- \l{QAudioDeviceInfo::defaultOutputDevice()}{default audio output
- device}. It is also possible to create QAudioOutput with a
- specific QAudioDeviceInfo. When you create the audio output, you
- should also send in the QAudioFormat to be used for the playback
- (see the QAudioFormat class description for details).
-
- To play a file:
-
- Starting to play an audio stream is simply a matter of calling
- start() with a QIODevice. QAudioOutput will then fetch the data it
- needs from the io device. So playing back an audio file is as
- simple as:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio output class members
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio output setup
-
- The file will start playing assuming that the audio system and
- output device support it. If you run out of luck, check what's
- up with the error() function.
-
- After the file has finished playing, we need to stop the device:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio output state changed
-
- At any given time, the QAudioOutput will be in one of four states:
- active, suspended, stopped, or idle. These states are described
- by the QAudio::State enum.
- State changes are reported through the stateChanged() signal. You
- can use this signal to, for instance, update the GUI of the
- application; the mundane example here being changing the state of
- a \c { play/pause } button. You request a state change directly
- with suspend(), stop(), reset(), resume(), and start().
-
- While the stream is playing, you can set a notify interval in
- milliseconds with setNotifyInterval(). This interval specifies the
- time between two emissions of the notify() signal. This is
- relative to the position in the stream, i.e., if the QAudioOutput
- is in the SuspendedState or the IdleState, the notify() signal is
- not emitted. A typical use-case would be to update a
- \l{QSlider}{slider} that allows seeking in the stream.
- If you want the time since playback started regardless of which
- states the audio output has been in, elapsedUSecs() is the function for you.
-
- If an error occurs, you can fetch the \l{QAudio::Error}{error
- type} with the error() function. Please see the QAudio::Error enum
- for a description of the possible errors that are reported. When
- an error is encountered, the state changes to QAudio::StoppedState.
- You can check for errors by connecting to the stateChanged()
- signal:
-
- \snippet doc/src/snippets/multimedia-snippets/audio.cpp Audio output state changed
-
- \sa QAudioInput, QAudioDeviceInfo
-*/
-
-/*!
- Construct a new audio output and attach it to \a parent.
- The default audio output device is used with the output
- \a format parameters.
- \since 1.0
-*/
-QAudioOutput::QAudioOutput(const QAudioFormat &format, QObject *parent):
- QObject(parent)
-{
- d = QAudioDeviceFactory::createDefaultOutputDevice(format);
- connect(d, SIGNAL(notify()), SIGNAL(notify()));
- connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
-}
-
-/*!
- Construct a new audio output and attach it to \a parent.
- The device referenced by \a audioDevice is used with the output
- \a format parameters.
- \since 1.0
-*/
-QAudioOutput::QAudioOutput(const QAudioDeviceInfo &audioDevice, const QAudioFormat &format, QObject *parent):
- QObject(parent)
-{
- d = QAudioDeviceFactory::createOutputDevice(audioDevice, format);
- connect(d, SIGNAL(notify()), SIGNAL(notify()));
- connect(d, SIGNAL(stateChanged(QAudio::State)), SIGNAL(stateChanged(QAudio::State)));
-}
-
-/*!
- Destroys this audio output.
-
- This will release any system resources used and free any buffers.
-*/
-QAudioOutput::~QAudioOutput()
-{
- delete d;
-}
-
-/*!
- Returns the QAudioFormat being used.
-
- \since 1.0
-*/
-QAudioFormat QAudioOutput::format() const
-{
- return d->format();
-}
-
-/*!
- Uses the \a device as the QIODevice to transfer data.
- Passing a QIODevice allows the data to be transferred without any extra code.
- All that is required is to open the QIODevice.
-
- If able to successfully output audio data to the systems audio device the
- state() is set to QAudio::ActiveState, error() is set to QAudio::NoError
- and the stateChanged() signal is emitted.
-
- If a problem occurs during this process the error() is set to QAudio::OpenError,
- state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
-
- \since 1.0
- \sa QIODevice
-*/
-void QAudioOutput::start(QIODevice* device)
-{
- d->start(device);
-}
-
-/*!
- Returns a pointer to the QIODevice being used to handle the data
- transfer. This QIODevice can be used to write() audio data directly.
-
- If able to access the systems audio device the state() is set to
- QAudio::IdleState, error() is set to QAudio::NoError
- and the stateChanged() signal is emitted.
-
- If a problem occurs during this process the error() is set to QAudio::OpenError,
- state() is set to QAudio::StoppedState and stateChanged() signal is emitted.
-
- \since 1.0
- \sa QIODevice
-*/
-QIODevice* QAudioOutput::start()
-{
- return d->start();
-}
-
-/*!
- Stops the audio output, detaching from the system resource.
-
- Sets error() to QAudio::NoError, state() to QAudio::StoppedState and
- emit stateChanged() signal.
- \since 1.0
-*/
-void QAudioOutput::stop()
-{
- d->stop();
-}
-
-/*!
- Drops all audio data in the buffers, resets buffers to zero.
-
- \since 1.0
-*/
-void QAudioOutput::reset()
-{
- d->reset();
-}
-
-/*!
- Stops processing audio data, preserving buffered audio data.
-
- Sets error() to QAudio::NoError, state() to QAudio::SuspendedState and
- emits stateChanged() signal.
- \since 1.0
-*/
-void QAudioOutput::suspend()
-{
- d->suspend();
-}
-
-/*!
- Resumes processing audio data after a suspend().
-
- Sets error() to QAudio::NoError.
- Sets state() to QAudio::ActiveState if you previously called start(QIODevice*).
- Sets state() to QAudio::IdleState if you previously called start().
- emits stateChanged() signal.
- \since 1.0
-*/
-void QAudioOutput::resume()
-{
- d->resume();
-}
-
-/*!
- Returns the number of free bytes available in the audio buffer.
-
- \note The returned value is only valid while in QAudio::ActiveState or QAudio::IdleState
- state, otherwise returns zero.
- \since 1.0
-*/
-int QAudioOutput::bytesFree() const
-{
- return d->bytesFree();
-}
-
-/*!
- Returns the period size in bytes. This is the amount of data required each period
- to prevent buffer underrun, and to ensure uninterrupted playback.
-
- \note It is recommended to provide at least enough data for a full period with each
- write operation.
- \since 1.0
-*/
-int QAudioOutput::periodSize() const
-{
- return d->periodSize();
-}
-
-/*!
- Sets the audio buffer size to \a value in bytes.
-
- \note This function can be called anytime before start(). Calls to this
- are ignored after start(). It should not be assumed that the buffer size
- set is the actual buffer size used - call bufferSize() anytime after start()
- to return the actual buffer size being used.
- \since 1.0
-*/
-void QAudioOutput::setBufferSize(int value)
-{
- d->setBufferSize(value);
-}
-
-/*!
- Returns the audio buffer size in bytes.
-
- If called before start(), returns platform default value.
- If called before start() but setBufferSize() was called prior, returns value set by setBufferSize().
- If called after start(), returns the actual buffer size being used. This may not be what was set previously
- by setBufferSize().
-
- \since 1.0
-*/
-int QAudioOutput::bufferSize() const
-{
- return d->bufferSize();
-}
-
-/*!
- Sets the interval for notify() signal to be emitted.
- This is based on the \a ms of audio data processed,
- not on wall clock time.
- The minimum resolution of the timer is platform specific and values
- should be checked with notifyInterval() to confirm the actual value
- being used.
- \since 1.0
-*/
-void QAudioOutput::setNotifyInterval(int ms)
-{
- d->setNotifyInterval(ms);
-}
-
-/*!
- Returns the notify interval in milliseconds.
- \since 1.0
-*/
-int QAudioOutput::notifyInterval() const
-{
- return d->notifyInterval();
-}
-
-/*!
- Returns the amount of audio data processed since start()
- was called (in microseconds).
- \since 1.0
-*/
-qint64 QAudioOutput::processedUSecs() const
-{
- return d->processedUSecs();
-}
-
-/*!
- Returns the microseconds since start() was called, including time in Idle and
- Suspend states.
- \since 1.0
-*/
-qint64 QAudioOutput::elapsedUSecs() const
-{
- return d->elapsedUSecs();
-}
-
-/*!
- Returns the error state.
- \since 1.0
-*/
-QAudio::Error QAudioOutput::error() const
-{
- return d->error();
-}
-
-/*!
- Returns the state of audio processing.
- \since 1.0
-*/
-QAudio::State QAudioOutput::state() const
-{
- return d->state();
-}
-
-/*!
- Sets the volume.
- Where \a volume is between 0.0 and 1.0 inclusive.
- \since 5.0
-*/
-void QAudioOutput::setVolume(qreal volume)
-{
- d->setVolume(volume);
-}
-
-/*!
- Returns the volume between 0.0 and 1.0 inclusive.
- \since 5.0
-*/
-qreal QAudioOutput::volume() const
-{
- return d->volume();
-}
-
-/*!
- \fn QAudioOutput::stateChanged(QAudio::State state)
- This signal is emitted when the device \a state has changed.
- This is the current state of the audio output.
- \since 1.0
-*/
-
-/*!
- \fn QAudioOutput::notify()
- This signal is emitted when a certain interval of milliseconds
- of audio data has been processed. The interval is set by
- setNotifyInterval().
- \since 1.0
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiooutput.cpp"
diff --git a/src/multimedia/audio/qaudiooutput.h b/src/multimedia/audio/qaudiooutput.h
deleted file mode 100644
index 3edec1b..0000000
--- a/src/multimedia/audio/qaudiooutput.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIOOUTPUT_H
-#define QAUDIOOUTPUT_H
-
-#include <QtCore/qiodevice.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include <qaudio.h>
-#include <qaudioformat.h>
-#include <qaudiodeviceinfo.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QAbstractAudioOutput;
-
-class Q_MULTIMEDIA_EXPORT QAudioOutput : public QObject
-{
- Q_OBJECT
-
-public:
- explicit QAudioOutput(const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
- explicit QAudioOutput(const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format = QAudioFormat(), QObject *parent = 0);
- ~QAudioOutput();
-
- QAudioFormat format() const;
-
- void start(QIODevice *device);
- QIODevice* start();
-
- void stop();
- void reset();
- void suspend();
- void resume();
-
- void setBufferSize(int bytes);
- int bufferSize() const;
-
- int bytesFree() const;
- int periodSize() const;
-
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
-
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
-
- QAudio::Error error() const;
- QAudio::State state() const;
-
- void setVolume(qreal);
- qreal volume() const;
-
-Q_SIGNALS:
- void stateChanged(QAudio::State);
- void notify();
-
-private:
- Q_DISABLE_COPY(QAudioOutput)
-
- QAbstractAudioOutput* d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIOOUTPUT_H
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.cpp b/src/multimedia/audio/qaudiooutput_alsa_p.cpp
deleted file mode 100644
index 8ef4e28..0000000
--- a/src/multimedia/audio/qaudiooutput_alsa_p.cpp
+++ /dev/null
@@ -1,834 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <QtCore/qcoreapplication.h>
-#include "qaudiooutput_alsa_p.h"
-#include "qaudiodeviceinfo_alsa_p.h"
-
-QT_BEGIN_NAMESPACE
-
-//#define DEBUG_AUDIO 1
-
-QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
-{
- bytesAvailable = 0;
- handle = 0;
- ahandler = 0;
- access = SND_PCM_ACCESS_RW_INTERLEAVED;
- pcmformat = SND_PCM_FORMAT_S16;
- buffer_frames = 0;
- period_frames = 0;
- buffer_size = 0;
- period_size = 0;
- buffer_time = 100000;
- period_time = 20000;
- totalTimeValue = 0;
- intervalTime = 1000;
- audioBuffer = 0;
- errorState = QAudio::NoError;
- deviceState = QAudio::StoppedState;
- audioSource = 0;
- pullMode = true;
- resuming = false;
- opened = false;
-
- m_device = device;
-
- timer = new QTimer(this);
- connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
-}
-
-QAudioOutputPrivate::~QAudioOutputPrivate()
-{
- close();
- disconnect(timer, SIGNAL(timeout()));
- QCoreApplication::processEvents();
- delete timer;
-}
-
-QAudio::Error QAudioOutputPrivate::error() const
-{
- return errorState;
-}
-
-QAudio::State QAudioOutputPrivate::state() const
-{
- return deviceState;
-}
-
-void QAudioOutputPrivate::async_callback(snd_async_handler_t *ahandler)
-{
- QAudioOutputPrivate* audioOut;
-
- audioOut = static_cast<QAudioOutputPrivate*>
- (snd_async_handler_get_callback_private(ahandler));
-
- if((audioOut->deviceState==QAudio::ActiveState)||(audioOut->resuming))
- audioOut->feedback();
-}
-
-int QAudioOutputPrivate::xrun_recovery(int err)
-{
- int count = 0;
- bool reset = false;
-
- if(err == -EPIPE) {
- errorState = QAudio::UnderrunError;
- emit errorChanged(errorState);
- err = snd_pcm_prepare(handle);
- if(err < 0)
- reset = true;
-
- } else if((err == -ESTRPIPE)||(err == -EIO)) {
- errorState = QAudio::IOError;
- emit errorChanged(errorState);
- while((err = snd_pcm_resume(handle)) == -EAGAIN){
- usleep(100);
- count++;
- if(count > 5) {
- reset = true;
- break;
- }
- }
- if(err < 0) {
- err = snd_pcm_prepare(handle);
- if(err < 0)
- reset = true;
- }
- }
- if(reset) {
- close();
- open();
- snd_pcm_prepare(handle);
- return 0;
- }
- return err;
-}
-
-int QAudioOutputPrivate::setFormat()
-{
- snd_pcm_format_t pcmformat = SND_PCM_FORMAT_UNKNOWN;
-
- if(settings.sampleSize() == 8) {
- pcmformat = SND_PCM_FORMAT_U8;
-
- } else if(settings.sampleSize() == 16) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_S16_LE;
- else
- pcmformat = SND_PCM_FORMAT_S16_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_U16_LE;
- else
- pcmformat = SND_PCM_FORMAT_U16_BE;
- }
- } else if(settings.sampleSize() == 24) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_S24_LE;
- else
- pcmformat = SND_PCM_FORMAT_S24_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_U24_LE;
- else
- pcmformat = SND_PCM_FORMAT_U24_BE;
- }
- } else if(settings.sampleSize() == 32) {
- if(settings.sampleType() == QAudioFormat::SignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_S32_LE;
- else
- pcmformat = SND_PCM_FORMAT_S32_BE;
- } else if(settings.sampleType() == QAudioFormat::UnSignedInt) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_U32_LE;
- else
- pcmformat = SND_PCM_FORMAT_U32_BE;
- } else if(settings.sampleType() == QAudioFormat::Float) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_FLOAT_LE;
- else
- pcmformat = SND_PCM_FORMAT_FLOAT_BE;
- }
- } else if(settings.sampleSize() == 64) {
- if(settings.byteOrder() == QAudioFormat::LittleEndian)
- pcmformat = SND_PCM_FORMAT_FLOAT64_LE;
- else
- pcmformat = SND_PCM_FORMAT_FLOAT64_BE;
- }
-
- return pcmformat != SND_PCM_FORMAT_UNKNOWN
- ? snd_pcm_hw_params_set_format( handle, hwparams, pcmformat)
- : -1;
-}
-
-void QAudioOutputPrivate::start(QIODevice* device)
-{
- if(deviceState != QAudio::StoppedState)
- deviceState = QAudio::StoppedState;
-
- errorState = QAudio::NoError;
-
- // Handle change of mode
- if(audioSource && !pullMode) {
- delete audioSource;
- audioSource = 0;
- }
-
- close();
-
- pullMode = true;
- audioSource = device;
-
- deviceState = QAudio::ActiveState;
-
- open();
-
- emit stateChanged(deviceState);
-}
-
-QIODevice* QAudioOutputPrivate::start()
-{
- if(deviceState != QAudio::StoppedState)
- deviceState = QAudio::StoppedState;
-
- errorState = QAudio::NoError;
-
- // Handle change of mode
- if(audioSource && !pullMode) {
- delete audioSource;
- audioSource = 0;
- }
-
- close();
-
- audioSource = new OutputPrivate(this);
- audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
- pullMode = false;
-
- deviceState = QAudio::IdleState;
-
- open();
-
- emit stateChanged(deviceState);
-
- return audioSource;
-}
-
-void QAudioOutputPrivate::stop()
-{
- if(deviceState == QAudio::StoppedState)
- return;
- errorState = QAudio::NoError;
- deviceState = QAudio::StoppedState;
- close();
- emit stateChanged(deviceState);
-}
-
-bool QAudioOutputPrivate::open()
-{
- if(opened)
- return true;
-
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
-#endif
- timeStamp.restart();
- elapsedTimeOffset = 0;
-
- int dir;
- int err = 0;
- int count=0;
- unsigned int freakuency=settings.frequency();
-
- if (!settings.isValid()) {
- qWarning("QAudioOutput: open error, invalid format.");
- } else if (settings.sampleRate() <= 0) {
- qWarning("QAudioOutput: open error, invalid sample rate (%d).",
- settings.sampleRate());
- } else {
- err = -1;
- }
-
- if (err == 0) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit errorChanged(errorState);
- return false;
- }
-
- QString dev = QString(QLatin1String(m_device.constData()));
- QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
- if(dev.compare(QLatin1String("default")) == 0) {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- if (devices.size() > 0)
- dev = QLatin1String(devices.first());
- else
- return false;
-#else
- dev = QLatin1String("hw:0,0");
-#endif
- } else {
-#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
- dev = QLatin1String(m_device);
-#else
- int idx = 0;
- char *name;
-
- QString shortName = QLatin1String(m_device.mid(m_device.indexOf('=',0)+1).constData());
-
- while(snd_card_get_name(idx,&name) == 0) {
- if(qstrncmp(shortName.toLocal8Bit().constData(),name,shortName.length()) == 0)
- break;
- idx++;
- }
- dev = QString(QLatin1String("hw:%1,0")).arg(idx);
-#endif
- }
-
- // Step 1: try and open the device
- while((count < 5) && (err < 0)) {
- err=snd_pcm_open(&handle,dev.toLocal8Bit().constData(),SND_PCM_STREAM_PLAYBACK,0);
- if(err < 0)
- count++;
- }
- if (( err < 0)||(handle == 0)) {
- errorState = QAudio::OpenError;
- emit errorChanged(errorState);
- deviceState = QAudio::StoppedState;
- return false;
- }
- snd_pcm_nonblock( handle, 0 );
-
- // Step 2: Set the desired HW parameters.
- snd_pcm_hw_params_alloca( &hwparams );
-
- bool fatal = false;
- QString errMessage;
- unsigned int chunks = 8;
-
- err = snd_pcm_hw_params_any( handle, hwparams );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_any: err = %1").arg(err);
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_rate_resample( handle, hwparams, 1 );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_resample: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_access( handle, hwparams, access );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_access: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = setFormat();
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_format: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_channels( handle, hwparams, (unsigned int)settings.channels() );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_channels: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_rate_near( handle, hwparams, &freakuency, 0 );
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_rate_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- unsigned int maxBufferTime = 0;
- unsigned int minBufferTime = 0;
- unsigned int maxPeriodTime = 0;
- unsigned int minPeriodTime = 0;
-
- err = snd_pcm_hw_params_get_buffer_time_max(hwparams, &maxBufferTime, &dir);
- if ( err >= 0)
- err = snd_pcm_hw_params_get_buffer_time_min(hwparams, &minBufferTime, &dir);
- if ( err >= 0)
- err = snd_pcm_hw_params_get_period_time_max(hwparams, &maxPeriodTime, &dir);
- if ( err >= 0)
- err = snd_pcm_hw_params_get_period_time_min(hwparams, &minPeriodTime, &dir);
-
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: buffer/period min and max: err = %1").arg(err);
- } else {
- if (maxBufferTime < buffer_time || buffer_time < minBufferTime || maxPeriodTime < period_time || minPeriodTime > period_time) {
-#ifdef DEBUG_AUDIO
- qDebug()<<"defaults out of range";
- qDebug()<<"pmin="<<minPeriodTime<<", pmax="<<maxPeriodTime<<", bmin="<<minBufferTime<<", bmax="<<maxBufferTime;
-#endif
- period_time = minPeriodTime;
- if (period_time*4 <= maxBufferTime) {
- // Use 4 periods if possible
- buffer_time = period_time*4;
- chunks = 4;
- } else if (period_time*2 <= maxBufferTime) {
- // Use 2 periods if possible
- buffer_time = period_time*2;
- chunks = 2;
- } else {
- qWarning()<<"QAudioOutput: alsa only supports single period!";
- fatal = true;
- }
-#ifdef DEBUG_AUDIO
- qDebug()<<"used: buffer_time="<<buffer_time<<", period_time="<<period_time;
-#endif
- }
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_buffer_time_near(handle, hwparams, &buffer_time, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_buffer_time_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_period_time_near(handle, hwparams, &period_time, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_period_time_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params_set_periods_near(handle, hwparams, &chunks, &dir);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params_set_periods_near: err = %1").arg(err);
- }
- }
- if ( !fatal ) {
- err = snd_pcm_hw_params(handle, hwparams);
- if ( err < 0 ) {
- fatal = true;
- errMessage = QString::fromLatin1("QAudioOutput: snd_pcm_hw_params: err = %1").arg(err);
- }
- }
- if( err < 0) {
- qWarning()<<errMessage;
- errorState = QAudio::OpenError;
- emit errorChanged(errorState);
- deviceState = QAudio::StoppedState;
- return false;
- }
- snd_pcm_hw_params_get_buffer_size(hwparams,&buffer_frames);
- buffer_size = snd_pcm_frames_to_bytes(handle,buffer_frames);
- snd_pcm_hw_params_get_period_size(hwparams,&period_frames, &dir);
- period_size = snd_pcm_frames_to_bytes(handle,period_frames);
- snd_pcm_hw_params_get_buffer_time(hwparams,&buffer_time, &dir);
- snd_pcm_hw_params_get_period_time(hwparams,&period_time, &dir);
-
- // Step 3: Set the desired SW parameters.
- snd_pcm_sw_params_t *swparams;
- snd_pcm_sw_params_alloca(&swparams);
- snd_pcm_sw_params_current(handle, swparams);
- snd_pcm_sw_params_set_start_threshold(handle,swparams,period_frames);
- snd_pcm_sw_params_set_stop_threshold(handle,swparams,buffer_frames);
- snd_pcm_sw_params_set_avail_min(handle, swparams,period_frames);
- snd_pcm_sw_params(handle, swparams);
-
- // Step 4: Prepare audio
- if(audioBuffer == 0)
- audioBuffer = new char[snd_pcm_frames_to_bytes(handle,buffer_frames)];
- snd_pcm_prepare( handle );
- snd_pcm_start(handle);
-
- // Step 5: Setup callback and timer fallback
- snd_async_add_pcm_handler(&ahandler, handle, async_callback, this);
- bytesAvailable = bytesFree();
-
- // Step 6: Start audio processing
- timer->start(period_time/1000);
-
- clockStamp.restart();
- timeStamp.restart();
- elapsedTimeOffset = 0;
- errorState = QAudio::NoError;
- totalTimeValue = 0;
- opened = true;
-
- return true;
-}
-
-void QAudioOutputPrivate::close()
-{
- timer->stop();
-
- if ( handle ) {
- snd_pcm_drain( handle );
- snd_pcm_close( handle );
- handle = 0;
- delete [] audioBuffer;
- audioBuffer=0;
- }
- if(!pullMode && audioSource) {
- delete audioSource;
- audioSource = 0;
- }
- opened = false;
-}
-
-int QAudioOutputPrivate::bytesFree() const
-{
- if(resuming)
- return period_size;
-
- if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
- return 0;
-
- int frames = snd_pcm_avail_update(handle);
- if (frames == -EPIPE) {
- // Try and handle buffer underrun
- int err = snd_pcm_recover(handle, frames, 0);
- if (err < 0)
- return 0;
- else
- frames = snd_pcm_avail_update(handle);
- } else if (frames < 0) {
- return 0;
- }
-
- if ((int)frames > (int)buffer_frames)
- frames = buffer_frames;
-
- return snd_pcm_frames_to_bytes(handle, frames);
-}
-
-qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
-{
- // Write out some audio data
- if ( !handle )
- return 0;
-#ifdef DEBUG_AUDIO
- qDebug()<<"frames to write out = "<<
- snd_pcm_bytes_to_frames( handle, (int)len )<<" ("<<len<<") bytes";
-#endif
- int frames, err;
- int space = bytesFree();
- if(len < space) {
- // Just write it
- frames = snd_pcm_bytes_to_frames( handle, (int)len );
- err = snd_pcm_writei( handle, data, frames );
- } else {
- // Only write space worth
- frames = snd_pcm_bytes_to_frames( handle, (int)space );
- err = snd_pcm_writei( handle, data, frames );
- }
- if(err > 0) {
- totalTimeValue += err;
- resuming = false;
- errorState = QAudio::NoError;
- if (deviceState != QAudio::ActiveState) {
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- return snd_pcm_frames_to_bytes( handle, err );
- } else
- err = xrun_recovery(err);
-
- if(err < 0) {
- close();
- errorState = QAudio::FatalError;
- emit errorChanged(errorState);
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- }
- return 0;
-}
-
-int QAudioOutputPrivate::periodSize() const
-{
- return period_size;
-}
-
-void QAudioOutputPrivate::setBufferSize(int value)
-{
- if(deviceState == QAudio::StoppedState)
- buffer_size = value;
-}
-
-int QAudioOutputPrivate::bufferSize() const
-{
- return buffer_size;
-}
-
-void QAudioOutputPrivate::setNotifyInterval(int ms)
-{
- intervalTime = qMax(0, ms);
-}
-
-int QAudioOutputPrivate::notifyInterval() const
-{
- return intervalTime;
-}
-
-qint64 QAudioOutputPrivate::processedUSecs() const
-{
- return qint64(1000000) * totalTimeValue / settings.frequency();
-}
-
-void QAudioOutputPrivate::resume()
-{
- if(deviceState == QAudio::SuspendedState) {
- int err = 0;
-
- if(handle) {
- err = snd_pcm_prepare( handle );
- if(err < 0)
- xrun_recovery(err);
-
- err = snd_pcm_start(handle);
- if(err < 0)
- xrun_recovery(err);
-
- bytesAvailable = (int)snd_pcm_frames_to_bytes(handle, buffer_frames);
- }
- resuming = true;
-
- deviceState = QAudio::ActiveState;
-
- errorState = QAudio::NoError;
- timer->start(period_time/1000);
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (deviceState == QAudio::StoppedState)
- settings = fmt;
-}
-
-QAudioFormat QAudioOutputPrivate::format() const
-{
- return settings;
-}
-
-void QAudioOutputPrivate::suspend()
-{
- if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) {
- timer->stop();
- deviceState = QAudio::SuspendedState;
- errorState = QAudio::NoError;
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioOutputPrivate::userFeed()
-{
- if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
- return;
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :userFeed() OUT";
-#endif
- if(deviceState == QAudio::IdleState)
- bytesAvailable = bytesFree();
-
- deviceReady();
-}
-
-void QAudioOutputPrivate::feedback()
-{
- updateAvailable();
-}
-
-
-void QAudioOutputPrivate::updateAvailable()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :updateAvailable()";
-#endif
- bytesAvailable = bytesFree();
-}
-
-bool QAudioOutputPrivate::deviceReady()
-{
- if(pullMode) {
- int l = 0;
- int chunks = bytesAvailable/period_size;
- if(chunks==0) {
- bytesAvailable = bytesFree();
- return false;
- }
-#ifdef DEBUG_AUDIO
- qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
- qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<period_size*chunks;
-#endif
- int input = period_frames*chunks;
- if(input > (int)buffer_frames)
- input = buffer_frames;
- l = audioSource->read(audioBuffer,snd_pcm_frames_to_bytes(handle, input));
- if(l > 0) {
- // Got some data to output
- if(deviceState != QAudio::ActiveState)
- return true;
- qint64 bytesWritten = write(audioBuffer,l);
- if (bytesWritten != l)
- audioSource->seek(audioSource->pos()-(l-bytesWritten));
- bytesAvailable = bytesFree();
-
- } else if(l == 0) {
- // Did not get any data to output
- bytesAvailable = bytesFree();
- if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) {
- // Underrun
- if (deviceState != QAudio::IdleState) {
- errorState = QAudio::UnderrunError;
- emit errorChanged(errorState);
- deviceState = QAudio::IdleState;
- emit stateChanged(deviceState);
- }
- }
-
- } else if(l < 0) {
- close();
- deviceState = QAudio::StoppedState;
- errorState = QAudio::IOError;
- emit errorChanged(errorState);
- emit stateChanged(deviceState);
- }
- } else {
- bytesAvailable = bytesFree();
- if(bytesAvailable > snd_pcm_frames_to_bytes(handle, buffer_frames-period_frames)) {
- // Underrun
- if (deviceState != QAudio::IdleState) {
- errorState = QAudio::UnderrunError;
- emit errorChanged(errorState);
- deviceState = QAudio::IdleState;
- emit stateChanged(deviceState);
- }
- }
- }
-
- if(deviceState != QAudio::ActiveState)
- return true;
-
- if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
- emit notify();
- elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
- timeStamp.restart();
- }
- return true;
-}
-
-qint64 QAudioOutputPrivate::elapsedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
-
- return clockStamp.elapsed()*1000;
-}
-
-void QAudioOutputPrivate::reset()
-{
- if(handle)
- snd_pcm_reset(handle);
-
- stop();
-}
-
-OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
-{
- audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
-}
-
-OutputPrivate::~OutputPrivate() {}
-
-qint64 OutputPrivate::readData( char* data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
-
- return 0;
-}
-
-qint64 OutputPrivate::writeData(const char* data, qint64 len)
-{
- int retry = 0;
- qint64 written = 0;
- if((audioDevice->deviceState == QAudio::ActiveState)
- ||(audioDevice->deviceState == QAudio::IdleState)) {
- while(written < len) {
- int chunk = audioDevice->write(data+written,(len-written));
- if(chunk <= 0)
- retry++;
- written+=chunk;
- if(retry > 10)
- return written;
- }
- }
- return written;
-
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiooutput_alsa_p.cpp"
diff --git a/src/multimedia/audio/qaudiooutput_alsa_p.h b/src/multimedia/audio/qaudiooutput_alsa_p.h
deleted file mode 100644
index f914ded..0000000
--- a/src/multimedia/audio/qaudiooutput_alsa_p.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIOOUTPUTALSA_H
-#define QAUDIOOUTPUTALSA_H
-
-#include <alsa/asoundlib.h>
-
-#include <QtCore/qfile.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class OutputPrivate;
-
-class QAudioOutputPrivate : public QAbstractAudioOutput
-{
- friend class OutputPrivate;
- Q_OBJECT
-public:
- QAudioOutputPrivate(const QByteArray &device);
- ~QAudioOutputPrivate();
-
- qint64 write( const char *data, qint64 len );
-
- void start(QIODevice* device);
- QIODevice* start();
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesFree() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- void setFormat(const QAudioFormat& fmt);
- QAudioFormat format() const;
-
- QIODevice* audioSource;
- QAudioFormat settings;
- QAudio::Error errorState;
- QAudio::State deviceState;
-
-private slots:
- void userFeed();
- void feedback();
- void updateAvailable();
- bool deviceReady();
-
-signals:
- void processMore();
-
-private:
- bool opened;
- bool pullMode;
- bool resuming;
- int buffer_size;
- int period_size;
- int intervalTime;
- qint64 totalTimeValue;
- unsigned int buffer_time;
- unsigned int period_time;
- snd_pcm_uframes_t buffer_frames;
- snd_pcm_uframes_t period_frames;
- static void async_callback(snd_async_handler_t *ahandler);
- int xrun_recovery(int err);
-
- int setFormat();
- bool open();
- void close();
-
- QTimer* timer;
- QByteArray m_device;
- int bytesAvailable;
- QTime timeStamp;
- QTime clockStamp;
- qint64 elapsedTimeOffset;
- char* audioBuffer;
- snd_pcm_t* handle;
- snd_async_handler_t* ahandler;
- snd_pcm_access_t access;
- snd_pcm_format_t pcmformat;
- snd_timestamp_t* timestamp;
- snd_pcm_hw_params_t *hwparams;
-};
-
-class OutputPrivate : public QIODevice
-{
- friend class QAudioOutputPrivate;
- Q_OBJECT
-public:
- OutputPrivate(QAudioOutputPrivate* audio);
- ~OutputPrivate();
-
- qint64 readData( char* data, qint64 len);
- qint64 writeData(const char* data, qint64 len);
-
-private:
- QAudioOutputPrivate *audioDevice;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.cpp b/src/multimedia/audio/qaudiooutput_mac_p.cpp
deleted file mode 100644
index 5e0c1cb..0000000
--- a/src/multimedia/audio/qaudiooutput_mac_p.cpp
+++ /dev/null
@@ -1,734 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <CoreServices/CoreServices.h>
-#include <CoreAudio/CoreAudio.h>
-#include <AudioUnit/AudioUnit.h>
-#include <AudioToolbox/AudioToolbox.h>
-
-#include <QtCore/qendian.h>
-#include <QtCore/qbuffer.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-
-#include <qaudiooutput.h>
-
-#include "qaudio_mac_p.h"
-#include "qaudiooutput_mac_p.h"
-#include "qaudiodeviceinfo_mac_p.h"
-
-
-QT_BEGIN_NAMESPACE
-
-
-namespace QtMultimediaInternal
-{
-
-static const int default_buffer_size = 8 * 1024;
-
-
-class QAudioOutputBuffer : public QObject
-{
- Q_OBJECT
-
-public:
- QAudioOutputBuffer(int bufferSize, int maxPeriodSize, QAudioFormat const& audioFormat):
- m_deviceError(false),
- m_maxPeriodSize(maxPeriodSize),
- m_device(0)
- {
- m_buffer = new QAudioRingBuffer(bufferSize + (bufferSize % maxPeriodSize == 0 ? 0 : maxPeriodSize - (bufferSize % maxPeriodSize)));
- m_bytesPerFrame = (audioFormat.sampleSize() / 8) * audioFormat.channels();
- m_periodTime = m_maxPeriodSize / m_bytesPerFrame * 1000 / audioFormat.frequency();
-
- m_fillTimer = new QTimer(this);
- connect(m_fillTimer, SIGNAL(timeout()), SLOT(fillBuffer()));
- }
-
- ~QAudioOutputBuffer()
- {
- delete m_buffer;
- }
-
- qint64 readFrames(char* data, qint64 maxFrames)
- {
- bool wecan = true;
- qint64 framesRead = 0;
-
- while (wecan && framesRead < maxFrames) {
- QAudioRingBuffer::Region region = m_buffer->acquireReadRegion((maxFrames - framesRead) * m_bytesPerFrame);
-
- if (region.second > 0) {
- // Ensure that we only read whole frames.
- region.second -= region.second % m_bytesPerFrame;
-
- if (region.second > 0) {
- memcpy(data + (framesRead * m_bytesPerFrame), region.first, region.second);
- framesRead += region.second / m_bytesPerFrame;
- } else
- wecan = false; // If there is only a partial frame left we should exit.
- }
- else
- wecan = false;
-
- m_buffer->releaseReadRegion(region);
- }
-
- if (framesRead == 0 && m_deviceError)
- framesRead = -1;
-
- return framesRead;
- }
-
- qint64 writeBytes(const char* data, qint64 maxSize)
- {
- bool wecan = true;
- qint64 bytesWritten = 0;
-
- maxSize -= maxSize % m_bytesPerFrame;
- while (wecan && bytesWritten < maxSize) {
- QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(maxSize - bytesWritten);
-
- if (region.second > 0) {
- memcpy(region.first, data + bytesWritten, region.second);
- bytesWritten += region.second;
- }
- else
- wecan = false;
-
- m_buffer->releaseWriteRegion(region);
- }
-
- if (bytesWritten > 0)
- emit readyRead();
-
- return bytesWritten;
- }
-
- int available() const
- {
- return m_buffer->free();
- }
-
- void reset()
- {
- m_buffer->reset();
- m_device = 0;
- m_deviceError = false;
- }
-
- void setPrefetchDevice(QIODevice* device)
- {
- if (m_device != device) {
- m_device = device;
- if (m_device != 0)
- fillBuffer();
- }
- }
-
- void startFillTimer()
- {
- if (m_device != 0)
- m_fillTimer->start(m_buffer->size() / 2 / m_maxPeriodSize * m_periodTime);
- }
-
- void stopFillTimer()
- {
- m_fillTimer->stop();
- }
-
-signals:
- void readyRead();
-
-private slots:
- void fillBuffer()
- {
- const int free = m_buffer->free();
- const int writeSize = free - (free % m_maxPeriodSize);
-
- if (writeSize > 0) {
- bool wecan = true;
- int filled = 0;
-
- while (!m_deviceError && wecan && filled < writeSize) {
- QAudioRingBuffer::Region region = m_buffer->acquireWriteRegion(writeSize - filled);
-
- if (region.second > 0) {
- region.second = m_device->read(region.first, region.second);
- if (region.second > 0)
- filled += region.second;
- else if (region.second == 0)
- wecan = false;
- else if (region.second < 0) {
- m_fillTimer->stop();
- region.second = 0;
- m_deviceError = true;
- }
- }
- else
- wecan = false;
-
- m_buffer->releaseWriteRegion(region);
- }
-
- if (filled > 0)
- emit readyRead();
- }
- }
-
-private:
- bool m_deviceError;
- int m_maxPeriodSize;
- int m_bytesPerFrame;
- int m_periodTime;
- QIODevice* m_device;
- QTimer* m_fillTimer;
- QAudioRingBuffer* m_buffer;
-};
-
-
-}
-
-class MacOutputDevice : public QIODevice
-{
- Q_OBJECT
-
-public:
- MacOutputDevice(QtMultimediaInternal::QAudioOutputBuffer* audioBuffer, QObject* parent):
- QIODevice(parent),
- m_audioBuffer(audioBuffer)
- {
- open(QIODevice::WriteOnly | QIODevice::Unbuffered);
- }
-
- qint64 readData(char* data, qint64 len)
- {
- Q_UNUSED(data);
- Q_UNUSED(len);
-
- return 0;
- }
-
- qint64 writeData(const char* data, qint64 len)
- {
- return m_audioBuffer->writeBytes(data, len);
- }
-
- bool isSequential() const
- {
- return true;
- }
-
-private:
- QtMultimediaInternal::QAudioOutputBuffer* m_audioBuffer;
-};
-
-
-QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray& device)
-{
- QDataStream ds(device);
- quint32 did, mode;
-
- ds >> did >> mode;
-
- if (QAudio::Mode(mode) == QAudio::AudioInput)
- errorCode = QAudio::OpenError;
- else {
- audioDeviceInfo = new QAudioDeviceInfoInternal(device, QAudio::AudioOutput);
- isOpen = false;
- audioDeviceId = AudioDeviceID(did);
- audioUnit = 0;
- audioIO = 0;
- startTime = 0;
- totalFrames = 0;
- audioBuffer = 0;
- internalBufferSize = QtMultimediaInternal::default_buffer_size;
- clockFrequency = AudioGetHostClockFrequency() / 1000;
- errorCode = QAudio::NoError;
- stateCode = QAudio::StoppedState;
- audioThreadState = Stopped;
-
- intervalTimer = new QTimer(this);
- intervalTimer->setInterval(1000);
- connect(intervalTimer, SIGNAL(timeout()), SIGNAL(notify()));
- }
-}
-
-QAudioOutputPrivate::~QAudioOutputPrivate()
-{
- delete audioDeviceInfo;
- close();
-}
-
-bool QAudioOutputPrivate::open()
-{
- if (errorCode != QAudio::NoError)
- return false;
-
- if (isOpen)
- return true;
-
- ComponentDescription cd;
- cd.componentType = kAudioUnitType_Output;
- cd.componentSubType = kAudioUnitSubType_HALOutput;
- cd.componentManufacturer = kAudioUnitManufacturer_Apple;
- cd.componentFlags = 0;
- cd.componentFlagsMask = 0;
-
- // Open
- Component cp = FindNextComponent(NULL, &cd);
- if (cp == 0) {
- qWarning() << "QAudioOutput: Failed to find HAL Output component";
- return false;
- }
-
- if (OpenAComponent(cp, &audioUnit) != noErr) {
- qWarning() << "QAudioOutput: Unable to Open Output Component";
- return false;
- }
-
- // register callback
- AURenderCallbackStruct cb;
- cb.inputProc = renderCallback;
- cb.inputProcRefCon = this;
-
- if (AudioUnitSetProperty(audioUnit,
- kAudioUnitProperty_SetRenderCallback,
- kAudioUnitScope_Global,
- 0,
- &cb,
- sizeof(cb)) != noErr) {
- qWarning() << "QAudioOutput: Failed to set AudioUnit callback";
- return false;
- }
-
- // Set Audio Device
- if (AudioUnitSetProperty(audioUnit,
- kAudioOutputUnitProperty_CurrentDevice,
- kAudioUnitScope_Global,
- 0,
- &audioDeviceId,
- sizeof(audioDeviceId)) != noErr) {
- qWarning() << "QAudioOutput: Unable to use configured device";
- return false;
- }
-
- // Set stream format
- streamFormat = toAudioStreamBasicDescription(audioFormat);
-
- UInt32 size = sizeof(streamFormat);
- if (AudioUnitSetProperty(audioUnit,
- kAudioUnitProperty_StreamFormat,
- kAudioUnitScope_Input,
- 0,
- &streamFormat,
- sizeof(streamFormat)) != noErr) {
- qWarning() << "QAudioOutput: Unable to Set Stream information";
- return false;
- }
-
- // Allocate buffer
- UInt32 numberOfFrames = 0;
- size = sizeof(UInt32);
- if (AudioUnitGetProperty(audioUnit,
- kAudioDevicePropertyBufferFrameSize,
- kAudioUnitScope_Global,
- 0,
- &numberOfFrames,
- &size) != noErr) {
- qWarning() << "QAudioInput: Failed to get audio period size";
- return false;
- }
-
- periodSizeBytes = numberOfFrames * streamFormat.mBytesPerFrame;
- if (internalBufferSize < periodSizeBytes * 2)
- internalBufferSize = periodSizeBytes * 2;
- else
- internalBufferSize -= internalBufferSize % streamFormat.mBytesPerFrame;
-
- audioBuffer = new QtMultimediaInternal::QAudioOutputBuffer(internalBufferSize, periodSizeBytes, audioFormat);
- connect(audioBuffer, SIGNAL(readyRead()), SLOT(inputReady())); // Pull
-
- audioIO = new MacOutputDevice(audioBuffer, this);
-
- // Init
- if (AudioUnitInitialize(audioUnit)) {
- qWarning() << "QAudioOutput: Failed to initialize AudioUnit";
- return false;
- }
-
- isOpen = true;
-
- return true;
-}
-
-void QAudioOutputPrivate::close()
-{
- if (audioUnit != 0) {
- AudioOutputUnitStop(audioUnit);
- AudioUnitUninitialize(audioUnit);
- CloseComponent(audioUnit);
- }
-
- delete audioBuffer;
-}
-
-QAudioFormat QAudioOutputPrivate::format() const
-{
- return audioFormat;
-}
-
-void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (stateCode == QAudio::StoppedState)
- audioFormat = fmt;
-}
-
-void QAudioOutputPrivate::start(QIODevice* device)
-{
- QIODevice* op = device;
-
- if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) {
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::OpenError;
- }
-
- reset();
- audioBuffer->reset();
- audioBuffer->setPrefetchDevice(op);
-
- if (op == 0) {
- op = audioIO;
- stateCode = QAudio::IdleState;
- }
- else
- stateCode = QAudio::ActiveState;
-
- // Start
- errorCode = QAudio::NoError;
- totalFrames = 0;
- startTime = AudioGetCurrentHostTime();
-
- if (stateCode == QAudio::ActiveState)
- audioThreadStart();
-
- emit stateChanged(stateCode);
-}
-
-QIODevice* QAudioOutputPrivate::start()
-{
- if (!audioDeviceInfo->isFormatSupported(audioFormat) || !open()) {
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::OpenError;
- return audioIO;
- }
-
- reset();
- audioBuffer->reset();
- audioBuffer->setPrefetchDevice(0);
-
- stateCode = QAudio::IdleState;
-
- // Start
- errorCode = QAudio::NoError;
- totalFrames = 0;
- startTime = AudioGetCurrentHostTime();
-
- emit stateChanged(stateCode);
-
- return audioIO;
-}
-
-void QAudioOutputPrivate::stop()
-{
- QMutexLocker lock(&mutex);
- if (stateCode != QAudio::StoppedState) {
- audioThreadDrain();
-
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::NoError;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioOutputPrivate::reset()
-{
- QMutexLocker lock(&mutex);
- if (stateCode != QAudio::StoppedState) {
- audioThreadStop();
-
- stateCode = QAudio::StoppedState;
- errorCode = QAudio::NoError;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioOutputPrivate::suspend()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState || stateCode == QAudio::IdleState) {
- audioThreadStop();
-
- stateCode = QAudio::SuspendedState;
- errorCode = QAudio::NoError;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-void QAudioOutputPrivate::resume()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::SuspendedState) {
- audioThreadStart();
-
- stateCode = QAudio::ActiveState;
- errorCode = QAudio::NoError;
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-int QAudioOutputPrivate::bytesFree() const
-{
- return audioBuffer->available();
-}
-
-int QAudioOutputPrivate::periodSize() const
-{
- return periodSizeBytes;
-}
-
-void QAudioOutputPrivate::setBufferSize(int bs)
-{
- if (stateCode == QAudio::StoppedState)
- internalBufferSize = bs;
-}
-
-int QAudioOutputPrivate::bufferSize() const
-{
- return internalBufferSize;
-}
-
-void QAudioOutputPrivate::setNotifyInterval(int milliSeconds)
-{
- if (intervalTimer->interval() == milliSeconds)
- return;
-
- if (milliSeconds <= 0)
- milliSeconds = 0;
-
- intervalTimer->setInterval(milliSeconds);
-}
-
-int QAudioOutputPrivate::notifyInterval() const
-{
- return intervalTimer->interval();
-}
-
-qint64 QAudioOutputPrivate::processedUSecs() const
-{
- return totalFrames * 1000000 / audioFormat.frequency();
-}
-
-qint64 QAudioOutputPrivate::elapsedUSecs() const
-{
- if (stateCode == QAudio::StoppedState)
- return 0;
-
- return (AudioGetCurrentHostTime() - startTime) / (clockFrequency / 1000);
-}
-
-QAudio::Error QAudioOutputPrivate::error() const
-{
- return errorCode;
-}
-
-QAudio::State QAudioOutputPrivate::state() const
-{
- return stateCode;
-}
-
-void QAudioOutputPrivate::audioThreadStart()
-{
- startTimers();
- audioThreadState = Running;
- AudioOutputUnitStart(audioUnit);
-}
-
-void QAudioOutputPrivate::audioThreadStop()
-{
- stopTimers();
- if (audioThreadState.testAndSetAcquire(Running, Stopped))
- threadFinished.wait(&mutex);
-}
-
-void QAudioOutputPrivate::audioThreadDrain()
-{
- stopTimers();
- if (audioThreadState.testAndSetAcquire(Running, Draining))
- threadFinished.wait(&mutex);
-}
-
-void QAudioOutputPrivate::audioDeviceStop()
-{
- AudioOutputUnitStop(audioUnit);
- audioThreadState = Stopped;
- threadFinished.wakeOne();
-}
-
-void QAudioOutputPrivate::audioDeviceIdle()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState) {
- audioDeviceStop();
-
- errorCode = QAudio::UnderrunError;
- stateCode = QAudio::IdleState;
- QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
- }
-}
-
-void QAudioOutputPrivate::audioDeviceError()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::ActiveState) {
- audioDeviceStop();
-
- errorCode = QAudio::IOError;
- stateCode = QAudio::StoppedState;
- QMetaObject::invokeMethod(this, "deviceStopped", Qt::QueuedConnection);
- }
-}
-
-void QAudioOutputPrivate::startTimers()
-{
- audioBuffer->startFillTimer();
- if (intervalTimer->interval() > 0)
- intervalTimer->start();
-}
-
-void QAudioOutputPrivate::stopTimers()
-{
- audioBuffer->stopFillTimer();
- intervalTimer->stop();
-}
-
-
-void QAudioOutputPrivate::deviceStopped()
-{
- intervalTimer->stop();
- emit stateChanged(stateCode);
-}
-
-void QAudioOutputPrivate::inputReady()
-{
- QMutexLocker lock(&mutex);
- if (stateCode == QAudio::IdleState) {
- audioThreadStart();
-
- stateCode = QAudio::ActiveState;
- errorCode = QAudio::NoError;
-
- QMetaObject::invokeMethod(this, "stateChanged", Qt::QueuedConnection, Q_ARG(QAudio::State, stateCode));
- }
-}
-
-
-OSStatus QAudioOutputPrivate::renderCallback(void* inRefCon,
- AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList* ioData)
-{
- Q_UNUSED(ioActionFlags)
- Q_UNUSED(inTimeStamp)
- Q_UNUSED(inBusNumber)
- Q_UNUSED(inNumberFrames)
-
- QAudioOutputPrivate* d = static_cast<QAudioOutputPrivate*>(inRefCon);
-
- const int threadState = d->audioThreadState.fetchAndAddAcquire(0);
- if (threadState == Stopped) {
- ioData->mBuffers[0].mDataByteSize = 0;
- d->audioDeviceStop();
- }
- else {
- const UInt32 bytesPerFrame = d->streamFormat.mBytesPerFrame;
- qint64 framesRead;
-
- framesRead = d->audioBuffer->readFrames((char*)ioData->mBuffers[0].mData,
- ioData->mBuffers[0].mDataByteSize / bytesPerFrame);
-
- if (framesRead > 0) {
- ioData->mBuffers[0].mDataByteSize = framesRead * bytesPerFrame;
- d->totalFrames += framesRead;
- }
- else {
- ioData->mBuffers[0].mDataByteSize = 0;
- if (framesRead == 0) {
- if (threadState == Draining)
- d->audioDeviceStop();
- else
- d->audioDeviceIdle();
- }
- else
- d->audioDeviceError();
- }
- }
-
- return noErr;
-}
-
-
-QT_END_NAMESPACE
-
-#include "qaudiooutput_mac_p.moc"
diff --git a/src/multimedia/audio/qaudiooutput_mac_p.h b/src/multimedia/audio/qaudiooutput_mac_p.h
deleted file mode 100644
index ded618c..0000000
--- a/src/multimedia/audio/qaudiooutput_mac_p.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIOOUTPUT_MAC_P_H
-#define QAUDIOOUTPUT_MAC_P_H
-
-#include <CoreServices/CoreServices.h>
-#include <CoreAudio/CoreAudio.h>
-#include <AudioUnit/AudioUnit.h>
-#include <AudioToolbox/AudioToolbox.h>
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qwaitcondition.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qatomic.h>
-
-#include <qaudio.h>
-#include <qaudioformat.h>
-#include <qaudiosystem.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QIODevice;
-class QAbstractAudioDeviceInfo;
-
-namespace QtMultimediaInternal
-{
-class QAudioOutputBuffer;
-}
-
-class QAudioOutputPrivate : public QAbstractAudioOutput
-{
- Q_OBJECT
-
-public:
- bool isOpen;
- int internalBufferSize;
- int periodSizeBytes;
- qint64 totalFrames;
- QAudioFormat audioFormat;
- QIODevice* audioIO;
- AudioDeviceID audioDeviceId;
- AudioUnit audioUnit;
- Float64 clockFrequency;
- UInt64 startTime;
- AudioStreamBasicDescription deviceFormat;
- AudioStreamBasicDescription streamFormat;
- QtMultimediaInternal::QAudioOutputBuffer* audioBuffer;
- QAtomicInt audioThreadState;
- QWaitCondition threadFinished;
- QMutex mutex;
- QTimer* intervalTimer;
- QAbstractAudioDeviceInfo *audioDeviceInfo;
-
- QAudio::Error errorCode;
- QAudio::State stateCode;
-
- QAudioOutputPrivate(const QByteArray& device);
- ~QAudioOutputPrivate();
-
- bool open();
- void close();
-
- QAudioFormat format() const;
- void setFormat(const QAudioFormat& fmt);
-
- QIODevice* start();
- void start(QIODevice* device);
- void stop();
- void reset();
- void suspend();
- void resume();
-
- int bytesFree() const;
- int periodSize() const;
-
- void setBufferSize(int value);
- int bufferSize() const;
-
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
-
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
-
- QAudio::Error error() const;
- QAudio::State state() const;
-
- void audioThreadStart();
- void audioThreadStop();
- void audioThreadDrain();
-
- void audioDeviceStop();
- void audioDeviceIdle();
- void audioDeviceError();
-
- void startTimers();
- void stopTimers();
-
-private slots:
- void deviceStopped();
- void inputReady();
-
-private:
- enum { Running, Draining, Stopped };
-
- static OSStatus renderCallback(void* inRefCon,
- AudioUnitRenderActionFlags* ioActionFlags,
- const AudioTimeStamp* inTimeStamp,
- UInt32 inBusNumber,
- UInt32 inNumberFrames,
- AudioBufferList* ioData);
-};
-
-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
deleted file mode 100644
index d5b31a3..0000000
--- a/src/multimedia/audio/qaudiooutput_win32_p.cpp
+++ /dev/null
@@ -1,715 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include "qaudiooutput_win32_p.h"
-
-#ifndef SPEAKER_FRONT_LEFT
- #define SPEAKER_FRONT_LEFT 0x00000001
- #define SPEAKER_FRONT_RIGHT 0x00000002
- #define SPEAKER_FRONT_CENTER 0x00000004
- #define SPEAKER_LOW_FREQUENCY 0x00000008
- #define SPEAKER_BACK_LEFT 0x00000010
- #define SPEAKER_BACK_RIGHT 0x00000020
- #define SPEAKER_FRONT_LEFT_OF_CENTER 0x00000040
- #define SPEAKER_FRONT_RIGHT_OF_CENTER 0x00000080
- #define SPEAKER_BACK_CENTER 0x00000100
- #define SPEAKER_SIDE_LEFT 0x00000200
- #define SPEAKER_SIDE_RIGHT 0x00000400
- #define SPEAKER_TOP_CENTER 0x00000800
- #define SPEAKER_TOP_FRONT_LEFT 0x00001000
- #define SPEAKER_TOP_FRONT_CENTER 0x00002000
- #define SPEAKER_TOP_FRONT_RIGHT 0x00004000
- #define SPEAKER_TOP_BACK_LEFT 0x00008000
- #define SPEAKER_TOP_BACK_CENTER 0x00010000
- #define SPEAKER_TOP_BACK_RIGHT 0x00020000
- #define SPEAKER_RESERVED 0x7FFC0000
- #define SPEAKER_ALL 0x80000000
-#endif
-
-#ifndef _WAVEFORMATEXTENSIBLE_
-
- #define _WAVEFORMATEXTENSIBLE_
- typedef struct
- {
- WAVEFORMATEX Format; // Base WAVEFORMATEX data
- union
- {
- WORD wValidBitsPerSample; // Valid bits in each sample container
- WORD wSamplesPerBlock; // Samples per block of audio data; valid
- // if wBitsPerSample=0 (but rarely used).
- WORD wReserved; // Zero if neither case above applies.
- } Samples;
- DWORD dwChannelMask; // Positions of the audio channels
- GUID SubFormat; // Format identifier GUID
- } WAVEFORMATEXTENSIBLE, *PWAVEFORMATEXTENSIBLE, *LPPWAVEFORMATEXTENSIBLE;
- typedef const WAVEFORMATEXTENSIBLE* LPCWAVEFORMATEXTENSIBLE;
-
-#endif
-
-#if !defined(WAVE_FORMAT_EXTENSIBLE)
-#define WAVE_FORMAT_EXTENSIBLE 0xFFFE
-#endif
-
-//#define DEBUG_AUDIO 1
-
-QT_BEGIN_NAMESPACE
-
-QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
-{
- bytesAvailable = 0;
- buffer_size = 0;
- period_size = 0;
- m_device = device;
- totalTimeValue = 0;
- intervalTime = 1000;
- audioBuffer = 0;
- errorState = QAudio::NoError;
- deviceState = QAudio::StoppedState;
- audioSource = 0;
- pullMode = true;
- finished = false;
-}
-
-QAudioOutputPrivate::~QAudioOutputPrivate()
-{
- mutex.lock();
- finished = true;
- mutex.unlock();
-
- close();
-}
-
-void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 )
-{
- Q_UNUSED(dwParam1)
- Q_UNUSED(dwParam2)
- Q_UNUSED(hWaveOut)
-
- QAudioOutputPrivate* qAudio;
- qAudio = (QAudioOutputPrivate*)(dwInstance);
- if(!qAudio)
- return;
-
- QMutexLocker(&qAudio->mutex);
-
- switch(uMsg) {
- case WOM_OPEN:
- qAudio->feedback();
- break;
- case WOM_CLOSE:
- return;
- case WOM_DONE:
- if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) {
- return;
- }
- qAudio->waveFreeBlockCount++;
- if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size)
- qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size;
- qAudio->feedback();
- break;
- default:
- return;
- }
-}
-
-WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count)
-{
- int i;
- unsigned char* buffer;
- WAVEHDR* blocks;
- DWORD totalBufferSize = (size + sizeof(WAVEHDR))*count;
-
- if((buffer=(unsigned char*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
- totalBufferSize)) == 0) {
- qWarning("QAudioOutput: Memory allocation error");
- return 0;
- }
- blocks = (WAVEHDR*)buffer;
- buffer += sizeof(WAVEHDR)*count;
- for(i = 0; i < count; i++) {
- blocks[i].dwBufferLength = size;
- blocks[i].lpData = (LPSTR)buffer;
- buffer += size;
- }
- return blocks;
-}
-
-void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
-{
- WAVEHDR* blocks = blockArray;
-
- int count = buffer_size/period_size;
-
- for(int i = 0; i < count; i++) {
- waveOutUnprepareHeader(hWaveOut,blocks, sizeof(WAVEHDR));
- blocks++;
- }
- HeapFree(GetProcessHeap(), 0, blockArray);
-}
-
-QAudioFormat QAudioOutputPrivate::format() const
-{
- return settings;
-}
-
-void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
-{
- if (deviceState == QAudio::StoppedState)
- settings = fmt;
-}
-
-void QAudioOutputPrivate::start(QIODevice* device)
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = true;
- audioSource = device;
-
- deviceState = QAudio::ActiveState;
-
- if(!open())
- return;
-
- emit stateChanged(deviceState);
-}
-
-QIODevice* QAudioOutputPrivate::start()
-{
- if(deviceState != QAudio::StoppedState)
- close();
-
- if(!pullMode && audioSource)
- delete audioSource;
-
- pullMode = false;
- audioSource = new OutputPrivate(this);
- audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
-
- deviceState = QAudio::IdleState;
-
- if(!open())
- return 0;
-
- emit stateChanged(deviceState);
-
- return audioSource;
-}
-
-void QAudioOutputPrivate::stop()
-{
- if(deviceState == QAudio::StoppedState)
- return;
- close();
- if(!pullMode && audioSource) {
- delete audioSource;
- audioSource = 0;
- }
- emit stateChanged(deviceState);
-}
-
-bool QAudioOutputPrivate::open()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
-#endif
-
- period_size = 0;
-
- if (!settings.isValid()) {
- qWarning("QAudioOutput: open error, invalid format.");
- } else if (settings.channelCount() <= 0) {
- qWarning("QAudioOutput: open error, invalid number of channels (%d).",
- settings.channelCount());
- } else if (settings.sampleSize() <= 0) {
- qWarning("QAudioOutput: open error, invalid sample size (%d).",
- settings.sampleSize());
- } else if (settings.frequency() < 8000 || settings.frequency() > 96000) {
- qWarning("QAudioOutput: open error, frequency out of range (%d).", settings.frequency());
- } else if (buffer_size == 0) {
- // Default buffer size, 200ms, default period size is 40ms
- buffer_size
- = (settings.frequency()
- * settings.channelCount()
- * settings.sampleSize()
- + 39) / 40;
- period_size = buffer_size / 5;
- } else {
- period_size = buffer_size / 5;
- }
-
- if (period_size == 0) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- return false;
- }
-
- waveBlocks = allocateBlocks(period_size, buffer_size/period_size);
-
- mutex.lock();
- waveFreeBlockCount = buffer_size/period_size;
- mutex.unlock();
-
- waveCurrentBlock = 0;
-
- if(audioBuffer == 0)
- audioBuffer = new char[buffer_size];
-
- timeStamp.restart();
- elapsedTimeOffset = 0;
-
- wfx.nSamplesPerSec = settings.frequency();
- wfx.wBitsPerSample = settings.sampleSize();
- wfx.nChannels = settings.channels();
- wfx.cbSize = 0;
-
- bool surround = false;
-
- if (settings.channels() > 2)
- surround = true;
-
- wfx.wFormatTag = WAVE_FORMAT_PCM;
- wfx.nBlockAlign = (wfx.wBitsPerSample >> 3) * wfx.nChannels;
- wfx.nAvgBytesPerSec = wfx.nBlockAlign * wfx.nSamplesPerSec;
-
- QDataStream ds(&m_device, QIODevice::ReadOnly);
- quint32 deviceId;
- ds >> deviceId;
-
- if (!surround) {
- if (waveOutOpen(&hWaveOut, UINT_PTR(deviceId), &wfx,
- (DWORD_PTR)&waveOutProc,
- (DWORD_PTR) this,
- CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- qWarning("QAudioOutput: open error");
- return false;
- }
- } else {
- WAVEFORMATEXTENSIBLE wfex;
- wfex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE;
- wfex.Format.nChannels = settings.channels();
- wfex.Format.wBitsPerSample = settings.sampleSize();
- wfex.Format.nSamplesPerSec = settings.frequency();
- wfex.Format.nBlockAlign = wfex.Format.nChannels*wfex.Format.wBitsPerSample/8;
- wfex.Format.nAvgBytesPerSec=wfex.Format.nSamplesPerSec*wfex.Format.nBlockAlign;
- wfex.Samples.wValidBitsPerSample=wfex.Format.wBitsPerSample;
- static const GUID _KSDATAFORMAT_SUBTYPE_PCM = {
- 0x00000001, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
- wfex.SubFormat=_KSDATAFORMAT_SUBTYPE_PCM;
- wfex.Format.cbSize=22;
-
- wfex.dwChannelMask = SPEAKER_FRONT_LEFT | SPEAKER_FRONT_RIGHT;
- if (settings.channels() >= 4)
- wfex.dwChannelMask |= SPEAKER_BACK_LEFT | SPEAKER_BACK_RIGHT;
- if (settings.channels() >= 6)
- wfex.dwChannelMask |= SPEAKER_FRONT_CENTER | SPEAKER_LOW_FREQUENCY;
- if (settings.channels() == 8)
- wfex.dwChannelMask |= SPEAKER_SIDE_LEFT | SPEAKER_SIDE_RIGHT;
-
- if (waveOutOpen(&hWaveOut, UINT_PTR(deviceId), &wfex.Format,
- (DWORD_PTR)&waveOutProc,
- (DWORD_PTR) this,
- CALLBACK_FUNCTION) != MMSYSERR_NOERROR) {
- errorState = QAudio::OpenError;
- deviceState = QAudio::StoppedState;
- emit stateChanged(deviceState);
- qWarning("QAudioOutput: open error");
- return false;
- }
- }
-
- totalTimeValue = 0;
- timeStampOpened.restart();
- elapsedTimeOffset = 0;
-
- errorState = QAudio::NoError;
- if(pullMode) {
- deviceState = QAudio::ActiveState;
- QTimer::singleShot(10, this, SLOT(feedback()));
- } else
- deviceState = QAudio::IdleState;
-
- return true;
-}
-
-void QAudioOutputPrivate::close()
-{
- if(deviceState == QAudio::StoppedState)
- return;
-
- deviceState = QAudio::StoppedState;
- errorState = QAudio::NoError;
- int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
- *settings.channels()*(settings.sampleSize()/8));
- waveOutReset(hWaveOut);
- Sleep(delay+10);
-
- freeBlocks(waveBlocks);
- waveOutClose(hWaveOut);
- delete [] audioBuffer;
- audioBuffer = 0;
- buffer_size = 0;
-}
-
-int QAudioOutputPrivate::bytesFree() const
-{
- int buf;
- buf = waveFreeBlockCount*period_size;
-
- return buf;
-}
-
-int QAudioOutputPrivate::periodSize() const
-{
- return period_size;
-}
-
-void QAudioOutputPrivate::setBufferSize(int value)
-{
- if(deviceState == QAudio::StoppedState)
- buffer_size = value;
-}
-
-int QAudioOutputPrivate::bufferSize() const
-{
- return buffer_size;
-}
-
-void QAudioOutputPrivate::setNotifyInterval(int ms)
-{
- intervalTime = qMax(0, ms);
-}
-
-int QAudioOutputPrivate::notifyInterval() const
-{
- return intervalTime;
-}
-
-qint64 QAudioOutputPrivate::processedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
- qint64 result = qint64(1000000) * totalTimeValue /
- (settings.channels()*(settings.sampleSize()/8)) /
- settings.frequency();
-
- return result;
-}
-
-qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
-{
- // Write out some audio data
- if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
- return 0;
-
- char* p = (char*)data;
- int l = (int)len;
-
- WAVEHDR* current;
- int remain;
- current = &waveBlocks[waveCurrentBlock];
- while(l > 0) {
- mutex.lock();
- if(waveFreeBlockCount==0) {
- mutex.unlock();
- break;
- }
- mutex.unlock();
-
- if(current->dwFlags & WHDR_PREPARED)
- waveOutUnprepareHeader(hWaveOut, current, sizeof(WAVEHDR));
-
- if(l < period_size)
- remain = l;
- else
- remain = period_size;
- memcpy(current->lpData, p, remain);
-
- l -= remain;
- p += remain;
- current->dwBufferLength = remain;
- waveOutPrepareHeader(hWaveOut, current, sizeof(WAVEHDR));
- waveOutWrite(hWaveOut, current, sizeof(WAVEHDR));
-
- mutex.lock();
- waveFreeBlockCount--;
-#ifdef DEBUG_AUDIO
- qDebug("write out l=%d, waveFreeBlockCount=%d",
- current->dwBufferLength,waveFreeBlockCount);
-#endif
- mutex.unlock();
-
- totalTimeValue += current->dwBufferLength;
- waveCurrentBlock++;
- waveCurrentBlock %= buffer_size/period_size;
- current = &waveBlocks[waveCurrentBlock];
- current->dwUser = 0;
- errorState = QAudio::NoError;
- if (deviceState != QAudio::ActiveState) {
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- }
- return (len-l);
-}
-
-void QAudioOutputPrivate::resume()
-{
- if(deviceState == QAudio::SuspendedState) {
- deviceState = QAudio::ActiveState;
- errorState = QAudio::NoError;
- waveOutRestart(hWaveOut);
- QTimer::singleShot(10, this, SLOT(feedback()));
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioOutputPrivate::suspend()
-{
- if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState) {
- int delay = (buffer_size-bytesFree())*1000/(settings.frequency()
- *settings.channels()*(settings.sampleSize()/8));
- waveOutPause(hWaveOut);
- Sleep(delay+10);
- deviceState = QAudio::SuspendedState;
- errorState = QAudio::NoError;
- emit stateChanged(deviceState);
- }
-}
-
-void QAudioOutputPrivate::feedback()
-{
-#ifdef DEBUG_AUDIO
- QTime now(QTime::currentTime());
- qDebug()<<now.second()<<"s "<<now.msec()<<"ms :feedback()";
-#endif
- bytesAvailable = bytesFree();
-
- if(!(deviceState==QAudio::StoppedState||deviceState==QAudio::SuspendedState)) {
- if(bytesAvailable >= period_size)
- QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection);
- }
-}
-
-bool QAudioOutputPrivate::deviceReady()
-{
- if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
- return false;
-
- if(pullMode) {
- int chunks = bytesAvailable/period_size;
-#ifdef DEBUG_AUDIO
- qDebug()<<"deviceReady() avail="<<bytesAvailable<<" bytes, period size="<<period_size<<" bytes";
- qDebug()<<"deviceReady() no. of chunks that can fit ="<<chunks<<", chunks in bytes ="<<chunks*period_size;
-#endif
- bool startup = false;
- if(totalTimeValue == 0)
- startup = true;
-
- bool full=false;
-
- mutex.lock();
- if(waveFreeBlockCount==0) full = true;
- mutex.unlock();
-
- if (full){
-#ifdef DEBUG_AUDIO
- qDebug() << "Skipping data as unable to write";
-#endif
- if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime ) {
- emit notify();
- elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
- timeStamp.restart();
- }
- return true;
- }
-
- if(startup)
- waveOutPause(hWaveOut);
- int input = period_size*chunks;
- int l = audioSource->read(audioBuffer,input);
- if(l > 0) {
- int out= write(audioBuffer,l);
- if(out > 0) {
- if (deviceState != QAudio::ActiveState) {
- deviceState = QAudio::ActiveState;
- emit stateChanged(deviceState);
- }
- }
- if ( out < l) {
- // Didn't write all data
- audioSource->seek(audioSource->pos()-(l-out));
- }
- if(startup)
- waveOutRestart(hWaveOut);
- } else if(l == 0) {
- bytesAvailable = bytesFree();
-
- int check = 0;
-
- mutex.lock();
- check = waveFreeBlockCount;
- mutex.unlock();
-
- if(check == buffer_size/period_size) {
- if (deviceState != QAudio::IdleState) {
- errorState = QAudio::UnderrunError;
- deviceState = QAudio::IdleState;
- emit stateChanged(deviceState);
- }
- }
-
- } else if(l < 0) {
- bytesAvailable = bytesFree();
- if (errorState != QAudio::IOError)
- errorState = QAudio::IOError;
- }
- } else {
- int buffered;
-
- mutex.lock();
- buffered = waveFreeBlockCount;
- mutex.unlock();
-
- if (buffered >= buffer_size/period_size && deviceState == QAudio::ActiveState) {
- if (deviceState != QAudio::IdleState) {
- errorState = QAudio::UnderrunError;
- deviceState = QAudio::IdleState;
- emit stateChanged(deviceState);
- }
- }
- }
- if(deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
- return true;
-
- if(intervalTime && (timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
- emit notify();
- elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
- timeStamp.restart();
- }
-
- return true;
-}
-
-qint64 QAudioOutputPrivate::elapsedUSecs() const
-{
- if (deviceState == QAudio::StoppedState)
- return 0;
-
- return timeStampOpened.elapsed()*1000;
-}
-
-QAudio::Error QAudioOutputPrivate::error() const
-{
- return errorState;
-}
-
-QAudio::State QAudioOutputPrivate::state() const
-{
- return deviceState;
-}
-
-void QAudioOutputPrivate::reset()
-{
- close();
-}
-
-OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
-{
- audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
-}
-
-OutputPrivate::~OutputPrivate() {}
-
-qint64 OutputPrivate::readData( char* data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
-
- return 0;
-}
-
-qint64 OutputPrivate::writeData(const char* data, qint64 len)
-{
- int retry = 0;
- qint64 written = 0;
-
- if((audioDevice->deviceState == QAudio::ActiveState)
- ||(audioDevice->deviceState == QAudio::IdleState)) {
- qint64 l = len;
- while(written < l) {
- int chunk = audioDevice->write(data+written,(l-written));
- if(chunk <= 0)
- retry++;
- else
- written+=chunk;
-
- if(retry > 10)
- return written;
- }
- audioDevice->deviceState = QAudio::ActiveState;
- }
- return written;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiooutput_win32_p.cpp"
diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h
deleted file mode 100644
index aa86d4e..0000000
--- a/src/multimedia/audio/qaudiooutput_win32_p.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIOOUTPUTWIN_H
-#define QAUDIOOUTPUTWIN_H
-
-#include <windows.h>
-#include <mmsystem.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qmutex.h>
-
-#include <qaudio.h>
-#include <qaudiodeviceinfo.h>
-#include <qaudiosystem.h>
-
-// For compat with 4.6
-#if !defined(QT_WIN_CALLBACK)
-# if defined(Q_CC_MINGW)
-# define QT_WIN_CALLBACK CALLBACK __attribute__ ((force_align_arg_pointer))
-# else
-# define QT_WIN_CALLBACK CALLBACK
-# endif
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioOutputPrivate : public QAbstractAudioOutput
-{
- Q_OBJECT
-public:
- QAudioOutputPrivate(const QByteArray &device);
- ~QAudioOutputPrivate();
-
- qint64 write( const char *data, qint64 len );
-
- void setFormat(const QAudioFormat& fmt);
- QAudioFormat format() const;
- QIODevice* start();
- void start(QIODevice* device);
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesFree() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
-
- QIODevice* audioSource;
- QAudioFormat settings;
- QAudio::Error errorState;
- QAudio::State deviceState;
-
-private slots:
- void feedback();
- bool deviceReady();
-
-private:
- QByteArray m_device;
- bool resuming;
- int bytesAvailable;
- QTime timeStamp;
- qint64 elapsedTimeOffset;
- QTime timeStampOpened;
- qint32 buffer_size;
- qint32 period_size;
- qint64 totalTimeValue;
- bool pullMode;
- int intervalTime;
- static void QT_WIN_CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
- DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 );
-
- QMutex mutex;
-
- WAVEHDR* allocateBlocks(int size, int count);
- void freeBlocks(WAVEHDR* blockArray);
- bool open();
- void close();
-
- WAVEFORMATEX wfx;
- HWAVEOUT hWaveOut;
- MMRESULT result;
- WAVEHDR header;
- WAVEHDR* waveBlocks;
- volatile bool finished;
- volatile int waveFreeBlockCount;
- int waveCurrentBlock;
- char* audioBuffer;
-};
-
-class OutputPrivate : public QIODevice
-{
- Q_OBJECT
-public:
- OutputPrivate(QAudioOutputPrivate* audio);
- ~OutputPrivate();
-
- qint64 readData( char* data, qint64 len);
- qint64 writeData(const char* data, qint64 len);
-
-private:
- QAudioOutputPrivate *audioDevice;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/audio/qaudiopluginloader.cpp b/src/multimedia/audio/qaudiopluginloader.cpp
deleted file mode 100644
index 5800635..0000000
--- a/src/multimedia/audio/qaudiopluginloader.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudiosystemplugin.h"
-#include "qaudiopluginloader_p.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qpluginloader.h>
-#include <QtCore/qfactoryinterface.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-QAudioPluginLoader::QAudioPluginLoader(const char *iid, const QString &location, Qt::CaseSensitivity):
- m_iid(iid)
-{
- m_location = location + QLatin1Char('/');
- load();
-}
-
-QAudioPluginLoader::~QAudioPluginLoader()
-{
- for (int i = 0; i < m_plugins.count(); i++ ) {
- delete m_plugins.at(i);
- }
-}
-
-QStringList QAudioPluginLoader::pluginList() const
-{
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
-#endif
-
- QStringList paths = QCoreApplication::libraryPaths();
-#ifdef QTM_PLUGIN_PATH
- paths << QLatin1String(QTM_PLUGIN_PATH);
-#endif
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug() << "Plugin paths:" << paths;
-#endif
-
- //temp variable to avoid multiple identic path
- QSet<QString> processed;
-
- /* Discover a bunch o plugins */
- QStringList plugins;
-
- /* Enumerate our plugin paths */
- for (int i=0; i < paths.count(); i++) {
- if (processed.contains(paths.at(i)))
- continue;
- processed.insert(paths.at(i));
- QDir pluginsDir(paths.at(i)+m_location);
- if (!pluginsDir.exists())
- continue;
-
- QStringList files = pluginsDir.entryList(QDir::Files);
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug()<<"Looking for plugins in "<<pluginsDir.path()<<files;
-#endif
- for (int j=0; j < files.count(); j++) {
- const QString &file = files.at(j);
- plugins << pluginsDir.absoluteFilePath(file);
- }
- }
- return plugins;
-}
-
-QStringList QAudioPluginLoader::keys() const
-{
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
-
- QStringList list;
- for (int i = 0; i < m_plugins.count(); i++) {
- QAudioSystemPlugin* p = qobject_cast<QAudioSystemPlugin*>(m_plugins.at(i)->instance());
- if (p) list << p->keys();
- }
-
- return list;
-}
-
-QObject* QAudioPluginLoader::instance(QString const &key)
-{
- QMutexLocker locker(&m_mutex);
-
- for (int i = 0; i < m_plugins.count(); i++) {
- QAudioSystemPlugin* p = qobject_cast<QAudioSystemPlugin*>(m_plugins.at(i)->instance());
- if (p && p->keys().contains(key))
- return m_plugins.at(i)->instance();
- }
- return 0;
-}
-
-QList<QObject*> QAudioPluginLoader::instances(QString const &key)
-{
- QMutexLocker locker(&m_mutex);
-
- QList<QObject*> list;
- for (int i = 0; i < m_plugins.count(); i++) {
- QAudioSystemPlugin* p = qobject_cast<QAudioSystemPlugin*>(m_plugins.at(i)->instance());
- if (p && p->keys().contains(key))
- list << m_plugins.at(i)->instance();
- }
- return list;
-}
-
-void QAudioPluginLoader::load()
-{
- if (!m_plugins.isEmpty())
- return;
-
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
-#endif
-
- QStringList plugins = pluginList();
- for (int i=0; i < plugins.count(); i++) {
- QPluginLoader* loader = new QPluginLoader(plugins.at(i));
- QObject *o = loader->instance();
- if (o != 0 && o->qt_metacast(m_iid) != 0) {
- m_plugins.append(loader);
- } else {
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qWarning() << "QAudioPluginLoader: Failed to load plugin: "
- << plugins.at(i) << loader->errorString();
-#endif
- delete o;
- //we are not calling loader->unload here for it may cause problem on some device
- delete loader;
- }
- }
-}
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/audio/qaudiopluginloader_p.h b/src/multimedia/audio/qaudiopluginloader_p.h
deleted file mode 100644
index 2e6fdbd..0000000
--- a/src/multimedia/audio/qaudiopluginloader_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOPLUGINLOADER_H
-#define QAUDIOPLUGINLOADER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediadefs.h>
-#include <QObject>
-#include <QtCore/qstring.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qpluginloader.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioPluginLoader
-{
-public:
- QAudioPluginLoader(const char *iid,
- const QString &suffix = QString(),
- Qt::CaseSensitivity = Qt::CaseSensitive);
-
- ~QAudioPluginLoader();
-
- QStringList keys() const;
- QObject* instance(QString const &key);
- QList<QObject*> instances(QString const &key);
-
-private:
- QStringList pluginList() const;
- void load();
-
- QMutex m_mutex;
-
- QByteArray m_iid;
- QString m_location;
- QList<QPluginLoader*> m_plugins;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QAUDIOPLUGINLOADER_H
diff --git a/src/multimedia/audio/qaudiosystem.cpp b/src/multimedia/audio/qaudiosystem.cpp
deleted file mode 100644
index a8837b0..0000000
--- a/src/multimedia/audio/qaudiosystem.cpp
+++ /dev/null
@@ -1,436 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudiosystem.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractAudioDeviceInfo
- \brief The QAbstractAudioDeviceInfo class is a base class for audio backends.
-
- \ingroup multimedia
- \inmodule QtMultimedia
- \internal
- \since 1.0
-
- This class implements the audio functionality for
- QAudioDeviceInfo, i.e., QAudioDeviceInfo keeps a
- QAbstractAudioDeviceInfo and routes function calls to it. For a
- description of the functionality that QAbstractAudioDeviceInfo
- implements, you can read the class and functions documentation of
- QAudioDeviceInfo.
-
- \sa QAudioDeviceInfo
- \sa QAbstractAudioOutput, QAbstractAudioInput
-*/
-
-/*!
- \fn virtual QAudioFormat QAbstractAudioDeviceInfo::preferredFormat() const
- Returns the recommended settings to use.
- \since 1.0
-*/
-
-/*!
- \fn virtual bool QAbstractAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const
- Returns true if \a format is available from audio device.
- \since 1.0
-*/
-
-/*!
- \fn virtual QString QAbstractAudioDeviceInfo::deviceName() const
- Returns the audio device name.
- \since 1.0
-*/
-
-/*!
- \fn virtual QStringList QAbstractAudioDeviceInfo::supportedCodecs()
- Returns the list of currently available codecs.
- \since 1.0
-*/
-
-/*!
- \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedSampleRates()
- Returns the list of currently available sample rates.
- \since 1.0
-*/
-
-/*!
- \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedChannelCounts()
- Returns the list of currently available channels.
- \since 1.0
-*/
-
-/*!
- \fn virtual QList<int> QAbstractAudioDeviceInfo::supportedSampleSizes()
- Returns the list of currently available sample sizes.
- \since 1.0
-*/
-
-/*!
- \fn virtual QList<QAudioFormat::Endian> QAbstractAudioDeviceInfo::supportedByteOrders()
- Returns the list of currently available byte orders.
- \since 1.0
-*/
-
-/*!
- \fn virtual QList<QAudioFormat::SampleType> QAbstractAudioDeviceInfo::supportedSampleTypes()
- Returns the list of currently available sample types.
- \since 1.0
-*/
-
-/*!
- \class QAbstractAudioOutput
- \brief The QAbstractAudioOutput class is a base class for audio backends.
- \since 1.0
-
- \ingroup multimedia
- \inmodule QtMultimedia
- \internal
-
- QAbstractAudioOutput implements audio functionality for
- QAudioOutput, i.e., QAudioOutput routes function calls to
- QAbstractAudioOutput. For a description of the functionality that
- is implemented, see the QAudioOutput class and function
- descriptions.
-
- \sa QAudioOutput
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::start(QIODevice* device)
- Uses the \a device as the QIODevice to transfer data.
- \since 1.0
-*/
-
-/*!
- \fn virtual QIODevice* QAbstractAudioOutput::start()
- Returns a pointer to the QIODevice being used to handle
- the data transfer. This QIODevice can be used to write() audio data directly.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::stop()
- Stops the audio output.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::reset()
- Drops all audio data in the buffers, resets buffers to zero.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::suspend()
- Stops processing audio data, preserving buffered audio data.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::resume()
- Resumes processing audio data after a suspend()
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioOutput::bytesFree() const
- Returns the free space available in bytes in the audio buffer.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioOutput::periodSize() const
- Returns the period size in bytes.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::setBufferSize(int value)
- Sets the audio buffer size to \a value in bytes.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioOutput::bufferSize() const
- Returns the audio buffer size in bytes.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::setNotifyInterval(int ms)
- Sets the interval for notify() signal to be emitted. This is based on the \a ms
- of audio data processed not on actual real-time. The resolution of the timer
- is platform specific.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioOutput::notifyInterval() const
- Returns the notify interval in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual qint64 QAbstractAudioOutput::processedUSecs() const
- Returns the amount of audio data processed since start() was called in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual qint64 QAbstractAudioOutput::elapsedUSecs() const
- Returns the milliseconds since start() was called, including time in Idle and suspend states.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudio::Error QAbstractAudioOutput::error() const
- Returns the error state.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudio::State QAbstractAudioOutput::state() const
- Returns the state of audio processing.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::setFormat(const QAudioFormat& fmt)
- Set the QAudioFormat to use to \a fmt.
- Setting the format is only allowable while in QAudio::StoppedState.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudioFormat QAbstractAudioOutput::format() const
- Returns the QAudioFormat being used.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioOutput::setVolume(qreal volume)
- Sets the volume.
- Where \a volume is between 0.0 and 1.0.
- \since 5.0
-*/
-
-/*!
- \fn virtual qreal QAbstractAudioOutput::volume() const
- Returns the volume in the range 0.0 and 1.0.
- \since 5.0
-*/
-
-/*!
- \fn QAbstractAudioOutput::errorChanged(QAudio::Error error)
- This signal is emitted when the \a error state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioOutput::stateChanged(QAudio::State state)
- This signal is emitted when the device \a state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioOutput::notify()
- This signal is emitted when x ms of audio data has been processed
- the interval set by setNotifyInterval(x).
- \since 1.0
-*/
-
-
-/*!
- \class QAbstractAudioInput
- \brief The QAbstractAudioInput class provides access for QAudioInput to access the audio
- device provided by the plugin.
- \since 1.0
-
- \ingroup multimedia
- \inmodule QtMultimedia
- \internal
-
- QAudioDeviceInput keeps an instance of QAbstractAudioInput and
- routes calls to functions of the same name to QAbstractAudioInput.
- This means that it is QAbstractAudioInput that implements the
- audio functionality. For a description of the functionality, see
- the QAudioInput class description.
-
- \sa QAudioInput
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::start(QIODevice* device)
- Uses the \a device as the QIODevice to transfer data.
- \since 1.0
-*/
-
-/*!
- \fn virtual QIODevice* QAbstractAudioInput::start()
- Returns a pointer to the QIODevice being used to handle
- the data transfer. This QIODevice can be used to read() audio data directly.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::stop()
- Stops the audio input.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::reset()
- Drops all audio data in the buffers, resets buffers to zero.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::suspend()
- Stops processing audio data, preserving buffered audio data.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::resume()
- Resumes processing audio data after a suspend().
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioInput::bytesReady() const
- Returns the amount of audio data available to read in bytes.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioInput::periodSize() const
- Returns the period size in bytes.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::setBufferSize(int value)
- Sets the audio buffer size to \a value in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioInput::bufferSize() const
- Returns the audio buffer size in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::setNotifyInterval(int ms)
- Sets the interval for notify() signal to be emitted. This is based
- on the \a ms of audio data processed not on actual real-time.
- The resolution of the timer is platform specific.
- \since 1.0
-*/
-
-/*!
- \fn virtual int QAbstractAudioInput::notifyInterval() const
- Returns the notify interval in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual qint64 QAbstractAudioInput::processedUSecs() const
- Returns the amount of audio data processed since start() was called in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn virtual qint64 QAbstractAudioInput::elapsedUSecs() const
- Returns the milliseconds since start() was called, including time in Idle and suspend states.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudio::Error QAbstractAudioInput::error() const
- Returns the error state.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudio::State QAbstractAudioInput::state() const
- Returns the state of audio processing.
- \since 1.0
-*/
-
-/*!
- \fn virtual void QAbstractAudioInput::setFormat(const QAudioFormat& fmt)
- Set the QAudioFormat to use to \a fmt.
- Setting the format is only allowable while in QAudio::StoppedState.
- \since 1.0
-*/
-
-/*!
- \fn virtual QAudioFormat QAbstractAudioInput::format() const
- Returns the QAudioFormat being used
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioInput::errorChanged(QAudio::Error error)
- This signal is emitted when the \a error state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioInput::stateChanged(QAudio::State state)
- This signal is emitted when the device \a state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioInput::notify()
- This signal is emitted when x ms of audio data has been processed
- the interval set by setNotifyInterval(x).
- \since 1.0
-*/
-
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiosystem.cpp"
diff --git a/src/multimedia/audio/qaudiosystem.h b/src/multimedia/audio/qaudiosystem.h
deleted file mode 100644
index 59b4eb4..0000000
--- a/src/multimedia/audio/qaudiosystem.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOSYSTEM_H
-#define QAUDIOSYSTEM_H
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include "qaudio.h"
-#include "qaudioformat.h"
-#include "qaudiodeviceinfo.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QAbstractAudioDeviceInfo : public QObject
-{
- Q_OBJECT
-
-public:
- virtual QAudioFormat preferredFormat() const = 0;
- virtual bool isFormatSupported(const QAudioFormat &format) const = 0;
- virtual QString deviceName() const = 0;
- virtual QStringList supportedCodecs() = 0;
- virtual QList<int> supportedSampleRates() = 0;
- virtual QList<int> supportedChannelCounts() = 0;
- virtual QList<int> supportedSampleSizes() = 0;
- virtual QList<QAudioFormat::Endian> supportedByteOrders() = 0;
- virtual QList<QAudioFormat::SampleType> supportedSampleTypes() = 0;
-};
-
-class Q_MULTIMEDIA_EXPORT QAbstractAudioOutput : public QObject
-{
- Q_OBJECT
-
-public:
- virtual void start(QIODevice *device) = 0;
- virtual QIODevice* start() = 0;
- virtual void stop() = 0;
- virtual void reset() = 0;
- virtual void suspend() = 0;
- virtual void resume() = 0;
- virtual int bytesFree() const = 0;
- virtual int periodSize() const = 0;
- virtual void setBufferSize(int value) = 0;
- virtual int bufferSize() const = 0;
- virtual void setNotifyInterval(int milliSeconds) = 0;
- virtual int notifyInterval() const = 0;
- virtual qint64 processedUSecs() const = 0;
- virtual qint64 elapsedUSecs() const = 0;
- virtual QAudio::Error error() const = 0;
- virtual QAudio::State state() const = 0;
- virtual void setFormat(const QAudioFormat& fmt) = 0;
- virtual QAudioFormat format() const = 0;
- virtual void setVolume(qreal) {}
- virtual qreal volume() const { return 1.0; }
-
-Q_SIGNALS:
- void errorChanged(QAudio::Error);
- void stateChanged(QAudio::State);
- void notify();
-};
-
-class Q_MULTIMEDIA_EXPORT QAbstractAudioInput : public QObject
-{
- Q_OBJECT
-
-public:
- virtual void start(QIODevice *device) = 0;
- virtual QIODevice* start() = 0;
- virtual void stop() = 0;
- virtual void reset() = 0;
- virtual void suspend() = 0;
- virtual void resume() = 0;
- virtual int bytesReady() const = 0;
- virtual int periodSize() const = 0;
- virtual void setBufferSize(int value) = 0;
- virtual int bufferSize() const = 0;
- virtual void setNotifyInterval(int milliSeconds) = 0;
- virtual int notifyInterval() const = 0;
- virtual qint64 processedUSecs() const = 0;
- virtual qint64 elapsedUSecs() const = 0;
- virtual QAudio::Error error() const = 0;
- virtual QAudio::State state() const = 0;
- virtual void setFormat(const QAudioFormat& fmt) = 0;
- virtual QAudioFormat format() const = 0;
-
-Q_SIGNALS:
- void errorChanged(QAudio::Error);
- void stateChanged(QAudio::State);
- void notify();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIOSYSTEM_H
diff --git a/src/multimedia/audio/qaudiosystemplugin.cpp b/src/multimedia/audio/qaudiosystemplugin.cpp
deleted file mode 100644
index 5cbcf1d..0000000
--- a/src/multimedia/audio/qaudiosystemplugin.cpp
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qaudiosystemplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAudioSystemPlugin
- \brief The QAudioSystemPlugin class provides an abstract base for audio plugins.
- \since 1.0
-
- \ingroup multimedia
- \inmodule QtMultimedia
- \internal
-
- Writing a audio plugin is achieved by subclassing this base class,
- reimplementing the pure virtual functions keys(), availableDevices(),
- createInput(), createOutput() and createDeviceInfo() then exporting
- the class with the Q_EXPORT_PLUGIN2() macro.
-
- Unit tests are available to help in debugging new plugins.
-
- \sa QAbstractAudioDeviceInfo, QAbstractAudioOutput, QAbstractAudioInput
-
- Qt supports win32, linux(alsa) and Mac OS X standard (builtin to the
- QtMultimedia library at compile time).
-
- You can support other backends other than these predefined ones by
- creating a plugin subclassing QAudioSystemPlugin, QAbstractAudioDeviceInfo,
- QAbstractAudioOutput and QAbstractAudioInput.
-
- Add "default" to your list of keys() available to override the default
- audio device to be provided by your plugin.
-
- -audio-backend configure option will force compiling in of the builtin backend
- into the QtMultimedia library at compile time. This is automatic by default
- and will only be compiled into the library if the dependencies are installed.
- eg. alsa-devel package installed for linux.
-
- If the builtin backend is not compiled into the QtMultimedia library and
- no audio plugins are available a fallback dummy backend will be used.
- This should print out warnings if this is the case when you try and use QAudioInput or QAudioOutput. To fix this problem
- reconfigure Qt using -audio-backend or create your own plugin with a default
- key to always override the dummy fallback. The easiest way to determine
- if you have only a dummy backend is to get a list of available audio devices.
-
- QAudioDeviceInfo::availableDevices(QAudio::AudioOutput).size() = 0 (dummy backend)
-*/
-
-/*!
- Construct a new audio plugin with \a parent.
- This is invoked automatically by the Q_EXPORT_PLUGIN2() macro.
-*/
-
-QAudioSystemPlugin::QAudioSystemPlugin(QObject* parent) :
- QObject(parent)
-{}
-
-/*!
- Destroy the audio plugin
-
- You never have to call this explicitly. Qt destroys a plugin automatically when it is no longer used.
-*/
-
-QAudioSystemPlugin::~QAudioSystemPlugin()
-{}
-
-/*!
- \fn QStringList QAudioSystemPlugin::keys() const
- Returns the list of device identifiers this plugin supports.
- \since 1.0
-*/
-
-/*!
- \fn QList<QByteArray> QAudioSystemPlugin::availableDevices(QAudio::Mode mode) const
- Returns a list of available audio devices for \a mode
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioInput* QAudioSystemPlugin::createInput(const QByteArray& device)
- Returns a pointer to a QAbstractAudioInput created using \a device identifier
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioOutput* QAudioSystemPlugin::createOutput(const QByteArray& device)
- Returns a pointer to a QAbstractAudioOutput created using \a device identifier
-
- \since 1.0
-*/
-
-/*!
- \fn QAbstractAudioDeviceInfo* QAudioSystemPlugin::createDeviceInfo(const QByteArray& device, QAudio::Mode mode)
- Returns a pointer to a QAbstractAudioDeviceInfo created using \a device and \a mode
-
- \since 1.0
-*/
-
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiosystemplugin.cpp"
diff --git a/src/multimedia/audio/qaudiosystemplugin.h b/src/multimedia/audio/qaudiosystemplugin.h
deleted file mode 100644
index f61dbcf..0000000
--- a/src/multimedia/audio/qaudiosystemplugin.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QAUDIOSYSTEMPLUGIN_H
-#define QAUDIOSYSTEMPLUGIN_H
-
-#include <QtCore/qstring.h>
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-#include "qaudioformat.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-struct Q_MULTIMEDIA_EXPORT QAudioSystemFactoryInterface : public QFactoryInterface
-{
- virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0;
- virtual QAbstractAudioInput* createInput(const QByteArray& device) = 0;
- virtual QAbstractAudioOutput* createOutput(const QByteArray& device) = 0;
- virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0;
-};
-
-#define QAudioSystemFactoryInterface_iid \
- "com.nokia.qt.QAudioSystemFactoryInterface"
-Q_DECLARE_INTERFACE(QAudioSystemFactoryInterface, QAudioSystemFactoryInterface_iid)
-
-class Q_MULTIMEDIA_EXPORT QAudioSystemPlugin : public QObject, public QAudioSystemFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QAudioSystemFactoryInterface:QFactoryInterface)
-
-public:
- QAudioSystemPlugin(QObject *parent = 0);
- ~QAudioSystemPlugin();
-
- virtual QStringList keys() const = 0;
- virtual QList<QByteArray> availableDevices(QAudio::Mode) const = 0;
- virtual QAbstractAudioInput* createInput(const QByteArray& device) = 0;
- virtual QAbstractAudioOutput* createOutput(const QByteArray& device) = 0;
- virtual QAbstractAudioDeviceInfo* createDeviceInfo(const QByteArray& device, QAudio::Mode mode) = 0;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QAUDIOSYSTEMPLUGIN_H
diff --git a/src/multimedia/effects/effects.pri b/src/multimedia/effects/effects.pri
deleted file mode 100644
index 9b8fbed..0000000
--- a/src/multimedia/effects/effects.pri
+++ /dev/null
@@ -1,38 +0,0 @@
-INCLUDEPATH += effects
-
-unix:!mac {
- contains(config_test_pulseaudio, yes) {
- CONFIG += link_pkgconfig
- PKGCONFIG += libpulse
-
- DEFINES += QT_MULTIMEDIA_PULSEAUDIO
- PRIVATE_HEADERS += effects/qsoundeffect_pulse_p.h
- SOURCES += effects/qsoundeffect_pulse_p.cpp
- !maemo*:DEFINES += QTM_PULSEAUDIO_DEFAULTBUFFER
- } else {
- DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
- PRIVATE_HEADERS += effects/qsoundeffect_qmedia_p.h
- SOURCES += effects/qsoundeffect_qmedia_p.cpp
- }
-} else:!qpa {
- PRIVATE_HEADERS += effects/qsoundeffect_qsound_p.h
- SOURCES += effects/qsoundeffect_qsound_p.cpp
-} else {
- DEFINES += QT_MULTIMEDIA_QMEDIAPLAYER
- PRIVATE_HEADERS += effects/qsoundeffect_qmedia_p.h
- SOURCES += effects/qsoundeffect_qmedia_p.cpp
-}
-
-PUBLIC_HEADERS += \
- effects/qsoundeffect.h
-
-PRIVATE_HEADERS += \
- effects/qwavedecoder_p.h \
- effects/qsamplecache_p.h
-
-SOURCES += \
- effects/qsoundeffect.cpp \
- effects/qwavedecoder_p.cpp \
- effects/qsamplecache_p.cpp
-
-HEADERS +=
diff --git a/src/multimedia/effects/qsamplecache_p.cpp b/src/multimedia/effects/qsamplecache_p.cpp
deleted file mode 100644
index 69c8d66..0000000
--- a/src/multimedia/effects/qsamplecache_p.cpp
+++ /dev/null
@@ -1,398 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsamplecache_p.h"
-#include "qwavedecoder_p.h"
-#include <QtNetwork>
-
-//#define QT_SAMPLECACHE_DEBUG
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QSampleCache
- \internal
-
- When you want to get a sound sample data, you need to request the QSample reference from QSampleCache.
-
- \since 1.1
-
- \code
- QSample *m_sample; // class member.
-
- private Q_SLOTS:
- void decoderError();
- void sampleReady();
- \endcode
-
- \code
- Q_GLOBAL_STATIC(QSampleCache, sampleCache) //declare a singleton manager
- \endcode
-
- \code
- m_sample = sampleCache()->requestSample(url);
- switch(m_sample->state()) {
- case QSample::Ready:
- sampleReady();
- break;
- case QSample::Error:
- decoderError();
- break;
- default:
- connect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
- connect(m_sample, SIGNAL(ready()), this, SLOT(sampleReady()));
- break;
- }
- \endcode
-
- When you no longer need the sound sample data, you need to release it:
-
- \code
- if (m_sample) {
- m_sample->release();
- m_sample = 0;
- }
- \endcode
-*/
-
-QSampleCache::QSampleCache()
- : m_networkAccessManager(0)
- , m_mutex(QMutex::Recursive)
- , m_capacity(0)
- , m_usage(0)
-{
- m_loadingThread.setObjectName(QLatin1String("QSampleCache::LoadingThread"));
-}
-
-QNetworkAccessManager& QSampleCache::networkAccessManager()
-{
- if (!m_networkAccessManager)
- m_networkAccessManager = new QNetworkAccessManager();
- return *m_networkAccessManager;
-}
-
-QSampleCache::~QSampleCache()
-{
- QMutexLocker m(&m_mutex);
-
- m_loadingThread.quit();
- m_loadingThread.wait();
-
- // Killing the loading thread means that no samples can be
- // deleted using deleteLater. And some samples that had deleteLater
- // already called won't have been processed (m_staleSamples)
- foreach (QSample* sample, m_samples)
- delete sample;
-
- foreach (QSample* sample, m_staleSamples)
- delete sample; // deleting a sample does affect the m_staleSamples list, but foreach copies it
-
- delete m_networkAccessManager;
-}
-
-QSample* QSampleCache::requestSample(const QUrl& url)
-{
- if (!m_loadingThread.isRunning())
- m_loadingThread.start();
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSampleCache: request sample [" << url << "]";
-#endif
- QMutexLocker locker(&m_mutex);
- QMap<QUrl, QSample*>::iterator it = m_samples.find(url);
- QSample* sample;
- if (it == m_samples.end()) {
- sample = new QSample(url, this);
- m_samples.insert(url, sample);
- sample->moveToThread(&m_loadingThread);
- } else {
- sample = *it;
- }
-
- sample->addRef();
- locker.unlock();
-
- sample->loadIfNecessary();
- return sample;
-}
-
-void QSampleCache::setCapacity(qint64 capacity)
-{
- QMutexLocker locker(&m_mutex);
- if (m_capacity == capacity)
- return;
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSampleCache: capacity changes from " << m_capacity << "to " << capacity;
-#endif
- if (m_capacity > 0 && capacity <= 0) { //memory management strategy changed
- for (QMap<QUrl, QSample*>::iterator it = m_samples.begin(); it != m_samples.end();) {
- QSample* sample = *it;
- if (sample->m_ref == 0) {
- unloadSample(sample);
- it = m_samples.erase(it);
- } else
- it++;
- }
- }
-
- m_capacity = capacity;
- refresh(0);
-}
-
-// Called locked
-void QSampleCache::unloadSample(QSample *sample)
-{
- m_usage -= sample->m_soundData.size();
- m_staleSamples.insert(sample);
- sample->deleteLater();
-}
-
-// Called in both threads
-void QSampleCache::refresh(qint64 usageChange)
-{
- QMutexLocker locker(&m_mutex);
- m_usage += usageChange;
- if (m_capacity <= 0 || m_usage <= m_capacity)
- return;
-
-#ifdef QT_SAMPLECACHE_DEBUG
- qint64 recoveredSize = 0;
-#endif
-
- //free unused samples to keep usage under capacity limit.
- for (QMap<QUrl, QSample*>::iterator it = m_samples.begin(); it != m_samples.end();) {
- QSample* sample = *it;
- if (sample->m_ref > 0) {
- ++it;
- continue;
- }
-#ifdef QT_SAMPLECACHE_DEBUG
- recoveredSize += sample->m_soundData.size();
-#endif
- unloadSample(sample);
- it = m_samples.erase(it);
- if (m_usage <= m_capacity)
- return;
- }
-
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSampleCache: refresh(" << usageChange
- << ") recovered size =" << recoveredSize
- << "new usage =" << m_usage;
-#endif
-
- if (m_usage > m_capacity)
- qWarning() << "QSampleCache: usage[" << m_usage << " out of limit[" << m_capacity << "]";
-}
-
-// Called in both threads
-void QSampleCache::removeUnreferencedSample(QSample *sample)
-{
- QMutexLocker m(&m_mutex);
- m_staleSamples.remove(sample);
-}
-
-// Called in loader thread (since this lives in that thread)
-// Also called from application thread after loader thread dies.
-QSample::~QSample()
-{
- // Remove ourselves from our parent
- m_parent->removeUnreferencedSample(this);
-
- QMutexLocker locker(&m_mutex);
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "~QSample" << this << ": deleted [" << m_url << "]" << QThread::currentThread();
-#endif
- cleanup();
-}
-
-// Called in application thread
-void QSample::loadIfNecessary()
-{
- QMutexLocker locker(&m_mutex);
- if (m_state == QSample::Error || m_state == QSample::Creating) {
- m_state = QSample::Loading;
- QMetaObject::invokeMethod(this, "load", Qt::QueuedConnection);
- }
-}
-
-// Called in both threads
-bool QSampleCache::notifyUnreferencedSample(QSample* sample)
-{
- QMutexLocker locker(&m_mutex);
- if (m_capacity > 0)
- return false;
- m_samples.remove(sample->m_url);
- m_staleSamples.insert(sample);
- sample->deleteLater();
- return true;
-}
-
-// Called in application threadd
-void QSample::release()
-{
- QMutexLocker locker(&m_mutex);
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "Sample:: release" << this << QThread::currentThread() << m_ref;
-#endif
- m_ref--;
- if (m_ref == 0)
- m_parent->notifyUnreferencedSample(this);
-}
-
-// Called in dtor and when stream is loaded
-// must be called locked.
-void QSample::cleanup()
-{
- m_waveDecoder->deleteLater();
- m_stream->deleteLater();
- m_waveDecoder = 0;
- m_stream = 0;
-}
-
-// Called in application thread
-void QSample::addRef()
-{
- m_ref++;
-}
-
-// Called in loading thread
-void QSample::readSample()
-{
- Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread"));
- QMutexLocker m(&m_mutex);
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSample: readSample";
-#endif
- qint64 read = m_waveDecoder->read(m_soundData.data() + m_sampleReadLength,
- qMin(m_waveDecoder->bytesAvailable(),
- qint64(m_waveDecoder->size() - m_sampleReadLength)));
- if (read > 0)
- m_sampleReadLength += read;
- if (m_sampleReadLength < m_waveDecoder->size())
- return;
- Q_ASSERT(m_sampleReadLength == qint64(m_soundData.size()));
- onReady();
-}
-
-// Called in loading thread
-void QSample::decoderReady()
-{
- Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread"));
- QMutexLocker m(&m_mutex);
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSample: decoder ready";
-#endif
- m_parent->refresh(m_waveDecoder->size());
-
- m_soundData.resize(m_waveDecoder->size());
- m_sampleReadLength = 0;
- qint64 read = m_waveDecoder->read(m_soundData.data(), m_waveDecoder->size());
- if (read > 0)
- m_sampleReadLength += read;
- if (m_sampleReadLength >= m_waveDecoder->size())
- onReady();
-}
-
-// Called in all threads
-QSample::State QSample::state() const
-{
- QMutexLocker m(&m_mutex);
- return m_state;
-}
-
-// Called in loading thread
-// Essentially a second ctor, doesn't need locks (?)
-void QSample::load()
-{
- Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread"));
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSample: load [" << m_url << "]";
-#endif
- m_stream = m_parent->networkAccessManager().get(QNetworkRequest(m_url));
- connect(m_stream, SIGNAL(error(QNetworkReply::NetworkError)), SLOT(decoderError()));
- m_waveDecoder = new QWaveDecoder(m_stream);
- connect(m_waveDecoder, SIGNAL(formatKnown()), SLOT(decoderReady()));
- connect(m_waveDecoder, SIGNAL(parsingError()), SLOT(decoderError()));
- connect(m_waveDecoder, SIGNAL(readyRead()), SLOT(readSample()));
-}
-
-// Called in loading thread
-void QSample::decoderError()
-{
- Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread"));
- QMutexLocker m(&m_mutex);
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSample: decoder error";
-#endif
- cleanup();
- m_state = QSample::Error;
- emit error();
-}
-
-// Called in loading thread from decoder when sample is done. Locked already.
-void QSample::onReady()
-{
- Q_ASSERT(QThread::currentThread()->objectName() == QLatin1String("QSampleCache::LoadingThread"));
-#ifdef QT_SAMPLECACHE_DEBUG
- qDebug() << "QSample: load ready";
-#endif
- m_audioFormat = m_waveDecoder->audioFormat();
- cleanup();
- m_state = QSample::Ready;
- emit ready();
-}
-
-// Called in application thread, then moved to loader thread
-QSample::QSample(const QUrl& url, QSampleCache *parent)
- : m_parent(parent)
- , m_stream(0)
- , m_waveDecoder(0)
- , m_url(url)
- , m_sampleReadLength(0)
- , m_state(Creating)
- , m_ref(0)
-{
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsamplecache_p.cpp"
diff --git a/src/multimedia/effects/qsamplecache_p.h b/src/multimedia/effects/qsamplecache_p.h
deleted file mode 100644
index 91ca457..0000000
--- a/src/multimedia/effects/qsamplecache_p.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSAMPLECACHE_P_H
-#define QSAMPLECACHE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-#include <qaudioformat.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QNetworkAccessManager;
-class QSampleCache;
-class QWaveDecoder;
-
-// Lives in application thread
-class QSample : public QObject
-{
- Q_OBJECT
-public:
- friend class QSampleCache;
- enum State
- {
- Creating,
- Loading,
- Error,
- Ready,
- };
-
- State state() const;
- // These are not (currently) locked because they are only meant to be called after these
- // variables are updated to their final states
- const QByteArray& data() const { Q_ASSERT(state() == Ready); return m_soundData; }
- const QAudioFormat& format() const { Q_ASSERT(state() == Ready); return m_audioFormat; }
- void release();
-
-Q_SIGNALS:
- void error();
- void ready();
-
-protected:
- QSample(const QUrl& url, QSampleCache *parent);
-
-private Q_SLOTS:
- void load();
- void decoderError();
- void readSample();
- void decoderReady();
-
-private:
- void onReady();
- void cleanup();
- void addRef();
- void loadIfNecessary();
- QSample();
- ~QSample();
-
- mutable QMutex m_mutex;
- QSampleCache *m_parent;
- QByteArray m_soundData;
- QAudioFormat m_audioFormat;
- QIODevice *m_stream;
- QWaveDecoder *m_waveDecoder;
- QUrl m_url;
- qint64 m_sampleReadLength;
- State m_state;
- int m_ref;
-};
-
-class QSampleCache
-{
-public:
- friend class QSample;
-
- QSampleCache();
- ~QSampleCache();
-
- QSample* requestSample(const QUrl& url);
- void setCapacity(qint64 capacity);
-
-private:
- QMap<QUrl, QSample*> m_samples;
- QSet<QSample*> m_staleSamples;
- QNetworkAccessManager *m_networkAccessManager;
- QMutex m_mutex;
- qint64 m_capacity;
- qint64 m_usage;
- QThread m_loadingThread;
-
- QNetworkAccessManager& networkAccessManager();
- void refresh(qint64 usageChange);
- bool notifyUnreferencedSample(QSample* sample);
- void removeUnreferencedSample(QSample* sample);
- void unloadSample(QSample* sample);
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSAMPLECACHE_P_H
diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp
deleted file mode 100644
index e959095..0000000
--- a/src/multimedia/effects/qsoundeffect.cpp
+++ /dev/null
@@ -1,300 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsoundeffect.h"
-
-#if defined(QT_MULTIMEDIA_PULSEAUDIO)
-#include "qsoundeffect_pulse_p.h"
-#elif(QT_MULTIMEDIA_QMEDIAPLAYER)
-#include "qsoundeffect_qmedia_p.h"
-#else
-#include "qsoundeffect_qsound_p.h"
-#endif
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \qmlclass SoundEffect QSoundEffect
- \brief The SoundEffect element provides a way to play sound effects in QML.
- \since 1.0
-
- \inmodule QtMultimedia
-
- This element is part of the \bold{QtMultimedia 4.0} module.
-
- The following example plays a WAV file on mouse click.
-
- \snippet doc/src/snippets/multimedia-snippets/soundeffect.qml complete snippet
-*/
-
-/*!
- \qmlproperty url SoundEffect::source
- \since 1.0
-
- This property provides a way to control the sound to play.
-*/
-
-/*!
- \qmlproperty int SoundEffect::loops
- \since 1.0
-
- This property provides a way to control the number of times to repeat the sound on each play().
-
- Set to -1 (infinite) to enable infinite loop.
-*/
-
-/*!
- \qmlproperty qreal SoundEffect::volume
- \since 1.0
-
- This property holds the volume of the playback, from 0.0 (silent) to 1.0 (maximum volume).
- Note: Currently this has no effect on Mac OS X.
-*/
-
-/*!
- \qmlproperty bool SoundEffect::muted
- \since 1.0
-
- This property provides a way to control muting.
-*/
-
-/*!
- \qmlproperty bool SoundEffect::playing
- \since 1.1
-
- This property indicates if the soundeffect is playing or not.
-*/
-
-/*!
- \qmlproperty int SoundEffect::status
- \since 1.0
-
- This property indicates the following status of the soundeffect.
-
- Null: no source has been set or is null.
- Loading: the soundeffect is trying to load the source.
- Ready: the source is loaded and ready for play.
- Error: some error happened during operation, such as failure of loading the source.
-*/
-
-/*!
- \qmlsignal SoundEffect::sourceChanged()
- \since 1.0
-
- This handler is called when the source has changed.
-*/
-
-/*!
- \qmlsignal SoundEffect::loopsChanged()
- \since 1.0
-
- This handler is called when the number of loops has changed.
-*/
-
-/*!
- \qmlsignal SoundEffect::volumeChanged()
- \since 1.0
-
- This handler is called when the volume has changed.
-*/
-
-/*!
- \qmlsignal SoundEffect::mutedChanged()
- \since 1.0
-
- This handler is called when the mute state has changed.
-*/
-
-/*!
- \qmlsignal SoundEffect::playingChanged()
- \since 1.0
-
- This handler is called when the playing property has changed.
-*/
-
-/*!
- \qmlsignal SoundEffect::statusChanged()
-
- This handler is called when the status property has changed.
- \since 1.0
-*/
-
-
-/*!
- \since 1.0
-*/
-
-QSoundEffect::QSoundEffect(QObject *parent) :
- QObject(parent)
-{
- d = new QSoundEffectPrivate(this);
- connect(d, SIGNAL(volumeChanged()), SIGNAL(volumeChanged()));
- connect(d, SIGNAL(mutedChanged()), SIGNAL(mutedChanged()));
- connect(d, SIGNAL(loadedChanged()), SIGNAL(loadedChanged()));
- connect(d, SIGNAL(playingChanged()), SIGNAL(playingChanged()));
- connect(d, SIGNAL(statusChanged()), SIGNAL(statusChanged()));
-}
-
-QSoundEffect::~QSoundEffect()
-{
- d->deleteLater();
-}
-
-QStringList QSoundEffect::supportedMimeTypes()
-{
- return QSoundEffectPrivate::supportedMimeTypes();
-}
-
-QUrl QSoundEffect::source() const
-{
- return d->source();
-}
-
-void QSoundEffect::setSource(const QUrl &url)
-{
- if (d->source() == url)
- return;
-
- d->setSource(url);
-
- emit sourceChanged();
-}
-
-int QSoundEffect::loopCount() const
-{
- return d->loopCount();
-}
-
-void QSoundEffect::setLoopCount(int loopCount)
-{
- if (loopCount < 0 && loopCount != Infinite) {
- qWarning("SoundEffect: loops should be SoundEffect.Infinite, 0 or positive integer");
- return;
- }
- if (loopCount == 0)
- loopCount = 1;
- if (d->loopCount() == loopCount)
- return;
-
- d->setLoopCount(loopCount);
- emit loopCountChanged();
-}
-
-qreal QSoundEffect::volume() const
-{
- return qreal(d->volume()) / 100;
-}
-
-void QSoundEffect::setVolume(qreal volume)
-{
- if (volume < 0 || volume > 1) {
- qWarning("SoundEffect: volume should be between 0.0 and 1.0");
- return;
- }
- int iVolume = qRound(volume * 100);
- if (d->volume() == iVolume)
- return;
-
- d->setVolume(iVolume);
-}
-
-bool QSoundEffect::isMuted() const
-{
- return d->isMuted();
-}
-
-void QSoundEffect::setMuted(bool muted)
-{
- if (d->isMuted() == muted)
- return;
-
- d->setMuted(muted);
-}
-
-bool QSoundEffect::isLoaded() const
-{
- return d->isLoaded();
-}
-
-/*!
- \qmlmethod SoundEffect::play()
-
- Start playback of the sound effect, looping the effect for the number of
- times as specificed in the loops property.
-
- This is the default method for SoundEffect.
-
- \snippet doc/src/snippets/multimedia-snippets/soundeffect.qml play sound on click
- \since 1.0
-*/
-void QSoundEffect::play()
-{
- d->play();
-}
-
-bool QSoundEffect::isPlaying() const
-{
- return d->isPlaying();
-}
-
-QSoundEffect::Status QSoundEffect::status() const
-{
- return d->status();
-}
-
-
-/*!
- \qmlmethod SoundEffect::stop()
-
- Stop current playback.
- Note that if the backend is PulseAudio, due to the limitation of the underlying API,
- tis stop will only prevent next looping but will not be able to stop current playback immediately.
-
- \since 1.0
- */
-void QSoundEffect::stop()
-{
- d->stop();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsoundeffect.cpp"
diff --git a/src/multimedia/effects/qsoundeffect.h b/src/multimedia/effects/qsoundeffect.h
deleted file mode 100644
index bac325d..0000000
--- a/src/multimedia/effects/qsoundeffect.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOUNDEFFECT_H
-#define QSOUNDEFFECT_H
-
-#include <qtmultimediadefs.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qstringlist.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QSoundEffectPrivate;
-
-class Q_MULTIMEDIA_EXPORT QSoundEffect : public QObject
-{
- Q_OBJECT
- Q_CLASSINFO("DefaultMethod", "play()")
- Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
- Q_PROPERTY(int loops READ loopCount WRITE setLoopCount NOTIFY loopCountChanged)
- Q_PROPERTY(qreal volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(bool playing READ isPlaying NOTIFY playingChanged)
- Q_PROPERTY(Status status READ status NOTIFY statusChanged)
- Q_ENUMS(Loop)
- Q_ENUMS(Status)
-
-public:
- enum Loop
- {
- Infinite = -2,
- };
-
- enum Status
- {
- Null,
- Loading,
- Ready,
- Error
- };
-
- explicit QSoundEffect(QObject *parent = 0);
- ~QSoundEffect();
-
- static QStringList supportedMimeTypes();
-
- QUrl source() const;
- void setSource(const QUrl &url);
-
- int loopCount() const;
- void setLoopCount(int loopCount);
-
- qreal volume() const;
- void setVolume(qreal volume);
-
- bool isMuted() const;
- void setMuted(bool muted);
-
- bool isLoaded() const;
-
- bool isPlaying() const;
- Status status() const;
-
-Q_SIGNALS:
- void sourceChanged();
- void loopCountChanged();
- void volumeChanged();
- void mutedChanged();
- void loadedChanged();
- void playingChanged();
- void statusChanged();
-
-public Q_SLOTS:
- void play();
- void stop();
-
-private:
- Q_DISABLE_COPY(QSoundEffect)
- QSoundEffectPrivate* d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QSOUNDEFFECT_H
diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.cpp b/src/multimedia/effects/qsoundeffect_pulse_p.cpp
deleted file mode 100644
index 4570f8f..0000000
--- a/src/multimedia/effects/qsoundeffect_pulse_p.cpp
+++ /dev/null
@@ -1,957 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include <QtCore/qcoreapplication.h>
-#include <qaudioformat.h>
-#include <QtNetwork>
-#include <QTime>
-
-#include "qsoundeffect_pulse_p.h"
-
-#if defined(Q_WS_MAEMO_6)
-#include <pulse/ext-stream-restore.h>
-#endif
-
-#include <unistd.h>
-
-//#define QT_PA_DEBUG
-#ifndef QTM_PULSEAUDIO_DEFAULTBUFFER
-#define QT_PA_STREAM_BUFFER_SIZE_MAX (1024 * 64) //64KB is a trade-off for balancing control latency and uploading overhead
-#endif
-
-QT_BEGIN_NAMESPACE
-
-namespace
-{
-inline pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format)
-{
- pa_sample_spec spec;
-
- spec.rate = format.frequency();
- spec.channels = format.channels();
-
- if (format.sampleSize() == 8)
- spec.format = PA_SAMPLE_U8;
- else if (format.sampleSize() == 16) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break;
- }
- }
- else if (format.sampleSize() == 32) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S32BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S32LE; break;
- }
- }
-
- return spec;
-}
-
-class PulseDaemon : public QObject
-{
- Q_OBJECT
-public:
- PulseDaemon(): m_prepared(false)
- {
- prepare();
- }
-
- ~PulseDaemon()
- {
- if (m_prepared)
- release();
- }
-
- inline void lock()
- {
- pa_threaded_mainloop_lock(m_mainLoop);
- }
-
- inline void unlock()
- {
- pa_threaded_mainloop_unlock(m_mainLoop);
- }
-
- inline pa_context *context() const
- {
- return m_context;
- }
-
- inline pa_cvolume * calcVolume(pa_cvolume *dest, int soundEffectVolume)
- {
- dest->channels = 2;
- dest->values[0] = dest->values[1] = m_vol * soundEffectVolume / 100;
- return dest;
- }
-
- void updateStatus(const pa_cvolume& volume)
- {
- if (m_vol != pa_cvolume_max(&volume)) {
- m_vol = pa_cvolume_max(&volume);
- emit volumeChanged();
- }
- }
-
-Q_SIGNALS:
- void contextReady();
- void volumeChanged();
-
-private:
- void prepare()
- {
- m_vol = PA_VOLUME_NORM;
-
- m_mainLoop = pa_threaded_mainloop_new();
- if (m_mainLoop == 0) {
- qWarning("PulseAudioService: unable to create pulseaudio mainloop");
- return;
- }
-
- if (pa_threaded_mainloop_start(m_mainLoop) != 0) {
- qWarning("PulseAudioService: unable to start pulseaudio mainloop");
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
-
- m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop);
-
- lock();
- m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtPulseAudio:%1")).arg(::getpid()).toAscii().constData());
-
- pa_context_set_state_callback(m_context, context_state_callback, this);
-
- if (m_context == 0) {
- qWarning("PulseAudioService: Unable to create new pulseaudio context");
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
-
- if (pa_context_connect(m_context, 0, (pa_context_flags_t)0, 0) < 0) {
- qWarning("PulseAudioService: pa_context_connect() failed");
- pa_context_unref(m_context);
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
- unlock();
-
- m_prepared = true;
- }
-
- void release()
- {
- if (!m_prepared) return;
- pa_threaded_mainloop_stop(m_mainLoop);
- pa_threaded_mainloop_free(m_mainLoop);
- m_prepared = false;
- }
-
- static void context_state_callback(pa_context *c, void *userdata)
- {
- PulseDaemon *self = reinterpret_cast<PulseDaemon*>(userdata);
- switch (pa_context_get_state(c)) {
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
- break;
- case PA_CONTEXT_READY:
- #if defined(Q_WS_MAEMO_6)
- pa_ext_stream_restore_read(c, &stream_restore_info_callback, self);
- pa_ext_stream_restore_set_subscribe_cb(c, &stream_restore_monitor_callback, self);
- pa_ext_stream_restore_subscribe(c, 1, 0, self);
- #endif
- QMetaObject::invokeMethod(self, "contextReady", Qt::QueuedConnection);
- break;
- default:
- break;
- }
- }
-
-#if defined(Q_WS_MAEMO_6)
-
- static void stream_restore_monitor_callback(pa_context *c, void *userdata)
- {
- PulseDaemon *self = reinterpret_cast<PulseDaemon*>(userdata);
- pa_ext_stream_restore_read(c, &stream_restore_info_callback, self);
- }
-
- static void stream_restore_info_callback(pa_context *c,
- const pa_ext_stream_restore_info *info,
- int eol, void *userdata)
- {
- Q_UNUSED(c)
-
- PulseDaemon *self = reinterpret_cast<PulseDaemon*>(userdata);
-
- if (!eol) {
- if (QString(info->name).startsWith(QLatin1String("sink-input-by-media-role:x-maemo"))) {
-#ifdef QT_PA_DEBUG
- qDebug() << "x-maemo volume =(" << info->volume.values[0] * 100 / PA_VOLUME_NORM << ","
- << info->volume.values[1] * 100 / PA_VOLUME_NORM << "), "
- << "mute = " << info->mute;
-#endif
- self->updateStatus(info->volume);
- }
- }
- }
-#endif
-
- pa_volume_t m_vol;
-
- bool m_prepared;
- pa_context *m_context;
- pa_threaded_mainloop *m_mainLoop;
- pa_mainloop_api *m_mainLoopApi;
-};
-
-}
-
-Q_GLOBAL_STATIC(PulseDaemon, daemon)
-Q_GLOBAL_STATIC(QSampleCache, sampleCache)
-
-namespace
-{
-class PulseDaemonLocker
-{
-public:
- PulseDaemonLocker()
- {
- daemon()->lock();
- }
-
- ~PulseDaemonLocker()
- {
- daemon()->unlock();
- }
-};
-}
-
-QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
- QObject(parent),
- m_pulseStream(0),
- m_sinkInputId(-1),
- m_emptying(false),
- m_sampleReady(false),
- m_playing(false),
- m_status(QSoundEffect::Null),
- m_muted(false),
- m_playQueued(false),
- m_stopping(false),
- m_volume(100),
- m_loopCount(1),
- m_runningCount(0),
- m_sample(0) ,
- m_position(0)
-{
- pa_sample_spec_init(&m_pulseSpec);
-}
-
-QSoundEffectPrivate::~QSoundEffectPrivate()
-{
- unloadPulseStream();
-
- if (m_sample)
- m_sample->release();
-}
-
-QStringList QSoundEffectPrivate::supportedMimeTypes()
-{
- QStringList supportedTypes;
- supportedTypes << QLatin1String("audio/x-wav") << QLatin1String("audio/vnd.wave") ;
- return supportedTypes;
-}
-
-QUrl QSoundEffectPrivate::source() const
-{
- return m_source;
-}
-
-void QSoundEffectPrivate::setSource(const QUrl &url)
-{
- Q_ASSERT(m_source != url);
-#ifdef QT_PA_DEBUG
- qDebug() << this << "setSource =" << url;
-#endif
- stop();
- if (m_sample) {
- if (!m_sampleReady) {
- disconnect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
- disconnect(m_sample, SIGNAL(ready()), this, SLOT(sampleReady()));
- }
- m_sample->release();
- m_sample = 0;
- }
-
- m_source = url;
- m_sampleReady = false;
-
- PulseDaemonLocker locker;
- m_runningCount = 0;
- if (m_pulseStream && !pa_stream_is_corked(m_pulseStream)) {
- pa_stream_set_write_callback(m_pulseStream, 0, 0);
- pa_stream_set_underflow_callback(m_pulseStream, 0, 0);
- pa_operation_unref(pa_stream_cork(m_pulseStream, 1, 0, 0));
- }
- setPlaying(false);
-
- if (url.isEmpty()) {
- setStatus(QSoundEffect::Null);
- return;
- }
-
- setStatus(QSoundEffect::Loading);
- m_sample = sampleCache()->requestSample(url);
- connect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
- connect(m_sample, SIGNAL(ready()), this, SLOT(sampleReady()));
- switch(m_sample->state()) {
- case QSample::Ready:
- sampleReady();
- break;
- case QSample::Error:
- decoderError();
- break;
- default:
- break;
- }
-}
-
-int QSoundEffectPrivate::loopCount() const
-{
- return m_loopCount;
-}
-
-void QSoundEffectPrivate::setLoopCount(int loopCount)
-{
- if (loopCount == 0)
- loopCount = 1;
- m_loopCount = loopCount;
-}
-
-int QSoundEffectPrivate::volume() const
-{
- return m_volume;
-}
-
-void QSoundEffectPrivate::setVolume(int volume)
-{
- m_volume = volume;
- emit volumeChanged();
- updateVolume();
-}
-
-void QSoundEffectPrivate::updateVolume()
-{
- if (m_sinkInputId < 0)
- return;
- PulseDaemonLocker locker;
- pa_cvolume volume;
- pa_operation_unref(pa_context_set_sink_input_volume(daemon()->context(), m_sinkInputId, daemon()->calcVolume(&volume, m_volume), setvolume_callback, this));
- Q_ASSERT(pa_cvolume_valid(&volume));
-#ifdef QT_PA_DEBUG
- qDebug() << this << "updateVolume =" << pa_cvolume_max(&volume);
-#endif
-}
-
-bool QSoundEffectPrivate::isMuted() const
-{
- return m_muted;
-}
-
-void QSoundEffectPrivate::setMuted(bool muted)
-{
- m_muted = muted;
- emit mutedChanged();
- updateMuted();
-}
-
-void QSoundEffectPrivate::updateMuted()
-{
- if (m_sinkInputId < 0)
- return;
- PulseDaemonLocker locker;
- pa_operation_unref(pa_context_set_sink_input_mute(daemon()->context(), m_sinkInputId, m_muted, setmuted_callback, this));
-#ifdef QT_PA_DEBUG
- qDebug() << this << "updateMuted = " << daemon()->calcMuted(m_muted);
-#endif
-}
-
-bool QSoundEffectPrivate::isLoaded() const
-{
- return m_status == QSoundEffect::Ready;
-}
-
-bool QSoundEffectPrivate::isPlaying() const
-{
- return m_playing;
-}
-
-QSoundEffect::Status QSoundEffectPrivate::status() const
-{
- return m_status;
-}
-
-void QSoundEffectPrivate::setPlaying(bool playing)
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "setPlaying(" << playing << ")";
-#endif
- if (m_playing == playing)
- return;
- if (!playing)
- m_playQueued = false;
- m_playing = playing;
- emit playingChanged();
-}
-
-void QSoundEffectPrivate::setStatus(QSoundEffect::Status status)
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "setStatus" << status;
-#endif
- if (m_status == status)
- return;
- bool oldLoaded = isLoaded();
- m_status = status;
- emit statusChanged();
- if (oldLoaded != isLoaded())
- emit loadedChanged();
-}
-
-void QSoundEffectPrivate::play()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "play";
-#endif
- if (m_status == QSoundEffect::Null || m_status == QSoundEffect::Error || m_playQueued)
- return;
-
- PulseDaemonLocker locker;
- if (!m_sampleReady || m_stopping || m_emptying) {
-#ifdef QT_PA_DEBUG
- qDebug() << this << "play deferred";
-#endif
- m_playQueued = true;
- } else {
- if (m_playing) { //restart playing from the beginning
-#ifdef QT_PA_DEBUG
- qDebug() << this << "restart playing";
-#endif
- m_runningCount = 0;
- m_playQueued = true;
- Q_ASSERT(m_pulseStream);
- emptyStream();
- return;
- }
- m_runningCount = m_loopCount;
- playSample();
- }
-
- setPlaying(true);
-}
-
-void QSoundEffectPrivate::emptyStream()
-{
- m_emptying = true;
- pa_stream_set_write_callback(m_pulseStream, 0, this);
- pa_stream_set_underflow_callback(m_pulseStream, 0, this);
- pa_operation_unref(pa_stream_flush(m_pulseStream, stream_flush_callback, this));
-}
-
-void QSoundEffectPrivate::emptyComplete()
-{
- PulseDaemonLocker locker;
- m_emptying = false;
- pa_operation_unref(pa_stream_cork(m_pulseStream, 1, stream_cork_callback, this));
-}
-
-void QSoundEffectPrivate::sampleReady()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "sampleReady";
-#endif
- disconnect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
- disconnect(m_sample, SIGNAL(ready()), this, SLOT(sampleReady()));
- pa_sample_spec newFormatSpec = audioFormatToSampleSpec(m_sample->format());
-
- if (m_pulseStream && (memcmp(&m_pulseSpec, &newFormatSpec, sizeof(m_pulseSpec)) != 0)) {
- unloadPulseStream();
- }
- m_pulseSpec = newFormatSpec;
-
- m_sampleReady = true;
- m_position = 0;
-
- if (m_name.isNull())
- m_name = QString(QLatin1String("QtPulseSample-%1-%2")).arg(::getpid()).arg(quintptr(this)).toUtf8();
-
- PulseDaemonLocker locker;
- if (m_pulseStream) {
-#ifdef QT_PA_DEBUG
- qDebug() << this << "reuse existing pulsestream";
-#endif
-#ifdef QTM_PULSEAUDIO_DEFAULTBUFFER
- const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(m_pulseStream);
- if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) {
- pa_buffer_attr newBufferAttr;
- newBufferAttr = *bufferAttr;
- newBufferAttr.prebuf = m_sample->data().size();
- pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, this);
- } else {
- streamReady();
- }
-#else
- const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(m_pulseStream);
- if (bufferAttr->tlength < m_sample->data().size() && bufferAttr->tlength < QT_PA_STREAM_BUFFER_SIZE_MAX) {
- pa_buffer_attr newBufferAttr;
- newBufferAttr.maxlength = -1;
- newBufferAttr.tlength = qMin(m_sample->data().size(), QT_PA_STREAM_BUFFER_SIZE_MAX);
- newBufferAttr.minreq = bufferAttr->tlength / 2;
- newBufferAttr.prebuf = -1;
- newBufferAttr.fragsize = -1;
- pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_reset_buffer_callback, this);
- } else if (bufferAttr->prebuf > uint32_t(m_sample->data().size())) {
- pa_buffer_attr newBufferAttr;
- newBufferAttr = *bufferAttr;
- newBufferAttr.prebuf = m_sample->data().size();
- pa_stream_set_buffer_attr(m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, this);
- } else {
- streamReady();
- }
-#endif
- } else {
- if (pa_context_get_state(daemon()->context()) != PA_CONTEXT_READY) {
- connect(daemon(), SIGNAL(contextReady()), SLOT(contextReady()));
- return;
- }
- createPulseStream();
- }
-}
-
-void QSoundEffectPrivate::decoderError()
-{
- qWarning("QSoundEffect(pulseaudio): Error decoding source");
- disconnect(m_sample, SIGNAL(error()), this, SLOT(decoderError()));
- bool playingDirty = false;
- if (m_playing) {
- m_playing = false;
- playingDirty = true;
- }
- setStatus(QSoundEffect::Error);
- if (playingDirty)
- emit playingChanged();
-}
-
-void QSoundEffectPrivate::unloadPulseStream()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "unloadPulseStream";
-#endif
- m_sinkInputId = -1;
- PulseDaemonLocker locker;
- if (m_pulseStream) {
- pa_stream_set_state_callback(m_pulseStream, 0, 0);
- pa_stream_set_write_callback(m_pulseStream, 0, 0);
- pa_stream_set_underflow_callback(m_pulseStream, 0, 0);
- pa_stream_disconnect(m_pulseStream);
- pa_stream_unref(m_pulseStream);
- disconnect(daemon(), SIGNAL(volumeChanged()), this, SLOT(updateVolume()));
- m_pulseStream = 0;
- }
-}
-
-void QSoundEffectPrivate::prepare()
-{
- if (!m_pulseStream || !m_sampleReady)
- return;
- PulseDaemonLocker locker;
- pa_stream_set_write_callback(m_pulseStream, stream_write_callback, this);
- pa_stream_set_underflow_callback(m_pulseStream, stream_underrun_callback, this);
- m_stopping = false;
- size_t writeBytes = size_t(qMin(m_pulseBufferSize, m_sample->data().size()));
-#ifdef QT_PA_DEBUG
- qDebug() << this << "prepare(): writable size =" << pa_stream_writable_size(m_pulseStream)
- << "actual writeBytes =" << writeBytes
- << "m_playQueued =" << m_playQueued;
-#endif
- m_position = int(writeBytes);
- if (pa_stream_write(m_pulseStream, reinterpret_cast<void *>(const_cast<char*>(m_sample->data().data())), writeBytes,
- stream_write_done_callback, 0, PA_SEEK_RELATIVE) != 0) {
- qWarning("QSoundEffect(pulseaudio): pa_stream_write, error = %s", pa_strerror(pa_context_errno(daemon()->context())));
- }
- if (m_playQueued) {
- m_playQueued = false;
- m_runningCount = m_loopCount;
- playSample();
- }
-}
-
-void QSoundEffectPrivate::uploadSample()
-{
- if (m_runningCount == 0) {
-#ifdef QT_PA_DEBUG
- qDebug() << this << "uploadSample: return due to 0 m_runningCount";
-#endif
- return;
- }
-#ifdef QT_PA_DEBUG
- qDebug() << this << "uploadSample: m_runningCount =" << m_runningCount;
-#endif
- if (m_position == m_sample->data().size()) {
- m_position = 0;
- if (m_runningCount > 0)
- m_runningCount--;
- if (m_runningCount == 0) {
- return;
- }
- }
-
- int writtenBytes = 0;
- int writableSize = int(pa_stream_writable_size(m_pulseStream));
- int firstPartLength = qMin(m_sample->data().size() - m_position, writableSize);
- if (pa_stream_write(m_pulseStream, reinterpret_cast<void *>(const_cast<char*>(m_sample->data().data()) + m_position),
- firstPartLength, stream_write_done_callback, 0, PA_SEEK_RELATIVE) != 0) {
- qWarning("QSoundEffect(pulseaudio): pa_stream_write, error = %s", pa_strerror(pa_context_errno(daemon()->context())));
- }
- writtenBytes = firstPartLength;
- m_position += firstPartLength;
- if (m_position == m_sample->data().size()) {
- m_position = 0;
- if (m_runningCount > 0)
- m_runningCount--;
- if (m_runningCount != 0 && firstPartLength < writableSize)
- {
- while (writtenBytes < writableSize) {
- int writeSize = qMin(writableSize - writtenBytes, m_sample->data().size());
- if (pa_stream_write(m_pulseStream, reinterpret_cast<void *>(const_cast<char*>(m_sample->data().data())),
- writeSize, stream_write_done_callback, 0, PA_SEEK_RELATIVE) != 0) {
- qWarning("QSoundEffect(pulseaudio): pa_stream_write, error = %s", pa_strerror(pa_context_errno(daemon()->context())));
- }
- writtenBytes += writeSize;
- if (writeSize < m_sample->data().size()) {
- m_position = writeSize;
- break;
- }
- if (m_runningCount > 0)
- m_runningCount--;
- if (m_runningCount == 0)
- break;
- }
- }
- }
-#ifdef QT_PA_DEBUG
- qDebug() << this << "uploadSample: use direct write, writeable size =" << writableSize
- << "actual writtenBytes =" << writtenBytes;
-#endif
-}
-
-void QSoundEffectPrivate::playSample()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "playSample";
-#endif
- Q_ASSERT(m_pulseStream);
- pa_operation_unref(pa_stream_cork(m_pulseStream, 0, 0, 0));
-}
-
-void QSoundEffectPrivate::stop()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "stop";
-#endif
- if (!m_playing)
- return;
- setPlaying(false);
- PulseDaemonLocker locker;
- m_stopping = true;
- if (m_pulseStream)
- emptyStream();
- m_runningCount = 0;
- m_position = 0;
- m_playQueued = false;
-}
-
-void QSoundEffectPrivate::underRun()
-{
- stop();
-}
-
-void QSoundEffectPrivate::streamReady()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "streamReady";
-#endif
- PulseDaemonLocker locker;
- m_sinkInputId = pa_stream_get_index(m_pulseStream);
- updateMuted();
- updateVolume();
-#ifdef QT_PA_DEBUG
- const pa_buffer_attr *realBufAttr = pa_stream_get_buffer_attr(m_pulseStream);
- qDebug() << this << "m_sinkInputId =" << m_sinkInputId
- << "tlength =" << realBufAttr->tlength << "maxlength =" << realBufAttr->maxlength
- << "minreq = " << realBufAttr->minreq << "prebuf =" << realBufAttr->prebuf;
-#endif
- prepare();
- setStatus(QSoundEffect::Ready);
-}
-
-void QSoundEffectPrivate::createPulseStream()
-{
-#ifdef QT_PA_DEBUG
- qDebug() << this << "createPulseStream";
-#endif
-
- pa_proplist *propList = pa_proplist_new();
- pa_proplist_sets(propList, PA_PROP_MEDIA_ROLE, "soundeffect");
- pa_stream *stream = pa_stream_new_with_proplist(daemon()->context(), m_name.constData(), &m_pulseSpec, 0, propList);
- pa_proplist_free(propList);
-
- connect(daemon(), SIGNAL(volumeChanged()), this, SLOT(updateVolume()));
-
- if (stream == 0) {
- qWarning("QSoundEffect(pulseaudio): Failed to create stream");
- m_pulseStream = 0;
- setStatus(QSoundEffect::Error);
- setPlaying(false);
- return;
- }
- else {
- pa_stream_set_state_callback(stream, stream_state_callback, this);
- pa_stream_set_write_callback(stream, stream_write_callback, this);
- pa_stream_set_underflow_callback(stream, stream_underrun_callback, this);
- }
- m_pulseStream = stream;
-
-#ifndef QTM_PULSEAUDIO_DEFAULTBUFFER
- pa_buffer_attr bufferAttr;
- bufferAttr.tlength = qMin(m_sample->data().size(), QT_PA_STREAM_BUFFER_SIZE_MAX);
- bufferAttr.maxlength = -1;
- bufferAttr.minreq = bufferAttr.tlength / 2;
- bufferAttr.prebuf = -1;
- bufferAttr.fragsize = -1;
- if (pa_stream_connect_playback(m_pulseStream, 0, &bufferAttr,
-#else
- if (pa_stream_connect_playback(m_pulseStream, 0, 0,
-#endif
- m_muted ? pa_stream_flags_t(PA_STREAM_START_MUTED | PA_STREAM_START_CORKED)
- : pa_stream_flags_t(PA_STREAM_START_UNMUTED | PA_STREAM_START_CORKED),
- 0, 0) < 0) {
- qWarning("QSoundEffect(pulseaudio): Failed to connect stream, error = %s",
- pa_strerror(pa_context_errno(daemon()->context())));
- }
-}
-
-void QSoundEffectPrivate::contextReady()
-{
- disconnect(daemon(), SIGNAL(contextReady()), this, SLOT(contextReady()));
- PulseDaemonLocker locker;
- createPulseStream();
-}
-
-void QSoundEffectPrivate::stream_write_callback(pa_stream *s, size_t length, void *userdata)
-{
- Q_UNUSED(length);
- Q_UNUSED(s)
-
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_write_callback";
-#endif
- self->uploadSample();
-}
-
-void QSoundEffectPrivate::stream_state_callback(pa_stream *s, void *userdata)
-{
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
- switch (pa_stream_get_state(s)) {
- case PA_STREAM_READY:
- {
-#ifdef QT_PA_DEBUG
- qDebug() << self << "pulse stream ready";
-#endif
- const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(self->m_pulseStream);
- self->m_pulseBufferSize = bufferAttr->tlength;
- if (bufferAttr->prebuf > uint32_t(self->m_sample->data().size())) {
- pa_buffer_attr newBufferAttr;
- newBufferAttr = *bufferAttr;
- newBufferAttr.prebuf = self->m_sample->data().size();
- pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata);
- } else {
- QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection);
- }
- break;
- }
- case PA_STREAM_CREATING:
-#ifdef QT_PA_DEBUG
- qDebug() << self << "pulse stream creating";
-#endif
- break;
- case PA_STREAM_TERMINATED:
-#ifdef QT_PA_DEBUG
- qDebug() << self << "pulse stream terminated";
-#endif
- break;
-
- case PA_STREAM_FAILED:
- default:
- qWarning("QSoundEffect(pulseaudio): Error in pulse audio stream");
- break;
- }
-}
-
-void QSoundEffectPrivate::stream_reset_buffer_callback(pa_stream *s, int success, void *userdata)
-{
- Q_UNUSED(s);
- if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to reset buffer attribute");
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_reset_buffer_callback";
-#endif
- const pa_buffer_attr *bufferAttr = pa_stream_get_buffer_attr(self->m_pulseStream);
- self->m_pulseBufferSize = bufferAttr->tlength;
- if (bufferAttr->prebuf > uint32_t(self->m_sample->data().size())) {
- pa_buffer_attr newBufferAttr;
- newBufferAttr = *bufferAttr;
- newBufferAttr.prebuf = self->m_sample->data().size();
- pa_stream_set_buffer_attr(self->m_pulseStream, &newBufferAttr, stream_adjust_prebuffer_callback, userdata);
- } else {
- QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection);
- }
-}
-
-void QSoundEffectPrivate::stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata)
-{
- Q_UNUSED(s);
- if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to adjust pre-buffer attribute");
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_adjust_prebuffer_callback";
-#endif
- QMetaObject::invokeMethod(self, "streamReady", Qt::QueuedConnection);
-}
-
-void QSoundEffectPrivate::setvolume_callback(pa_context *c, int success, void *userdata)
-{
- Q_UNUSED(c);
- Q_UNUSED(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << reinterpret_cast<QSoundEffectPrivate*>(userdata) << "setvolume_callback";
-#endif
- if (!success) {
- qWarning("QSoundEffect(pulseaudio): faild to set volume");
- }
-}
-
-void QSoundEffectPrivate::setmuted_callback(pa_context *c, int success, void *userdata)
-{
- Q_UNUSED(c);
- Q_UNUSED(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << reinterpret_cast<QSoundEffectPrivate*>(userdata) << "setmuted_callback";
-#endif
- if (!success) {
- qWarning("QSoundEffect(pulseaudio): faild to set muted");
- }
-}
-
-void QSoundEffectPrivate::stream_underrun_callback(pa_stream *s, void *userdata)
-{
- Q_UNUSED(s);
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_underrun_callback";
-#endif
- if (self->m_runningCount == 0 && !self->m_playQueued)
- QMetaObject::invokeMethod(self, "underRun", Qt::QueuedConnection);
-#ifdef QT_PA_DEBUG
- else
- qDebug() << "underun corked =" << pa_stream_is_corked(s);
-#endif
-}
-
-void QSoundEffectPrivate::stream_cork_callback(pa_stream *s, int success, void *userdata)
-{
- Q_UNUSED(s);
- if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to stop");
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_cork_callback";
-#endif
- QMetaObject::invokeMethod(self, "prepare", Qt::QueuedConnection);
-}
-
-void QSoundEffectPrivate::stream_flush_callback(pa_stream *s, int success, void *userdata)
-{
- Q_UNUSED(s);
- if (!success)
- qWarning("QSoundEffect(pulseaudio): faild to drain");
- QSoundEffectPrivate *self = reinterpret_cast<QSoundEffectPrivate*>(userdata);
-#ifdef QT_PA_DEBUG
- qDebug() << self << "stream_flush_callback";
-#endif
- QMetaObject::invokeMethod(self, "emptyComplete", Qt::QueuedConnection);
-}
-
-void QSoundEffectPrivate::stream_write_done_callback(void *p)
-{
- Q_UNUSED(p);
-#ifdef QT_PA_DEBUG
- qDebug() << "stream_write_done_callback";
-#endif
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsoundeffect_pulse_p.cpp"
-#include "qsoundeffect_pulse_p.moc"
diff --git a/src/multimedia/effects/qsoundeffect_pulse_p.h b/src/multimedia/effects/qsoundeffect_pulse_p.h
deleted file mode 100644
index eaf78e8..0000000
--- a/src/multimedia/effects/qsoundeffect_pulse_p.h
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOUNDEFFECT_PULSE_H
-#define QSOUNDEFFECT_PULSE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#include "qsoundeffect.h"
-
-#include <QtCore/qobject.h>
-#include <QtCore/qdatetime.h>
-#include <qmediaplayer.h>
-#include <pulse/pulseaudio.h>
-#include "qsamplecache_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QSoundEffectPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QSoundEffectPrivate(QObject* parent);
- ~QSoundEffectPrivate();
-
- static QStringList supportedMimeTypes();
-
- QUrl source() const;
- void setSource(const QUrl &url);
- int loopCount() const;
- void setLoopCount(int loopCount);
- int volume() const;
- void setVolume(int volume);
- bool isMuted() const;
- void setMuted(bool muted);
- bool isLoaded() const;
- bool isPlaying() const;
- QSoundEffect::Status status() const;
-
-public Q_SLOTS:
- void play();
- void stop();
-
-Q_SIGNALS:
- void volumeChanged();
- void mutedChanged();
- void loadedChanged();
- void playingChanged();
- void statusChanged();
-
-private Q_SLOTS:
- void decoderError();
- void sampleReady();
- void uploadSample();
- void contextReady();
- void underRun();
- void prepare();
- void streamReady();
- void emptyComplete();
- void updateVolume();
- void updateMuted();
-
-private:
- void playSample();
-
- void emptyStream();
- void createPulseStream();
- void unloadPulseStream();
-
- void setPlaying(bool playing);
- void setStatus(QSoundEffect::Status status);
-
- static void stream_write_callback(pa_stream *s, size_t length, void *userdata);
- static void stream_state_callback(pa_stream *s, void *userdata);
- static void stream_underrun_callback(pa_stream *s, void *userdata);
- static void stream_cork_callback(pa_stream *s, int success, void *userdata);
- static void stream_flush_callback(pa_stream *s, int success, void *userdata);
- static void stream_write_done_callback(void *p);
- static void stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata);
- static void stream_reset_buffer_callback(pa_stream *s, int success, void *userdata);
- static void setvolume_callback(pa_context *c, int success, void *userdata);
- static void setmuted_callback(pa_context *c, int success, void *userdata);
-
- pa_stream *m_pulseStream;
- int m_sinkInputId;
- pa_sample_spec m_pulseSpec;
- int m_pulseBufferSize;
-
- bool m_emptying;
- bool m_sampleReady;
- bool m_playing;
- QSoundEffect::Status m_status;
- bool m_muted;
- bool m_playQueued;
- bool m_stopping;
- int m_volume;
- int m_loopCount;
- int m_runningCount;
- QUrl m_source;
- QByteArray m_name;
-
- QSample *m_sample;
- int m_position;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSOUNDEFFECT_PULSE_H
diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.cpp b/src/multimedia/effects/qsoundeffect_qmedia_p.cpp
deleted file mode 100644
index dfd56b0..0000000
--- a/src/multimedia/effects/qsoundeffect_qmedia_p.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include "qsoundeffect_qmedia_p.h"
-
-#include <QtCore/qcoreapplication.h>
-
-#include "qmediacontent.h"
-#include "qmediaplayer.h"
-
-
-QT_BEGIN_NAMESPACE
-
-QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
- QObject(parent),
- m_loopCount(1),
- m_runningCount(0),
- m_player(0),
- m_status(QSoundEffect::Null),
- m_playing(false)
-{
- m_player = new QMediaPlayer(this, QMediaPlayer::LowLatency);
- connect(m_player, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(stateChanged(QMediaPlayer::State)));
- connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- connect(m_player, SIGNAL(error(QMediaPlayer::Error)), SLOT(error(QMediaPlayer::Error)));
- connect(m_player, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged()));
- connect(m_player, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged()));
-}
-
-QSoundEffectPrivate::~QSoundEffectPrivate()
-{
-}
-
-QStringList QSoundEffectPrivate::supportedMimeTypes()
-{
- return QMediaPlayer::supportedMimeTypes();
-}
-
-QUrl QSoundEffectPrivate::source() const
-{
- return m_player->media().canonicalUrl();
-}
-
-void QSoundEffectPrivate::setSource(const QUrl &url)
-{
- m_player->setMedia(url);
-}
-
-int QSoundEffectPrivate::loopCount() const
-{
- return m_loopCount;
-}
-
-void QSoundEffectPrivate::setLoopCount(int loopCount)
-{
- m_loopCount = loopCount;
-}
-
-int QSoundEffectPrivate::volume() const
-{
- return m_player->volume();
-}
-
-void QSoundEffectPrivate::setVolume(int volume)
-{
- m_player->setVolume(volume);
-}
-
-bool QSoundEffectPrivate::isMuted() const
-{
- return m_player->isMuted();
-}
-
-void QSoundEffectPrivate::setMuted(bool muted)
-{
- m_player->setMuted(muted);
-}
-
-bool QSoundEffectPrivate::isLoaded() const
-{
- return m_status == QSoundEffect::Ready;
-}
-
-bool QSoundEffectPrivate::isPlaying() const
-{
- return m_playing;
-}
-
-QSoundEffect::Status QSoundEffectPrivate::status() const
-{
- return m_status;
-}
-
-void QSoundEffectPrivate::play()
-{
- if (m_status == QSoundEffect::Null || m_status == QSoundEffect::Error)
- return;
- if (m_loopCount < 0) {
- m_runningCount = -1;
- }
- else {
- if (m_runningCount < 0)
- m_runningCount = 0;
- m_runningCount += m_loopCount;
- }
- m_player->play();
-}
-
-void QSoundEffectPrivate::stop()
-{
- m_runningCount = 0;
- m_player->stop();
-}
-
-void QSoundEffectPrivate::stateChanged(QMediaPlayer::State state)
-{
- if (state == QMediaPlayer::StoppedState) {
- if (m_runningCount < 0) {
- m_player->play();
- } else if (m_runningCount == 0) {
- setPlaying(false);
- return;
- } else if (--m_runningCount > 0) {
- m_player->play();
- } else {
- setPlaying(false);
- }
- } else {
- setPlaying(true);
- }
-}
-
-void QSoundEffectPrivate::mediaStatusChanged(QMediaPlayer::MediaStatus status)
-{
- switch(status) {
- case QMediaPlayer::LoadingMedia:
- setStatus(QSoundEffect::Loading);
- break;
- case QMediaPlayer::NoMedia:
- setStatus(QSoundEffect::Null);
- break;
- case QMediaPlayer::InvalidMedia:
- setStatus(QSoundEffect::Error);
- break;
- default:
- setStatus(QSoundEffect::Ready);
- break;
- }
-}
-
-void QSoundEffectPrivate::error(QMediaPlayer::Error err)
-{
- bool playingDirty = false;
- if (m_playing) {
- m_playing = false;
- playingDirty = true;
- }
- setStatus(QSoundEffect::Error);
- if (playingDirty)
- emit playingChanged();
-}
-
-void QSoundEffectPrivate::setStatus(QSoundEffect::Status status)
-{
- if (m_status == status)
- return;
- bool oldLoaded = isLoaded();
- m_status = status;
- emit statusChanged();
- if (oldLoaded != isLoaded())
- emit loadedChanged();
-}
-
-void QSoundEffectPrivate::setPlaying(bool playing)
-{
- if (m_playing == playing)
- return;
- m_playing = playing;
- emit playingChanged();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsoundeffect_qmedia_p.cpp"
diff --git a/src/multimedia/effects/qsoundeffect_qmedia_p.h b/src/multimedia/effects/qsoundeffect_qmedia_p.h
deleted file mode 100644
index 3e448f7..0000000
--- a/src/multimedia/effects/qsoundeffect_qmedia_p.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOUNDEFFECT_QMEDIA_H
-#define QSOUNDEFFECT_QMEDIA_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include "qmediaplayer.h"
-#include "qsoundeffect.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QSoundEffectPrivate : public QObject
-{
- Q_OBJECT
-public:
-
- explicit QSoundEffectPrivate(QObject* parent);
- ~QSoundEffectPrivate();
-
- static QStringList supportedMimeTypes();
-
- QUrl source() const;
- void setSource(const QUrl &url);
- int loopCount() const;
- void setLoopCount(int loopCount);
- int volume() const;
- void setVolume(int volume);
- bool isMuted() const;
- void setMuted(bool muted);
- bool isLoaded() const;
- bool isPlaying() const;
- QSoundEffect::Status status() const;
-
-public Q_SLOTS:
- void play();
- void stop();
-
-Q_SIGNALS:
- void volumeChanged();
- void mutedChanged();
- void loadedChanged();
- void playingChanged();
- void statusChanged();
-
-private Q_SLOTS:
- void stateChanged(QMediaPlayer::State);
- void mediaStatusChanged(QMediaPlayer::MediaStatus);
- void error(QMediaPlayer::Error);
-
-private:
- void setStatus(QSoundEffect::Status status);
- void setPlaying(bool playing);
-
- int m_loopCount;
- int m_runningCount;
- bool m_playing;
- QSoundEffect::Status m_status;
- QMediaPlayer *m_player;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSOUNDEFFECT_QMEDIA_H
diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.cpp b/src/multimedia/effects/qsoundeffect_qsound_p.cpp
deleted file mode 100644
index 0b9082e..0000000
--- a/src/multimedia/effects/qsoundeffect_qsound_p.cpp
+++ /dev/null
@@ -1,222 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// INTERNAL USE ONLY: Do NOT use for any other purpose.
-//
-
-#include "qsoundeffect_qsound_p.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtWidgets/qsound.h>
-#include <QtCore/qstringlist.h>
-
-
-QT_BEGIN_NAMESPACE
-
-QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
- QObject(parent),
- m_playing(false),
- m_timerID(0),
- m_muted(false),
- m_loopCount(1),
- m_volume(100),
- m_status(QSoundEffect::Null),
- m_sound(0)
-{
- if (!QSound::isAvailable())
- qWarning("SoundEffect(qsound) : not available");
-}
-
-QSoundEffectPrivate::~QSoundEffectPrivate()
-{
-}
-
-QStringList QSoundEffectPrivate::supportedMimeTypes()
-{
- QStringList supportedTypes;
- supportedTypes << QLatin1String("audio/x-wav") << QLatin1String("audio/vnd.wave") ;
- return supportedTypes;
-}
-
-QUrl QSoundEffectPrivate::source() const
-{
- return m_source;
-}
-
-void QSoundEffectPrivate::setSource(const QUrl &url)
-{
- if (url.isEmpty()) {
- m_source = QUrl();
- setStatus(QSoundEffect::Null);
- return;
- }
-
- if (url.scheme() != QLatin1String("file")) {
- m_source = url;
- setStatus(QSoundEffect::Error);
- return;
- }
-
- if (m_sound != 0)
- delete m_sound;
-
- m_source = url;
- m_sound = new QSound(m_source.toLocalFile(), this);
- m_sound->setLoops(m_loopCount);
- m_status = QSoundEffect::Ready;
- emit statusChanged();
- emit loadedChanged();
-}
-
-int QSoundEffectPrivate::loopCount() const
-{
- return m_loopCount;
-}
-
-void QSoundEffectPrivate::setLoopCount(int lc)
-{
- m_loopCount = lc;
- if (m_sound)
- m_sound->setLoops(lc);
-}
-
-int QSoundEffectPrivate::volume() const
-{
- return m_volume;
-}
-
-void QSoundEffectPrivate::setVolume(int v)
-{
- m_volume = v;
-}
-
-bool QSoundEffectPrivate::isMuted() const
-{
- return m_muted;
-}
-
-void QSoundEffectPrivate::setMuted(bool muted)
-{
- m_muted = muted;
-}
-
-bool QSoundEffectPrivate::isLoaded() const
-{
- return m_status == QSoundEffect::Ready;
-}
-
-void QSoundEffectPrivate::play()
-{
- if (m_status == QSoundEffect::Null || m_status == QSoundEffect::Error)
- return;
- if (m_timerID != 0)
- killTimer(m_timerID);
- m_timerID = startTimer(500);
- m_sound->play();
- setPlaying(true);
-}
-
-
-void QSoundEffectPrivate::stop()
-{
- if (m_timerID != 0)
- killTimer(m_timerID);
- m_timerID = 0;
- m_sound->stop();
- setPlaying(false);
-}
-
-bool QSoundEffectPrivate::isPlaying()
-{
- if (m_playing && m_sound && m_sound->isFinished()) {
- if (m_timerID != 0)
- killTimer(m_timerID);
- m_timerID = 0;
- setPlaying(false);
- }
- return m_playing;
-}
-
-QSoundEffect::Status QSoundEffectPrivate::status() const
-{
- return m_status;
-}
-
-void QSoundEffectPrivate::timerEvent(QTimerEvent *event)
-{
- Q_UNUSED(event);
- setPlaying(!m_sound->isFinished());
- if (isPlaying())
- return;
- killTimer(m_timerID);
- m_timerID = 0;
-}
-
-void QSoundEffectPrivate::setStatus(QSoundEffect::Status status)
-{
- if (m_status == status)
- return;
- bool oldLoaded = isLoaded();
- m_status = status;
- emit statusChanged();
- if (oldLoaded != isLoaded())
- emit loadedChanged();
-}
-
-void QSoundEffectPrivate::setPlaying(bool playing)
-{
- if (m_playing == playing)
- return;
- m_playing = playing;
- emit playingChanged();
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qsoundeffect_qsound_p.cpp"
diff --git a/src/multimedia/effects/qsoundeffect_qsound_p.h b/src/multimedia/effects/qsoundeffect_qsound_p.h
deleted file mode 100644
index e867bf4..0000000
--- a/src/multimedia/effects/qsoundeffect_qsound_p.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSOUNDEFFECT_QSOUND_H
-#define QSOUNDEFFECT_QSOUND_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-
-#include <QtCore/qobject.h>
-#include <QtCore/qurl.h>
-#include "qsoundeffect.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QSound;
-
-class QSoundEffectPrivate : public QObject
-{
- Q_OBJECT
-public:
- explicit QSoundEffectPrivate(QObject* parent);
- ~QSoundEffectPrivate();
-
- static QStringList supportedMimeTypes();
-
- QUrl source() const;
- void setSource(const QUrl &url);
- int loopCount() const;
- void setLoopCount(int loopCount);
- int volume() const;
- void setVolume(int volume);
- bool isMuted() const;
- void setMuted(bool muted);
- bool isLoaded() const;
- bool isPlaying();
- QSoundEffect::Status status() const;
-
-public Q_SLOTS:
- void play();
- void stop();
-
-Q_SIGNALS:
- void volumeChanged();
- void mutedChanged();
- void loadedChanged();
- void playingChanged();
- void statusChanged();
-
-private:
- void setStatus(QSoundEffect::Status status);
- void setPlaying(bool playing);
- void timerEvent(QTimerEvent *event);
-
- bool m_playing;
- int m_timerID;
- bool m_muted;
- int m_loopCount;
- int m_volume;
- QSoundEffect::Status m_status;
- QSound *m_sound;
- QUrl m_source;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QSOUNDEFFECT_QSOUND_H
diff --git a/src/multimedia/effects/qwavedecoder_p.cpp b/src/multimedia/effects/qwavedecoder_p.cpp
deleted file mode 100644
index eb65a3a..0000000
--- a/src/multimedia/effects/qwavedecoder_p.cpp
+++ /dev/null
@@ -1,307 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qwavedecoder_p.h"
-
-#include <QtCore/qtimer.h>
-#include <QtCore/qendian.h>
-
-QT_BEGIN_NAMESPACE
-
-QWaveDecoder::QWaveDecoder(QIODevice *s, QObject *parent):
- QIODevice(parent),
- haveFormat(false),
- dataSize(0),
- source(s),
- state(QWaveDecoder::InitialState),
- junkToSkip(0),
- bigEndian(false)
-{
- open(QIODevice::ReadOnly | QIODevice::Unbuffered);
-
- if (enoughDataAvailable())
- QTimer::singleShot(0, this, SLOT(handleData()));
- else
- connect(source, SIGNAL(readyRead()), SLOT(handleData()));
-}
-
-QWaveDecoder::~QWaveDecoder()
-{
-}
-
-QAudioFormat QWaveDecoder::audioFormat() const
-{
- return format;
-}
-
-int QWaveDecoder::duration() const
-{
- return size() * 1000 / (format.sampleSize() / 8) / format.channels() / format.frequency();
-}
-
-qint64 QWaveDecoder::size() const
-{
- return haveFormat ? dataSize : 0;
-}
-
-bool QWaveDecoder::isSequential() const
-{
- return source->isSequential();
-}
-
-qint64 QWaveDecoder::bytesAvailable() const
-{
- return haveFormat ? source->bytesAvailable() : 0;
-}
-
-qint64 QWaveDecoder::readData(char *data, qint64 maxlen)
-{
- return haveFormat ? source->read(data, maxlen) : 0;
-}
-
-qint64 QWaveDecoder::writeData(const char *data, qint64 len)
-{
- Q_UNUSED(data);
- Q_UNUSED(len);
-
- return -1;
-}
-
-void QWaveDecoder::parsingFailed()
-{
- Q_ASSERT(source);
- source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
- emit parsingError();
-}
-
-void QWaveDecoder::handleData()
-{
- // As a special "state", if we have junk to skip, we do
- if (junkToSkip > 0) {
- discardBytes(junkToSkip); // this also updates junkToSkip
-
- // If we couldn't skip all the junk, return
- if (junkToSkip > 0) {
- // We might have run out
- if (source->atEnd())
- parsingFailed();
- return;
- }
- }
-
- if (state == QWaveDecoder::InitialState) {
- if (source->bytesAvailable() < qint64(sizeof(RIFFHeader)))
- return;
-
- RIFFHeader riff;
- source->read(reinterpret_cast<char *>(&riff), sizeof(RIFFHeader));
-
- // RIFF = little endian RIFF, RIFX = big endian RIFF
- if (((qstrncmp(riff.descriptor.id, "RIFF", 4) != 0) && (qstrncmp(riff.descriptor.id, "RIFX", 4) != 0))
- || qstrncmp(riff.type, "WAVE", 4) != 0) {
- parsingFailed();
- return;
- } else {
- state = QWaveDecoder::WaitingForFormatState;
- if (qstrncmp(riff.descriptor.id, "RIFX", 4) == 0)
- bigEndian = true;
- else
- bigEndian = false;
- }
- }
-
- if (state == QWaveDecoder::WaitingForFormatState) {
- if (findChunk("fmt ")) {
- chunk descriptor;
- peekChunk(&descriptor);
-
- if (source->bytesAvailable() < qint64(descriptor.size + sizeof(chunk)))
- return;
-
- WAVEHeader wave;
- source->read(reinterpret_cast<char *>(&wave), sizeof(WAVEHeader));
- if (descriptor.size > sizeof(WAVEHeader))
- discardBytes(descriptor.size - sizeof(WAVEHeader));
-
- // Swizzle this
- if (bigEndian) {
- wave.audioFormat = qFromBigEndian<quint16>(wave.audioFormat);
- }
-
- if (wave.audioFormat != 0 && wave.audioFormat != 1) {
- // 32bit wave files have format == 0xFFFE (WAVE_FORMAT_EXTENSIBLE).
- // but don't support them at the moment.
- parsingFailed();
- return;
- } else {
- format.setCodec(QLatin1String("audio/pcm"));
-
- if (bigEndian) {
- int bps = qFromBigEndian<quint16>(wave.bitsPerSample);
-
- format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setFrequency(qFromBigEndian<quint32>(wave.sampleRate));
- format.setSampleSize(bps);
- format.setChannels(qFromBigEndian<quint16>(wave.numChannels));
- } else {
- int bps = qFromLittleEndian<quint16>(wave.bitsPerSample);
-
- format.setSampleType(bps == 8 ? QAudioFormat::UnSignedInt : QAudioFormat::SignedInt);
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setFrequency(qFromLittleEndian<quint32>(wave.sampleRate));
- format.setSampleSize(bps);
- format.setChannels(qFromLittleEndian<quint16>(wave.numChannels));
- }
-
- state = QWaveDecoder::WaitingForDataState;
- }
- }
- }
-
- if (state == QWaveDecoder::WaitingForDataState) {
- if (findChunk("data")) {
- source->disconnect(SIGNAL(readyRead()), this, SLOT(handleData()));
-
- chunk descriptor;
- source->read(reinterpret_cast<char *>(&descriptor), sizeof(chunk));
- if (bigEndian)
- descriptor.size = qFromBigEndian<quint32>(descriptor.size);
-
- dataSize = descriptor.size;
-
- haveFormat = true;
- connect(source, SIGNAL(readyRead()), SIGNAL(readyRead()));
- emit formatKnown();
-
- return;
- }
- }
-
- // If we hit the end without finding data, it's a parsing error
- if (source->atEnd()) {
- parsingFailed();
- }
-}
-
-bool QWaveDecoder::enoughDataAvailable()
-{
- chunk descriptor;
- if (!peekChunk(&descriptor))
- return false;
-
- // This is only called for the RIFF/RIFX header, before bigEndian is set,
- // so we have to manually swizzle
- if (qstrncmp(descriptor.id, "RIFX", 4) == 0)
- descriptor.size = qFromBigEndian<quint32>(descriptor.size);
-
- if (source->bytesAvailable() < qint64(sizeof(chunk) + descriptor.size))
- return false;
-
- return true;
-}
-
-bool QWaveDecoder::findChunk(const char *chunkId)
-{
- chunk descriptor;
- if (!peekChunk(&descriptor))
- return false;
-
- if (qstrncmp(descriptor.id, chunkId, 4) == 0)
- return true;
-
- // It's possible that bytes->available() is less than the chunk size
- // if it's corrupt.
- junkToSkip = qint64(sizeof(chunk) + descriptor.size);
- while (source->bytesAvailable() > 0) {
- // Skip the current amount
- if (junkToSkip > 0)
- discardBytes(junkToSkip);
-
- // If we still have stuff left, just exit and try again later
- // since we can't call peekChunk
- if (junkToSkip > 0)
- return false;
-
- if (!peekChunk(&descriptor))
- return false;
-
- if (qstrncmp(descriptor.id, chunkId, 4) == 0)
- return true;
- }
-
- return false;
-}
-
-// Handles endianness
-bool QWaveDecoder::peekChunk(chunk *pChunk)
-{
- if (source->bytesAvailable() < qint64(sizeof(chunk)))
- return false;
-
- source->peek(reinterpret_cast<char *>(pChunk), sizeof(chunk));
- if (bigEndian)
- pChunk->size = qFromBigEndian<quint32>(pChunk->size);
-
- return true;
-}
-
-void QWaveDecoder::discardBytes(qint64 numBytes)
-{
- // Discards a number of bytes
- // If the iodevice doesn't have this many bytes in it,
- // remember how much more junk we have to skip.
- if (source->isSequential()) {
- QByteArray r = source->read(qMin(numBytes, qint64(16384))); // uggh, wasted memory, limit to a max of 16k
- if (r.size() < numBytes)
- junkToSkip = numBytes - r.size();
- else
- junkToSkip = 0;
- } else {
- quint64 origPos = source->pos();
- source->seek(source->pos() + numBytes);
- junkToSkip = origPos + numBytes - source->pos();
- }
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qwavedecoder_p.cpp"
diff --git a/src/multimedia/effects/qwavedecoder_p.h b/src/multimedia/effects/qwavedecoder_p.h
deleted file mode 100644
index 1a7bef9..0000000
--- a/src/multimedia/effects/qwavedecoder_p.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WAVEDECODER_H
-#define WAVEDECODER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qiodevice.h>
-#include <qaudioformat.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QWaveDecoder : public QIODevice
-{
- Q_OBJECT
-
-public:
- explicit QWaveDecoder(QIODevice *source, QObject *parent = 0);
- ~QWaveDecoder();
-
- QAudioFormat audioFormat() const;
- int duration() const;
-
- qint64 size() const;
- bool isSequential() const;
- qint64 bytesAvailable() const;
-
-Q_SIGNALS:
- void formatKnown();
- void parsingError();
-
-private Q_SLOTS:
- void handleData();
-
-private:
- qint64 readData(char *data, qint64 maxlen);
- qint64 writeData(const char *data, qint64 len);
-
- bool enoughDataAvailable();
- bool findChunk(const char *chunkId);
- void discardBytes(qint64 numBytes);
- void parsingFailed();
-
- enum State {
- InitialState,
- WaitingForFormatState,
- WaitingForDataState
- };
-
- struct chunk
- {
- char id[4];
- quint32 size;
- };
- bool peekChunk(chunk* pChunk);
-
- struct RIFFHeader
- {
- chunk descriptor;
- char type[4];
- };
- struct WAVEHeader
- {
- chunk descriptor;
- quint16 audioFormat;
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
- };
-
- bool haveFormat;
- qint64 dataSize;
- QAudioFormat format;
- QIODevice *source;
- State state;
- quint32 junkToSkip;
- bool bigEndian;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // WAVEDECODER_H
diff --git a/src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h b/src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h
deleted file mode 100644
index 40c75ad..0000000
--- a/src/multimedia/gsttools_headers/qabstractgstbufferpool_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTBUFFERPOOL_P_H
-#define QGSTBUFFERPOOL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qabstractvideobuffer.h>
-#include <qvideosurfaceformat.h>
-
-#include <gst/gst.h>
-
-/*!
- Abstract interface for video buffers allocation.
-*/
-class QAbstractGstBufferPool
-{
-public:
- virtual ~QAbstractGstBufferPool() {}
-
- virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const = 0;
-
- virtual GType bufferType() const = 0;
- virtual GstBuffer *takeBuffer(const QVideoSurfaceFormat &format, GstCaps *caps) = 0;
- virtual void clear() = 0;
-
- virtual QAbstractVideoBuffer::HandleType handleType() const = 0;
-
- /*!
- Build an QAbstractVideoBuffer instance from compatible (mathcing gst buffer type)
- GstBuffer.
-
- This method is called from gstreamer video sink thread.
- */
- virtual QAbstractVideoBuffer *prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine) = 0;
-};
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h b/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
deleted file mode 100644
index 0ae5b89..0000000
--- a/src/multimedia/gsttools_headers/qgstreamerbushelper_p.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERBUSHELPER_P_H
-#define QGSTREAMERBUSHELPER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QObject>
-
-#include "qgstreamermessage_p.h"
-#include <gst/gst.h>
-
-class QGstreamerSyncMessageFilter {
-public:
- //returns true if message was processed and should be dropped, false otherwise
- virtual bool processSyncMessage(const QGstreamerMessage &message) = 0;
-};
-#define QGstreamerSyncMessageFilter_iid "com.nokia.Qt.QGstreamerSyncMessageFilter/1.0"
-Q_DECLARE_INTERFACE(QGstreamerSyncMessageFilter, QGstreamerSyncMessageFilter_iid)
-
-
-class QGstreamerBusMessageFilter {
-public:
- //returns true if message was processed and should be dropped, false otherwise
- virtual bool processBusMessage(const QGstreamerMessage &message) = 0;
-};
-#define QGstreamerBusMessageFilter_iid "com.nokia.Qt.QGstreamerBusMessageFilter/1.0"
-Q_DECLARE_INTERFACE(QGstreamerBusMessageFilter, QGstreamerBusMessageFilter_iid)
-
-
-class QGstreamerBusHelperPrivate;
-
-class QGstreamerBusHelper : public QObject
-{
- Q_OBJECT
- friend class QGstreamerBusHelperPrivate;
-
-public:
- QGstreamerBusHelper(GstBus* bus, QObject* parent = 0);
- ~QGstreamerBusHelper();
-
- void installMessageFilter(QObject *filter);
- void removeMessageFilter(QObject *filter);
-
-signals:
- void message(QGstreamerMessage const& message);
-
-private:
- QGstreamerBusHelperPrivate* d;
-};
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qgstreamermessage_p.h b/src/multimedia/gsttools_headers/qgstreamermessage_p.h
deleted file mode 100644
index b0a568d..0000000
--- a/src/multimedia/gsttools_headers/qgstreamermessage_p.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERMESSAGE_P_H
-#define QGSTREAMERMESSAGE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QMetaType>
-
-#include <gst/gst.h>
-
-
-class QGstreamerMessage
-{
-public:
- QGstreamerMessage();
- QGstreamerMessage(GstMessage* message);
- QGstreamerMessage(QGstreamerMessage const& m);
- ~QGstreamerMessage();
-
- GstMessage* rawMessage() const;
-
- QGstreamerMessage& operator=(QGstreamerMessage const& rhs);
-
-private:
- GstMessage* m_message;
-};
-
-Q_DECLARE_METATYPE(QGstreamerMessage);
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qgstutils_p.h b/src/multimedia/gsttools_headers/qgstutils_p.h
deleted file mode 100644
index ea99e56..0000000
--- a/src/multimedia/gsttools_headers/qgstutils_p.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTUTILS_P_H
-#define QGSTUTILS_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qmap.h>
-#include <gst/gst.h>
-
-class QSize;
-class QVariant;
-class QByteArray;
-
-namespace QGstUtils {
- QMap<QByteArray, QVariant> gstTagListToMap(const GstTagList *list);
-
- QSize capsResolution(const GstCaps *caps);
- QSize capsCorrectedResolution(const GstCaps *caps);
-}
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h b/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
deleted file mode 100644
index 0f14a8f..0000000
--- a/src/multimedia/gsttools_headers/qgstvideobuffer_p.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTVIDEOBUFFER_P_H
-#define QGSTVIDEOBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qabstractvideobuffer.h>
-#include <QtCore/qvariant.h>
-
-#include <gst/gst.h>
-
-class QGstVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine);
- QGstVideoBuffer(GstBuffer *buffer, int bytesPerLine,
- HandleType handleType, const QVariant &handle);
- ~QGstVideoBuffer();
-
- MapMode mapMode() const;
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
-
- QVariant handle() const { return m_handle; }
-private:
- GstBuffer *m_buffer;
- int m_bytesPerLine;
- MapMode m_mode;
- QVariant m_handle;
-};
-
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h b/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h
deleted file mode 100644
index c6f7437..0000000
--- a/src/multimedia/gsttools_headers/qgstxvimagebuffer_p.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTXVIMAGEBUFFER_P_H
-#define QGSTXVIMAGEBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qabstractvideobuffer.h>
-#include <qvideosurfaceformat.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qwaitcondition.h>
-#include <QtCore/qqueue.h>
-
-#ifndef QT_NO_XVIDEO
-
-#include <X11/Xlib.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <X11/extensions/XShm.h>
-#include <X11/Xlib.h>
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-
-#include <gst/gst.h>
-#include "qabstractgstbufferpool_p.h"
-
-class QGstXvImageBufferPool;
-
-struct QGstXvImageBuffer {
- GstBuffer buffer;
- QGstXvImageBufferPool *pool;
- XvImage *xvImage;
- XShmSegmentInfo shmInfo;
- bool markedForDeletion;
-
- static GType get_type(void);
- static void class_init(gpointer g_class, gpointer class_data);
- static void buffer_init(QGstXvImageBuffer *xvimage, gpointer g_class);
- static void buffer_finalize(QGstXvImageBuffer * xvimage);
- static GstBufferClass *parent_class;
-};
-
-Q_DECLARE_METATYPE(XvImage*)
-
-class QGstXvImageBufferPool : public QObject, public QAbstractGstBufferPool {
-Q_OBJECT
-friend class QGstXvImageBuffer;
-public:
- QGstXvImageBufferPool(QObject *parent = 0);
- virtual ~QGstXvImageBufferPool();
-
- bool isFormatSupported(const QVideoSurfaceFormat &format) const;
-
- GType bufferType() const;
- GstBuffer *takeBuffer(const QVideoSurfaceFormat &format, GstCaps *caps);
- void clear();
-
- QAbstractVideoBuffer::HandleType handleType() const;
- QAbstractVideoBuffer *prepareVideoBuffer(GstBuffer *buffer, int bytesPerLine);
-
-private slots:
- void queuedAlloc();
- void queuedDestroy();
-
- void doClear();
-
- void recycleBuffer(QGstXvImageBuffer *);
- void destroyBuffer(QGstXvImageBuffer *);
-
-private:
- void doAlloc();
-
- struct XvShmImage {
- XvImage *xvImage;
- XShmSegmentInfo shmInfo;
- };
-
- QMutex m_poolMutex;
- QMutex m_allocMutex;
- QWaitCondition m_allocWaitCondition;
- QMutex m_destroyMutex;
- QVideoSurfaceFormat m_format;
- GstCaps *m_caps;
- QList<QGstXvImageBuffer*> m_pool;
- QList<QGstXvImageBuffer*> m_allBuffers;
- QList<XvShmImage> m_imagesToDestroy;
- Qt::HANDLE m_threadId;
-};
-
-#endif //QT_NO_XVIDEO
-
-#endif
diff --git a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h b/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
deleted file mode 100644
index 438b796..0000000
--- a/src/multimedia/gsttools_headers/qvideosurfacegstsink_p.h
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOSURFACEGSTSINK_P_H
-#define VIDEOSURFACEGSTSINK_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <gst/video/gstvideosink.h>
-
-#include <QtCore/qlist.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qqueue.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qwaitcondition.h>
-#include <qvideosurfaceformat.h>
-#include <qvideoframe.h>
-#include <qabstractvideobuffer.h>
-
-#include "qabstractgstbufferpool_p.h"
-
-QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-class QGstXvImageBuffer;
-class QGstXvImageBufferPool;
-#endif
-
-class QVideoSurfaceGstDelegate : public QObject
-{
- Q_OBJECT
-public:
- QVideoSurfaceGstDelegate(QAbstractVideoSurface *surface);
- ~QVideoSurfaceGstDelegate();
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- QVideoSurfaceFormat surfaceFormat() const;
-
- bool start(const QVideoSurfaceFormat &format, int bytesPerLine);
- void stop();
-
- bool isActive();
-
- QAbstractGstBufferPool *pool() { return m_pool; }
- QMutex *poolMutex() { return &m_poolMutex; }
-
- GstFlowReturn render(GstBuffer *buffer);
-
-private slots:
- void queuedStart();
- void queuedStop();
- void queuedRender();
-
- void updateSupportedFormats();
-
-private:
- QPointer<QAbstractVideoSurface> m_surface;
- QList<QVideoFrame::PixelFormat> m_supportedPixelFormats;
- //pixel formats of buffers pool native type
- QList<QVideoFrame::PixelFormat> m_supportedPoolPixelFormats;
- QAbstractGstBufferPool *m_pool;
- QList<QAbstractGstBufferPool *> m_pools;
- QMutex m_poolMutex;
- QMutex m_mutex;
- QWaitCondition m_setupCondition;
- QWaitCondition m_renderCondition;
- QVideoSurfaceFormat m_format;
- QVideoFrame m_frame;
- GstFlowReturn m_renderReturn;
- int m_bytesPerLine;
- bool m_started;
- bool m_startCanceled;
-};
-
-class QVideoSurfaceGstSink
-{
-public:
- GstVideoSink parent;
-
- static QVideoSurfaceGstSink *createSink(QAbstractVideoSurface *surface);
- static QVideoSurfaceFormat formatForCaps(GstCaps *caps, int *bytesPerLine = 0);
-
-private:
- static GType get_type();
- static void class_init(gpointer g_class, gpointer class_data);
- static void base_init(gpointer g_class);
- static void instance_init(GTypeInstance *instance, gpointer g_class);
-
- static void finalize(GObject *object);
-
- static GstStateChangeReturn change_state(GstElement *element, GstStateChange transition);
-
- static GstCaps *get_caps(GstBaseSink *sink);
- static gboolean set_caps(GstBaseSink *sink, GstCaps *caps);
-
- static GstFlowReturn buffer_alloc(
- GstBaseSink *sink, guint64 offset, guint size, GstCaps *caps, GstBuffer **buffer);
-
- static gboolean start(GstBaseSink *sink);
- static gboolean stop(GstBaseSink *sink);
-
- static gboolean unlock(GstBaseSink *sink);
-
- static gboolean event(GstBaseSink *sink, GstEvent *event);
- static GstFlowReturn preroll(GstBaseSink *sink, GstBuffer *buffer);
- static GstFlowReturn render(GstBaseSink *sink, GstBuffer *buffer);
-
-private:
- QVideoSurfaceGstDelegate *delegate;
-
- GstCaps *lastRequestedCaps;
- GstCaps *lastBufferCaps;
- QVideoSurfaceFormat *lastSurfaceFormat;
-};
-
-
-class QVideoSurfaceGstSinkClass
-{
-public:
- GstVideoSinkClass parent_class;
-};
-
-#endif
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
deleted file mode 100644
index f1c11b9..0000000
--- a/src/multimedia/multimedia.pro
+++ /dev/null
@@ -1,160 +0,0 @@
-load(qt_module)
-
-TARGET = QtMultimedia
-QPRO_PWD = $$PWD
-QT = core network gui
-
-CONFIG += module
-MODULE_PRI += ../../modules/qt_multimedia.pri
-
-contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) {
-} else {
- DEFINES += QT_NO_OPENGL
-}
-
-!static:DEFINES += QT_MAKEDLL
-DEFINES += QT_BUILD_MULTIMEDIA_LIB
-
-load(qt_module_config)
-
-HEADERS += qtmultimediaversion.h
-
-
-PRIVATE_HEADERS += \
- qmediacontrol_p.h \
- qmediaobject_p.h \
- qmediaservice_p.h \
- qmediaplaylist_p.h \
- qmediaplaylistprovider_p.h \
- qmediaimageviewerservice_p.h \
- qmediapluginloader_p.h \
- qvideosurfaceoutput_p.h
-
-PUBLIC_HEADERS += \
- qmediacontrol.h \
- qmediaobject.h \
- qmediaservice.h \
- qmediabindableinterface.h \
- qlocalmediaplaylistprovider.h \
- qmediaimageviewer.h \
- qmediaplayer.h \
- qmediaplayercontrol.h \
- qmediaplaylist.h \
- qmediaplaylistnavigator.h \
- qmediaplaylistprovider.h \
- qmediaplaylistioplugin.h \
- qmediabackgroundplaybackcontrol.h \
- qmediacontent.h \
- qmediaresource.h \
- qmediarecorder.h \
- qmediaencodersettings.h \
- qmediarecordercontrol.h \
- qmediaserviceprovider.h \
- qmediaserviceproviderplugin.h \
- qmetadatareadercontrol.h \
- qmetadatawritercontrol.h \
- qmediastreamscontrol.h \
- qradiotuner.h \
- qradiodata.h \
- qradiotunercontrol.h \
- qradiodatacontrol.h \
- qtmedianamespace.h \
- qaudioencodercontrol.h \
- qvideoencodercontrol.h \
- qimageencodercontrol.h \
- qaudiocapturesource.h \
- qmediacontainercontrol.h \
- qmediaplaylistcontrol.h \
- qmediaplaylistsourcecontrol.h \
- qaudioendpointselector.h \
- qvideodevicecontrol.h \
- qvideorenderercontrol.h \
- qmediatimerange.h \
- qmedianetworkaccesscontrol.h \
- qmediaenumdebug.h \
- qtmultimediadefs.h
-
-SOURCES += qmediacontrol.cpp \
- qmediaobject.cpp \
- qmediaservice.cpp \
- qmediabindableinterface.cpp \
- qlocalmediaplaylistprovider.cpp \
- qmediaimageviewer.cpp \
- qmediaimageviewerservice.cpp \
- qmediaplayer.cpp \
- qmediaplayercontrol.cpp \
- qmediaplaylist.cpp \
- qmediaplaylistioplugin.cpp \
- qmediaplaylistnavigator.cpp \
- qmediaplaylistprovider.cpp \
- qmediarecorder.cpp \
- qmediaencodersettings.cpp \
- qmediarecordercontrol.cpp \
- qmediacontent.cpp \
- qmediaresource.cpp \
- qmediaserviceprovider.cpp \
- qmetadatareadercontrol.cpp \
- qmetadatawritercontrol.cpp \
- qmediastreamscontrol.cpp \
- qradiotuner.cpp \
- qradiodata.cpp \
- qradiotunercontrol.cpp \
- qradiodatacontrol.cpp \
- qaudioencodercontrol.cpp \
- qvideoencodercontrol.cpp \
- qimageencodercontrol.cpp \
- qaudiocapturesource.cpp \
- qmediacontainercontrol.cpp \
- qmediaplaylistcontrol.cpp \
- qmediaplaylistsourcecontrol.cpp \
- qaudioendpointselector.cpp \
- qvideodevicecontrol.cpp \
- qmediapluginloader.cpp \
- qvideorenderercontrol.cpp \
- qmediatimerange.cpp \
- qmedianetworkaccesscontrol.cpp \
- qvideosurfaceoutput.cpp \
- qmediabackgroundplaybackcontrol.cpp
-
-#Camera
-PUBLIC_HEADERS += \
- qcamera.h \
- qcameraimagecapture.h \
- qcameraimagecapturecontrol.h \
- qcameraexposure.h \
- qcamerafocus.h \
- qcameraimageprocessing.h \
- qcameracontrol.h \
- qcameralockscontrol.h \
- qcameraexposurecontrol.h \
- qcamerafocuscontrol.h \
- qcameraflashcontrol.h \
- qcameraimageprocessingcontrol.h \
- qcameracapturedestinationcontrol.h \
- qcameracapturebufferformatcontrol.h
-
-SOURCES += \
- qcamera.cpp \
- qcameraexposure.cpp \
- qcamerafocus.cpp \
- qcameraimageprocessing.cpp \
- qcameraimagecapture.cpp \
- qcameraimagecapturecontrol.cpp \
- qcameracontrol.cpp \
- qcameralockscontrol.cpp \
- qcameraexposurecontrol.cpp \
- qcamerafocuscontrol.cpp \
- qcameraflashcontrol.cpp \
- qcameraimageprocessingcontrol.cpp \
- qcameracapturedestinationcontrol.cpp \
- qcameracapturebufferformatcontrol.cpp
-
-include(audio/audio.pri)
-include(video/video.pri)
-include(effects/effects.pri)
-
-mac:!qpa {
- LIBS += -framework AppKit -framework QuartzCore -framework QTKit
-}
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
diff --git a/src/multimedia/qaudiocapturesource.cpp b/src/multimedia/qaudiocapturesource.cpp
deleted file mode 100644
index 4696171..0000000
--- a/src/multimedia/qaudiocapturesource.cpp
+++ /dev/null
@@ -1,275 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaobject_p.h"
-#include <qaudiocapturesource.h>
-#include "qaudioendpointselector.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAudioCaptureSource
- \brief The QAudioCaptureSource class provides an interface to query and select an audio input endpoint.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- QAudioCaptureSource provides access to the audio inputs available on your system.
-
- You can query these inputs and select one to use.
-
- A typical implementation example:
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Audio capture source
-
- The audiocapturesource interface is then used to:
-
- - Get and Set the audio input to use.
-
- The capture interface is then used to:
-
- - Set the destination using setOutputLocation()
-
- - Set the format parameters using setAudioCodec(),
-
- - Control the recording using record(),stop()
-
- \sa QMediaRecorder
-*/
-
-class QAudioCaptureSourcePrivate : public QMediaObjectPrivate
-{
-public:
- Q_DECLARE_PUBLIC(QAudioCaptureSource)
-
- void initControls()
- {
- Q_Q(QAudioCaptureSource);
-
- if (service != 0)
- audioEndpointSelector = qobject_cast<QAudioEndpointSelector*>(service->requestControl(QAudioEndpointSelector_iid));
-
- if (audioEndpointSelector) {
- q->connect(audioEndpointSelector, SIGNAL(activeEndpointChanged(const QString&)),
- SIGNAL(activeAudioInputChanged(const QString&)));
- q->connect(audioEndpointSelector, SIGNAL(availableEndpointsChanged()),
- SIGNAL(availableAudioInputsChanged()));
- q->connect(audioEndpointSelector, SIGNAL(availableEndpointsChanged()),
- SLOT(statusChanged()));
- errorState = QtMultimedia::NoError;
- }
- }
-
- QAudioCaptureSourcePrivate():provider(0), audioEndpointSelector(0), errorState(QtMultimedia::ServiceMissingError) {}
- QMediaServiceProvider *provider;
- QAudioEndpointSelector *audioEndpointSelector;
- QtMultimedia::AvailabilityError errorState;
-};
-
-/*!
- Construct a QAudioCaptureSource using the QMediaService from \a provider, with \a parent.
- \since 1.0
-*/
-
-QAudioCaptureSource::QAudioCaptureSource(QObject *parent, QMediaServiceProvider *provider):
- QMediaObject(*new QAudioCaptureSourcePrivate, parent, provider->requestService(Q_MEDIASERVICE_AUDIOSOURCE))
-{
- Q_D(QAudioCaptureSource);
-
- d->provider = provider;
- d->initControls();
-}
-
-/*!
- Destroys the audiocapturesource object.
-*/
-
-QAudioCaptureSource::~QAudioCaptureSource()
-{
- Q_D(QAudioCaptureSource);
-
- if (d->service && d->audioEndpointSelector)
- d->service->releaseControl(d->audioEndpointSelector);
-
- if (d->provider)
- d->provider->releaseService(d->service);
-}
-
-/*!
- Returns the error state of the audio capture service.
- \since 1.0
-*/
-
-QtMultimedia::AvailabilityError QAudioCaptureSource::availabilityError() const
-{
- Q_D(const QAudioCaptureSource);
-
- return d->errorState;
-}
-
-/*!
- Returns true if the audio capture service is available, otherwise returns false.
- \since 1.0
-*/
-bool QAudioCaptureSource::isAvailable() const
-{
- Q_D(const QAudioCaptureSource);
-
- if (d->service != NULL) {
- if (d->audioEndpointSelector && d->audioEndpointSelector->availableEndpoints().size() > 0)
- return true;
- }
- return false;
-}
-
-
-/*!
- Returns a list of available audio inputs
- \since 1.0
-*/
-
-QList<QString> QAudioCaptureSource::audioInputs() const
-{
- Q_D(const QAudioCaptureSource);
-
- QList<QString> list;
- if (d && d->audioEndpointSelector)
- list <<d->audioEndpointSelector->availableEndpoints();
-
- return list;
-}
-
-/*!
- Returns the description of the audio input device with \a name.
- \since 1.0
-*/
-
-QString QAudioCaptureSource::audioDescription(const QString& name) const
-{
- Q_D(const QAudioCaptureSource);
-
- if(d->audioEndpointSelector)
- return d->audioEndpointSelector->endpointDescription(name);
- else
- return QString();
-}
-
-/*!
- Returns the default audio input name.
- \since 1.0
-*/
-
-QString QAudioCaptureSource::defaultAudioInput() const
-{
- Q_D(const QAudioCaptureSource);
-
- if(d->audioEndpointSelector)
- return d->audioEndpointSelector->defaultEndpoint();
- else
- return QString();
-}
-
-/*!
- Returns the active audio input name.
- \since 1.0
-*/
-
-QString QAudioCaptureSource::activeAudioInput() const
-{
- Q_D(const QAudioCaptureSource);
-
- if(d->audioEndpointSelector)
- return d->audioEndpointSelector->activeEndpoint();
- else
- return QString();
-}
-
-/*!
- Set the active audio input to \a name.
- \since 1.0
-*/
-
-void QAudioCaptureSource::setAudioInput(const QString& name)
-{
- Q_D(const QAudioCaptureSource);
-
- if(d->audioEndpointSelector)
- return d->audioEndpointSelector->setActiveEndpoint(name);
-}
-
-/*!
- \fn QAudioCaptureSource::activeAudioInputChanged(const QString& name)
-
- Signal emitted when active audio input changes to \a name.
- \since 1.0
-*/
-
-/*!
- \fn QAudioCaptureSource::availableAudioInputsChanged()
-
- Signal is emitted when the available audio inputs change.
- \since 1.0
-*/
-
-/*!
- \internal
- \since 1.0
-*/
-void QAudioCaptureSource::statusChanged()
-{
- Q_D(QAudioCaptureSource);
-
- if (d->audioEndpointSelector) {
- if (d->audioEndpointSelector->availableEndpoints().size() > 0) {
- d->errorState = QtMultimedia::NoError;
- emit availabilityChanged(true);
- } else {
- d->errorState = QtMultimedia::BusyError;
- emit availabilityChanged(false);
- }
- } else {
- d->errorState = QtMultimedia::ServiceMissingError;
- emit availabilityChanged(false);
- }
-}
-
-#include "moc_qaudiocapturesource.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qaudiocapturesource.h b/src/multimedia/qaudiocapturesource.h
deleted file mode 100644
index 1571b4e..0000000
--- a/src/multimedia/qaudiocapturesource.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOCAPTURESOURCE_H
-#define QAUDIOCAPTURESOURCE_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-
-#include <qaudioformat.h>
-
-#include "qmediarecorder.h"
-#include "qmediacontrol.h"
-#include "qmediaobject.h"
-#include "qmediaservice.h"
-
-#include "qmediaserviceprovider.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioCaptureSourcePrivate;
-
-class Q_MULTIMEDIA_EXPORT QAudioCaptureSource : public QMediaObject
-{
- Q_OBJECT
-
-public:
- QAudioCaptureSource(QObject *parent = 0, QMediaServiceProvider *service = QMediaServiceProvider::defaultServiceProvider());
- ~QAudioCaptureSource();
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- QList<QString> audioInputs() const;
-
- QString audioDescription(const QString& name) const;
- QString defaultAudioInput() const;
- QString activeAudioInput() const;
-
-public Q_SLOTS:
- void setAudioInput(const QString& name);
-
-Q_SIGNALS:
- void activeAudioInputChanged(const QString& name);
- void availableAudioInputsChanged();
-
-private Q_SLOTS:
- void statusChanged();
-
-private:
- Q_DECLARE_PRIVATE(QAudioCaptureSource)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QAUDIOCAPTURESOURCE_H
diff --git a/src/multimedia/qaudioencodercontrol.cpp b/src/multimedia/qaudioencodercontrol.cpp
deleted file mode 100644
index 62fa893..0000000
--- a/src/multimedia/qaudioencodercontrol.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudioencodercontrol.h"
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QAudioEncoderControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- \brief The QAudioEncoderControl class provides access to the settings of a
- media service that performs audio encoding.
-
- If a QMediaService supports encoding audio data it will implement
- QAudioEncoderControl. This control provides information about the limits
- of restricted audio encoder options and allows the selection of a set of
- audio encoder settings as specified in a QAudioEncoderSettings object.
-
- The functionality provided by this control is exposed to application code through the
- QMediaRecorder class.
-
- The interface name of QAudioEncoderControl is \c com.nokia.Qt.QAudioEncoderControl/1.0 as
- defined in QAudioEncoderControl_iid.
-
- \sa QMediaService::requestControl(), QMediaRecorder
-*/
-
-/*!
- \macro QAudioEncoderControl_iid
-
- \c com.nokia.Qt.AudioEncoderControl/1.0
-
- Defines the interface name of the QAudioEncoderControl class.
-
- \relates QAudioEncoderControl
-*/
-
-/*!
- Create a new audio encode control object with the given \a parent.
-*/
-QAudioEncoderControl::QAudioEncoderControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys the audio encode control.
-*/
-QAudioEncoderControl::~QAudioEncoderControl()
-{
-}
-
-/*!
- \fn QAudioEncoderControl::supportedAudioCodecs() const
-
- Returns the list of supported audio codec names.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::codecDescription(const QString &codec) const
-
- Returns description of audio \a codec.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *continuous) const
-
- Returns the list of supported audio sample rates, if known.
-
- If non null audio \a settings parameter is passed,
- the returned list is reduced to sample rates supported with partial settings applied.
-
- It can be used for example to query the list of sample rates, supported by specific audio codec.
-
- If the encoder supports arbitrary sample rates within the supported rates range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::supportedEncodingOptions(const QString &codec) const
-
- Returns the list of \a codec specific audio encoding options.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::encodingOption(const QString &codec, const QString &option) const
-
- Returns the value of audio encoding \a option for \a codec.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::setEncodingOption(const QString &codec, const QString &option, const QVariant &value)
-
- Set the \a codec specific \a option to \a value.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::audioSettings() const
-
- Returns the audio encoder settings.
-
- The returned value may be different tha passed to QAudioEncoderControl::setAudioSettings()
- if the settings contains the default or undefined parameters.
- In this case if the undefined parameters are already resolved, they should be returned.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
-
- Sets the selected audio \a settings.
- \since 1.0
-*/
-
-#include "moc_qaudioencodercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qaudioencodercontrol.h b/src/multimedia/qaudioencodercontrol.h
deleted file mode 100644
index 2e3a4bf..0000000
--- a/src/multimedia/qaudioencodercontrol.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOENCODERCONTROL_H
-#define QAUDIOENCODERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediarecorder.h"
-#include <QtCore/qlist.h>
-#include <QtCore/qpair.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QStringList;
-class QAudioFormat;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT QAudioEncoderControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QAudioEncoderControl();
-
- virtual QStringList supportedAudioCodecs() const = 0;
- virtual QString codecDescription(const QString &codecName) const = 0;
-
- virtual QList<int> supportedSampleRates(const QAudioEncoderSettings &settings,
- bool *continuous = 0) const = 0;
-
- virtual QAudioEncoderSettings audioSettings() const = 0;
- virtual void setAudioSettings(const QAudioEncoderSettings&) = 0;
-
- virtual QStringList supportedEncodingOptions(const QString &codec) const = 0;
- virtual QVariant encodingOption(const QString &codec, const QString &name) const = 0;
- virtual void setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value) = 0;
-
-protected:
- QAudioEncoderControl(QObject *parent = 0);
-};
-
-#define QAudioEncoderControl_iid "com.nokia.Qt.QAudioEncoderControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QAudioEncoderControl, QAudioEncoderControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QAUDIOCAPTUREPROPERTIESCONTROL_H
diff --git a/src/multimedia/qaudioendpointselector.cpp b/src/multimedia/qaudioendpointselector.cpp
deleted file mode 100644
index ba02c8d..0000000
--- a/src/multimedia/qaudioendpointselector.cpp
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudioendpointselector.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAudioEndpointSelector
-
- \brief The QAudioEndpointSelector class provides an audio endpoint selector media control.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- The QAudioEndpointSelector class provides descriptions of the audio
- endpoints available on a system and allows one to be selected as the audio
- of a media service.
-
- The interface name of QAudioEndpointSelector is \c com.nokia.Qt.QAudioEndpointSelector/1.0 as
- defined in QAudioEndpointSelector_iid.
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- \macro QAudioEndpointSelector_iid
-
- \c com.nokia.Qt.QAudioEndpointSelector/1.0
-
- Defines the interface name of the QAudioEndpointSelector class.
-
- \relates QAudioEndpointSelector
-*/
-
-/*!
- Constructs a new audio endpoint selector with the given \a parent.
-*/
-QAudioEndpointSelector::QAudioEndpointSelector(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys an audio endpoint selector.
-*/
-QAudioEndpointSelector::~QAudioEndpointSelector()
-{
-}
-
-/*!
- \fn QList<QString> QAudioEndpointSelector::availableEndpoints() const
-
- Returns a list of the names of the available audio endpoints.
- \since 1.0
-*/
-
-/*!
- \fn QString QAudioEndpointSelector::endpointDescription(const QString& name) const
-
- Returns the description of the endpoint \a name.
- \since 1.0
-*/
-
-/*!
- \fn QString QAudioEndpointSelector::defaultEndpoint() const
-
- Returns the name of the default audio endpoint.
- \since 1.0
-*/
-
-/*!
- \fn QString QAudioEndpointSelector::activeEndpoint() const
-
- Returns the name of the currently selected audio endpoint.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEndpointSelector::setActiveEndpoint(const QString& name)
-
- Set the active audio endpoint to \a name.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEndpointSelector::activeEndpointChanged(const QString& name)
-
- Signals that the audio endpoint has changed to \a name.
- \since 1.0
-*/
-
-/*!
- \fn QAudioEndpointSelector::availableEndpointsChanged()
-
- Signals that list of available endpoints has changed.
- \since 1.0
-*/
-
-#include "moc_qaudioendpointselector.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qaudioendpointselector.h b/src/multimedia/qaudioendpointselector.h
deleted file mode 100644
index 00250bc..0000000
--- a/src/multimedia/qaudioendpointselector.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOENDPOINTSELECTOR_H
-#define QAUDIOENDPOINTSELECTOR_H
-
-#include <qaudio.h>
-#include <qmediacontrol.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QAudioEndpointSelector : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QAudioEndpointSelector();
-
- virtual QList<QString> availableEndpoints() const = 0;
- virtual QString endpointDescription(const QString& name) const = 0;
- virtual QString defaultEndpoint() const = 0;
- virtual QString activeEndpoint() const = 0;
-
-public Q_SLOTS:
- virtual void setActiveEndpoint(const QString& name) = 0;
-
-Q_SIGNALS:
- void activeEndpointChanged(const QString& name);
- void availableEndpointsChanged();
-
-protected:
- QAudioEndpointSelector(QObject *parent = 0);
-};
-
-#define QAudioEndpointSelector_iid "com.nokia.Qt.QAudioEndpointSelector/1.0"
-Q_MEDIA_DECLARE_CONTROL(QAudioEndpointSelector, QAudioEndpointSelector_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QAUDIOENDPOINTSELECTOR_H
diff --git a/src/multimedia/qaudionamespace.qdoc b/src/multimedia/qaudionamespace.qdoc
deleted file mode 100644
index 86300b0..0000000
--- a/src/multimedia/qaudionamespace.qdoc
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** GNU Free Documentation License
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-
-/*!
- \namespace QAudio
- \brief The QAudio namespace contains enums used by the audio classes.
- \inmodule QtMultimedia
- \ingroup multimedia
-*/
-
-/*
- \enum QAudio::Error
-
- Error states
-
- \value NoError No errors have occurred
- \value OpenError An error opening the audio device
- \value IOError An error occurred during read/write of audio device
- \value UnderrunError Audio data is not being fed to the audio device at a fast enough rate
- \value FatalError A non-recoverable error has occurred, the audio device is not usable at this time.
-*/
-
-/*
- \enum QAudio::State
-
- Audio processing states
-
- \value ActiveState Audio data is being processed, this state is set after start() is called
- and while audio data is available to be processed.
- \value SuspendedState The audio device is in a suspended state, this state will only be entered
- after suspend() is called.
- \value StoppedState The audio device is closed, not processing any audio data
- \value IdleState The QIODevice passed in has no data and audio system's buffer is empty, this state
- is set after start() is called and while no audio data is available to be processed.
-*/
-
-/*
- \enum QAudio::Mode
-
- Audio I/O modes
-
- \value AudioOutput audio output device
- \value AudioInput audio input device
-*/
diff --git a/src/multimedia/qcamera.cpp b/src/multimedia/qcamera.cpp
deleted file mode 100644
index fd1fe5b..0000000
--- a/src/multimedia/qcamera.cpp
+++ /dev/null
@@ -1,1035 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideosurfaceoutput_p.h"
-#include "qmediaobject_p.h"
-
-#include <qcamera.h>
-#include <qcameracontrol.h>
-#include <qcameralockscontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qmediarecordercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qvideodevicecontrol.h>
-
-#include <QDebug>
-
-QT_USE_NAMESPACE
-
-namespace
-{
-class CameraRegisterMetaTypes
-{
-public:
- CameraRegisterMetaTypes()
- {
- qRegisterMetaType<QCamera::Error>("QCamera::Error");
- qRegisterMetaType<QCamera::State>("QCamera::State");
- qRegisterMetaType<QCamera::Status>("QCamera::Status");
- qRegisterMetaType<QCamera::CaptureMode>("QCamera::CaptureMode");
- qRegisterMetaType<QCamera::LockType>("QCamera::LockType");
- qRegisterMetaType<QCamera::LockStatus>("QCamera::LockStatus");
- qRegisterMetaType<QCamera::LockChangeReason>("QCamera::LockChangeReason");
- }
-} _registerCameraMetaTypes;
-}
-
-
-/*!
- \class QCamera
-
-
- \brief The QCamera class provides interface for system camera devices.
-
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
- QCamera can be used with QVideoWidget for viewfinder display,
- QMediaRecorder for video recording and QCameraImageCapture for image taking.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Request control
-
-*/
-
-
-class QCameraPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCamera)
-public:
- QCameraPrivate():
- QMediaObjectPrivate(),
- provider(0),
- control(0),
- deviceControl(0),
- viewfinder(0),
- capture(0),
- state(QCamera::UnloadedState),
- error(QCamera::NoError),
- supportedLocks(QCamera::NoLock),
- requestedLocks(QCamera::NoLock),
- lockStatus(QCamera::Unlocked),
- lockChangeReason(QCamera::UserRequest),
- supressLockChangedSignal(false),
- restartPending(false)
- {
- }
-
- void initControls();
-
- QMediaServiceProvider *provider;
-
- QCameraControl *control;
- QVideoDeviceControl *deviceControl;
- QCameraLocksControl *locksControl;
-
- QCameraExposure *cameraExposure;
- QCameraFocus *cameraFocus;
- QCameraImageProcessing *imageProcessing;
-
- QObject *viewfinder;
- QObject *capture;
-
- QCamera::State state;
-
- QCamera::Error error;
- QString errorString;
-
- QCamera::LockTypes supportedLocks;
- QCamera::LockTypes requestedLocks;
-
- QCamera::LockStatus lockStatus;
- QCamera::LockChangeReason lockChangeReason;
- bool supressLockChangedSignal;
-
- bool restartPending;
-
- QVideoSurfaceOutput surfaceViewfinder;
-
- void _q_error(int error, const QString &errorString);
- void unsetError() { error = QCamera::NoError; errorString.clear(); }
-
- void setState(QCamera::State);
-
- void _q_updateLockStatus(QCamera::LockType, QCamera::LockStatus, QCamera::LockChangeReason);
- void _q_updateState(QCamera::State newState);
- void _q_preparePropertyChange(int changeType);
- void _q_restartCamera();
- void updateLockStatus();
-};
-
-
-void QCameraPrivate::_q_error(int error, const QString &errorString)
-{
- Q_Q(QCamera);
-
- this->error = QCamera::Error(error);
- this->errorString = errorString;
-
- qWarning() << "Camera error:" << errorString;
-
- emit q->error(this->error);
-}
-
-void QCameraPrivate::setState(QCamera::State newState)
-{
- Q_Q(QCamera);
-
- unsetError();
-
- if (!control) {
- _q_error(QCamera::ServiceMissingError, q_ptr->tr("The camera service is missing"));
- return;
- }
-
- if (state == newState)
- return;
-
- restartPending = false;
- state = newState;
- control->setState(state);
- emit q->stateChanged(state);
-}
-
-void QCameraPrivate::_q_updateState(QCamera::State newState)
-{
- Q_Q(QCamera);
-
- //omit changins state to Loaded when the camera is temporarily
- //stopped to apply shanges
- if (restartPending)
- return;
-
- if (newState != state) {
- qDebug() << "Camera state changed:" << newState;
- state = newState;
- emit q->stateChanged(state);
- }
-}
-
-void QCameraPrivate::_q_preparePropertyChange(int changeType)
-{
- if (!control)
- return;
-
- QCamera::Status status = control->status();
-
- //all the changes are allowed until the camera is starting
- if (control->state() != QCamera::ActiveState)
- return;
-
- if (control->canChangeProperty(QCameraControl::PropertyChangeType(changeType), status))
- return;
-
- restartPending = true;
- control->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(q_ptr, "_q_restartCamera", Qt::QueuedConnection);
-}
-
-void QCameraPrivate::_q_restartCamera()
-{
- if (restartPending) {
- restartPending = false;
- control->setState(QCamera::ActiveState);
- }
-}
-
-void QCameraPrivate::initControls()
-{
- Q_Q(QCamera);
-
- supportedLocks = 0;
-
- if (service) {
- control = qobject_cast<QCameraControl *>(service->requestControl(QCameraControl_iid));
- locksControl = qobject_cast<QCameraLocksControl *>(service->requestControl(QCameraLocksControl_iid));
- deviceControl = qobject_cast<QVideoDeviceControl*>(service->requestControl(QVideoDeviceControl_iid));
-
- if (control) {
- q->connect(control, SIGNAL(stateChanged(QCamera::State)), q, SLOT(_q_updateState(QCamera::State)));
- q->connect(control, SIGNAL(statusChanged(QCamera::Status)), q, SIGNAL(statusChanged(QCamera::Status)));
- q->connect(control, SIGNAL(captureModeChanged(QCamera::CaptureMode)),
- q, SIGNAL(captureModeChanged(QCamera::CaptureMode)));
- q->connect(control, SIGNAL(error(int,QString)), q, SLOT(_q_error(int,QString)));
-
- }
-
- if (locksControl) {
- q->connect(locksControl, SIGNAL(lockStatusChanged(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)),
- q, SLOT(_q_updateLockStatus(QCamera::LockType,QCamera::LockStatus,QCamera::LockChangeReason)));
- supportedLocks = locksControl->supportedLocks();
- }
-
- error = QCamera::NoError;
- } else {
- control = 0;
- locksControl = 0;
- deviceControl = 0;
-
- error = QCamera::ServiceMissingError;
- errorString = QCamera::tr("The camera service is missing");
- }
-}
-
-void QCameraPrivate::updateLockStatus()
-{
- Q_Q(QCamera);
-
- QCamera::LockStatus oldStatus = lockStatus;
-
- QMap<QCamera::LockStatus, int> lockStatusPriority;
- lockStatusPriority.insert(QCamera::Locked, 1);
- lockStatusPriority.insert(QCamera::Searching, 2);
- lockStatusPriority.insert(QCamera::Unlocked, 3);
-
- lockStatus = requestedLocks ? QCamera::Locked : QCamera::Unlocked;
- int priority = 0;
-
- QList<QCamera::LockStatus> lockStatuses;
-
- if (requestedLocks & QCamera::LockFocus)
- lockStatuses << q->lockStatus(QCamera::LockFocus);
-
- if (requestedLocks & QCamera::LockExposure)
- lockStatuses << q->lockStatus(QCamera::LockExposure);
-
- if (requestedLocks & QCamera::LockWhiteBalance)
- lockStatuses << q->lockStatus(QCamera::LockWhiteBalance);
-
-
- foreach (QCamera::LockStatus currentStatus, lockStatuses) {
- int currentPriority = lockStatusPriority.value(currentStatus, -1);
- if (currentPriority > priority) {
- priority = currentPriority;
- lockStatus = currentStatus;
- }
- }
-
- if (!supressLockChangedSignal && oldStatus != lockStatus) {
- emit q->lockStatusChanged(lockStatus, lockChangeReason);
-
- if (lockStatus == QCamera::Locked)
- emit q->locked();
- else if (lockStatus == QCamera::Unlocked && lockChangeReason == QCamera::LockFailed)
- emit q->lockFailed();
- }
-/*
- qDebug() << "Requested locks:" << (requestedLocks & QCamera::LockExposure ? 'e' : ' ')
- << (requestedLocks & QCamera::LockFocus ? 'f' : ' ')
- << (requestedLocks & QCamera::LockWhiteBalance ? 'w' : ' ');
- qDebug() << "Lock status: f:" << q->lockStatus(QCamera::LockFocus)
- << " e:" << q->lockStatus(QCamera::LockExposure)
- << " w:" << q->lockStatus(QCamera::LockWhiteBalance)
- << " composite:" << lockStatus;
-*/
-}
-
-void QCameraPrivate::_q_updateLockStatus(QCamera::LockType type, QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- Q_Q(QCamera);
- lockChangeReason = reason;
- updateLockStatus();
- emit q->lockStatusChanged(type, status, reason);
-}
-
-
-/*!
- Construct a QCamera from service \a provider and \a parent.
-*/
-
-QCamera::QCamera(QObject *parent, QMediaServiceProvider *provider):
- QMediaObject(*new QCameraPrivate, parent, provider->requestService(Q_MEDIASERVICE_CAMERA))
-{
- Q_D(QCamera);
- d->provider = provider;
- d->initControls();
- d->cameraExposure = new QCameraExposure(this);
- d->cameraFocus = new QCameraFocus(this);
- d->imageProcessing = new QCameraImageProcessing(this);
-}
-
-/*!
- Construct a QCamera from device name \a device and \a parent.
-*/
-
-QCamera::QCamera(const QByteArray& device, QObject *parent):
- QMediaObject(*new QCameraPrivate, parent,
- QMediaServiceProvider::defaultServiceProvider()->requestService(Q_MEDIASERVICE_CAMERA, QMediaServiceProviderHint(device)))
-{
- Q_D(QCamera);
- d->provider = QMediaServiceProvider::defaultServiceProvider();
- d->initControls();
-
- if (d->service != 0) {
- //pass device name to service
- if (d->deviceControl) {
- QString deviceName = QString::fromLatin1(device);
-
- for (int i=0; i<d->deviceControl->deviceCount(); i++) {
- if (d->deviceControl->deviceName(i) == deviceName) {
- d->deviceControl->setSelectedDevice(i);
- break;
- }
- }
- }
- }
-
- d->cameraExposure = new QCameraExposure(this);
- d->cameraFocus = new QCameraFocus(this);
- d->imageProcessing = new QCameraImageProcessing(this);
-}
-
-/*!
- Destroys the camera object.
-*/
-
-QCamera::~QCamera()
-{
- Q_D(QCamera);
- delete d->cameraExposure;
- d->cameraExposure = 0;
- delete d->cameraFocus;
- d->cameraFocus = 0;
- delete d->imageProcessing;
- d->imageProcessing = 0;
-
- if (d->service) {
- if (d->control)
- d->service->releaseControl(d->control);
- if (d->locksControl)
- d->service->releaseControl(d->locksControl);
- if (d->deviceControl)
- d->service->releaseControl(d->deviceControl);
-
- d->provider->releaseService(d->service);
- }
-}
-
-
-/*!
- Return true if the camera service is ready to use.
- \since 1.1
-*/
-bool QCamera::isAvailable() const
-{
- return availabilityError() == QtMultimedia::NoError;
-}
-
-/*!
- Returns the error state of the camera service.
- \since 1.1
-*/
-
-QtMultimedia::AvailabilityError QCamera::availabilityError() const
-{
- Q_D(const QCamera);
- if (d->control == NULL)
- return QtMultimedia::ServiceMissingError;
-
- if (d->deviceControl && d->deviceControl->deviceCount() == 0)
- return QtMultimedia::ResourceError;
-
- if (d->error != QCamera::NoError)
- return QtMultimedia::ResourceError;
-
- return QtMultimedia::NoError;
-}
-
-
-/*!
- Returns the camera exposure control object.
- \since 1.1
-*/
-QCameraExposure *QCamera::exposure() const
-{
- return d_func()->cameraExposure;
-}
-
-/*!
- Returns the camera focus control object.
- \since 1.1
-*/
-QCameraFocus *QCamera::focus() const
-{
- return d_func()->cameraFocus;
-}
-
-/*!
- Returns the camera image processing control object.
- \since 1.1
-*/
-QCameraImageProcessing *QCamera::imageProcessing() const
-{
- return d_func()->imageProcessing;
-}
-
-/*!
- Sets the QVideoWidget based camera \a viewfinder.
- The previously set viewfinder is detached.
- \since 1.1
-*/
-
-// QVideoWidget is forward declared
-void QCamera::setViewfinder(QVideoWidget *viewfinder)
-{
- Q_D(QCamera);
- d->_q_preparePropertyChange(QCameraControl::Viewfinder);
-
- if (d->viewfinder)
- unbind(d->viewfinder);
-
- // We don't know (in this library) that QVideoWidget inherits QObject
- QObject *viewFinderObject = reinterpret_cast<QObject*>(viewfinder);
-
- d->viewfinder = viewFinderObject && bind(viewFinderObject) ? viewFinderObject : 0;
-}
-
-/*!
- Sets the QGraphicsVideoItem based camera \a viewfinder.
- The previously set viewfinder is detached.
- \since 1.1
-*/
-// QGraphicsVideoItem is forward declared
-void QCamera::setViewfinder(QGraphicsVideoItem *viewfinder)
-{
- Q_D(QCamera);
- d->_q_preparePropertyChange(QCameraControl::Viewfinder);
-
- if (d->viewfinder)
- unbind(d->viewfinder);
-
- // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject
- // but QObject inheritance depends on QObject coming first, so try this out.
- QObject *viewFinderObject = reinterpret_cast<QObject*>(viewfinder);
-
- d->viewfinder = viewFinderObject && bind(viewFinderObject) ? viewFinderObject : 0;
-}
-
-/*!
- Sets a video \a surface as the viewfinder of a camera.
-
- If a viewfinder has already been set on the camera the new surface
- will replace it.
- \since 1.2
-*/
-
-void QCamera::setViewfinder(QAbstractVideoSurface *surface)
-{
- Q_D(QCamera);
-
- d->surfaceViewfinder.setVideoSurface(surface);
-
- if (d->viewfinder != &d->surfaceViewfinder) {
- if (d->viewfinder)
- unbind(d->viewfinder);
-
- d->viewfinder = bind(&d->surfaceViewfinder) ? &d->surfaceViewfinder : 0;
- }
-}
-
-/*!
- Returns the error state of the object.
- \since 1.1
-*/
-
-QCamera::Error QCamera::error() const
-{
- return d_func()->error;
-}
-
-/*!
- Returns a string describing a camera's error state.
- \since 1.1
-*/
-QString QCamera::errorString() const
-{
- return d_func()->errorString;
-}
-
-
-/*!
- Returns true if the capture \a mode is suported.
- \since 1.1
-*/
-bool QCamera::isCaptureModeSupported(QCamera::CaptureMode mode) const
-{
- return d_func()->control ? d_func()->control->isCaptureModeSupported(mode) : false;
-}
-
-/*!
- \property QCamera::captureMode
-
- The type of media (video or still images),
- the camera is configured to capture.
-
- It's allowed to change capture mode in any camera state,
- but if the camera is currently active,
- chaging capture mode is likely to lead to camera status
- chaged to QCamera::LoadedStatus, QCamera::LoadingStatus,
- and when the camera is ready to QCamera::ActiveStatus.
- \since 1.1
-*/
-
-QCamera::CaptureMode QCamera::captureMode() const
-{
- return d_func()->control ? d_func()->control->captureMode() : QCamera::CaptureStillImage;
-}
-
-void QCamera::setCaptureMode(QCamera::CaptureMode mode)
-{
- Q_D(QCamera);
-
- if (mode != captureMode()) {
- if (d->control) {
- d->_q_preparePropertyChange(QCameraControl::CaptureMode);
- d->control->setCaptureMode(mode);
- }
- }
-}
-
-
-/*!
- Starts the camera.
-
- State is changed to QCamera::ActiveState if camera is started
- successfully, otherwise error() signal is emitted.
-
- While the camera state is changed to QCamera::ActiveState,
- starting the camera service can be asynchronous with the actual
- status reported with QCamera::status property.
- \since 1.1
-*/
-void QCamera::start()
-{
- Q_D(QCamera);
- d->setState(QCamera::ActiveState);
-}
-
-/*!
- Stops the camera.
- The camera state is changed from QCamera::ActiveState to QCamera::LoadedState.
- \since 1.1
-*/
-void QCamera::stop()
-{
- Q_D(QCamera);
- d->setState(QCamera::LoadedState);
-}
-
-/*!
- Open the camera device.
- The camera state is changed to QCamera::LoadedStatus.
-
- It's not necessary to explcitly load the camera,
- unless unless the application have to read the supported camera
- settings and change the default depending on the camera capabilities.
-
- In all the other cases it's possible to start the camera directly
- from unloaded state.
- \since 1.1
-*/
-void QCamera::load()
-{
- Q_D(QCamera);
- d->setState(QCamera::LoadedState);
-}
-
-/*!
- Close the camera device and deallocate the related resources.
- The camera state is changed to QCamera::UnloadedStatus.
- \since 1.1
-*/
-void QCamera::unload()
-{
- Q_D(QCamera);
- d->setState(QCamera::UnloadedState);
-}
-
-
-/*!
- Returns a list of camera device's available from the default service provider.
- \since 1.1
-*/
-
-QList<QByteArray> QCamera::availableDevices()
-{
- return QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA));
-}
-
-/*!
- Returns the description of the \a device.
- \since 1.1
-*/
-
-QString QCamera::deviceDescription(const QByteArray &device)
-{
- return QMediaServiceProvider::defaultServiceProvider()->deviceDescription(QByteArray(Q_MEDIASERVICE_CAMERA), device);
-}
-
-QCamera::State QCamera::state() const
-{
- return d_func()->state;
-}
-
-QCamera::Status QCamera::status() const
-{
- if(d_func()->control)
- return (QCamera::Status)d_func()->control->status();
-
- return QCamera::UnavailableStatus;
-}
-
-
-/*!
- Returns the lock types, camera supports.
- \since 1.1
-*/
-QCamera::LockTypes QCamera::supportedLocks() const
-{
- return d_func()->supportedLocks;
-}
-
-/*!
- Returns the requested lock types.
- \since 1.1
-*/
-QCamera::LockTypes QCamera::requestedLocks() const
-{
- return d_func()->requestedLocks;
-}
-
-/*!
- Returns the status of requested camera settings locks.
- \since 1.1
-*/
-QCamera::LockStatus QCamera::lockStatus() const
-{
- return d_func()->lockStatus;
-}
-
-/*!
- Returns the status of camera settings \a lock.
- \since 1.1
-*/
-QCamera::LockStatus QCamera::lockStatus(QCamera::LockType lockType) const
-{
- const QCameraPrivate *d = d_func();
-
- if (!(lockType & d->supportedLocks))
- return lockType & d->requestedLocks ? QCamera::Locked : QCamera::Unlocked;
-
- if (!(lockType & d->requestedLocks))
- return QCamera::Unlocked;
-
- if (d->locksControl)
- return d->locksControl->lockStatus(lockType);
-
- return QCamera::Unlocked;
-}
-
-/*!
- \fn void QCamera::searchAndLock(QCamera::LockTypes locks)
-
- Locks the camera settings with the requested \a locks, including focusing in the single autofocus mode,
- exposure and white balance if the exposure and white balance modes are not manual.
-
- The camera settings are usually locked before taking one or multiple still images,
- in responce to the shutter button being half pressed.
-
- The QCamera::locked() signal is emitted when camera settings are successfully locked,
- otherwise QCamera::lockFailed() is emitted.
-
- QCamera also emits lockStatusChanged(QCamera::LockType, QCamera::LockStatus)
- on individual lock status changes and lockStatusChanged(QCamera::LockStatus) signal on composite status changes.
-
- Locking serves two roles: it initializes calculation of automatic parameter
- (focusing, calculating the correct exposure and white balance) and allows
- to keep some or all of those parameters during number of shots.
-
- If the camera doesn't support keeping one of parameters between shots, the related
- lock state changes to QCamera::Unlocked.
-
- It's also acceptable to relock already locked settings,
- depending on the lock parameter this initiates new focusing, exposure or white balance calculation.
- \since 1.1
- */
-void QCamera::searchAndLock(QCamera::LockTypes locks)
-{
- Q_D(QCamera);
-
- QCamera::LockStatus oldStatus = d->lockStatus;
- d->supressLockChangedSignal = true;
-
- d->requestedLocks |= locks;
-
- locks &= d->supportedLocks;
-
- if (d->locksControl)
- d->locksControl->searchAndLock(locks);
-
- d->supressLockChangedSignal = false;
-
- d->lockStatus = oldStatus;
- d->updateLockStatus();
-}
-
-/*!
- Lock all the supported camera settings.
- \since 1.1
- */
-void QCamera::searchAndLock()
-{
- searchAndLock(LockExposure | LockWhiteBalance | LockFocus);
-}
-
-/*!
- Unlocks the camera settings specified with \a locks or cancel the current locking if one is active.
- \since 1.1
- */
-void QCamera::unlock(QCamera::LockTypes locks)
-{
- Q_D(QCamera);
-
- QCamera::LockStatus oldStatus = d->lockStatus;
- d->supressLockChangedSignal = true;
-
- d->requestedLocks &= ~locks;
-
- locks &= d->supportedLocks;
-
- if (d->locksControl)
- d->locksControl->unlock(locks);
-
- d->supressLockChangedSignal = false;
-
- d->lockStatus = oldStatus;
- d->updateLockStatus();
-}
-
-/*!
- Unlock all the requested camera locks.
- \since 1.1
- */
-void QCamera::unlock()
-{
- unlock(d_func()->requestedLocks);
-}
-
-
-/*!
- \enum QCamera::State
- \value UnloadedState
- The initial camera state, with camera not loaded,
- the camera capabilities except of supported capture modes
- are unknown.
-
- While the supported settings are unknown in this state,
- it's allowed to set the camera capture settings like codec,
- resolution, or frame rate.
-
- \value LoadedState
- The camera is loaded and ready to be configured.
-
- In the Idle state it's allowed to query camera capabilities,
- set capture resolution, codecs, etc.
-
- The viewfinder is not active in the loaded state.
-
- \value ActiveState
- In the active state as soon as camera is started
- the viewfinder displays video frames and the
- camera is ready for capture.
-*/
-
-
-/*!
- \property QCamera::state
- \brief The current state of the camera object.
- \since 1.1
-*/
-
-/*!
- \enum QCamera::Status
- \value ActiveStatus
- The camera has been started and can produce data.
- The viewfinder displays video frames in active state.
-
- Depending on backend, changing some camera settings like
- capture mode, codecs or resolution in ActiveState may lead
- to changing the camera status to LoadedStatus and StartingStatus while
- the settings are applied and back to ActiveStatus when the camera is ready.
-
- \value StartingStatus
- The camera is starting in result of state transition to QCamera::ActiveState.
- The camera service is not ready to capture yet.
-
- \value StandbyStatus
- The camera is in the power saving standby mode.
- The camera may come to the standby mode after some time of inactivity
- in the QCamera::LoadedState state.
-
- \value LoadedStatus
- The camera is loaded and ready to be configured.
- This status indicates the camera device is opened and
- it's possible to query for supported image and video capture settings,
- like resolution, framerate and codecs.
-
- \value LoadingStatus
- The camera device loading in result of state transition from
- QCamera::UnloadedState to QCamera::LoadedState or QCamera::ActiveState.
-
- \value UnloadedStatus
- The initial camera status, with camera not loaded.
- The camera capabilities including supported capture settings may be unknown.
-
- \value UnavailableStatus
- The camera or camera backend is not available.
-*/
-
-
-/*!
- \property QCamera::status
- \brief The current status of the camera object.
- \since 1.1
-*/
-
-
-/*!
- \enum QCamera::CaptureMode
- \value CaptureStillImage Camera is configured for still frames capture.
- \value CaptureVideo Camera is configured for video capture.
- \since 1.1
-*/
-
-/*!
- \enum QCamera::LockType
-
- \value NoLock
- \value LockExposure
- Lock camera exposure.
- \value LockWhiteBalance
- Lock the white balance.
- \value LockFocus
- Lock camera focus.
-*/
-
-
-/*!
- \property QCamera::lockStatus
- \brief The overall status for all the requested camera locks.
- \since 1.1
-*/
-
-/*!
- \fn void QCamera::locked()
-
- Signals all the requested camera settings are locked.
- \since 1.1
-*/
-
-/*!
- \fn void QCamera::lockFailed()
-
- Signals locking of at least one requested camera settings failed.
- \since 1.1
-*/
-
-/*!
- \fn QCamera::lockStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-
- Signals the overall \a status for all the requested camera locks was changed with specified \a reason.
- \since 1.1
-*/
-
-/*!
- \fn QCamera::lockStatusChanged(QCamera::LockType lock, QCamera::LockStatus status, QCamera::LockChangeReason reason)
- Signals the \a lock \a status was changed with specified \a reason.
- \since 1.1
-*/
-
-/*!
- \enum QCamera::LockStatus
- \value Unlocked
- The application is not interested in camera settings value.
- The camera may keep this parameter without changes, this is common with camera focus,
- or adjust exposure and white balance constantly to keep the viewfinder image nice.
-
- \value Searching
- The application has requested the camera focus, exposure or white balance lock with
- QCamera::searchAndLock(). This state indicates the camera is focusing or calculating exposure and white balance.
-
- \value Locked
- The camera focus, exposure or white balance is locked.
- The camera is ready to capture, application may check the exposure parameters.
-
- The locked state usually means the requested parameter stays the same,
- except of the cases when the parameter is requested to be constantly updated.
- For example in continuous focusing mode, the focus is considered locked as long
- and the object is in focus, even while the actual focusing distance may be constantly changing.
-*/
-
-/*!
- \enum QCamera::LockChangeReason
-
- \value UserRequest
- The lock status changed in result of user request, usually to unlock camera settings.
- \value LockAcquired
- The lock status successfuly changed to QCamera::Locked.
- \value LockFailed
- The camera failed to acquire the requested lock in result of
- autofocus failure, exposure out of supported range, etc.
- \value LockLost
- The camera is not able to maintain the requested lock any more.
- Lock status is changed to QCamera::Unlocked.
- \value LockTemporaryLost
- The lock is lost, but the camera is working hard to reacquire it.
- This value may be used in continuous focusing mode,
- when the camera loses the focus, the focus lock state is changed to Qcamera::Searching
- with LockTemporaryLost reason.
-*/
-
-/*!
- \enum QCamera::Error
-
- \value NoError No errors have occurred.
- \value CameraError An error has occurred.
- \value InvalidRequestError System resource doesn't support requested functionality.
- \value ServiceMissingError No camera service available.
- \value NotSupportedFeatureError The feature is not supported.
-*/
-
-/*!
- \fn void QCamera::error(QCamera::Error value)
-
- Signal emitted when error state changes to \a value.
- \since 1.1
-*/
-
-/*!
- \fn void QCamera::captureModeChanged(QCamera::CaptureMode mode)
-
- Signals the capture \a mode has changed.
- \since 1.1
-*/
-
-/*!
- \fn QCamera::stateChanged(QCamera::State state)
-
- Signals the camera \a state has changed.
-
- Usually the state changes is caused by calling
- load(), unload(), start() and stop(),
- but the state can also be changed change as a result of camera error.
- \since 1.1
-*/
-
-/*!
- \fn QCamera::statusChanged(QCamera::Status status)
-
- Signals the camera \a status has changed.
-
- \since 1.1
-*/
-
-
-#include "moc_qcamera.cpp"
diff --git a/src/multimedia/qcamera.h b/src/multimedia/qcamera.h
deleted file mode 100644
index da009e1..0000000
--- a/src/multimedia/qcamera.h
+++ /dev/null
@@ -1,238 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERA_H
-#define QCAMERA_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qrect.h>
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-
-#include <qcameraexposure.h>
-#include <qcamerafocus.h>
-#include <qcameraimageprocessing.h>
-
-#include <qmediaserviceprovider.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoSurface;
-class QVideoWidget;
-class QGraphicsVideoItem;
-
-class QCameraPrivate;
-class Q_MULTIMEDIA_EXPORT QCamera : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(QCamera::State state READ state NOTIFY stateChanged)
- Q_PROPERTY(QCamera::Status status READ status NOTIFY statusChanged)
- Q_PROPERTY(QCamera::CaptureMode captureMode READ captureMode WRITE setCaptureMode NOTIFY captureModeChanged)
- Q_PROPERTY(QCamera::LockStatus lockStatus READ lockStatus NOTIFY lockStatusChanged)
-
- Q_ENUMS(Status)
- Q_ENUMS(State)
- Q_ENUMS(CaptureMode)
- Q_ENUMS(Error)
- Q_ENUMS(LockStatus)
- Q_ENUMS(LockChangeReason)
- Q_ENUMS(LockType)
-public:
- enum Status {
- UnavailableStatus,
- UnloadedStatus,
- LoadingStatus,
- LoadedStatus,
- StandbyStatus,
- StartingStatus,
- ActiveStatus
- };
-
- enum State {
- UnloadedState,
- LoadedState,
- ActiveState
- };
-
- enum CaptureMode
- {
- CaptureStillImage,
- CaptureVideo
- };
-
- enum Error
- {
- NoError,
- CameraError,
- InvalidRequestError,
- ServiceMissingError,
- NotSupportedFeatureError
- };
-
- enum LockStatus
- {
- Unlocked,
- Searching,
- Locked
- };
-
- enum LockChangeReason {
- UserRequest,
- LockAcquired,
- LockFailed,
- LockLost,
- LockTemporaryLost
- };
-
- enum LockType
- {
- NoLock = 0,
- LockExposure = 0x01,
- LockWhiteBalance = 0x02,
- LockFocus = 0x04
- };
- Q_DECLARE_FLAGS(LockTypes, LockType)
-
- QCamera(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
- QCamera(const QByteArray& device, QObject *parent = 0);
- ~QCamera();
-
- static QList<QByteArray> availableDevices();
- static QString deviceDescription(const QByteArray &device);
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- State state() const;
- Status status() const;
-
- CaptureMode captureMode() const;
- bool isCaptureModeSupported(CaptureMode mode) const;
-
- QCameraExposure *exposure() const;
- QCameraFocus *focus() const;
- QCameraImageProcessing *imageProcessing() const;
-
- void setViewfinder(QVideoWidget *viewfinder);
- void setViewfinder(QGraphicsVideoItem *viewfinder);
- void setViewfinder(QAbstractVideoSurface *surface);
-
- Error error() const;
- QString errorString() const;
-
- QCamera::LockTypes supportedLocks() const;
- QCamera::LockTypes requestedLocks() const;
-
- QCamera::LockStatus lockStatus() const;
- QCamera::LockStatus lockStatus(QCamera::LockType lock) const;
-
-public Q_SLOTS:
- void setCaptureMode(QCamera::CaptureMode mode);
-
- void load();
- void unload();
-
- void start();
- void stop();
-
- void searchAndLock();
- void unlock();
-
- void searchAndLock(QCamera::LockTypes locks);
- void unlock(QCamera::LockTypes locks);
-
-Q_SIGNALS:
- void stateChanged(QCamera::State);
- void captureModeChanged(QCamera::CaptureMode);
- void statusChanged(QCamera::Status);
-
- void locked();
- void lockFailed();
-
- void lockStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason);
- void lockStatusChanged(QCamera::LockType, QCamera::LockStatus, QCamera::LockChangeReason);
-
- void error(QCamera::Error);
-
-private:
- Q_DISABLE_COPY(QCamera)
- Q_DECLARE_PRIVATE(QCamera)
- Q_PRIVATE_SLOT(d_func(), void _q_preparePropertyChange(int))
- Q_PRIVATE_SLOT(d_func(), void _q_restartCamera())
- Q_PRIVATE_SLOT(d_func(), void _q_error(int, const QString &))
- Q_PRIVATE_SLOT(d_func(), void _q_updateLockStatus(QCamera::LockType, QCamera::LockStatus, QCamera::LockChangeReason))
- Q_PRIVATE_SLOT(d_func(), void _q_updateState(QCamera::State))
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCamera::LockTypes)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCamera::State)
-Q_DECLARE_METATYPE(QCamera::Status)
-Q_DECLARE_METATYPE(QCamera::Error)
-Q_DECLARE_METATYPE(QCamera::CaptureMode)
-Q_DECLARE_METATYPE(QCamera::LockType)
-Q_DECLARE_METATYPE(QCamera::LockStatus)
-Q_DECLARE_METATYPE(QCamera::LockChangeReason)
-
-Q_MEDIA_ENUM_DEBUG(QCamera, State)
-Q_MEDIA_ENUM_DEBUG(QCamera, Status)
-Q_MEDIA_ENUM_DEBUG(QCamera, Error)
-Q_MEDIA_ENUM_DEBUG(QCamera, CaptureMode)
-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/qcameracapturebufferformatcontrol.cpp b/src/multimedia/qcameracapturebufferformatcontrol.cpp
deleted file mode 100644
index 536c8b3..0000000
--- a/src/multimedia/qcameracapturebufferformatcontrol.cpp
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameracapturebufferformatcontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraCaptureBufferFormatControl
-
- \brief The QCameraCaptureBufferFormatControl class provides a control for setting the capture buffer format.
-
- The format is of type QVideoFrame::PixelFormat.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
-
- The interface name of QCameraCaptureBufferFormatControl is \c com.nokia.Qt.QCameraCaptureBufferFormatControl/1.0 as
- defined in QCameraCaptureBufferFormatControl_iid.
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- \macro QCameraCaptureBufferFormatControl_iid
-
- \c com.nokia.Qt.QCameraCaptureBufferFormatControl/1.0
-
- Defines the interface name of the QCameraCaptureBufferFormatControl class.
-
- \relates QCameraCaptureBufferFormatControl
-*/
-
-/*!
- Constructs a new image buffer capture format control object with the given \a parent
-*/
-QCameraCaptureBufferFormatControl::QCameraCaptureBufferFormatControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys an image buffer capture format control.
-*/
-QCameraCaptureBufferFormatControl::~QCameraCaptureBufferFormatControl()
-{
-}
-
-/*!
- \fn QCameraCaptureBufferFormatControl::supportedBufferFormats() const
-
- Returns the list of the supported buffer capture formats.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureBufferFormatControl::bufferFormat() const
-
- Returns the current buffer capture format.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureBufferFormatControl::setBufferFormat(QVideoFrame::PixelFormat format)
-
- Sets the buffer capture \a format.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureBufferFormatControl::bufferFormatChanged(QVideoFrame::PixelFormat format)
-
- Signals the buffer image capture format changed to \a format.
- \since 1.2
-*/
-
-#include "moc_qcameracapturebufferformatcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameracapturebufferformatcontrol.h b/src/multimedia/qcameracapturebufferformatcontrol.h
deleted file mode 100644
index 81079a7..0000000
--- a/src/multimedia/qcameracapturebufferformatcontrol.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERACAPTUREBUFFERFORMATCONTROL_H
-#define QCAMERACAPTUREBUFFERFORMATCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qcameraimagecapture.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraCaptureBufferFormatControl : public QMediaControl
-{
- Q_OBJECT
-public:
- ~QCameraCaptureBufferFormatControl();
-
- virtual QList<QVideoFrame::PixelFormat> supportedBufferFormats() const = 0;
- virtual QVideoFrame::PixelFormat bufferFormat() const = 0;
- virtual void setBufferFormat(QVideoFrame::PixelFormat format) = 0;
-
-Q_SIGNALS:
- void bufferFormatChanged(QVideoFrame::PixelFormat);
-
-protected:
- QCameraCaptureBufferFormatControl(QObject* parent = 0);
-};
-
-#define QCameraCaptureBufferFormatControl_iid "com.nokia.Qt.QCameraCaptureBufferFormatControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraCaptureBufferFormatControl, QCameraCaptureBufferFormatControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
-
diff --git a/src/multimedia/qcameracapturedestinationcontrol.cpp b/src/multimedia/qcameracapturedestinationcontrol.cpp
deleted file mode 100644
index 5072ae7..0000000
--- a/src/multimedia/qcameracapturedestinationcontrol.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameracapturedestinationcontrol.h>
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraCaptureDestinationControl
-
- \brief The QCameraCaptureDestinationControl class provides a control for setting capture destination.
-
- Depending on backend capabilities capture to file, buffer or both can be supported.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
-
-
-
- The interface name of QCameraCaptureDestinationControl is \c com.nokia.Qt.QCameraCaptureDestinationControl/1.0 as
- defined in QCameraCaptureDestinationControl_iid.
-
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- \macro QCameraCaptureDestinationControl_iid
-
- \c com.nokia.Qt.QCameraCaptureDestinationControl/1.0
-
- Defines the interface name of the QCameraCaptureDestinationControl class.
-
- \relates QCameraCaptureDestinationControl
-*/
-
-/*!
- Constructs a new image capture destination control object with the given \a parent
-*/
-QCameraCaptureDestinationControl::QCameraCaptureDestinationControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys an image capture destination control.
-*/
-QCameraCaptureDestinationControl::~QCameraCaptureDestinationControl()
-{
-}
-
-/*!
- \fn QCameraCaptureDestinationControl::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
-
- Returns true if the capture \a destination is supported; and false if it is not.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureDestinationControl::captureDestination() const
-
- Returns the current capture \a destination. The default destination is QCameraImageCapture::CaptureToFile.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureDestinationControl::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
-
- Sets the capture \a destination.
- \since 1.2
-*/
-
-/*!
- \fn QCameraCaptureDestinationControl::captureDestinationChanged(QCameraImageCapture::CaptureDestinations destination)
-
- Signals the image capture \a destination changed.
- \since 1.2
-*/
-
-#include "moc_qcameracapturedestinationcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameracapturedestinationcontrol.h b/src/multimedia/qcameracapturedestinationcontrol.h
deleted file mode 100644
index cdd769a..0000000
--- a/src/multimedia/qcameracapturedestinationcontrol.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERACAPTUREDESTINATIONCONTROL_H
-#define QCAMERACAPTUREDESTINATIONCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qcameraimagecapture.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraCaptureDestinationControl : public QMediaControl
-{
- Q_OBJECT
-public:
- ~QCameraCaptureDestinationControl();
-
- virtual bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const = 0;
- virtual QCameraImageCapture::CaptureDestinations captureDestination() const = 0;
- virtual void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination) = 0;
-
-Q_SIGNALS:
- void captureDestinationChanged(QCameraImageCapture::CaptureDestinations);
-
-protected:
- QCameraCaptureDestinationControl(QObject* parent = 0);
-};
-
-#define QCameraCaptureDestinationControl_iid "com.nokia.Qt.QCameraCaptureDestinationControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraCaptureDestinationControl, QCameraCaptureDestinationControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
-
diff --git a/src/multimedia/qcameracontrol.cpp b/src/multimedia/qcameracontrol.cpp
deleted file mode 100644
index df5c44c..0000000
--- a/src/multimedia/qcameracontrol.cpp
+++ /dev/null
@@ -1,215 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameracontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraControl
-
-
-
- \brief The QCameraControl class is an abstract base class for
- classes that control still cameras or video cameras.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
- This service is provided by a QMediaService object via
- QMediaService::control(). It is used by QCamera.
-
- The interface name of QCameraControl is \c com.nokia.Qt.QCameraControl/1.0 as
- defined in QCameraControl_iid.
-
-
-
- \sa QMediaService::requestControl(), QCamera
-*/
-
-/*!
- \macro QCameraControl_iid
-
- \c com.nokia.Qt.QCameraControl/1.0
-
- Defines the interface name of the QCameraControl class.
-
- \relates QCameraControl
-*/
-
-/*!
- Constructs a camera control object with \a parent.
-*/
-
-QCameraControl::QCameraControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destruct the camera control object.
-*/
-
-QCameraControl::~QCameraControl()
-{
-}
-
-/*!
- \fn QCameraControl::state() const
-
- Returns the state of the camera service.
-
- \since 1.1
- \sa QCamera::state
-*/
-
-/*!
- \fn QCameraControl::setState(QCamera::State state)
-
- Sets the camera \a state.
-
- State changes are synchronous and indicate user intention,
- while camera status is used as a feedback mechanism to inform application about backend status.
- Status changes are reported asynchronously with QCameraControl::statusChanged() signal.
-
- \since 1.1
- \sa QCamera::State
-*/
-
-/*!
- \fn void QCameraControl::stateChanged(QCamera::State state)
-
- Signal emitted when the camera \a state changes.
-
- In most cases the state chage is caused by QCameraControl::setState(),
- but if critical error has occurred the state changes to QCamera::UnloadedState.
- \since 1.1
-*/
-
-/*!
- \fn QCameraControl::status() const
-
- Returns the status of the camera service.
-
- \since 1.1
- \sa QCamera::state
-*/
-
-/*!
- \fn void QCameraControl::statusChanged(QCamera::Status status)
-
- Signal emitted when the camera \a status changes.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraControl::error(int error, const QString &errorString)
-
- Signal emitted when an error occurs with error code \a error and
- a description of the error \a errorString.
- \since 1.1
-*/
-
-/*!
- \fn Camera::CaptureMode QCameraControl::captureMode() const = 0
-
- Returns the current capture mode.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraControl::setCaptureMode(QCamera::CaptureMode mode) = 0;
-
- Sets the current capture \a mode.
-
- The capture mode changes are synchronous and allowed in any camera state.
-
- If the capture mode is changed while camera is active,
- it's recommended to change status to QCamera::LoadedStatus
- and start activating the camera in the next event loop
- with the status changed to QCamera::StartingStatus.
- This allows the capture settings to be applied before camera is started.
- Than change the status to QCamera::StartedStatus when the capture mode change is done.
- \since 1.1
-*/
-
-/*!
- \fn bool QCameraControl::isCaptureModeSupported(QCamera::CaptureMode mode) const = 0;
-
- Returns true if the capture \a mode is suported.
- \since 1.1
-*/
-
-/*!
- \fn QCameraControl::captureModeChanged(QCamera::CaptureMode mode)
-
- Signal emitted when the camera capture \a mode changes.
- \since 1.1
- */
-
-/*!
- \fn bool QCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-
- Returns true if backend can effectively apply changing camera properties of \a changeType type
- while the camera state is QCamera::Active and camera status matches \a status parameter.
-
- If backend doesn't support applying this change in the active state, it will be stopped
- before the settings are changed and restarted after.
- Otherwise the backend should apply the change in the current state,
- with the camera status indicating the progress, if necessary.
- \since 1.1
-*/
-
-/*!
- \enum QCameraControl::PropertyChangeType
-
- \value CaptureMode Indicates the capture mode is changed.
- \value ImageEncodingSettings Image encoder settings are changed, including resolution.
- \value VideoEncodingSettings
- Video encoder settings are changed, including audio, video and container settings.
- \value Viewfinder Viewfinder is changed.
-*/
-
-#include "moc_qcameracontrol.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qcameracontrol.h b/src/multimedia/qcameracontrol.h
deleted file mode 100644
index dfc2b37..0000000
--- a/src/multimedia/qcameracontrol.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERACONTROL_H
-#define QCAMERACONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcamera.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- enum PropertyChangeType {
- CaptureMode = 1,
- ImageEncodingSettings = 2,
- VideoEncodingSettings = 3,
- Viewfinder = 4
- };
-
- ~QCameraControl();
-
- virtual QCamera::State state() const = 0;
- virtual void setState(QCamera::State state) = 0;
-
- virtual QCamera::Status status() const = 0;
-
- virtual QCamera::CaptureMode captureMode() const = 0;
- virtual void setCaptureMode(QCamera::CaptureMode) = 0;
- virtual bool isCaptureModeSupported(QCamera::CaptureMode mode) const = 0;
-
- virtual bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const = 0;
-
-Q_SIGNALS:
- void stateChanged(QCamera::State);
- void statusChanged(QCamera::Status);
- void error(int error, const QString &errorString);
- void captureModeChanged(QCamera::CaptureMode);
-
-protected:
- QCameraControl(QObject* parent = 0);
-};
-
-#define QCameraControl_iid "com.nokia.Qt.QCameraControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraControl, QCameraControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERACONTROL_H
-
diff --git a/src/multimedia/qcameraexposure.cpp b/src/multimedia/qcameraexposure.cpp
deleted file mode 100644
index 5c75ad9..0000000
--- a/src/multimedia/qcameraexposure.cpp
+++ /dev/null
@@ -1,646 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcameraexposure.h"
-#include "qmediaobject_p.h"
-
-#include <qcamera.h>
-#include <qcameraexposurecontrol.h>
-#include <qcameraflashcontrol.h>
-
-#include <QtCore/QMetaObject>
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraExposure
-
-
- \brief The QCameraExposure class provides interface for exposure related camera settings.
-
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
-*/
-
-//#define DEBUG_EXPOSURE_CHANGES 1
-
-#ifdef DEBUG_EXPOSURE_CHANGES
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-#endif
-
-namespace
-{
-class CameraExposureRegisterMetaTypes
-{
-public:
- CameraExposureRegisterMetaTypes()
- {
- qRegisterMetaType<QCameraExposure::ExposureMode>("QCameraExposure::ExposureMode");
- qRegisterMetaType<QCameraExposure::FlashModes>("QCameraExposure::FlashModes");
- qRegisterMetaType<QCameraExposure::MeteringMode>("QCameraExposure::MeteringMode");
- }
-} _registerCameraExposureMetaTypes;
-}
-
-
-
-class QCameraExposurePrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCameraExposure)
-public:
- void initControls();
- QCameraExposure *q_ptr;
-
- QCamera *camera;
- QCameraExposureControl *exposureControl;
- QCameraFlashControl *flashControl;
-
- void _q_exposureParameterChanged(int parameter);
- void _q_exposureParameterRangeChanged(int parameter);
-};
-
-void QCameraExposurePrivate::initControls()
-{
- Q_Q(QCameraExposure);
-
- QMediaService *service = camera->service();
- exposureControl = 0;
- flashControl = 0;
- if (service) {
- exposureControl = qobject_cast<QCameraExposureControl *>(service->requestControl(QCameraExposureControl_iid));
- flashControl = qobject_cast<QCameraFlashControl *>(service->requestControl(QCameraFlashControl_iid));
- }
- if (exposureControl) {
- q->connect(exposureControl, SIGNAL(exposureParameterChanged(int)),
- q, SLOT(_q_exposureParameterChanged(int)));
- q->connect(exposureControl, SIGNAL(exposureParameterRangeChanged(int)),
- q, SLOT(_q_exposureParameterRangeChanged(int)));
- }
-
- if (flashControl)
- q->connect(flashControl, SIGNAL(flashReady(bool)), q, SIGNAL(flashReady(bool)));
-}
-
-void QCameraExposurePrivate::_q_exposureParameterChanged(int parameter)
-{
- Q_Q(QCameraExposure);
-
-#if DEBUG_EXPOSURE_CHANGES
- qDebug() << "Exposure parameter changed:"
- << ENUM_NAME(QCameraExposureControl, "ExposureParameter", parameter)
- << exposureControl->exposureParameter(QCameraExposureControl::ExposureParameter(parameter));
-#endif
-
- switch (parameter) {
- case QCameraExposureControl::ISO:
- emit q->isoSensitivityChanged(q->isoSensitivity());
- break;
- case QCameraExposureControl::Aperture:
- emit q->apertureChanged(q->aperture());
- break;
- case QCameraExposureControl::ShutterSpeed:
- emit q->shutterSpeedChanged(q->shutterSpeed());
- break;
- case QCameraExposureControl::ExposureCompensation:
- emit q->exposureCompensationChanged(q->exposureCompensation());
- break;
- }
-}
-
-void QCameraExposurePrivate::_q_exposureParameterRangeChanged(int parameter)
-{
- Q_Q(QCameraExposure);
-
- switch (parameter) {
- case QCameraExposureControl::Aperture:
- emit q->apertureRangeChanged();
- break;
- case QCameraExposureControl::ShutterSpeed:
- emit q->shutterSpeedRangeChanged();
- break;
- }
-}
-
-/*!
- Construct a QCameraExposure from service \a provider and \a parent.
-*/
-
-QCameraExposure::QCameraExposure(QCamera *parent):
- QObject(parent), d_ptr(new QCameraExposurePrivate)
-{
- Q_D(QCameraExposure);
- d->camera = parent;
- d->q_ptr = this;
- d->initControls();
-}
-
-
-/*!
- Destroys the camera exposure object.
-*/
-
-QCameraExposure::~QCameraExposure()
-{
- Q_D(QCameraExposure);
- if (d->exposureControl)
- d->camera->service()->releaseControl(d->exposureControl);
-}
-
-/*!
- Returns true if exposure settings are supported by this camera.
- \since 1.1
-*/
-bool QCameraExposure::isAvailable() const
-{
- return d_func()->exposureControl != 0;
-}
-
-
-/*!
- \property QCameraExposure::flashMode
- \brief The flash mode being used.
-
- Usually the single QCameraExposure::FlashMode flag is used,
- but some non conflicting flags combination are also allowed,
- like QCameraExposure::FlashManual | QCameraExposure::FlashSlowSyncRearCurtain.
-
- \since 1.1
- \sa QCameraExposure::isFlashModeSupported(), QCameraExposure::isFlashReady()
-*/
-
-QCameraExposure::FlashModes QCameraExposure::flashMode() const
-{
- return d_func()->flashControl ? d_func()->flashControl->flashMode() : QCameraExposure::FlashOff;
-}
-
-void QCameraExposure::setFlashMode(QCameraExposure::FlashModes mode)
-{
- if (d_func()->flashControl)
- d_func()->flashControl->setFlashMode(mode);
-}
-
-/*!
- Returns true if the flash \a mode is supported.
- \since 1.1
-*/
-
-bool QCameraExposure::isFlashModeSupported(QCameraExposure::FlashModes mode) const
-{
- return d_func()->flashControl ? d_func()->flashControl->isFlashModeSupported(mode) : false;
-}
-
-/*!
- Returns true if flash is charged.
-*/
-
-bool QCameraExposure::isFlashReady() const
-{
- return d_func()->flashControl ? d_func()->flashControl->isFlashReady() : false;
-}
-
-
-/*!
- \property QCameraExposure::exposureMode
- \brief The exposure mode being used.
-
- \since 1.1
- \sa QCameraExposure::isExposureModeSupported()
-*/
-
-QCameraExposure::ExposureMode QCameraExposure::exposureMode() const
-{
- return d_func()->exposureControl ? d_func()->exposureControl->exposureMode() : QCameraExposure::ExposureAuto;
-}
-
-void QCameraExposure::setExposureMode(QCameraExposure::ExposureMode mode)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureMode(mode);
-}
-
-/*!
- Returns true if the exposure \a mode is supported.
- \since 1.1
-*/
-
-bool QCameraExposure::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
-{
- return d_func()->exposureControl ?
- d_func()->exposureControl->isExposureModeSupported(mode) : false;
-}
-
-/*!
- \property QCameraExposure::exposureCompensation
- \brief Exposure compensation in EV units.
-
- Exposure compensation property allows to adjust the automatically calculated exposure.
- \since 1.1
-*/
-
-qreal QCameraExposure::exposureCompensation() const
-{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ExposureCompensation).toReal();
- else
- return 0;
-}
-
-void QCameraExposure::setExposureCompensation(qreal ev)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ExposureCompensation, QVariant(ev));
-}
-
-/*!
- \property QCameraExposure::meteringMode
- \brief The metering mode being used.
-
- \since 1.1
- \sa QCameraExposure::isMeteringModeSupported()
-*/
-
-QCameraExposure::MeteringMode QCameraExposure::meteringMode() const
-{
- return d_func()->exposureControl ? d_func()->exposureControl->meteringMode() : QCameraExposure::MeteringMatrix;
-}
-
-void QCameraExposure::setMeteringMode(QCameraExposure::MeteringMode mode)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setMeteringMode(mode);
-}
-
-/*!
- Returns true if the metering \a mode is supported.
- \since 1.1
-*/
-bool QCameraExposure::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
-{
- return d_func()->exposureControl ? d_func()->exposureControl->isMeteringModeSupported(mode) : false;
-}
-
-int QCameraExposure::isoSensitivity() const
-{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ISO).toInt();
-
- return -1;
-}
-
-/*!
- Returns the list of ISO senitivities camera supports.
-
- If the camera supports arbitrary ISO sensitivities within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
- \since 1.1
-*/
-QList<int> QCameraExposure::supportedIsoSensitivities(bool *continuous) const
-{
- QList<int> res;
- QCameraExposureControl *control = d_func()->exposureControl;
-
- if (!control)
- return res;
-
- foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::ISO)) {
- bool ok = false;
- int intValue = value.toInt(&ok);
- if (ok)
- res.append(intValue);
- else
- qWarning() << "Incompatible ISO value type, int is expected";
- }
-
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::ISO) &
- QCameraExposureControl::ContinuousRange;
-
- return res;
-}
-
-/*!
- \fn QCameraExposure::setManualIsoSensitivity(int iso)
- Sets the manual sensitivity to \a iso
- \since 1.1
-*/
-
-void QCameraExposure::setManualIsoSensitivity(int iso)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ISO, QVariant(iso));
-}
-
-/*!
- \fn QCameraExposure::setAutoIsoSensitivity()
- Turn on auto sensitivity
- \since 1.1
-*/
-
-void QCameraExposure::setAutoIsoSensitivity()
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ISO, QVariant());
-}
-
-/*!
- \property QCameraExposure::shutterSpeed
- \brief Camera's shutter speed in seconds.
-
- \since 1.1
- \sa supportedShutterSpeeds(), setAutoShutterSpeed(), setManualShutterSpeed()
-*/
-
-/*!
- \fn QCameraExposure::shutterSpeedChanged(qreal speed)
-
- Signals that a camera's shutter \a speed has changed.
- \since 1.1
-*/
-
-/*!
- \property QCameraExposure::isoSensitivity
- \brief The sensor ISO sensitivity.
-
- \sa supportedIsoSensitivities(), setAutoIsoSensitivity(), setManualIsoSensitivity()
- \since 1.1
-*/
-
-/*!
- \property QCameraExposure::aperture
- \brief Lens aperture is specified as an F number, the ratio of the focal length to effective aperture diameter.
-
- \since 1.1
- \sa supportedApertures(), setAutoAperture(), setManualAperture()
-*/
-
-
-qreal QCameraExposure::aperture() const
-{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::Aperture).toReal();
-
- return -1.0;
-}
-
-/*!
- Returns the list of aperture values camera supports.
- The apertures list can change depending on the focal length,
- in such a case the apertureRangeChanged() signal is emitted.
-
- If the camera supports arbitrary aperture values within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
- \since 1.1
-*/
-QList<qreal> QCameraExposure::supportedApertures(bool * continuous) const
-{
- QList<qreal> res;
- QCameraExposureControl *control = d_func()->exposureControl;
-
- if (!control)
- return res;
-
- foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::Aperture)) {
- bool ok = false;
- qreal realValue = value.toReal(&ok);
- if (ok)
- res.append(realValue);
- else
- qWarning() << "Incompatible aperture value type, qreal is expected";
- }
-
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::Aperture) &
- QCameraExposureControl::ContinuousRange;
-
- return res;
-}
-
-/*!
- \fn QCameraExposure::setManualAperture(qreal aperture)
- Sets the manual camera \a aperture value.
- \since 1.1
-*/
-
-void QCameraExposure::setManualAperture(qreal aperture)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::Aperture, QVariant(aperture));
-}
-
-/*!
- \fn QCameraExposure::setAutoAperture()
- Turn on auto aperture
- \since 1.1
-*/
-
-void QCameraExposure::setAutoAperture()
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::Aperture, QVariant());
-}
-
-/*!
- Returns the current shutter speed in seconds.
- \since 1.1
-*/
-
-qreal QCameraExposure::shutterSpeed() const
-{
- if (d_func()->exposureControl)
- return d_func()->exposureControl->exposureParameter(QCameraExposureControl::ShutterSpeed).toReal();
-
- return -1.0;
-}
-
-/*!
- Returns the list of shutter speed values in seconds camera supports.
-
- If the camera supports arbitrary shutter speed values within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
- \since 1.1
-*/
-QList<qreal> QCameraExposure::supportedShutterSpeeds(bool *continuous) const
-{
- QList<qreal> res;
-
- QCameraExposureControl *control = d_func()->exposureControl;
- if (!control)
- return res;
-
- foreach (const QVariant &value,
- control->supportedParameterRange(QCameraExposureControl::ShutterSpeed)) {
- bool ok = false;
- qreal realValue = value.toReal(&ok);
- if (ok)
- res.append(realValue);
- else
- qWarning() << "Incompatible shutter speed value type, qreal is expected";
- }
-
- if (continuous)
- *continuous = control->exposureParameterFlags(QCameraExposureControl::ShutterSpeed) &
- QCameraExposureControl::ContinuousRange;
-
- return res;
-}
-
-/*!
- Set the manual shutter speed to \a seconds
- \since 1.1
-*/
-
-void QCameraExposure::setManualShutterSpeed(qreal seconds)
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ShutterSpeed, QVariant(seconds));
-}
-
-/*!
- Turn on auto shutter speed
- \since 1.1
-*/
-
-void QCameraExposure::setAutoShutterSpeed()
-{
- if (d_func()->exposureControl)
- d_func()->exposureControl->setExposureParameter(QCameraExposureControl::ShutterSpeed, QVariant());
-}
-
-
-/*!
- \enum QCameraExposure::FlashMode
-
- \value FlashOff Flash is Off.
- \value FlashOn Flash is On.
- \value FlashAuto Automatic flash.
- \value FlashRedEyeReduction Red eye reduction flash.
- \value FlashFill Use flash to fillin shadows.
- \value FlashTorch Constant light source, useful for focusing and video capture.
- \value FlashSlowSyncFrontCurtain
- Use the flash in conjunction with a slow shutter speed.
- This mode allows better exposure of distant objects and/or motion blur effect.
- \value FlashSlowSyncRearCurtain
- The similar mode to FlashSlowSyncFrontCurtain but flash is fired at the end of exposure.
- \value FlashManual Flash power is manualy set.
-*/
-
-/*!
- \enum QCameraExposure::ExposureMode
-
- \value ExposureManual Manual mode.
- \value ExposureAuto Automatic mode.
- \value ExposureNight Night mode.
- \value ExposureBacklight Backlight exposure mode.
- \value ExposureSpotlight Spotlight exposure mode.
- \value ExposureSports Spots exposure mode.
- \value ExposureSnow Snow exposure mode.
- \value ExposureBeach Beach exposure mode.
- \value ExposureLargeAperture Use larger aperture with small depth of field.
- \value ExposureSmallAperture Use smaller aperture.
- \value ExposurePortrait Portrait exposure mode.
- \value ExposureModeVendor The base value for device specific exposure modes.
-*/
-
-/*!
- \enum QCameraExposure::MeteringMode
-
- \value MeteringAverage Center weighted average metering mode.
- \value MeteringSpot Spot metering mode.
- \value MeteringMatrix Matrix metering mode.
-*/
-
-/*!
- \property QCameraExposure::flashReady
- \brief Indicates if the flash is charged and ready to use.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposure::flashReady(bool ready)
-
- Signal the flash \a ready status has changed.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposure::apertureChanged(qreal value)
-
- Signal emitted when aperature changes to \a value.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposure::apertureRangeChanged()
-
- Signal emitted when aperature range has changed.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraExposure::shutterSpeedRangeChanged()
-
- Signal emitted when the shutter speed range has changed.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraExposure::isoSensitivityChanged(int value)
-
- Signal emitted when sensitivity changes to \a value.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposure::exposureCompensationChanged(qreal value)
-
- Signal emitted when the exposure compensation changes to \a value.
- \since 1.1
-*/
-
-#include "moc_qcameraexposure.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qcameraexposure.h b/src/multimedia/qcameraexposure.h
deleted file mode 100644
index 088e7c0..0000000
--- a/src/multimedia/qcameraexposure.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAEXPOSURE_H
-#define QCAMERAEXPOSURE_H
-
-#include <qmediaobject.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QCamera;
-class QCameraExposurePrivate;
-
-class Q_MULTIMEDIA_EXPORT QCameraExposure : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(qreal aperture READ aperture NOTIFY apertureChanged)
- Q_PROPERTY(qreal shutterSpeed READ shutterSpeed NOTIFY shutterSpeedChanged)
- Q_PROPERTY(int isoSensitivity READ isoSensitivity NOTIFY isoSensitivityChanged)
- Q_PROPERTY(qreal exposureCompensation READ exposureCompensation WRITE setExposureCompensation NOTIFY exposureCompensationChanged)
- Q_PROPERTY(bool flashReady READ isFlashReady NOTIFY flashReady)
- Q_PROPERTY(QCameraExposure::FlashModes flashMode READ flashMode WRITE setFlashMode)
- Q_PROPERTY(QCameraExposure::ExposureMode exposureMode READ exposureMode WRITE setExposureMode)
- Q_PROPERTY(QCameraExposure::MeteringMode meteringMode READ meteringMode WRITE setMeteringMode)
-
- Q_ENUMS(FlashMode)
- Q_ENUMS(ExposureMode)
- Q_ENUMS(MeteringMode)
-public:
- enum FlashMode {
- FlashAuto = 0x1,
- FlashOff = 0x2,
- FlashOn = 0x4,
- FlashRedEyeReduction = 0x8,
- FlashFill = 0x10,
- FlashTorch = 0x20,
- FlashSlowSyncFrontCurtain = 0x40,
- FlashSlowSyncRearCurtain = 0x80,
- FlashManual = 0x100
- };
- Q_DECLARE_FLAGS(FlashModes, FlashMode)
-
- enum ExposureMode {
- ExposureAuto = 0,
- ExposureManual = 1,
- ExposurePortrait = 2,
- ExposureNight = 3,
- ExposureBacklight = 4,
- ExposureSpotlight = 5,
- ExposureSports = 6,
- ExposureSnow = 7,
- ExposureBeach = 8,
- ExposureLargeAperture = 9,
- ExposureSmallAperture = 10,
- ExposureModeVendor = 1000
- };
-
- enum MeteringMode {
- MeteringMatrix = 1,
- MeteringAverage = 2,
- MeteringSpot = 3
- };
-
- bool isAvailable() const;
-
- FlashModes flashMode() const;
- bool isFlashModeSupported(FlashModes mode) const;
- bool isFlashReady() const;
-
- ExposureMode exposureMode() const;
- bool isExposureModeSupported(ExposureMode mode) const;
-
- qreal exposureCompensation() const;
-
- MeteringMode meteringMode() const;
-
- bool isMeteringModeSupported(MeteringMode mode) const;
-
- int isoSensitivity() const;
- QList<int> supportedIsoSensitivities(bool *continuous = 0) const;
-
- qreal aperture() const;
- QList<qreal> supportedApertures(bool *continuous = 0) const;
-
- qreal shutterSpeed() const;
- QList<qreal> supportedShutterSpeeds(bool *continuous = 0) const;
-
-public Q_SLOTS:
- void setFlashMode(FlashModes mode);
- void setExposureMode(ExposureMode mode);
-
- void setExposureCompensation(qreal ev);
-
- void setMeteringMode(MeteringMode mode);
-
- void setManualIsoSensitivity(int iso);
- void setAutoIsoSensitivity();
-
- void setManualAperture(qreal aperture);
- void setAutoAperture();
-
- void setManualShutterSpeed(qreal seconds);
- void setAutoShutterSpeed();
-
-Q_SIGNALS:
- void flashReady(bool);
-
- void apertureChanged(qreal);
- void apertureRangeChanged();
- void shutterSpeedChanged(qreal);
- void shutterSpeedRangeChanged();
- void isoSensitivityChanged(int);
- void exposureCompensationChanged(qreal);
-
-private:
- friend class QCamera;
- explicit QCameraExposure(QCamera *parent = 0);
- virtual ~QCameraExposure();
-
- Q_DISABLE_COPY(QCameraExposure)
- Q_DECLARE_PRIVATE(QCameraExposure)
- Q_PRIVATE_SLOT(d_func(), void _q_exposureParameterChanged(int))
- Q_PRIVATE_SLOT(d_func(), void _q_exposureParameterRangeChanged(int))
- QCameraExposurePrivate *d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraExposure::FlashModes)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraExposure::ExposureMode)
-Q_DECLARE_METATYPE(QCameraExposure::FlashModes)
-Q_DECLARE_METATYPE(QCameraExposure::MeteringMode)
-
-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/qcameraexposurecontrol.cpp b/src/multimedia/qcameraexposurecontrol.cpp
deleted file mode 100644
index 4a6f655..0000000
--- a/src/multimedia/qcameraexposurecontrol.cpp
+++ /dev/null
@@ -1,252 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameraexposurecontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraExposureControl
-
- \brief The QCameraExposureControl class allows controlling camera exposure parameters.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
- You can adjust a number of parameters that will affect images and video taken with
- the corresponding QCamera object.
-
- There are a number of different parameters that can be adjusted, including:
-
- \table
- \row
- \header
- \
-
- \endtable
-
- The interface name of QCameraExposureControl is \c com.nokia.Qt.QCameraExposureControl/1.0 as
- defined in QCameraExposureControl_iid.
-
- \sa QCamera
-*/
-
-/*!
- \macro QCameraExposureControl_iid
-
- \c com.nokia.Qt.QCameraExposureControl/1.0
-
- Defines the interface name of the QCameraExposureControl class.
-
- \relates QCameraExposureControl
-*/
-
-/*!
- Constructs a camera exposure control object with \a parent.
-*/
-QCameraExposureControl::QCameraExposureControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys the camera control object.
-*/
-QCameraExposureControl::~QCameraExposureControl()
-{
-}
-
-/*!
- \fn QCamera::ExposureMode QCameraExposureControl::exposureMode() const
-
- Returns the exposure mode.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mode)
-
- Set the exposure mode to \a mode.
- \since 1.1
-*/
-
-
-/*!
- \fn bool QCameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
-
- Returns true if the exposure \a mode is supported.
- \since 1.1
-*/
-
-
-/*!
- \fn QCameraExposure::MeteringMode QCameraExposureControl::meteringMode() const
- Returns the current metering mode.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mode)
-
- Set the metering mode to \a mode.
- \since 1.1
-*/
-
-
-/*!
- \fn bool QCameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
- Returns true if the metering \a mode is supported.
- \since 1.1
-*/
-
-/*!
- \enum QCameraExposureControl::ExposureParameter
- \value InvalidParameter
- Parameter is invalid.
- \value ISO
- Camera ISO sensitivity, specified as integer value.
- \value Aperture
- Lens aperture is specified as an qreal F number.
- The supported apertures list can change depending on the focal length,
- in such a case the exposureParameterRangeChanged() signal is emitted.
- \value ShutterSpeed
- Shutter speed in seconds, specified as qreal.
- \value ExposureCompensation
- Exposure compensation, specified as qreal EV value.
- \value FlashPower
- Manual flash power, specified as qreal value.
- Accepted power range is [0..1.0],
- with 0 value means no flash and 1.0 corresponds to full flash power.
-
- This value is only used in the \l{QCameraExposure::FlashManual}{manual flash mode}.
- \value FlashCompensation
- Flash compensation, specified as qreal EV value.
- \value ExtendedExposureParameter
- The base value for platform specific extended parameters.
- For such parameters the sequential values starting from ExtendedExposureParameter shuld be used.
-*/
-
-/*!
- \enum QCameraExposureControl::ParameterFlag
- \value AutomaticValue
- Use the automatic values for parameters.
- \value ReadOnly
- Parameters are read only.
- \value ContinuousRange
- Parameters are continuous in their range.
-*/
-
-/*!
- \fn QCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
-
- Returns true is exposure \a parameter is supported by backend.
- \since 1.1
-*/
-
-/*!
- \fn QCameraExposureControl::exposureParameter(ExposureParameter parameter) const
-
- Returns the exposure \a parameter value, or invalid QVariant() if the value is unknown or not supported.
- \since 1.1
-*/
-
-/*!
- \fn QCameraExposureControl::exposureParameterFlags(ExposureParameter parameter) const
-
- Returns the properties of exposure \a parameter.
- \since 1.1
-*/
-
-
-/*!
- \fn QCameraExposureControl::supportedParameterRange(ExposureParameter parameter) const
-
- Returns the list of supported \a parameter values;
- \since 1.1
-*/
-
-/*!
- \fn bool QCameraExposureControl::setExposureParameter(ExposureParameter parameter, const QVariant& value)
-
- Set the exposure \a parameter to \a value.
- If a null or invalid QVariant is passed, backend should choose the value automatically,
- and if possible report the actual value to user with QCameraExposureControl::exposureParameter().
-
- Returns true if parameter is supported and value is correct.
- \since 1.1
-*/
-
-/*!
- \fn QCameraExposureControl::extendedParameterName(ExposureParameter parameter)
-
- Returns the extended exposure \a parameter name.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposureControl::flashReady(bool ready)
-
- Signal emitted when flash state changes, flash is charged \a ready.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraExposureControl::exposureParameterChanged(int parameter)
-
- Signal emitted when the exposure \a parameter has changed.
- \since 1.1
-*/
-
-/*!
-
- \fn void QCameraExposureControl::exposureParameterRangeChanged(int parameter)
-
- Signal emitted when the exposure \a parameter range has changed.
- \since 1.1
-*/
-
-
-#include "moc_qcameraexposurecontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameraexposurecontrol.h b/src/multimedia/qcameraexposurecontrol.h
deleted file mode 100644
index ff60784..0000000
--- a/src/multimedia/qcameraexposurecontrol.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAEXPOSURECONTROL_H
-#define QCAMERAEXPOSURECONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcameraexposure.h>
-#include <qcamera.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraExposureControl : public QMediaControl
-{
- Q_OBJECT
- Q_ENUMS(ExposureParameter)
-
-public:
- ~QCameraExposureControl();
-
- enum ExposureParameter {
- InvalidParameter = 0,
- ISO = 1,
- Aperture = 2,
- ShutterSpeed = 3,
- ExposureCompensation = 4,
- FlashPower = 5,
- FlashCompensation = 6,
- ExtendedExposureParameter = 1000
- };
-
- enum ParameterFlag {
- AutomaticValue = 0x01,
- ReadOnly = 0x02,
- ContinuousRange = 0x04
- };
- Q_DECLARE_FLAGS(ParameterFlags, ParameterFlag)
-
- virtual QCameraExposure::ExposureMode exposureMode() const = 0;
- virtual void setExposureMode(QCameraExposure::ExposureMode mode) = 0;
- virtual bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const = 0;
-
- virtual QCameraExposure::MeteringMode meteringMode() const = 0;
- virtual void setMeteringMode(QCameraExposure::MeteringMode mode) = 0;
- virtual bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const = 0;
-
- virtual bool isParameterSupported(ExposureParameter parameter) const = 0;
- virtual QVariant exposureParameter(ExposureParameter parameter) const = 0;
- virtual ParameterFlags exposureParameterFlags(ExposureParameter parameter) const = 0;
- virtual QVariantList supportedParameterRange(ExposureParameter parameter) const = 0;
- virtual bool setExposureParameter(ExposureParameter parameter, const QVariant& value) = 0;
-
- virtual QString extendedParameterName(ExposureParameter parameter) = 0;
-
-Q_SIGNALS:
- void flashReady(bool);
-
- void exposureParameterChanged(int parameter);
- void exposureParameterRangeChanged(int parameter);
-
-protected:
- QCameraExposureControl(QObject* parent = 0);
-};
-
-#define QCameraExposureControl_iid "com.nokia.Qt.QCameraExposureControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraExposureControl, QCameraExposureControl_iid)
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraExposureControl::ParameterFlags)
-
-Q_MEDIA_ENUM_DEBUG(QCameraExposureControl, ExposureParameter)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERAEXPOSURECONTROL_H
-
diff --git a/src/multimedia/qcameraflashcontrol.cpp b/src/multimedia/qcameraflashcontrol.cpp
deleted file mode 100644
index 34dcbde..0000000
--- a/src/multimedia/qcameraflashcontrol.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameraflashcontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraFlashControl
-
- \brief The QCameraFlashControl class allows controlling a camera's flash.
-
- \ingroup multimedia-serv
- \inmodule QtMultimedia
- \since 1.1
-
- \inmodule QtMultimedia
-
- You can set the type of flash effect used when an image is captured, and test to see
- if the flash hardware is ready to fire.
-
- You can retrieve this control from the camera object in the usual way:
-
- Some camera devices may not have flash hardware, or may not be configurable. In that
- case, there will be no QCameraFlashControl available.
-
- The interface name of QCameraFlashControl is \c com.nokia.Qt.QCameraFlashControl/1.0 as
- defined in QCameraFlashControl_iid.
-
- \sa QCamera
-*/
-
-/*!
- \macro QCameraFlashControl_iid
-
- \c com.nokia.Qt.QCameraFlashControl/1.0
-
- Defines the interface name of the QCameraFlashControl class.
-
- \relates QCameraFlashControl
-*/
-
-/*!
- Constructs a camera flash control object with \a parent.
-*/
-QCameraFlashControl::QCameraFlashControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys the camera control object.
-*/
-QCameraFlashControl::~QCameraFlashControl()
-{
-}
-
-/*!
- \fn QCamera::FlashModes QCameraFlashControl::flashMode() const
-
- Returns the current flash mode.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFlashControl::setFlashMode(QCameraExposure::FlashModes mode)
-
- Set the current flash \a mode.
-
- Usually a single QCameraExposure::FlashMode flag is used,
- but some non conflicting flags combination are also allowed,
- like QCameraExposure::FlashManual | QCameraExposure::FlashSlowSyncRearCurtain.
- \since 1.1
-*/
-
-
-/*!
- \fn QCameraFlashControl::isFlashModeSupported(QCameraExposure::FlashModes mode) const
-
- Return true if the reqested flash \a mode is supported.
- Some QCameraExposure::FlashMode values can be combined,
- for example QCameraExposure::FlashManual | QCameraExposure::FlashSlowSyncRearCurtain
- \since 1.1
-*/
-
-/*!
- \fn bool QCameraFlashControl::isFlashReady() const
-
- Returns true if flash is charged.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFlashControl::flashReady(bool ready)
-
- Signal emitted when flash state changes to \a ready.
- \since 1.1
-*/
-
-#include "moc_qcameraflashcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameraflashcontrol.h b/src/multimedia/qcameraflashcontrol.h
deleted file mode 100644
index 89b3b9d..0000000
--- a/src/multimedia/qcameraflashcontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAFLASHCONTROL_H
-#define QCAMERAFLASHCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcameraexposure.h>
-#include <qcamera.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraFlashControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QCameraFlashControl();
-
- virtual QCameraExposure::FlashModes flashMode() const = 0;
- virtual void setFlashMode(QCameraExposure::FlashModes mode) = 0;
- virtual bool isFlashModeSupported(QCameraExposure::FlashModes mode) const = 0;
-
- virtual bool isFlashReady() const = 0;
-
-Q_SIGNALS:
- void flashReady(bool);
-
-protected:
- QCameraFlashControl(QObject* parent = 0);
-};
-
-#define QCameraFlashControl_iid "com.nokia.Qt.QCameraFlashControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraFlashControl, QCameraFlashControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERAFLASHCONTROL_H
-
diff --git a/src/multimedia/qcamerafocus.cpp b/src/multimedia/qcamerafocus.cpp
deleted file mode 100644
index 9b9caed..0000000
--- a/src/multimedia/qcamerafocus.cpp
+++ /dev/null
@@ -1,478 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcamerafocus.h"
-#include "qmediaobject_p.h"
-
-#include <qcamera.h>
-#include <qcameracontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qmediarecordercontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qvideodevicecontrol.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace
-{
-class CameraFocusRegisterMetaTypes
-{
-public:
- CameraFocusRegisterMetaTypes()
- {
- qRegisterMetaType<QCameraFocus::FocusModes>("QCameraFocus::FocusModes");
- qRegisterMetaType<QCameraFocus::FocusPointMode>("QCameraFocus::FocusPointMode");
- }
-} _registerCameraFocusMetaTypes;
-}
-
-
-class QCameraFocusZoneData : public QSharedData
-{
-public:
- QCameraFocusZoneData():
- status(QCameraFocusZone::Invalid)
- {
-
- }
-
- QCameraFocusZoneData(const QRectF &_area, QCameraFocusZone::FocusZoneStatus _status):
- area(_area),
- status(_status)
- {
-
- }
-
-
- QCameraFocusZoneData(const QCameraFocusZoneData &other):
- QSharedData(other),
- area(other.area),
- status(other.status)
- {
- }
-
- QCameraFocusZoneData& operator=(const QCameraFocusZoneData &other)
- {
- area = other.area;
- status = other.status;
- return *this;
- }
-
- QRectF area;
- QCameraFocusZone::FocusZoneStatus status;
-};
-
-QCameraFocusZone::QCameraFocusZone()
- :d(new QCameraFocusZoneData)
-{
-
-}
-
-QCameraFocusZone::QCameraFocusZone(const QRectF &area, QCameraFocusZone::FocusZoneStatus status)
- :d(new QCameraFocusZoneData(area, status))
-{
-}
-
-QCameraFocusZone::QCameraFocusZone(const QCameraFocusZone &other)
- :d(other.d)
-{
-
-}
-
-QCameraFocusZone::~QCameraFocusZone()
-{
-
-}
-
-QCameraFocusZone& QCameraFocusZone::operator=(const QCameraFocusZone &other)
-{
- d = other.d;
- return *this;
-}
-
-bool QCameraFocusZone::operator==(const QCameraFocusZone &other) const
-{
- return d == other.d ||
- (d->area == other.d->area && d->status == other.d->status);
-}
-
-bool QCameraFocusZone::operator!=(const QCameraFocusZone &other) const
-{
- return !(*this == other);
-}
-
-bool QCameraFocusZone::isValid() const
-{
- return d->status != Invalid && !d->area.isValid();
-}
-
-QRectF QCameraFocusZone::area() const
-{
- return d->area;
-}
-
-QCameraFocusZone::FocusZoneStatus QCameraFocusZone::status() const
-{
- return d->status;
-}
-
-void QCameraFocusZone::setStatus(QCameraFocusZone::FocusZoneStatus status)
-{
- d->status = status;
-}
-
-
-/*!
- \class QCameraFocus
-
-
- \brief The QCameraFocus class provides interface for
- focus and zoom related camera settings.
-
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
-*/
-
-
-class QCameraFocusPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCameraFocus)
-public:
- void initControls();
-
- QCameraFocus *q_ptr;
-
- QCamera *camera;
- QCameraFocusControl *focusControl;
-};
-
-
-void QCameraFocusPrivate::initControls()
-{
- Q_Q(QCameraFocus);
-
- focusControl = 0;
-
- QMediaService *service = camera->service();
- if (service)
- focusControl = qobject_cast<QCameraFocusControl *>(service->requestControl(QCameraFocusControl_iid));
-
- if (focusControl) {
- q->connect(focusControl, SIGNAL(opticalZoomChanged(qreal)), q, SIGNAL(opticalZoomChanged(qreal)));
- q->connect(focusControl, SIGNAL(digitalZoomChanged(qreal)), q, SIGNAL(digitalZoomChanged(qreal)));
- q->connect(focusControl, SIGNAL(maximumOpticalZoomChanged(qreal)),
- q, SIGNAL(maximumOpticalZoomChanged(qreal)));
- q->connect(focusControl, SIGNAL(maximumDigitalZoomChanged(qreal)),
- q, SIGNAL(maximumDigitalZoomChanged(qreal)));
- q->connect(focusControl, SIGNAL(focusZonesChanged()), q, SIGNAL(focusZonesChanged()));
- }
-}
-
-/*!
- Construct a QCameraFocus for \a camera.
-*/
-
-QCameraFocus::QCameraFocus(QCamera *camera):
- QObject(camera), d_ptr(new QCameraFocusPrivate)
-{
- Q_D(QCameraFocus);
- d->camera = camera;
- d->q_ptr = this;
- d->initControls();
-}
-
-
-/*!
- Destroys the camera focus object.
-*/
-
-QCameraFocus::~QCameraFocus()
-{
-}
-
-/*!
- Returns true if focus related settings are supported by this camera.
- \since 1.1
-*/
-bool QCameraFocus::isAvailable() const
-{
- return d_func()->focusControl != 0;
-}
-
-/*!
- \property QCameraFocus::focusMode
- \brief The current camera focus mode.
-
- \since 1.1
- \sa QCameraFocus::isFocusModeSupported()
-*/
-
-QCameraFocus::FocusMode QCameraFocus::focusMode() const
-{
- return d_func()->focusControl ? d_func()->focusControl->focusMode() : QCameraFocus::AutoFocus;
-}
-
-void QCameraFocus::setFocusMode(QCameraFocus::FocusMode mode)
-{
- if (d_func()->focusControl)
- d_func()->focusControl->setFocusMode(mode);
-}
-
-/*!
- Returns true if the focus \a mode is supported by camera.
- \since 1.1
-*/
-
-bool QCameraFocus::isFocusModeSupported(QCameraFocus::FocusMode mode) const
-{
- return d_func()->focusControl ? d_func()->focusControl->isFocusModeSupported(mode) : false;
-}
-
-/*!
- \property QCameraFocus::focusPointMode
- \brief The current camera focus point selection mode.
-
- \sa QCameraFocus::isFocusPointModeSupported()
- \since 1.1
-*/
-
-QCameraFocus::FocusPointMode QCameraFocus::focusPointMode() const
-{
- return d_func()->focusControl ?
- d_func()->focusControl->focusPointMode() :
- QCameraFocus::FocusPointAuto;
-}
-
-void QCameraFocus::setFocusPointMode(QCameraFocus::FocusPointMode mode)
-{
- if (d_func()->focusControl)
- d_func()->focusControl->setFocusPointMode(mode);
- else
- qWarning("Focus points mode selection is not supported");
-}
-
-/*!
- Returns true if focus point \a mode is supported.
- \since 1.1
- */
-bool QCameraFocus::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
-{
- return d_func()->focusControl ?
- d_func()->focusControl->isFocusPointModeSupported(mode) :
- false;
-
-}
-
-/*!
- \property QCameraFocus::customFocusPoint
-
- Position of custom focus point, in relative frame coordinates:
- QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center.
-
- Custom focus point is used only in FocusPointCustom focus mode.
- \since 1.1
- */
-
-QPointF QCameraFocus::customFocusPoint() const
-{
- return d_func()->focusControl ?
- d_func()->focusControl->customFocusPoint() :
- QPointF(0.5,0.5);
-}
-
-void QCameraFocus::setCustomFocusPoint(const QPointF &point)
-{
- if (d_func()->focusControl)
- d_func()->focusControl->setCustomFocusPoint(point);
- else
- qWarning("Focus points selection is not supported");
-
-}
-
-/*!
- \property QCameraFocus::focusZones
-
- Returns the list of active focus zones.
-
- If QCamera::FocusPointAuto or QCamera::FocusPointFaceDetection focus mode is selected
- this method returns the list of zones the camera is actually focused on.
-
- The coordinates system is the same as for custom focus points:
- QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center.
- \since 1.1
- */
-QCameraFocusZoneList QCameraFocus::focusZones() const
-{
- return d_func()->focusControl ?
- d_func()->focusControl->focusZones() :
- QCameraFocusZoneList();
-}
-
-/*!
- Returns the maximum optical zoom
- \since 1.1
-*/
-
-qreal QCameraFocus::maximumOpticalZoom() const
-{
- return d_func()->focusControl ? d_func()->focusControl->maximumOpticalZoom() : 1.0;
-}
-
-/*!
- Returns the maximum digital zoom
- \since 1.1
-*/
-
-qreal QCameraFocus::maximumDigitalZoom() const
-{
- return d_func()->focusControl ? d_func()->focusControl->maximumDigitalZoom() : 1.0;
-}
-
-/*!
- \property QCameraFocus::opticalZoom
- \brief The current optical zoom value.
-
- \since 1.1
- \sa QCameraFocus::digitalZoom
-*/
-
-qreal QCameraFocus::opticalZoom() const
-{
- return d_func()->focusControl ? d_func()->focusControl->opticalZoom() : 1.0;
-}
-
-/*!
- \property QCameraFocus::digitalZoom
- \brief The current digital zoom value.
-
- \since 1.1
- \sa QCameraFocus::opticalZoom
-*/
-qreal QCameraFocus::digitalZoom() const
-{
- return d_func()->focusControl ? d_func()->focusControl->digitalZoom() : 1.0;
-}
-
-
-/*!
- Set the camera \a optical and \a digital zoom values.
- \since 1.1
-*/
-void QCameraFocus::zoomTo(qreal optical, qreal digital)
-{
- if (d_func()->focusControl)
- d_func()->focusControl->zoomTo(optical, digital);
- else
- qWarning("The camera doesn't support zooming.");
-}
-
-/*!
- \enum QCameraFocus::FocusMode
-
- \value ManualFocus Manual or fixed focus mode.
- \value AutoFocus One-shot auto focus mode.
- \value ContinuousFocus Continuous auto focus mode.
- \value InfinityFocus Focus strictly to infinity.
- \value HyperfocalFocus Focus to hyperfocal distance, with with the maximum depth of field achieved.
- All objects at distances from half of this
- distance out to infinity will be acceptably sharp.
- \value MacroFocus One shot auto focus to objects close to camera.
-*/
-
-/*!
- \enum QCameraFocus::FocusPointMode
-
- \value FocusPointAuto Automatically select one or multiple focus points.
- \value FocusPointCenter Focus to the frame center.
- \value FocusPointFaceDetection Focus on faces in the frame.
- \value FocusPointCustom Focus to the custom point, defined by QCameraFocus::customFocusPoint property.
-*/
-
-/*!
- \fn void QCameraFocus::opticalZoomChanged(qreal value)
-
- Signal emitted when optical zoom value changes to new \a value.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocus::digitalZoomChanged(qreal value)
-
- Signal emitted when digital zoom value changes to new \a value.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocus::maximumOpticalZoomChanged(qreal zoom)
-
- Signal emitted when the maximum supported optical \a zoom value changed.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocus::maximumDigitalZoomChanged(qreal zoom)
-
- Signal emitted when the maximum supported digital \a zoom value changed.
-
- The maximum supported zoom value can depend on other camera settings,
- like capture mode or resolution.
- \since 1.1
-*/
-
-
-
-/*!
- \fn QCameraFocus::focusZonesChanged()
-
- Signal is emitted when the set of zones, camera focused on is changed.
-
- Usually the zones list is changed when the camera is focused.
- \since 1.1
-*/
-
-
-#include "moc_qcamerafocus.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qcamerafocus.h b/src/multimedia/qcamerafocus.h
deleted file mode 100644
index 064af7a..0000000
--- a/src/multimedia/qcamerafocus.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAFOCUS_H
-#define QCAMERAFOCUS_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qrect.h>
-#include <QtCore/qshareddata.h>
-
-#include <qmediaobject.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QCamera;
-
-class QCameraFocusZoneData;
-
-class Q_MULTIMEDIA_EXPORT QCameraFocusZone {
-public:
- enum FocusZoneStatus {
- Invalid,
- Unused,
- Selected,
- Focused
- };
-
- QCameraFocusZone();
- QCameraFocusZone(const QRectF &area, FocusZoneStatus status = Selected);
- QCameraFocusZone(const QCameraFocusZone &other);
-
- QCameraFocusZone& operator=(const QCameraFocusZone &other);
- bool operator==(const QCameraFocusZone &other) const;
- bool operator!=(const QCameraFocusZone &other) const;
-
- ~QCameraFocusZone();
-
- bool isValid() const;
-
- QRectF area() const;
-
- FocusZoneStatus status() const;
- void setStatus(FocusZoneStatus status);
-
-private:
- QSharedDataPointer<QCameraFocusZoneData> d;
-};
-
-typedef QList<QCameraFocusZone> QCameraFocusZoneList;
-
-
-class QCameraFocusPrivate;
-class Q_MULTIMEDIA_EXPORT QCameraFocus : public QObject
-{
- Q_OBJECT
-
- Q_PROPERTY(FocusMode focusMode READ focusMode WRITE setFocusMode)
- Q_PROPERTY(FocusPointMode focusPointMode READ focusPointMode WRITE setFocusPointMode)
- Q_PROPERTY(QPointF customFocusPoint READ customFocusPoint WRITE setCustomFocusPoint)
- Q_PROPERTY(QCameraFocusZoneList focusZones READ focusZones NOTIFY focusZonesChanged)
- Q_PROPERTY(qreal opticalZoom READ opticalZoom NOTIFY opticalZoomChanged)
- Q_PROPERTY(qreal digitalZoom READ digitalZoom NOTIFY digitalZoomChanged)
-
- Q_ENUMS(FocusMode)
- Q_ENUMS(FocusPointMode)
-public:
- enum FocusMode {
- ManualFocus = 0x1,
- HyperfocalFocus = 0x02,
- InfinityFocus = 0x04,
- AutoFocus = 0x8,
- ContinuousFocus = 0x10,
- MacroFocus = 0x20
- };
- Q_DECLARE_FLAGS(FocusModes, FocusMode)
-
- enum FocusPointMode {
- FocusPointAuto,
- FocusPointCenter,
- FocusPointFaceDetection,
- FocusPointCustom
- };
-
- bool isAvailable() const;
-
- FocusMode focusMode() const;
- void setFocusMode(FocusMode mode);
- bool isFocusModeSupported(FocusMode mode) const;
-
- FocusPointMode focusPointMode() const;
- void setFocusPointMode(FocusPointMode mode);
- bool isFocusPointModeSupported(FocusPointMode) const;
- QPointF customFocusPoint() const;
- void setCustomFocusPoint(const QPointF &point);
-
- QCameraFocusZoneList focusZones() const;
-
- qreal maximumOpticalZoom() const;
- qreal maximumDigitalZoom() const;
- qreal opticalZoom() const;
- qreal digitalZoom() const;
-
- void zoomTo(qreal opticalZoom, qreal digitalZoom);
-
-Q_SIGNALS:
- void opticalZoomChanged(qreal);
- void digitalZoomChanged(qreal);
-
- void focusZonesChanged();
-
- void maximumOpticalZoomChanged(qreal);
- void maximumDigitalZoomChanged(qreal);
-
-private:
- friend class QCamera;
- QCameraFocus(QCamera *camera);
- ~QCameraFocus();
-
- Q_DISABLE_COPY(QCameraFocus)
- Q_DECLARE_PRIVATE(QCameraFocus)
- QCameraFocusPrivate *d_ptr;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraFocus::FocusModes)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraFocus::FocusModes)
-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/qcamerafocuscontrol.cpp b/src/multimedia/qcamerafocuscontrol.cpp
deleted file mode 100644
index 93c4668..0000000
--- a/src/multimedia/qcamerafocuscontrol.cpp
+++ /dev/null
@@ -1,253 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcamerafocuscontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraFocusControl
-
-
- \brief The QCameraFocusControl class supplies control for
- focusing related camera parameters.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
- The interface name of QCameraFocusControl is \c com.nokia.Qt.QCameraFocusControl/1.0 as
- defined in QCameraFocusControl_iid.
-
-
- \sa QMediaService::requestControl(), QCamera
-*/
-
-/*!
- \macro QCameraFocusControl_iid
-
- \c com.nokia.Qt.QCameraFocusControl/1.0
-
- Defines the interface name of the QCameraFocusControl class.
-
- \relates QCameraFocusControl
-*/
-
-/*!
- Constructs a camera control object with \a parent.
-*/
-
-QCameraFocusControl::QCameraFocusControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destruct the camera control object.
-*/
-
-QCameraFocusControl::~QCameraFocusControl()
-{
-}
-
-
-/*!
- \fn QCameraFocus::FocusMode QCameraFocusControl::focusMode() const
-
- Returns the focus mode being used.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraFocusControl::setFocusMode(QCameraFocus::FocusMode mode)
-
- Set the focus mode to \a mode.
- \since 1.1
-*/
-
-
-/*!
- \fn bool QCameraFocusControl::isFocusModeSupported(QCameraFocus::FocusMode mode) const
-
- Returns true if focus \a mode is supported.
- \since 1.1
-*/
-
-
-/*!
- \fn qreal QCameraFocusControl::maximumOpticalZoom() const
-
- Returns the maximum optical zoom value, or 1.0 if optical zoom is not supported.
- \since 1.1
-*/
-
-
-/*!
- \fn qreal QCameraFocusControl::maximumDigitalZoom() const
-
- Returns the maximum digital zoom value, or 1.0 if digital zoom is not supported.
- \since 1.1
-*/
-
-
-/*!
- \fn qreal QCameraFocusControl::opticalZoom() const
-
- Return the current optical zoom value.
- \since 1.1
-*/
-
-/*!
- \fn qreal QCameraFocusControl::digitalZoom() const
-
- Return the current digital zoom value.
- \since 1.1
-*/
-
-
-/*!
- \fn void QCameraFocusControl::zoomTo(qreal optical, qreal digital)
-
- Sets \a optical and \a digital zoom values.
- \since 1.1
-*/
-
-/*!
- \fn QCameraFocusControl::focusPointMode() const
-
- Returns the camera focus point selection mode.
- \since 1.1
-*/
-
-/*!
- \fn QCameraFocusControl::setFocusPointMode(QCameraFocus::FocusPointMode mode)
-
- Sets the camera focus point selection \a mode.
- \since 1.1
-*/
-
-/*!
- \fn QCameraFocusControl::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
-
- Returns true if the camera focus point \a mode is supported.
- \since 1.1
-*/
-
-/*!
- \fn QCameraFocusControl::customFocusPoint() const
-
- Return the position of custom focus point, in relative frame coordinates:
- QPointF(0,0) points to the left top frame point, QPointF(0.5,0.5) points to the frame center.
-
- Custom focus point is used only in FocusPointCustom focus mode.
- \since 1.1
-*/
-
-/*!
- \fn QCameraFocusControl::setCustomFocusPoint(const QPointF &point)
-
- Sets the custom focus \a point.
-
- If camera supports fixed set of focus points,
- it should use the nearest supported focus point,
- and return the actual focus point with QCameraFocusControl::focusZones().
-
- \since 1.1
- \sa QCameraFocusControl::customFocusPoint(), QCameraFocusControl::focusZones()
-*/
-
-/*!
- \fn QCameraFocusControl::focusZones() const
-
- Returns the list of zones, the camera is using for focusing or focused on.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocusControl::opticalZoomChanged(qreal zoom)
-
- Signal emitted when the optical \a zoom value changed.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocusControl::digitalZoomChanged(qreal zoom)
-
- Signal emitted when the digital \a zoom value changed.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocusControl::maximumOpticalZoomChanged(qreal zoom)
-
- Signal emitted when the maximum supported optical \a zoom value changed.
- \since 1.1
-*/
-
-/*!
- \fn void QCameraFocusControl::maximumDigitalZoomChanged(qreal zoom)
-
- Signal emitted when the maximum supported digital \a zoom value changed.
-
- The maximum supported zoom value can depend on other camera settings,
- like capture mode or resolution.
- \since 1.1
-*/
-
-
-/*!
- \fn QCameraFocusControl::focusZonesChanged()
-
- Signal is emitted when the set of zones, camera focused on is changed.
-
- Usually the zones list is changed when the camera is focused.
-
- \since 1.1
- \sa QCameraFocusControl::focusZones()
-*/
-
-
-
-#include "moc_qcamerafocuscontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcamerafocuscontrol.h b/src/multimedia/qcamerafocuscontrol.h
deleted file mode 100644
index 20ffe6a..0000000
--- a/src/multimedia/qcamerafocuscontrol.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAFOCUSCONTROL_H
-#define QCAMERAFOCUSCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcamerafocus.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraFocusControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QCameraFocusControl();
-
- virtual QCameraFocus::FocusMode focusMode() const = 0;
- virtual void setFocusMode(QCameraFocus::FocusMode mode) = 0;
- virtual bool isFocusModeSupported(QCameraFocus::FocusMode mode) const = 0;
-
- virtual qreal maximumOpticalZoom() const = 0;
- virtual qreal maximumDigitalZoom() const = 0;
- virtual qreal opticalZoom() const = 0;
- virtual qreal digitalZoom() const = 0;
-
- virtual void zoomTo(qreal optical, qreal digital) = 0;
-
- virtual QCameraFocus::FocusPointMode focusPointMode() const = 0;
- virtual void setFocusPointMode(QCameraFocus::FocusPointMode mode) = 0;
- virtual bool isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const = 0;
- virtual QPointF customFocusPoint() const = 0;
- virtual void setCustomFocusPoint(const QPointF &point) = 0;
-
- virtual QCameraFocusZoneList focusZones() const = 0;
-
-Q_SIGNALS:
- void opticalZoomChanged(qreal opticalZoom);
- void digitalZoomChanged(qreal digitalZoom);
- void focusZonesChanged();
- void maximumOpticalZoomChanged(qreal);
- void maximumDigitalZoomChanged(qreal);
-
-protected:
- QCameraFocusControl(QObject* parent = 0);
-};
-
-#define QCameraFocusControl_iid "com.nokia.Qt.QCameraFocusingControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraFocusControl, QCameraFocusControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERAFOCUSCONTROL_H
-
diff --git a/src/multimedia/qcameraimagecapture.cpp b/src/multimedia/qcameraimagecapture.cpp
deleted file mode 100644
index f49531e..0000000
--- a/src/multimedia/qcameraimagecapture.cpp
+++ /dev/null
@@ -1,681 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include <qcameraimagecapture.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qmediaencodersettings.h>
-#include <qcameracapturedestinationcontrol.h>
-#include <qcameracapturebufferformatcontrol.h>
-
-#include <qimageencodercontrol.h>
-#include "qmediaobject_p.h"
-#include <qmediaservice.h>
-#include <qcamera.h>
-#include <qcameracontrol.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmetaobject.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraImageCapture
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
-
- \brief The QCameraImageCapture class is used for the recording of media content.
-
- The QCameraImageCapture class is a high level images recording class.
- It's not intended to be used alone but for accessing the media
- recording functions of other media objects, like QCamera.
-
- \snippet doc/src/snippets/multimedia-snippets/camera.cpp Camera
-
- \snippet doc/src/snippets/multimedia-snippets/camera.cpp Camera keys
-
- \sa QCamera
-*/
-
-namespace
-{
-class MediaRecorderRegisterMetaTypes
-{
-public:
- MediaRecorderRegisterMetaTypes()
- {
- qRegisterMetaType<QCameraImageCapture::Error>("QCameraImageCapture::Error");
- qRegisterMetaType<QCameraImageCapture::CaptureDestination>("QCameraImageCapture::CaptureDestination");
- qRegisterMetaType<QCameraImageCapture::CaptureDestinations>("QCameraImageCapture::CaptureDestinations");
- }
-} _registerRecorderMetaTypes;
-}
-
-
-class QCameraImageCapturePrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCameraImageCapture)
-public:
- QCameraImageCapturePrivate();
-
- QMediaObject *mediaObject;
-
- QCameraImageCaptureControl *control;
- QImageEncoderControl *encoderControl;
- QCameraCaptureDestinationControl *captureDestinationControl;
- QCameraCaptureBufferFormatControl *bufferFormatControl;
-
- QCameraImageCapture::Error error;
- QString errorString;
-
- void _q_error(int id, int error, const QString &errorString);
- void _q_readyChanged(bool);
- void _q_serviceDestroyed();
-
- void unsetError() { error = QCameraImageCapture::NoError; errorString.clear(); }
-
- QCameraImageCapture *q_ptr;
-};
-
-QCameraImageCapturePrivate::QCameraImageCapturePrivate():
- mediaObject(0),
- control(0),
- encoderControl(0),
- captureDestinationControl(0),
- bufferFormatControl(0),
- error(QCameraImageCapture::NoError)
-{
-}
-
-void QCameraImageCapturePrivate::_q_error(int id, int error, const QString &errorString)
-{
- Q_Q(QCameraImageCapture);
-
- this->error = QCameraImageCapture::Error(error);
- this->errorString = errorString;
-
- emit q->error(id, this->error, errorString);
-}
-
-void QCameraImageCapturePrivate::_q_readyChanged(bool ready)
-{
- Q_Q(QCameraImageCapture);
- emit q->readyForCaptureChanged(ready);
-}
-
-void QCameraImageCapturePrivate::_q_serviceDestroyed()
-{
- mediaObject = 0;
- control = 0;
- encoderControl = 0;
- captureDestinationControl = 0;
- bufferFormatControl = 0;
-}
-
-/*!
- Constructs a media recorder which records the media produced by \a mediaObject.
-
- The \a parent is passed to QMediaObject.
-*/
-
-QCameraImageCapture::QCameraImageCapture(QMediaObject *mediaObject, QObject *parent):
- QObject(parent), d_ptr(new QCameraImageCapturePrivate)
-{
- Q_D(QCameraImageCapture);
-
- d->q_ptr = this;
-
- if (mediaObject)
- mediaObject->bind(this);
-}
-
-/*!
- Destroys images capture object.
-*/
-
-QCameraImageCapture::~QCameraImageCapture()
-{
- Q_D(QCameraImageCapture);
-
- if (d->mediaObject)
- d->mediaObject->unbind(this);
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-QMediaObject *QCameraImageCapture::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-bool QCameraImageCapture::setMediaObject(QMediaObject *mediaObject)
-{
- Q_D(QCameraImageCapture);
-
- if (d->mediaObject) {
- if (d->control) {
- disconnect(d->control, SIGNAL(imageExposed(int)),
- this, SIGNAL(imageExposed(int)));
- disconnect(d->control, SIGNAL(imageCaptured(int,QImage)),
- this, SIGNAL(imageCaptured(int,QImage)));
- disconnect(d->control, SIGNAL(imageAvailable(int,QVideoFrame)),
- this, SIGNAL(imageAvailable(int,QVideoFrame)));
- disconnect(d->control, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)),
- this, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)));
- disconnect(d->control, SIGNAL(imageMetadataAvailable(int,QString,QVariant)),
- this, SIGNAL(imageMetadataAvailable(int,QString,QVariant)));
- disconnect(d->control, SIGNAL(imageSaved(int,QString)),
- this, SIGNAL(imageSaved(int,QString)));
- disconnect(d->control, SIGNAL(readyForCaptureChanged(bool)),
- this, SLOT(_q_readyChanged(bool)));
- disconnect(d->control, SIGNAL(error(int,int,QString)),
- this, SLOT(_q_error(int,int,QString)));
-
- if (d->captureDestinationControl) {
- disconnect(d->captureDestinationControl, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)),
- this, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)));
- }
-
- if (d->bufferFormatControl) {
- disconnect(d->bufferFormatControl, SIGNAL(bufferFormatChanged(QVideoFrame::PixelFormat)),
- this, SIGNAL(bufferFormatChanged(QVideoFrame::PixelFormat)));
- }
-
- QMediaService *service = d->mediaObject->service();
- service->releaseControl(d->control);
- if (d->encoderControl)
- service->releaseControl(d->encoderControl);
- if (d->captureDestinationControl)
- service->releaseControl(d->captureDestinationControl);
- if (d->bufferFormatControl)
- service->releaseControl(d->bufferFormatControl);
-
- disconnect(service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
- }
- }
-
- d->mediaObject = mediaObject;
-
- if (d->mediaObject) {
- QMediaService *service = mediaObject->service();
- if (service) {
- d->control = qobject_cast<QCameraImageCaptureControl*>(service->requestControl(QCameraImageCaptureControl_iid));
-
- if (d->control) {
- d->encoderControl = qobject_cast<QImageEncoderControl *>(service->requestControl(QImageEncoderControl_iid));
- d->captureDestinationControl = qobject_cast<QCameraCaptureDestinationControl *>(
- service->requestControl(QCameraCaptureDestinationControl_iid));
- d->bufferFormatControl = qobject_cast<QCameraCaptureBufferFormatControl *>(
- service->requestControl(QCameraCaptureBufferFormatControl_iid));
-
- connect(d->control, SIGNAL(imageExposed(int)),
- this, SIGNAL(imageExposed(int)));
- connect(d->control, SIGNAL(imageCaptured(int,QImage)),
- this, SIGNAL(imageCaptured(int,QImage)));
- connect(d->control, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)),
- this, SIGNAL(imageMetadataAvailable(int,QtMultimedia::MetaData,QVariant)));
- connect(d->control, SIGNAL(imageMetadataAvailable(int,QString,QVariant)),
- this, SIGNAL(imageMetadataAvailable(int,QString,QVariant)));
- connect(d->control, SIGNAL(imageAvailable(int,QVideoFrame)),
- this, SIGNAL(imageAvailable(int,QVideoFrame)));
- connect(d->control, SIGNAL(imageSaved(int, QString)),
- this, SIGNAL(imageSaved(int, QString)));
- connect(d->control, SIGNAL(readyForCaptureChanged(bool)),
- this, SLOT(_q_readyChanged(bool)));
- connect(d->control, SIGNAL(error(int,int,QString)),
- this, SLOT(_q_error(int,int,QString)));
-
- if (d->captureDestinationControl) {
- connect(d->captureDestinationControl, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)),
- this, SIGNAL(captureDestinationChanged(QCameraImageCapture::CaptureDestinations)));
- }
-
- if (d->bufferFormatControl) {
- connect(d->bufferFormatControl, SIGNAL(bufferFormatChanged(QVideoFrame::PixelFormat)),
- this, SIGNAL(bufferFormatChanged(QVideoFrame::PixelFormat)));
- }
-
- connect(service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
-
- return true;
- }
- }
- }
-
- // without QCameraImageCaptureControl discard the media object
- d->mediaObject = 0;
- d->control = 0;
- d->encoderControl = 0;
- d->captureDestinationControl = 0;
- d->bufferFormatControl = 0;
-
- return false;
-}
-
-/*!
- Returns true if the images capture service ready to use.
- \since 1.1
-*/
-bool QCameraImageCapture::isAvailable() const
-{
- if (d_func()->control != NULL)
- return true;
- else
- return false;
-}
-
-/*!
- Returns the availability error code.
- \since 1.1
-*/
-QtMultimedia::AvailabilityError QCameraImageCapture::availabilityError() const
-{
- if (d_func()->control != NULL)
- return QtMultimedia::NoError;
- else
- return QtMultimedia::ServiceMissingError;
-}
-
-/*!
- Returns the current error state.
-
- \since 1.1
- \sa errorString()
-*/
-
-QCameraImageCapture::Error QCameraImageCapture::error() const
-{
- return d_func()->error;
-}
-
-/*!
- Returns a string describing the current error state.
-
- \since 1.1
- \sa error()
-*/
-
-QString QCameraImageCapture::errorString() const
-{
- return d_func()->errorString;
-}
-
-
-/*!
- Returns a list of supported image codecs.
- \since 1.1
-*/
-QStringList QCameraImageCapture::supportedImageCodecs() const
-{
- return d_func()->encoderControl ?
- d_func()->encoderControl->supportedImageCodecs() : QStringList();
-}
-
-/*!
- Returns a description of an image \a codec.
- \since 1.1
-*/
-QString QCameraImageCapture::imageCodecDescription(const QString &codec) const
-{
- return d_func()->encoderControl ?
- d_func()->encoderControl->imageCodecDescription(codec) : QString();
-}
-
-/*!
- Returns a list of resolutions images can be encoded at.
-
- If non null image \a settings parameter is passed,
- the returned list is reduced to resolution supported with partial settings like image codec or quality applied.
-
- If the encoder supports arbitrary resolutions within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
-
- \since 1.1
- \sa QImageEncoderSettings::resolution()
-*/
-QList<QSize> QCameraImageCapture::supportedResolutions(const QImageEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return d_func()->encoderControl ?
- d_func()->encoderControl->supportedResolutions(settings, continuous) : QList<QSize>();
-}
-
-/*!
- Returns the image encoder settings being used.
-
- \since 1.1
- \sa setEncodingSettings()
-*/
-
-QImageEncoderSettings QCameraImageCapture::encodingSettings() const
-{
- return d_func()->encoderControl ?
- d_func()->encoderControl->imageSettings() : QImageEncoderSettings();
-}
-
-/*!
- Sets the image encoding \a settings.
-
- If some parameters are not specified, or null settings are passed,
- the encoder choose the default encoding parameters.
-
- \since 1.1
- \sa encodingSettings()
-*/
-
-void QCameraImageCapture::setEncodingSettings(const QImageEncoderSettings &settings)
-{
- Q_D(QCameraImageCapture);
-
- if (d->encoderControl) {
- QCamera *camera = qobject_cast<QCamera*>(d->mediaObject);
- if (camera && camera->captureMode() == QCamera::CaptureStillImage) {
- QMetaObject::invokeMethod(camera,
- "_q_preparePropertyChange",
- Qt::DirectConnection,
- Q_ARG(int, QCameraControl::ImageEncodingSettings));
- }
-
- d->encoderControl->setImageSettings(settings);
- }
-}
-
-/*!
- Returns the list of supported buffer image capture formats.
-
- \since 1.1
- \sa bufferFormat() setBufferFormat()
-*/
-QList<QVideoFrame::PixelFormat> QCameraImageCapture::supportedBufferFormats() const
-{
- if (d_func()->bufferFormatControl)
- return d_func()->bufferFormatControl->supportedBufferFormats();
- else
- return QList<QVideoFrame::PixelFormat>();
-}
-
-/*!
- Returns the buffer image capture format being used.
-
- \since 1.2
- \sa supportedBufferCaptureFormats() setBufferCaptureFormat()
-*/
-QVideoFrame::PixelFormat QCameraImageCapture::bufferFormat() const
-{
- if (d_func()->bufferFormatControl)
- return d_func()->bufferFormatControl->bufferFormat();
- else
- return QVideoFrame::Format_Invalid;
-}
-
-/*!
- Sets the buffer image capture format to be used.
-
- \since 1.2
- \sa bufferCaptureFormat() supportedBufferCaptureFormats() captureDestination()
-*/
-void QCameraImageCapture::setBufferFormat(const QVideoFrame::PixelFormat format)
-{
- if (d_func()->bufferFormatControl)
- d_func()->bufferFormatControl->setBufferFormat(format);
-}
-
-/*!
- Returns true if the image capture \a destination is supported; otherwise returns false.
-
- \since 1.2
- \sa captureDestination() setCaptureDestination()
-*/
-bool QCameraImageCapture::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
-{
- if (d_func()->captureDestinationControl)
- return d_func()->captureDestinationControl->isCaptureDestinationSupported(destination);
- else
- return destination == CaptureToFile;
-}
-
-/*!
- Returns the image capture destination being used.
-
- \since 1.2
- \sa isCaptureDestinationSupported() setCaptureDestination()
-*/
-QCameraImageCapture::CaptureDestinations QCameraImageCapture::captureDestination() const
-{
- if (d_func()->captureDestinationControl)
- return d_func()->captureDestinationControl->captureDestination();
- else
- return CaptureToFile;
-}
-
-/*!
- Sets the capture \a destination to be used.
-
- \since 1.2
- \sa isCaptureDestinationSupported() captureDestination()
-*/
-void QCameraImageCapture::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
-{
- Q_D(QCameraImageCapture);
-
- if (d->captureDestinationControl)
- d->captureDestinationControl->setCaptureDestination(destination);
-}
-
-/*!
- \property QCameraImageCapture::readyForCapture
- Indicates the service is ready to capture a an image immediately.
- \since 1.1
-*/
-
-bool QCameraImageCapture::isReadyForCapture() const
-{
- if (d_func()->control)
- return d_func()->control->isReadyForCapture();
- else
- return false;
-}
-
-/*!
- \fn QCameraImageCapture::readyForCaptureChanged(bool ready)
-
- Signals that a camera's \a ready for capture state has changed.
- \since 1.1
-*/
-
-
-/*!
- Capture the image and save it to \a file.
- This operation is asynchronous in majority of cases,
- followed by signals QCameraImageCapture::imageCaptured(), QCameraImageCapture::imageSaved()
- or QCameraImageCapture::error().
-
- If an empty \a file is passed, the camera backend choses
- the default location and naming scheme for photos on the system,
- if only file name without full path is specified, the image will be saved to
- the default directory, with a full path reported with imageCaptured() and imageSaved() signals.
-
- QCameraImageCapture::capture returns the capture Id parameter, used with
- imageExposed(), imageCaptured() and imageSaved() signals.
- \since 1.1
-*/
-int QCameraImageCapture::capture(const QString &file)
-{
- Q_D(QCameraImageCapture);
-
- d->unsetError();
-
- if (d->control) {
- return d->control->capture(file);
- } else {
- d->error = NotSupportedFeatureError;
- d->errorString = tr("Device does not support images capture.");
-
- emit error(-1, d->error, d->errorString);
- }
-
- return -1;
-}
-
-/*!
- Cancel incomplete capture requests.
- Already captured and queused for proicessing images may be discarded.
- \since 1.1
-*/
-void QCameraImageCapture::cancelCapture()
-{
- Q_D(QCameraImageCapture);
-
- d->unsetError();
-
- if (d->control) {
- d->control->cancelCapture();
- } else {
- d->error = NotSupportedFeatureError;
- d->errorString = tr("Device does not support images capture.");
-
- emit error(-1, d->error, d->errorString);
- }
-}
-
-
-/*!
- \enum QCameraImageCapture::Error
-
- \value NoError No Errors.
- \value NotReadyError The service is not ready for capture yet.
- \value ResourceError Device is not ready or not available.
- \value NotSupportedFeatureError Device does not support stillimages capture.
- \value FormatError Current format is not supported.
- \value OutOfSpaceError No space left on device.
-*/
-
-/*!
- \enum QCameraImageCapture::DriveMode
-
- \value SingleImageCapture Drive mode is capturing a single picture.
-*/
-
-/*!
- \fn QCameraImageCapture::error(int id, QCameraImageCapture::Error error, const QString &errorString)
-
- Signals that the capture request \a id has failed with an \a error
- and \a errorString description.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCapture::bufferFormatChanged(QVideoFrame::PixelFormat format)
-
- Signal emitted when the buffer \a format for the buffer image capture has changed.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCapture::captureDestinationChanged(CaptureDestinations destination)
-
- Signal emitted when the capture \a destination has changed.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCapture::imageExposed(int id)
-
- Signal emitted when the frame with request \a id was exposed.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCapture::imageCaptured(int id, const QImage &preview);
-
- Signal emitted when the frame with request \a id was captured, but not processed and saved yet.
- Frame \a preview can be displayed to user.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCapture::imageMetadataAvailable(int id, QtMultimedia::MetaData key, const QVariant &value)
-
- Signals that a metadata for an image with request \a id is available.
- This signal is emitted for metadata \a value with a \a key listed in QtMultimedia::MetaData enum.
-
- This signal is emitted between imageExposed and imageSaved signals.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCapture::imageMetadataAvailable(int id, const QString &key, const QVariant &value)
-
- Signals that a metadata for an image with request \a id is available.
- This signal is emitted for extended metadata \a value with a \a key not listed in QtMultimedia::MetaData enum.
-
- This signal is emitted between imageExposed and imageSaved signals.
- \since 1.2
-*/
-
-
-/*!
- \fn QCameraImageCapture::imageAvailable(int id, const QVideoFrame &buffer)
-
- Signal emitted when the frame with request \a id is available as \a buffer.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCapture::imageSaved(int id, const QString &fileName)
-
- Signal emitted when the frame with request \a id was saved to \a fileName.
- \since 1.1
-*/
-
-
-#include "moc_qcameraimagecapture.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameraimagecapture.h b/src/multimedia/qcameraimagecapture.h
deleted file mode 100644
index bc41622..0000000
--- a/src/multimedia/qcameraimagecapture.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAIMAGECAPTURE_H
-#define QCAMERAIMAGECAPTURE_H
-
-#include <qmediaobject.h>
-#include <qmediaencodersettings.h>
-#include <qmediabindableinterface.h>
-#include <qvideoframe.h>
-
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QSize;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QImageEncoderSettings;
-
-class QCameraImageCapturePrivate;
-class Q_MULTIMEDIA_EXPORT QCameraImageCapture : public QObject, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
- Q_ENUMS(Error)
- Q_ENUMS(CaptureDestination)
- Q_PROPERTY(bool readyForCapture READ isReadyForCapture NOTIFY readyForCaptureChanged)
-public:
- enum Error
- {
- NoError,
- NotReadyError,
- ResourceError,
- OutOfSpaceError,
- NotSupportedFeatureError,
- FormatError
- };
-
- enum DriveMode
- {
- SingleImageCapture
- };
-
- enum CaptureDestination
- {
- CaptureToFile = 0x01,
- CaptureToBuffer = 0x02
- };
- Q_DECLARE_FLAGS(CaptureDestinations, CaptureDestination)
-
- QCameraImageCapture(QMediaObject *mediaObject, QObject *parent = 0);
- ~QCameraImageCapture();
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- QMediaObject *mediaObject() const;
-
- Error error() const;
- QString errorString() const;
-
- bool isReadyForCapture() const;
-
- QStringList supportedImageCodecs() const;
- QString imageCodecDescription(const QString &codecName) const;
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const;
-
- QImageEncoderSettings encodingSettings() const;
- void setEncodingSettings(const QImageEncoderSettings& settings);
-
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const;
- QVideoFrame::PixelFormat bufferFormat() const;
- void setBufferFormat(QVideoFrame::PixelFormat format);
-
- bool isCaptureDestinationSupported(CaptureDestinations destination) const;
- CaptureDestinations captureDestination() const;
- void setCaptureDestination(CaptureDestinations destination);
-
-public Q_SLOTS:
- int capture(const QString &location = QString());
- void cancelCapture();
-
-Q_SIGNALS:
- void error(int id, QCameraImageCapture::Error error, const QString &errorString);
-
- void readyForCaptureChanged(bool);
- void bufferFormatChanged(QVideoFrame::PixelFormat);
- void captureDestinationChanged(QCameraImageCapture::CaptureDestinations);
-
- void imageExposed(int id);
- void imageCaptured(int id, const QImage &preview);
- void imageMetadataAvailable(int id, QtMultimedia::MetaData key, const QVariant &value);
- void imageMetadataAvailable(int id, const QString &key, const QVariant &value);
- void imageAvailable(int id, const QVideoFrame &image);
- void imageSaved(int id, const QString &fileName);
-
-protected:
- bool setMediaObject(QMediaObject *);
-
- QCameraImageCapturePrivate *d_ptr;
-private:
- Q_DISABLE_COPY(QCameraImageCapture)
- Q_DECLARE_PRIVATE(QCameraImageCapture)
- Q_PRIVATE_SLOT(d_func(), void _q_error(int, int, const QString &))
- Q_PRIVATE_SLOT(d_func(), void _q_readyChanged(bool))
- Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed())
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QCameraImageCapture::CaptureDestinations)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraImageCapture::Error)
-Q_DECLARE_METATYPE(QCameraImageCapture::CaptureDestination)
-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/qcameraimagecapturecontrol.cpp b/src/multimedia/qcameraimagecapturecontrol.cpp
deleted file mode 100644
index ad4c55e..0000000
--- a/src/multimedia/qcameraimagecapturecontrol.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameraimagecapturecontrol.h>
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraImageCaptureControl
-
- \brief The QCameraImageCaptureControl class provides a control interface
- for image capture services.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
-
-
- The interface name of QCameraImageCaptureControl is \c com.nokia.Qt.QCameraImageCaptureControl/1.0 as
- defined in QCameraImageCaptureControl_iid.
-
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- \macro QCameraImageCaptureControl_iid
-
- \c com.nokia.Qt.QCameraImageCaptureControl/1.0
-
- Defines the interface name of the QCameraImageCaptureControl class.
-
- \relates QCameraImageCaptureControl
-*/
-
-/*!
- Constructs a new image capture control object with the given \a parent
-*/
-QCameraImageCaptureControl::QCameraImageCaptureControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys an image capture control.
-*/
-QCameraImageCaptureControl::~QCameraImageCaptureControl()
-{
-}
-
-/*!
- \fn QCameraImageCaptureControl::isReadyForCapture() const
-
- Identifies if a capture control is ready to perform a capture
- immediately (all the resources necessary for image capture are allocated,
- hardware initialized, flash is charged, etc).
-
- Returns true if the camera is ready for capture; and false if it is not.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::readyForCaptureChanged(bool ready)
-
- Signals that a capture control's \a ready state has changed.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::capture(const QString &fileName)
-
- Initiates the capture of an image to \a fileName.
- The \a fileName can be relative or empty,
- in this case the service should use the system specific place
- and file naming scheme.
-
- Returns the capture request id number, which is used later
- with imageExposed(), imageCaptured() and imageSaved() signals.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::cancelCapture()
-
- Cancel pending capture requests.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageExposed(int requestId)
-
- Signals that an image with it \a requestId
- has just been exposed.
- This signal can be used for the shutter sound or other indicaton.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageCaptured(int requestId, const QImage &preview)
-
- Signals that an image with it \a requestId
- has been captured and a \a preview is available.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageMetadataAvailable(int id, QtMultimedia::MetaData key, const QVariant &value)
-
- Signals that a metadata for an image with request \a id is available.
- This signal is emitted for metadata \a value with a \a key listed in QtMultimedia::MetaData enum.
-
- This signal should be emitted between imageExposed and imageSaved signals.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageMetadataAvailable(int id, const QString &key, const QVariant &value)
-
- Signals that a metadata for an image with request \a id is available.
- This signal is emitted for extended metadata \a value with a \a key not listed in QtMultimedia::MetaData enum.
-
- This signal should be emitted between imageExposed and imageSaved signals.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageAvailable(int requestId, const QVideoFrame &buffer)
-
- Signals that a captured \a buffer with a \a requestId is available.
- \since 1.2
-*/
-
-/*!
- \fn QCameraImageCaptureControl::imageSaved(int requestId, const QString &fileName)
-
- Signals that a captured image with a \a requestId has been saved
- to \a fileName.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::driveMode() const
-
- Returns the current camera drive mode.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode)
-
- Sets the current camera drive \a mode.
- \since 1.1
-*/
-
-
-/*!
- \fn QCameraImageCaptureControl::error(int id, int error, const QString &errorString)
-
- Signals the capture request \a id failed with \a error code and message \a errorString.
-
- \since 1.1
- \sa QCameraImageCapture::Error
-*/
-
-
-#include "moc_qcameraimagecapturecontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameraimagecapturecontrol.h b/src/multimedia/qcameraimagecapturecontrol.h
deleted file mode 100644
index 0459c14..0000000
--- a/src/multimedia/qcameraimagecapturecontrol.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAIMAGECAPTURECONTROL_H
-#define QCAMERAIMAGECAPTURECONTROL_H
-
-#include <qmediacontrol.h>
-#include <qcameraimagecapture.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QImage;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT QCameraImageCaptureControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QCameraImageCaptureControl();
-
- virtual bool isReadyForCapture() const = 0;
-
- virtual QCameraImageCapture::DriveMode driveMode() const = 0;
- virtual void setDriveMode(QCameraImageCapture::DriveMode mode) = 0;
-
- virtual int capture(const QString &fileName) = 0;
- virtual void cancelCapture() = 0;
-
-Q_SIGNALS:
- void readyForCaptureChanged(bool);
-
- void imageExposed(int id);
- void imageCaptured(int id, const QImage &preview);
- void imageMetadataAvailable(int id, QtMultimedia::MetaData key, const QVariant &value);
- 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 error(int id, int error, const QString &errorString);
-
-protected:
- QCameraImageCaptureControl(QObject* parent = 0);
-};
-
-#define QCameraImageCaptureControl_iid "com.nokia.Qt.QCameraImageCaptureControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraImageCaptureControl, QCameraImageCaptureControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERAIMAGECAPTURECONTROL_H
-
diff --git a/src/multimedia/qcameraimageprocessing.cpp b/src/multimedia/qcameraimageprocessing.cpp
deleted file mode 100644
index 4286afc..0000000
--- a/src/multimedia/qcameraimageprocessing.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcameraimageprocessing.h"
-#include "qmediaobject_p.h"
-
-#include <qcameracontrol.h>
-#include <qcameraexposurecontrol.h>
-#include <qcamerafocuscontrol.h>
-#include <qmediarecordercontrol.h>
-#include <qcameraimageprocessingcontrol.h>
-#include <qcameraimagecapturecontrol.h>
-#include <qvideodevicecontrol.h>
-
-#include <QtCore/QDebug>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraImageProcessing
-
-
- \brief The QCameraImageProcessing class provides interface for
- focus and zoom related camera settings.
-
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
-*/
-
-
-class QCameraImageProcessingPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCameraImageProcessing)
-public:
- void initControls();
-
- QCameraImageProcessing *q_ptr;
-
- QCamera *camera;
- QCameraImageProcessingControl *imageControl;
-};
-
-
-void QCameraImageProcessingPrivate::initControls()
-{
- imageControl = 0;
-
- QMediaService *service = camera->service();
- if (service)
- imageControl = qobject_cast<QCameraImageProcessingControl *>(service->requestControl(QCameraImageProcessingControl_iid));
-}
-
-/*!
- Construct a QCameraImageProcessing for \a camera.
-*/
-
-QCameraImageProcessing::QCameraImageProcessing(QCamera *camera):
- QObject(camera), d_ptr(new QCameraImageProcessingPrivate)
-{
- Q_D(QCameraImageProcessing);
- d->camera = camera;
- d->q_ptr = this;
- d->initControls();
-}
-
-
-/*!
- Destroys the camera focus object.
-*/
-
-QCameraImageProcessing::~QCameraImageProcessing()
-{
-}
-
-
-/*!
- Returns true if image processing related settings are supported by this camera.
- \since 1.1
-*/
-bool QCameraImageProcessing::isAvailable() const
-{
- return d_func()->imageControl != 0;
-}
-
-
-/*!
- Returns the white balance mode being used.
- \since 1.1
-*/
-
-QCameraImageProcessing::WhiteBalanceMode QCameraImageProcessing::whiteBalanceMode() const
-{
- return d_func()->imageControl ? d_func()->imageControl->whiteBalanceMode() : QCameraImageProcessing::WhiteBalanceAuto;
-}
-
-/*!
- Sets the white balance to \a mode.
- \since 1.1
-*/
-
-void QCameraImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
-{
- if (d_func()->imageControl)
- d_func()->imageControl->setWhiteBalanceMode(mode);
-}
-
-/*!
- Returns true if the white balance \a mode is supported.
- \since 1.1
-*/
-
-bool QCameraImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
-{
- return d_func()->imageControl ? d_func()->imageControl->isWhiteBalanceModeSupported(mode) : false;
-}
-
-/*!
- Returns the current color temperature if the
- manual white balance is active, otherwise the
- return value is undefined.
- \since 1.1
-*/
-
-int QCameraImageProcessing::manualWhiteBalance() const
-{
- QVariant value;
-
- if (d_func()->imageControl)
- value = d_func()->imageControl->processingParameter(QCameraImageProcessingControl::ColorTemperature);
-
- return value.toInt();
-}
-
-/*!
- Sets manual white balance to \a colorTemperature
- \since 1.1
-*/
-
-void QCameraImageProcessing::setManualWhiteBalance(int colorTemperature)
-{
- if (d_func()->imageControl) {
- d_func()->imageControl->setProcessingParameter(
- QCameraImageProcessingControl::ColorTemperature,
- QVariant(colorTemperature));
- }
-}
-
-/*!
- Return the contrast.
- \since 1.1
-*/
-int QCameraImageProcessing::contrast() const
-{
- QVariant value;
-
- if (d_func()->imageControl)
- value = d_func()->imageControl->processingParameter(QCameraImageProcessingControl::Contrast);
-
- return value.toInt();
-}
-
-/*!
- Set the contrast to \a value.
-
- Valid contrast values range between -100 and 100, the default is 0.
- \since 1.1
-*/
-void QCameraImageProcessing::setContrast(int value)
-{
- if (d_func()->imageControl)
- d_func()->imageControl->setProcessingParameter(QCameraImageProcessingControl::Contrast,
- QVariant(value));
-}
-
-/*!
- Returns the saturation value.
- \since 1.1
-*/
-int QCameraImageProcessing::saturation() const
-{
- QVariant value;
-
- if (d_func()->imageControl)
- value = d_func()->imageControl->processingParameter(QCameraImageProcessingControl::Saturation);
-
- return value.toInt();
-}
-
-/*!
- Sets the saturation value to \a value.
-
- Valid saturation values range between -100 and 100, the default is 0.
- \since 1.1
-*/
-
-void QCameraImageProcessing::setSaturation(int value)
-{
- if (d_func()->imageControl)
- d_func()->imageControl->setProcessingParameter(QCameraImageProcessingControl::Saturation,
- QVariant(value));
-}
-
-/*!
- Identifies if sharpening is supported.
-
- Returns true if sharpening is supported; and false if it is not.
- \since 1.1
-*/
-bool QCameraImageProcessing::isSharpeningSupported() const
-{
- if (d_func()->imageControl)
- return d_func()->imageControl->isProcessingParameterSupported(QCameraImageProcessingControl::Sharpening);
- else
- return false;
-}
-
-/*!
- Returns the sharpening level.
- \since 1.1
-*/
-int QCameraImageProcessing::sharpeningLevel() const
-{
- QVariant value;
-
- if (d_func()->imageControl)
- value = d_func()->imageControl->processingParameter(QCameraImageProcessingControl::Sharpening);
-
- if (value.isNull())
- return -1;
- else
- return value.toInt();
-}
-
-/*!
- Sets the sharpening \a level.
-
- Valid sharpening level values range between -1 for default sharpening level,
- 0 for sharpening disabled and 100 for maximum sharpening applied.
- \since 1.1
-*/
-
-void QCameraImageProcessing::setSharpeningLevel(int level)
-{
- Q_D(QCameraImageProcessing);
- if (d->imageControl)
- d->imageControl->setProcessingParameter(QCameraImageProcessingControl::Sharpening,
- level == -1 ? QVariant() : QVariant(level));
-}
-
-/*!
- Returns true if denoising is supported.
- \since 1.1
-*/
-bool QCameraImageProcessing::isDenoisingSupported() const
-{
- if (d_func()->imageControl)
- return d_func()->imageControl->isProcessingParameterSupported(QCameraImageProcessingControl::Denoising);
- else
- return false;
-}
-
-/*!
- Returns the denoising level.
- \since 1.1
-*/
-int QCameraImageProcessing::denoisingLevel() const
-{
- QVariant value;
-
- if (d_func()->imageControl)
- value = d_func()->imageControl->processingParameter(QCameraImageProcessingControl::Denoising);
-
- if (value.isNull())
- return -1;
- else
- return value.toInt();
-}
-
-/*!
- Sets the denoising \a level.
-
- Valid denoising level values range between -1 for default denoising level,
- 0 for denoising disabled and 100 for maximum denoising applied.
- \since 1.1
-*/
-void QCameraImageProcessing::setDenoisingLevel(int level)
-{
- Q_D(QCameraImageProcessing);
- if (d->imageControl)
- d->imageControl->setProcessingParameter(QCameraImageProcessingControl::Denoising,
- level == -1 ? QVariant() : QVariant(level));
-}
-
-
-/*!
- \enum QCameraImageProcessing::WhiteBalanceMode
-
- \value WhiteBalanceManual Manual white balance. In this mode the white balance should be set with
- setManualWhiteBalance()
- \value WhiteBalanceAuto Auto white balance mode.
- \value WhiteBalanceSunlight Sunlight white balance mode.
- \value WhiteBalanceCloudy Cloudy white balance mode.
- \value WhiteBalanceShade Shade white balance mode.
- \value WhiteBalanceTungsten Tungsten white balance mode.
- \value WhiteBalanceFluorescent Fluorescent white balance mode.
- \value WhiteBalanceFlash Flash white balance mode.
- \value WhiteBalanceSunset Sunset white balance mode.
- \value WhiteBalanceVendor Vendor defined white balance mode.
-*/
-
-#include "moc_qcameraimageprocessing.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qcameraimageprocessing.h b/src/multimedia/qcameraimageprocessing.h
deleted file mode 100644
index 42a7eb5..0000000
--- a/src/multimedia/qcameraimageprocessing.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAIMAGEPROCESSING_H
-#define QCAMERAIMAGEPROCESSING_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qrect.h>
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QCamera;
-
-class QCameraImageProcessingPrivate;
-class Q_MULTIMEDIA_EXPORT QCameraImageProcessing : public QObject
-{
- Q_OBJECT
- Q_ENUMS(WhiteBalanceMode)
-public:
- enum WhiteBalanceMode {
- WhiteBalanceAuto = 0,
- WhiteBalanceManual = 1,
- WhiteBalanceSunlight = 2,
- WhiteBalanceCloudy = 3,
- WhiteBalanceShade = 4,
- WhiteBalanceTungsten = 5,
- WhiteBalanceFluorescent = 6,
- WhiteBalanceFlash = 7,
- WhiteBalanceSunset = 8,
- WhiteBalanceVendor = 1000
- };
-
- bool isAvailable() const;
-
- WhiteBalanceMode whiteBalanceMode() const;
- void setWhiteBalanceMode(WhiteBalanceMode mode);
- bool isWhiteBalanceModeSupported(WhiteBalanceMode mode) const;
- int manualWhiteBalance() const;
- void setManualWhiteBalance(int colorTemperature);
-
- int contrast() const;
- void setContrast(int value);
-
- int saturation() const;
- void setSaturation(int value);
-
- bool isSharpeningSupported() const;
- int sharpeningLevel() const;
- void setSharpeningLevel(int value);
-
- bool isDenoisingSupported() const;
- int denoisingLevel() const;
- void setDenoisingLevel(int value);
-
-private:
- friend class QCamera;
- QCameraImageProcessing(QCamera *camera);
- ~QCameraImageProcessing();
-
- Q_DISABLE_COPY(QCameraImageProcessing)
- Q_DECLARE_PRIVATE(QCameraImageProcessing)
- QCameraImageProcessingPrivate *d_ptr;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraImageProcessing::WhiteBalanceMode)
-
-Q_MEDIA_ENUM_DEBUG(QCameraImageProcessing, WhiteBalanceMode)
-
-QT_END_HEADER
-
-#endif // QCAMERAIMAGEPROCESSING_H
diff --git a/src/multimedia/qcameraimageprocessingcontrol.cpp b/src/multimedia/qcameraimageprocessingcontrol.cpp
deleted file mode 100644
index 5e318cc..0000000
--- a/src/multimedia/qcameraimageprocessingcontrol.cpp
+++ /dev/null
@@ -1,169 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameraimageprocessingcontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraImageProcessingControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
-
- \brief The QCameraImageProcessingControl class provides an abstract class
- for controlling image processing parameters, like white balance,
- contrast, saturation, sharpening and denoising.
-
- The interface name of QCameraImageProcessingControl is \c com.nokia.Qt.QCameraImageProcessingControl/1.0 as
- defined in QCameraImageProcessingControl_iid.
-
-
-
- \sa QMediaService::requestControl(), QCamera
-*/
-
-/*!
- \macro QCameraImageProcessingControl_iid
-
- \c com.nokia.Qt.QCameraImageProcessingControl/1.0
-
- Defines the interface name of the QCameraImageProcessingControl class.
-
- \relates QCameraImageProcessingControl
-*/
-
-/*!
- Constructs an image processing control object with \a parent.
-*/
-
-QCameraImageProcessingControl::QCameraImageProcessingControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destruct the image processing control object.
-*/
-
-QCameraImageProcessingControl::~QCameraImageProcessingControl()
-{
-}
-
-
-/*!
- \fn QCameraImageProcessingControl::whiteBalanceMode() const
- Return the white balance mode being used.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageProcessingControl::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
- Set the white balance mode to \a mode
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageProcessingControl::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
- Returns true if the white balance \a mode is supported.
- The backend should support at least QCameraImageProcessing::WhiteBalanceAuto mode.
- \since 1.1
-*/
-
-/*!
- \fn bool QCameraImageProcessingControl::isProcessingParameterSupported(ProcessingParameter parameter) const
-
- Returns true if the camera supports adjusting image processing \a parameter.
-
- Usually the the supported settings is static,
- but some parameter may not be available depending on other
- camera settings, like presets.
- In such case the currently supported parameters should be returned.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageProcessingControl::processingParameter(ProcessingParameter parameter) const
- Returns the image processing \a parameter value.
- \since 1.1
-*/
-
-/*!
- \fn QCameraImageProcessingControl::setProcessingParameter(ProcessingParameter parameter, QVariant value)
-
- Sets the image processing \a parameter \a value.
- Passing the null or invalid QVariant value allows
- backend to choose the suitable parameter value.
-
- The valid values range depends on the parameter type,
- for contrast, saturation and brightness value should be
- between -100 and 100, the default is 0,
-
- For sharpening and denoising the range is 0..100,
- 0 for sharpening or denoising disabled
- and 100 for maximum sharpening/denoising applied.
- \since 1.1
-*/
-
-/*!
- \enum QCameraImageProcessingControl::ProcessingParameter
-
- \value Contrast
- Image contrast.
- \value Saturation
- Image saturation.
- \value Brightness
- Image brightness.
- \value Sharpening
- Amount of sharpening applied.
- \value Denoising
- Amount of denoising applied.
- \value ColorTemperature
- Color temperature in K. This value is used when the manual white balance mode is selected.
- \value ExtendedParameter
- The base value for platform specific extended parameters.
- */
-
-#include "moc_qcameraimageprocessingcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qcameraimageprocessingcontrol.h b/src/multimedia/qcameraimageprocessingcontrol.h
deleted file mode 100644
index 8c73928..0000000
--- a/src/multimedia/qcameraimageprocessingcontrol.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAIMAGEPROCESSINGCONTROL_H
-#define QCAMERAIMAGEPROCESSINGCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcamera.h>
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraImageProcessingControl : public QMediaControl
-{
- Q_OBJECT
- Q_ENUMS(ProcessingParameter)
-
-public:
- ~QCameraImageProcessingControl();
-
- enum ProcessingParameter {
- Contrast = 0,
- Saturation = 1,
- Brightness = 2,
- Sharpening = 3,
- Denoising = 4,
- ColorTemperature = 5,
- ExtendedParameter = 1000
- };
-
- virtual QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const = 0;
- virtual void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode) = 0;
- virtual bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode) const = 0;
-
- virtual bool isProcessingParameterSupported(ProcessingParameter) const = 0;
- virtual QVariant processingParameter(ProcessingParameter parameter) const = 0;
- virtual void setProcessingParameter(ProcessingParameter parameter, QVariant value) = 0;
-
-protected:
- QCameraImageProcessingControl(QObject* parent = 0);
-};
-
-#define QCameraImageProcessingControl_iid "com.nokia.Qt.QCameraImageProcessingControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraImageProcessingControl, QCameraImageProcessingControl_iid)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QCameraImageProcessingControl::ProcessingParameter)
-
-Q_MEDIA_ENUM_DEBUG(QCameraImageProcessingControl, ProcessingParameter)
-
-QT_END_HEADER
-
-#endif
-
diff --git a/src/multimedia/qcameralockscontrol.cpp b/src/multimedia/qcameralockscontrol.cpp
deleted file mode 100644
index 289a07b..0000000
--- a/src/multimedia/qcameralockscontrol.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qcameralockscontrol.h>
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QCameraLocksControl
-
-
-
- \brief The QCameraLocksControl class is an abstract base class for
- classes that control still cameras or video cameras.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.1
-
- This service is provided by a QMediaService object via
- QMediaService::control(). It is used by QCamera.
-
- The interface name of QCameraLocksControl is \c com.nokia.Qt.QCameraLocksControl/1.0 as
- defined in QCameraLocksControl_iid.
-
-
- \sa QMediaService::requestControl(), QCamera
-*/
-
-/*!
- \macro QCameraLocksControl_iid
-
- \c com.nokia.Qt.QCameraLocksControl/1.0
-
- Defines the interface name of the QCameraLocksControl class.
-
- \relates QCameraLocksControl
-*/
-
-/*!
- Constructs a camera locks control object with \a parent.
-*/
-
-QCameraLocksControl::QCameraLocksControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destruct the camera locks control object.
-*/
-
-QCameraLocksControl::~QCameraLocksControl()
-{
-}
-
-/*!
- \fn QCameraLocksControl::supportedLocks() const
-
- Returns the lock types, the camera supports.
- \since 1.1
-*/
-
-/*!
- \fn QCameraLocksControl::lockStatus(QCamera::LockType lock) const
-
- Returns the camera \a lock status.
- \since 1.1
-*/
-
-/*!
- \fn QCameraLocksControl::searchAndLock(QCamera::LockTypes locks)
-
- Request camera \a locks.
- \since 1.1
-*/
-
-/*!
- \fn QCameraLocksControl::unlock(QCamera::LockTypes locks)
-
- Unlock camera \a locks.
- \since 1.1
-*/
-
-/*!
- \fn QCameraLocksControl::lockStatusChanged(QCamera::LockType lock, QCamera::LockStatus status, QCamera::LockChangeReason reason)
-
- Signals the \a lock \a status was changed with a specified \a reason.
- \since 1.1
-*/
-
-
-
-#include "moc_qcameralockscontrol.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qcameralockscontrol.h b/src/multimedia/qcameralockscontrol.h
deleted file mode 100644
index 93120ee..0000000
--- a/src/multimedia/qcameralockscontrol.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERALOCKSCONTROL_H
-#define QCAMERALOCKSCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qcamera.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QCameraLocksControl : public QMediaControl
-{
- Q_OBJECT
-public:
- ~QCameraLocksControl();
-
- virtual QCamera::LockTypes supportedLocks() const = 0;
-
- virtual QCamera::LockStatus lockStatus(QCamera::LockType lock) const = 0;
-
- virtual void searchAndLock(QCamera::LockTypes locks) = 0;
- virtual void unlock(QCamera::LockTypes locks) = 0;
-
-Q_SIGNALS:
- void lockStatusChanged(QCamera::LockType type, QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
-protected:
- QCameraLocksControl(QObject* parent = 0);
-};
-
-#define QCameraLocksControl_iid "com.nokia.Qt.QCameraLocksControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QCameraLocksControl, QCameraLocksControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERALOCKSCONTROL_H
-
diff --git a/src/multimedia/qimageencodercontrol.cpp b/src/multimedia/qimageencodercontrol.cpp
deleted file mode 100644
index ee62a50..0000000
--- a/src/multimedia/qimageencodercontrol.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qimageencodercontrol.h"
-#include <QtCore/qstringlist.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QImageEncoderControl
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- \brief The QImageEncoderControl class provides access to the settings of a media service that
- performs image encoding.
-
- If a QMediaService supports encoding image data it will implement QImageEncoderControl.
- This control allows to \l {setImageSettings()}{set image encoding settings} and
- provides functions for quering supported image \l {supportedImageCodecs()}{codecs} and
- \l {supportedResolutions()}{resolutions}.
-
- The interface name of QImageEncoderControl is \c com.nokia.Qt.QImageEncoderControl/1.0 as
- defined in QImageEncoderControl_iid.
-
- \sa QImageEncoderSettings, QMediaService::requestControl()
-*/
-
-/*!
- \macro QImageEncoderControl_iid
-
- \c com.nokia.Qt.QImageEncoderControl/1.0
-
- Defines the interface name of the QImageEncoderControl class.
-
- \relates QImageEncoderControl
-*/
-
-/*!
- Constructs a new image encoder control object with the given \a parent
-*/
-QImageEncoderControl::QImageEncoderControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys the image encoder control.
-*/
-QImageEncoderControl::~QImageEncoderControl()
-{
-}
-
-/*!
- \fn QImageEncoderControl::supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const
-
- Returns a list of supported resolutions.
-
- If non null image \a settings parameter is passed,
- the returned list is reduced to resolutions supported with partial settings applied.
- It can be used to query the list of resolutions, supported by specific image codec.
-
- If the encoder supports arbitrary resolutions within the supported resolutions range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
- \since 1.0
-*/
-
-/*!
- \fn QImageEncoderControl::supportedImageCodecs() const
-
- Returns a list of supported image codecs.
- \since 1.0
-*/
-
-/*!
- \fn QImageEncoderControl::imageCodecDescription(const QString &codec) const
-
- Returns a description of an image \a codec.
- \since 1.0
-*/
-
-/*!
- \fn QImageEncoderControl::imageSettings() const
-
- Returns the currently used image encoder settings.
-
- The returned value may be different tha passed to QImageEncoderControl::setImageSettings()
- if the settings contains the default or undefined parameters.
- In this case if the undefined parameters are already resolved, they should be returned.
- \since 1.0
-*/
-
-/*!
- \fn QImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings)
-
- Sets the selected image encoder \a settings.
- \since 1.0
-*/
-
-#include "moc_qimageencodercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qimageencodercontrol.h b/src/multimedia/qimageencodercontrol.h
deleted file mode 100644
index c8a8261..0000000
--- a/src/multimedia/qimageencodercontrol.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QIMAGEENCODERCONTROL_H
-#define QIMAGEENCODERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediarecorder.h"
-#include "qmediaencodersettings.h"
-
-#include <QtCore/qsize.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QByteArray;
-class QStringList;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT QImageEncoderControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QImageEncoderControl();
-
- virtual QStringList supportedImageCodecs() const = 0;
- virtual QString imageCodecDescription(const QString &codecName) const = 0;
-
- virtual QList<QSize> supportedResolutions(const QImageEncoderSettings &settings,
- bool *continuous = 0) const = 0;
-
- virtual QImageEncoderSettings imageSettings() const = 0;
- virtual void setImageSettings(const QImageEncoderSettings &settings) = 0;
-
-protected:
- QImageEncoderControl(QObject *parent = 0);
-};
-
-#define QImageEncoderControl_iid "com.nokia.Qt.QImageEncoderControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QImageEncoderControl, QImageEncoderControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qlocalmediaplaylistprovider.cpp b/src/multimedia/qlocalmediaplaylistprovider.cpp
deleted file mode 100644
index 84d54ec..0000000
--- a/src/multimedia/qlocalmediaplaylistprovider.cpp
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qlocalmediaplaylistprovider.h"
-#include "qmediaplaylistprovider_p.h"
-#include "qmediacontent.h"
-
-QT_BEGIN_NAMESPACE
-
-class QLocalMediaPlaylistProviderPrivate: public QMediaPlaylistProviderPrivate
-{
-public:
- QList<QMediaContent> resources;
-};
-
-QLocalMediaPlaylistProvider::QLocalMediaPlaylistProvider(QObject *parent)
- :QMediaPlaylistProvider(*new QLocalMediaPlaylistProviderPrivate, parent)
-{
-}
-
-QLocalMediaPlaylistProvider::~QLocalMediaPlaylistProvider()
-{
-}
-
-bool QLocalMediaPlaylistProvider::isReadOnly() const
-{
- return false;
-}
-
-int QLocalMediaPlaylistProvider::mediaCount() const
-{
- return d_func()->resources.size();
-}
-
-QMediaContent QLocalMediaPlaylistProvider::media(int pos) const
-{
- return d_func()->resources.value(pos);
-}
-
-bool QLocalMediaPlaylistProvider::addMedia(const QMediaContent &content)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- int pos = d->resources.count();
-
- emit mediaAboutToBeInserted(pos, pos);
- d->resources.append(content);
- emit mediaInserted(pos, pos);
-
- return true;
-}
-
-bool QLocalMediaPlaylistProvider::addMedia(const QList<QMediaContent> &items)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- if (items.isEmpty())
- return true;
-
- int pos = d->resources.count();
- int end = pos+items.count()-1;
-
- emit mediaAboutToBeInserted(pos, end);
- d->resources.append(items);
- emit mediaInserted(pos, end);
-
- return true;
-}
-
-
-bool QLocalMediaPlaylistProvider::insertMedia(int pos, const QMediaContent &content)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- emit mediaAboutToBeInserted(pos, pos);
- d->resources.insert(pos, content);
- emit mediaInserted(pos,pos);
-
- return true;
-}
-
-bool QLocalMediaPlaylistProvider::insertMedia(int pos, const QList<QMediaContent> &items)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- if (items.isEmpty())
- return true;
-
- const int last = pos+items.count()-1;
-
- emit mediaAboutToBeInserted(pos, last);
- for (int i=0; i<items.count(); i++)
- d->resources.insert(pos+i, items.at(i));
- emit mediaInserted(pos, last);
-
- return true;
-}
-
-bool QLocalMediaPlaylistProvider::removeMedia(int fromPos, int toPos)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- Q_ASSERT(fromPos >= 0);
- Q_ASSERT(fromPos <= toPos);
- Q_ASSERT(toPos < mediaCount());
-
- emit mediaAboutToBeRemoved(fromPos, toPos);
- d->resources.erase(d->resources.begin()+fromPos, d->resources.begin()+toPos+1);
- emit mediaRemoved(fromPos, toPos);
-
- return true;
-}
-
-bool QLocalMediaPlaylistProvider::removeMedia(int pos)
-{
- Q_D(QLocalMediaPlaylistProvider);
-
- emit mediaAboutToBeRemoved(pos, pos);
- d->resources.removeAt(pos);
- emit mediaRemoved(pos, pos);
-
- return true;
-}
-
-bool QLocalMediaPlaylistProvider::clear()
-{
- Q_D(QLocalMediaPlaylistProvider);
- if (!d->resources.isEmpty()) {
- int lastPos = mediaCount()-1;
- emit mediaAboutToBeRemoved(0, lastPos);
- d->resources.clear();
- emit mediaRemoved(0, lastPos);
- }
-
- return true;
-}
-
-void QLocalMediaPlaylistProvider::shuffle()
-{
- Q_D(QLocalMediaPlaylistProvider);
- if (!d->resources.isEmpty()) {
- QList<QMediaContent> resources;
-
- while (!d->resources.isEmpty()) {
- resources.append(d->resources.takeAt(qrand() % d->resources.size()));
- }
-
- d->resources = resources;
- emit mediaChanged(0, mediaCount()-1);
- }
-
-}
-
-#include "moc_qlocalmediaplaylistprovider.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qlocalmediaplaylistprovider.h b/src/multimedia/qlocalmediaplaylistprovider.h
deleted file mode 100644
index e712a3f..0000000
--- a/src/multimedia/qlocalmediaplaylistprovider.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QLOCALMEDIAPAYLISTPROVIDER_H
-#define QLOCALMEDIAPAYLISTPROVIDER_H
-
-#include "qmediaplaylistprovider.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QLocalMediaPlaylistProviderPrivate;
-class Q_MULTIMEDIA_EXPORT QLocalMediaPlaylistProvider : public QMediaPlaylistProvider
-{
- Q_OBJECT
-public:
- QLocalMediaPlaylistProvider(QObject *parent=0);
- virtual ~QLocalMediaPlaylistProvider();
-
- virtual int mediaCount() const;
- virtual QMediaContent media(int pos) const;
-
- virtual bool isReadOnly() const;
-
- virtual bool addMedia(const QMediaContent &content);
- virtual bool addMedia(const QList<QMediaContent> &items);
- virtual bool insertMedia(int pos, const QMediaContent &content);
- virtual bool insertMedia(int pos, const QList<QMediaContent> &items);
- virtual bool removeMedia(int pos);
- virtual bool removeMedia(int start, int end);
- virtual bool clear();
-
-public Q_SLOTS:
- virtual void shuffle();
-
-private:
- Q_DECLARE_PRIVATE(QLocalMediaPlaylistProvider)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QLOCALMEDIAPAYLISTSOURCE_H
diff --git a/src/multimedia/qmediabackgroundplaybackcontrol.cpp b/src/multimedia/qmediabackgroundplaybackcontrol.cpp
deleted file mode 100644
index d7cbd38..0000000
--- a/src/multimedia/qmediabackgroundplaybackcontrol.cpp
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediabackgroundplaybackcontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMediaBackgroundPlaybackControl
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 5.0
-
-
- \brief The QMediaBackgroundPlaybackControl class provides access to the background playback
- related control of a QMediaService.
-
- If a QMediaService can play media in background, it should implement QMediaBackgroundPlaybackControl.
- This control provides a means to set the \l {setContextId()}{contextId} for application,
- \l {acquire()}{acquire the resource for playback} and \l {release()} {release the playback resource}.
-
- The interface name of QMediaBackgroundPlaybackControl is \c com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0 as
- defined in QMediaBackgroundPlaybackControl_iid.
-
- \sa QMediaService::requestControl(), QMediaPlayer
-*/
-
-/*!
- \macro QMediaBackgroundPlaybackControl_iid
-
- \c com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0
-
- Defines the interface name of the QMediaBackgroundPlaybackControl class.
-
- \relates QMediaBackgroundPlaybackControl
-*/
-
-/*!
- Destroys a media background playback control.
-*/
-QMediaBackgroundPlaybackControl::~QMediaBackgroundPlaybackControl()
-{
-}
-
-/*!
- Constructs a new media background playback control with the given \a parent.
-*/
-QMediaBackgroundPlaybackControl::QMediaBackgroundPlaybackControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- \fn QMediaBackgroundPlaybackControl::setContextId(const QString& contextId)
-
- Sets the contextId for the application, the last contextId will be released if previously set.
- \l {acquire()}{acquire method} will be automatically invoked after setting a new contextId.
-
- contextId is an unique string set by the application and is used by the background daemon to
- distinguish and manage different context for different application.
-
- \since 1.0
-*/
-
-/*!
- \fn QMediaBackgroundPlaybackControl::acquire()
-
- Try to acquire the playback resource for current application
- \since 1.0
-*/
-
-/*!
- \fn QMediaBackgroundPlaybackControl::release()
-
- Give up the playback resource if current applicaiton holds it.
- \since 1.0
-*/
-
-/*!
- \property QMediaBackgroundPlaybackControl::isAcquired()
- \brief indicate whether the background playback resource is granted or not
-
- It may take sometime for the backend to actually update this value before the first use.
-
- By default this property is false
-
- \since 1.0
-*/
-
-/*!
- \fn QMediaBackgroundPlaybackControl::acquired()
-
- Signals that the playback resource is acquired
-
- \since 1.0
-*/
-
-/*!
- \fn QMediaBackgroundPlaybackControl::lost()
-
- Signals that the playback resource is lost
-
- \since 1.0
-*/
-
-#include "moc_qmediabackgroundplaybackcontrol.cpp"
-QT_END_NAMESPACE
-
-
diff --git a/src/multimedia/qmediabackgroundplaybackcontrol.h b/src/multimedia/qmediabackgroundplaybackcontrol.h
deleted file mode 100644
index 2cf8d19..0000000
--- a/src/multimedia/qmediabackgroundplaybackcontrol.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIABACKGROUNDPLAYBACKCONTROL_H
-#define QMEDIABACKGROUNDPLAYBACKCONTROL_H
-
-#include "qmediacontrol.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaBackgroundPlaybackControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QMediaBackgroundPlaybackControl();
-
- virtual void setContextId(const QString& contextId) = 0;
- virtual void acquire() = 0;
- virtual void release() = 0;
-
- virtual bool isAcquired() const = 0;
-
-Q_SIGNALS:
- void acquired();
- void lost();
-
-protected:
- QMediaBackgroundPlaybackControl(QObject* parent = 0);
-};
-
-#define QMediaBackgroundPlaybackControl_iid "com.nokia.Qt.QMediaBackgroundPlaybackControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaBackgroundPlaybackControl, QMediaBackgroundPlaybackControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIABACKGROUNDPLAYBACKCONTROL_H
diff --git a/src/multimedia/qmediabindableinterface.cpp b/src/multimedia/qmediabindableinterface.cpp
deleted file mode 100644
index f5be34d..0000000
--- a/src/multimedia/qmediabindableinterface.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qmediabindableinterface.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaBindableInterface
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
-
- \brief The QMediaBindableInterface class is the base class for objects extending media objects functionality.
-
- \sa
-*/
-
-/*!
- Destroys a media helper object.
-*/
-
-QMediaBindableInterface::~QMediaBindableInterface()
-{
-}
-
-/*!
- \fn QMediaBindableInterface::mediaObject() const;
-
- Return the currently attached media object.
- \since 1.0
-*/
-
-
-/*!
- \fn QMediaBindableInterface::setMediaObject(QMediaObject *object);
-
- Attaches to the media \a object.
- Returns true if attached successfully, otherwise returns false.
- \since 1.0
-*/
-
-
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediabindableinterface.h b/src/multimedia/qmediabindableinterface.h
deleted file mode 100644
index 02b5b1a..0000000
--- a/src/multimedia/qmediabindableinterface.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIABINDABLEINTERFACE_H
-#define QMEDIABINDABLEINTERFACE_H
-
-#include <qmediaobject.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaObject;
-
-class Q_MULTIMEDIA_EXPORT QMediaBindableInterface
-{
-public:
- virtual ~QMediaBindableInterface();
-
- virtual QMediaObject *mediaObject() const = 0;
-
-protected:
- friend class QMediaObject;
- virtual bool setMediaObject(QMediaObject *object) = 0;
-};
-
-#define QMediaBindableInterface_iid \
- "com.nokia.Qt.QMediaBindableInterface/1.0"
-Q_DECLARE_INTERFACE(QMediaBindableInterface, QMediaBindableInterface_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIABINDABLEINTERFACE_H
diff --git a/src/multimedia/qmediacontainercontrol.cpp b/src/multimedia/qmediacontainercontrol.cpp
deleted file mode 100644
index 5a4e618..0000000
--- a/src/multimedia/qmediacontainercontrol.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qmediacontainercontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaContainerControl
-
- \brief The QMediaContainerControl class provides access to the output container format of a QMediaService
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- If a QMediaService supports writing encoded data it will implement
- QMediaContainerControl. This control provides information about the output
- containers supported by a media service and allows one to be selected as
- the current output containers.
-
- The functionality provided by this control is exposed to application code
- through the QMediaRecorder class.
-
- The interface name of QMediaContainerControl is \c com.nokia.Qt.QMediaContainerControl/1.0 as
- defined in QMediaContainerControl_iid.
-
- \sa QMediaService::requestControl(), QMediaRecorder
-*/
-
-/*!
- \macro QMediaContainerControl_iid
-
- \c com.nokia.Qt.QMediaContainerControl/1.0
-
- Defines the interface name of the QMediaContainerControl class.
-
- \relates QMediaContainerControl
-*/
-
-/*!
- Constructs a new media container control with the given \a parent.
-*/
-QMediaContainerControl::QMediaContainerControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a media container control.
-*/
-QMediaContainerControl::~QMediaContainerControl()
-{
-}
-
-
-/*!
- \fn QMediaContainerControl::supportedContainers() const
-
- Returns a list of MIME types of supported container formats.
- \since 1.0
-*/
-
-/*!
- \fn QMediaContainerControl::containerMimeType() const
-
- Returns the MIME type of the selected container format.
- \since 1.0
-*/
-
-/*!
- \fn QMediaContainerControl::setContainerMimeType(const QString &mimeType)
-
- Sets the current container format to the format identified by the given \a mimeType.
- \since 1.0
-*/
-
-/*!
- \fn QMediaContainerControl::containerDescription(const QString &mimeType) const
-
- Returns a description of the container format identified by the given \a mimeType.
- \since 1.0
-*/
-
-#include "moc_qmediacontainercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediacontainercontrol.h b/src/multimedia/qmediacontainercontrol.h
deleted file mode 100644
index af48605..0000000
--- a/src/multimedia/qmediacontainercontrol.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QMEDIACONTAINERCONTROL_H
-#define QMEDIACONTAINERCONTROL_H
-
-#include "qmediacontrol.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaContainerControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QMediaContainerControl();
-
- virtual QStringList supportedContainers() const = 0;
- virtual QString containerMimeType() const = 0;
- virtual void setContainerMimeType(const QString &formatMimeType) = 0;
-
- virtual QString containerDescription(const QString &formatMimeType) const = 0;
-
-protected:
- QMediaContainerControl(QObject *parent = 0);
-};
-
-#define QMediaContainerControl_iid "com.nokia.Qt.QMediaContainerControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaContainerControl, QMediaContainerControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIACONTAINERCONTROL_H
diff --git a/src/multimedia/qmediacontent.cpp b/src/multimedia/qmediacontent.cpp
deleted file mode 100644
index 8cd97bb..0000000
--- a/src/multimedia/qmediacontent.cpp
+++ /dev/null
@@ -1,254 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qurl.h>
-#include <QtCore/qvariant.h>
-
-#include "qmediacontent.h"
-
-QT_BEGIN_NAMESPACE
-
-
-class QMediaContentPrivate : public QSharedData
-{
-public:
- QMediaContentPrivate() {}
- QMediaContentPrivate(const QMediaResourceList &r):
- resources(r) {}
-
- QMediaContentPrivate(const QMediaContentPrivate &other):
- QSharedData(other),
- resources(other.resources)
- {}
-
- bool operator ==(const QMediaContentPrivate &other) const
- {
- return resources == other.resources;
- }
-
- QMediaResourceList resources;
-private:
- QMediaContentPrivate& operator=(const QMediaContentPrivate &other);
-};
-
-
-/*!
- \class QMediaContent
-
- \brief The QMediaContent class provides access to the resources relating to a media content.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- QMediaContent is used within the multimedia framework as the logical handle
- to media content. A QMediaContent object is composed of one or more
- \l {QMediaResource}s where each resource provides the URL and format
- information of a different encoding of the content.
-
- A non-null QMediaContent will always have a primary or canonical reference to
- the content available through the canonicalUrl() or canonicalResource()
- methods, any additional resources are optional.
-*/
-
-
-/*!
- Constructs a null QMediaContent.
-*/
-
-QMediaContent::QMediaContent()
-{
-}
-
-/*!
- Constructs a media content with \a url providing a reference to the content.
- \since 1.0
-*/
-
-QMediaContent::QMediaContent(const QUrl &url):
- d(new QMediaContentPrivate)
-{
- d->resources << QMediaResource(url);
-}
-
-/*!
- Constructs a media content with \a request providing a reference to the content.
-
- This constructor can be used to reference media content via network protocols such as HTTP.
- This may include additional information required to obtain the resource, such as Cookies or HTTP headers.
- \since 1.0
-*/
-
-QMediaContent::QMediaContent(const QNetworkRequest &request):
- d(new QMediaContentPrivate)
-{
- d->resources << QMediaResource(request);
-}
-
-/*!
- Constructs a media content with \a resource providing a reference to the content.
- \since 1.0
-*/
-
-QMediaContent::QMediaContent(const QMediaResource &resource):
- d(new QMediaContentPrivate)
-{
- d->resources << resource;
-}
-
-/*!
- Constructs a media content with \a resources providing a reference to the content.
- \since 1.0
-*/
-
-QMediaContent::QMediaContent(const QMediaResourceList &resources):
- d(new QMediaContentPrivate(resources))
-{
-}
-
-/*!
- Constructs a copy of the media content \a other.
- \since 1.0
-*/
-
-QMediaContent::QMediaContent(const QMediaContent &other):
- d(other.d)
-{
-}
-
-/*!
- Destroys the media content object.
-*/
-
-QMediaContent::~QMediaContent()
-{
-}
-
-/*!
- Assigns the value of \a other to this media content.
- \since 1.0
-*/
-
-QMediaContent& QMediaContent::operator=(const QMediaContent &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Returns true if \a other is equivalent to this media content; false otherwise.
- \since 1.0
-*/
-
-bool QMediaContent::operator==(const QMediaContent &other) const
-{
- return (d.constData() == 0 && other.d.constData() == 0) ||
- (d.constData() != 0 && other.d.constData() != 0 &&
- *d.constData() == *other.d.constData());
-}
-
-/*!
- Returns true if \a other is not equivalent to this media content; false otherwise.
- \since 1.0
-*/
-
-bool QMediaContent::operator!=(const QMediaContent &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Returns true if this media content is null (uninitialized); false otherwise.
- \since 1.0
-*/
-
-bool QMediaContent::isNull() const
-{
- return d.constData() == 0;
-}
-
-/*!
- Returns a QUrl that represents that canonical resource for this media content.
- \since 1.0
-*/
-
-QUrl QMediaContent::canonicalUrl() const
-{
- return canonicalResource().url();
-}
-
-/*!
- Returns a QNetworkRequest that represents that canonical resource for this media content.
- \since 1.0
-*/
-
-QNetworkRequest QMediaContent::canonicalRequest() const
-{
- return canonicalResource().request();
-}
-
-/*!
- Returns a QMediaResource that represents that canonical resource for this media content.
- \since 1.0
-*/
-
-QMediaResource QMediaContent::canonicalResource() const
-{
- return d.constData() != 0
- ? d->resources.value(0)
- : QMediaResource();
-}
-
-/*!
- Returns a list of alternative resources for this media content. The first item in this list
- is always the canonical resource.
- \since 1.0
-*/
-
-QMediaResourceList QMediaContent::resources() const
-{
- return d.constData() != 0
- ? d->resources
- : QMediaResourceList();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediacontent.h b/src/multimedia/qmediacontent.h
deleted file mode 100644
index cfd109d..0000000
--- a/src/multimedia/qmediacontent.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIACONTENT_H
-#define QMEDIACONTENT_H
-
-#include <QtCore/qmetatype.h>
-#include <QtCore/qshareddata.h>
-
-#include "qmediaresource.h"
-
-#include <qtmultimediadefs.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaContentPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaContent
-{
-public:
- QMediaContent();
- QMediaContent(const QUrl &contentUrl);
- QMediaContent(const QNetworkRequest &contentRequest);
- QMediaContent(const QMediaResource &contentResource);
- QMediaContent(const QMediaResourceList &resources);
- QMediaContent(const QMediaContent &other);
- ~QMediaContent();
-
- QMediaContent& operator=(const QMediaContent &other);
-
- bool operator==(const QMediaContent &other) const;
- bool operator!=(const QMediaContent &other) const;
-
- bool isNull() const;
-
- QUrl canonicalUrl() const;
- QNetworkRequest canonicalRequest() const;
- QMediaResource canonicalResource() const;
-
- QMediaResourceList resources() const;
-
-private:
- QSharedDataPointer<QMediaContentPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaContent)
-
-QT_END_HEADER
-
-#endif // QMEDIACONTENT_H
diff --git a/src/multimedia/qmediacontrol.cpp b/src/multimedia/qmediacontrol.cpp
deleted file mode 100644
index 0cde2cd..0000000
--- a/src/multimedia/qmediacontrol.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qtimer.h>
-
-#include "qmediacontrol.h"
-#include "qmediacontrol_p.h"
-
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMediaControl class provides a base interface for media service controls.
-
- Media controls provide an interface to individual features provided by a
- media service. Most services implement a principal control which exposes
- the core functionality of the service and a number of optional controls which
- expose any additional functionality.
-
- A pointer to a control implemented by a media service can be obtained using
- the \l {QMediaService::requestControl()} member of QMediaService. If the
- service doesn't implement a control it will instead return a null pointer.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Request control
-
- Alternatively if the IId of the control has been declared using
- Q_MEDIA_DECLARE_CONTROL the template version of
- QMediaService::requestControl() can be used to request the service without
- explicitly passing the IId or using qobject_cast().
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Request control templated
-
- Most application code will not interface directly with a media service's
- controls, instead the QMediaObject which owns the service acts as an
- intermediary between one or more controls and the application.
-
- \sa QMediaService, QMediaObject
-*/
-
-/*!
- \macro Q_MEDIA_DECLARE_CONTROL(Class, IId)
- \relates QMediaControl
-
- The Q_MEDIA_DECLARE_CONTROL macro declares an \a IId for a \a Class that
- inherits from QMediaControl.
-
- Declaring an IId for a QMediaControl allows an instance of that control to
- be requested from QMediaService::requestControl() without explicitly
- passing the IId.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Request control templated
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- Destroys a media control.
-*/
-
-QMediaControl::~QMediaControl()
-{
- delete d_ptr;
-}
-
-/*!
- Constructs a media control with the given \a parent.
- \since 1.0
-*/
-
-QMediaControl::QMediaControl(QObject *parent)
- : QObject(parent)
- , d_ptr(new QMediaControlPrivate)
-{
- d_ptr->q_ptr = this;
-}
-
-/*!
- \internal
- \since 1.0
-*/
-
-QMediaControl::QMediaControl(QMediaControlPrivate &dd, QObject *parent)
- : QObject(parent)
- , d_ptr(&dd)
-
-{
- d_ptr->q_ptr = this;
-}
-
-#include "moc_qmediacontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediacontrol.h b/src/multimedia/qmediacontrol.h
deleted file mode 100644
index 3d27026..0000000
--- a/src/multimedia/qmediacontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIACONTROL_H
-#define QABSTRACTMEDIACONTROL_H
-
-#include <qtmultimediadefs.h>
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qvariant.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaControlPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaControl : public QObject
-{
- Q_OBJECT
-
-public:
- ~QMediaControl();
-
-protected:
- QMediaControl(QObject *parent = 0);
- QMediaControl(QMediaControlPrivate &dd, QObject *parent = 0);
-
- QMediaControlPrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QMediaControl)
-};
-
-template <typename T> const char *qmediacontrol_iid() { return 0; }
-
-#define Q_MEDIA_DECLARE_CONTROL(Class, IId) \
- template <> inline const char *qmediacontrol_iid<Class *>() { return IId; }
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QABSTRACTMEDIACONTROL_H
diff --git a/src/multimedia/qmediacontrol_p.h b/src/multimedia/qmediacontrol_p.h
deleted file mode 100644
index 05693a0..0000000
--- a/src/multimedia/qmediacontrol_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIACONTROL_P_H
-#define QABSTRACTMEDIACONTROL_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediadefs.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaControl;
-
-class QMediaControlPrivate
-{
-public:
- virtual ~QMediaControlPrivate() {}
-
- QMediaControl *q_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmediaencodersettings.cpp b/src/multimedia/qmediaencodersettings.cpp
deleted file mode 100644
index 5f85eec..0000000
--- a/src/multimedia/qmediaencodersettings.cpp
+++ /dev/null
@@ -1,822 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaencodersettings.h"
-
-QT_BEGIN_NAMESPACE
-
-class QAudioEncoderSettingsPrivate : public QSharedData
-{
-public:
- QAudioEncoderSettingsPrivate() :
- isNull(true),
- encodingMode(QtMultimedia::ConstantQualityEncoding),
- bitrate(-1),
- sampleRate(-1),
- channels(-1),
- quality(QtMultimedia::NormalQuality)
- {
- }
-
- QAudioEncoderSettingsPrivate(const QAudioEncoderSettingsPrivate &other):
- QSharedData(other),
- isNull(other.isNull),
- encodingMode(other.encodingMode),
- codec(other.codec),
- bitrate(other.bitrate),
- sampleRate(other.sampleRate),
- channels(other.channels),
- quality(other.quality)
- {
- }
-
- bool isNull;
- QtMultimedia::EncodingMode encodingMode;
- QString codec;
- int bitrate;
- int sampleRate;
- int channels;
- QtMultimedia::EncodingQuality quality;
-
-private:
- QAudioEncoderSettingsPrivate& operator=(const QAudioEncoderSettingsPrivate &other);
-};
-
-/*!
- \class QAudioEncoderSettings
-
- \brief The QAudioEncoderSettings class provides a set of audio encoder settings.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- A audio encoder settings object is used to specify the audio encoder
- settings used by QMediaRecorder. Audio encoder settings are selected by
- constructing a QAudioEncoderSettings object, setting the desired properties
- and then passing it to a QMediaRecorder instance using the
- QMediaRecorder::setEncodingSettings() function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Audio encoder settings
-
- \sa QMediaRecorder, QAudioEncoderControl
-*/
-
-/*!
- Construct a null audio encoder settings object.
-*/
-QAudioEncoderSettings::QAudioEncoderSettings()
- :d(new QAudioEncoderSettingsPrivate)
-{
-}
-
-/*!
- Constructs a copy of the audio encoder settings object \a other.
- \since 1.0
-*/
-
-QAudioEncoderSettings::QAudioEncoderSettings(const QAudioEncoderSettings& other)
- :d(other.d)
-{
-}
-
-/*!
- Destroys an audio encoder settings object.
-*/
-
-QAudioEncoderSettings::~QAudioEncoderSettings()
-{
-}
-
-/*!
- Assigns the value of \a other to an audio encoder settings object.
- \since 1.0
-*/
-
-QAudioEncoderSettings& QAudioEncoderSettings::operator=(const QAudioEncoderSettings &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Determines if \a other is of equal value to an audio encoder settings
- object.
-
- Returns true if the settings objects are of equal value, and false if they
- are not of equal value.
- \since 1.0
-*/
-
-bool QAudioEncoderSettings::operator==(const QAudioEncoderSettings &other) const
-{
- return (d == other.d) ||
- (d->isNull == other.d->isNull &&
- d->encodingMode == other.d->encodingMode &&
- d->bitrate == other.d->bitrate &&
- d->sampleRate == other.d->sampleRate &&
- d->channels == other.d->channels &&
- d->quality == other.d->quality &&
- d->codec == other.d->codec);
-}
-
-/*!
- Determines if \a other is of equal value to an audio encoder settings
- object.
-
- Returns true if the settings objects are not of equal value, and true if
- they are of equal value.
- \since 1.0
-*/
-
-bool QAudioEncoderSettings::operator!=(const QAudioEncoderSettings &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Identifies if an audio settings object is initialized.
-
- Returns true if the settings object is null, and false if it is not.
- \since 1.0
-*/
-
-bool QAudioEncoderSettings::isNull() const
-{
- return d->isNull;
-}
-
-/*!
- Returns the audio encoding mode.
-
- \since 1.0
- \sa QtMultimedia::EncodingMode
-*/
-QtMultimedia::EncodingMode QAudioEncoderSettings::encodingMode() const
-{
- return d->encodingMode;
-}
-
-/*!
- Sets the audio encoding \a mode setting.
-
- If QtMultimedia::ConstantQualityEncoding is set, the quality
- encoding parameter is used and bit rate is ignored,
- otherwise the bitrate is used.
-
- The audio codec, channels count and sample rate settings are used in all
- the encoding modes.
-
- \since 1.0
- \sa encodingMode(), QtMultimedia::EncodingMode
-*/
-void QAudioEncoderSettings::setEncodingMode(QtMultimedia::EncodingMode mode)
-{
- d->encodingMode = mode;
-}
-
-/*!
- Returns the audio codec.
- \since 1.0
-*/
-QString QAudioEncoderSettings::codec() const
-{
- return d->codec;
-}
-
-/*!
- Sets the audio \a codec.
- \since 1.0
-*/
-void QAudioEncoderSettings::setCodec(const QString& codec)
-{
- d->isNull = false;
- d->codec = codec;
-}
-
-/*!
- Returns the bit rate of the compressed audio stream in bits per second.
- \since 1.0
-*/
-int QAudioEncoderSettings::bitRate() const
-{
- return d->bitrate;
-}
-
-/*!
- Returns the number of audio channels.
- \since 1.0
-*/
-int QAudioEncoderSettings::channelCount() const
-{
- return d->channels;
-}
-
-/*!
- Sets the number of audio \a channels.
-
- A value of -1 indicates the encoder should make an optimal choice based on
- what is available from the audio source and the limitations of the codec.
- \since 1.0
-*/
-void QAudioEncoderSettings::setChannelCount(int channels)
-{
- d->isNull = false;
- d->channels = channels;
-}
-
-/*!
- Sets the audio bit \a rate in bits per second.
- \since 1.0
-*/
-void QAudioEncoderSettings::setBitRate(int rate)
-{
- d->isNull = false;
- d->bitrate = rate;
-}
-
-/*!
- Returns the audio sample rate in Hz.
- \since 1.0
-*/
-int QAudioEncoderSettings::sampleRate() const
-{
- return d->sampleRate;
-}
-
-/*!
- Sets the audio sample \a rate in Hz.
-
- A value of -1 indicates the encoder should make an optimal choice based on what is avaialbe
- from the audio source and the limitations of the codec.
- \since 1.0
- */
-void QAudioEncoderSettings::setSampleRate(int rate)
-{
- d->isNull = false;
- d->sampleRate = rate;
-}
-
-/*!
- Returns the audio encoding quality.
- \since 1.0
-*/
-
-QtMultimedia::EncodingQuality QAudioEncoderSettings::quality() const
-{
- return d->quality;
-}
-
-/*!
- Set the audio encoding \a quality.
-
- Setting the audio quality parameter allows backend to choose the balanced
- set of encoding parameters to achieve the desired quality level.
-
- The \a quality settings parameter is only used in the
- \l {QtMultimedia::ConstantQualityEncoding}{constant quality} \l{encodingMode()}{encoding mode}.
- \since 1.0
-*/
-void QAudioEncoderSettings::setQuality(QtMultimedia::EncodingQuality quality)
-{
- d->isNull = false;
- d->quality = quality;
-}
-
-class QVideoEncoderSettingsPrivate : public QSharedData
-{
-public:
- QVideoEncoderSettingsPrivate() :
- isNull(true),
- encodingMode(QtMultimedia::ConstantQualityEncoding),
- bitrate(-1),
- frameRate(0),
- quality(QtMultimedia::NormalQuality)
- {
- }
-
- QVideoEncoderSettingsPrivate(const QVideoEncoderSettingsPrivate &other):
- QSharedData(other),
- isNull(other.isNull),
- encodingMode(other.encodingMode),
- codec(other.codec),
- bitrate(other.bitrate),
- resolution(other.resolution),
- frameRate(other.frameRate),
- quality(other.quality)
- {
- }
-
- bool isNull;
- QtMultimedia::EncodingMode encodingMode;
- QString codec;
- int bitrate;
- QSize resolution;
- qreal frameRate;
- QtMultimedia::EncodingQuality quality;
-
-private:
- QVideoEncoderSettingsPrivate& operator=(const QVideoEncoderSettingsPrivate &other);
-};
-
-/*!
- \class QVideoEncoderSettings
-
- \brief The QVideoEncoderSettings class provides a set of video encoder settings.
- \since 1.0
-
- A video encoder settings object is used to specify the video encoder
- settings used by QMediaRecorder. Video encoder settings are selected by
- constructing a QVideoEncoderSettings object, setting the desired properties
- and then passing it to a QMediaRecorder instance using the
- QMediaRecorder::setEncodingSettings() function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Video encoder settings
-
- \sa QMediaRecorder, QVideoEncoderControl
-*/
-
-/*!
- Constructs a null video encoder settings object.
-*/
-
-QVideoEncoderSettings::QVideoEncoderSettings()
- :d(new QVideoEncoderSettingsPrivate)
-{
-}
-
-/*!
- Constructs a copy of the video encoder settings object \a other.
- \since 1.0
-*/
-
-QVideoEncoderSettings::QVideoEncoderSettings(const QVideoEncoderSettings& other)
- :d(other.d)
-{
-}
-
-/*!
- Destroys a video encoder settings object.
-*/
-
-QVideoEncoderSettings::~QVideoEncoderSettings()
-{
-}
-
-/*!
- Assigns the value of \a other to a video encoder settings object.
- \since 1.0
-*/
-QVideoEncoderSettings &QVideoEncoderSettings::operator=(const QVideoEncoderSettings &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Determines if \a other is of equal value to a video encoder settings object.
-
- Returns true if the settings objects are of equal value, and false if they
- are not of equal value.
- \since 1.0
-*/
-bool QVideoEncoderSettings::operator==(const QVideoEncoderSettings &other) const
-{
- return (d == other.d) ||
- (d->isNull == other.d->isNull &&
- d->encodingMode == other.d->encodingMode &&
- d->bitrate == other.d->bitrate &&
- d->quality == other.d->quality &&
- d->codec == other.d->codec &&
- d->resolution == other.d->resolution &&
- qFuzzyCompare(d->frameRate, other.d->frameRate));
-}
-
-/*!
- Determines if \a other is of equal value to a video encoder settings object.
-
- Returns true if the settings objects are not of equal value, and false if
- they are of equal value.
- \since 1.0
-*/
-bool QVideoEncoderSettings::operator!=(const QVideoEncoderSettings &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Identifies if a video encoder settings object is uninitalized.
-
- Returns true if the settings are null, and false if they are not.
- \since 1.0
-*/
-bool QVideoEncoderSettings::isNull() const
-{
- return d->isNull;
-}
-
-/*!
- Returns the video encoding mode.
-
- \since 1.0
- \sa QtMultimedia::EncodingMode
-*/
-QtMultimedia::EncodingMode QVideoEncoderSettings::encodingMode() const
-{
- return d->encodingMode;
-}
-
-/*!
- Sets the video encoding \a mode.
-
- If QtMultimedia::ConstantQualityEncoding is set,
- the quality encoding parameter is used and bit rate is ignored,
- otherwise the bitrate is used.
-
- The rest of encoding settings are respected regardless of encoding mode.
-
- \since 1.0
- \sa QtMultimedia::EncodingMode
-*/
-void QVideoEncoderSettings::setEncodingMode(QtMultimedia::EncodingMode mode)
-{
- d->isNull = false;
- d->encodingMode = mode;
-}
-
-/*!
- Returns the video codec.
- \since 1.0
-*/
-
-QString QVideoEncoderSettings::codec() const
-{
- return d->codec;
-}
-
-/*!
- Sets the video \a codec.
- \since 1.0
-*/
-void QVideoEncoderSettings::setCodec(const QString& codec)
-{
- d->isNull = false;
- d->codec = codec;
-}
-
-/*!
- Returns bit rate of the encoded video stream in bits per second.
- \since 1.0
-*/
-int QVideoEncoderSettings::bitRate() const
-{
- return d->bitrate;
-}
-
-/*!
- Sets the bit rate of the encoded video stream to \a value.
- \since 1.0
-*/
-
-void QVideoEncoderSettings::setBitRate(int value)
-{
- d->isNull = false;
- d->bitrate = value;
-}
-
-/*!
- Returns the video frame rate.
- \since 1.0
-*/
-qreal QVideoEncoderSettings::frameRate() const
-{
- return d->frameRate;
-}
-
-/*!
- \fn QVideoEncoderSettings::setFrameRate(qreal rate)
-
- Sets the video frame \a rate.
-
- A value of 0 indicates the encoder should make an optimal choice based on what is available
- from the video source and the limitations of the codec.
- \since 1.0
-*/
-
-void QVideoEncoderSettings::setFrameRate(qreal rate)
-{
- d->isNull = false;
- d->frameRate = rate;
-}
-
-/*!
- Returns the resolution of the encoded video.
- \since 1.0
-*/
-
-QSize QVideoEncoderSettings::resolution() const
-{
- return d->resolution;
-}
-
-/*!
- Sets the \a resolution of the encoded video.
-
- An empty QSize indicates the encoder should make an optimal choice based on
- what is available from the video source and the limitations of the codec.
- \since 1.0
-*/
-
-void QVideoEncoderSettings::setResolution(const QSize &resolution)
-{
- d->isNull = false;
- d->resolution = resolution;
-}
-
-/*!
- Sets the \a width and \a height of the resolution of the encoded video.
-
- \overload
- \since 1.0
-*/
-
-void QVideoEncoderSettings::setResolution(int width, int height)
-{
- d->isNull = false;
- d->resolution = QSize(width, height);
-}
-
-/*!
- Returns the video encoding quality.
- \since 1.0
-*/
-
-QtMultimedia::EncodingQuality QVideoEncoderSettings::quality() const
-{
- return d->quality;
-}
-
-/*!
- Sets the video encoding \a quality.
-
- Setting the video quality parameter allows backend to choose the balanced
- set of encoding parameters to achieve the desired quality level.
-
- The \a quality settings parameter is only used in the
- \l {QtMultimedia::ConstantQualityEncoding}{constant quality} \l{encodingMode()}{encoding mode}.
- The \a quality settings parameter is only used in the \l
- {QtMultimedia::ConstantQualityEncoding}{constant quality}
- \l{encodingMode()}{encoding mode}.
- \since 1.0
-*/
-
-void QVideoEncoderSettings::setQuality(QtMultimedia::EncodingQuality quality)
-{
- d->isNull = false;
- d->quality = quality;
-}
-
-
-
-class QImageEncoderSettingsPrivate : public QSharedData
-{
-public:
- QImageEncoderSettingsPrivate() :
- isNull(true),
- quality(QtMultimedia::NormalQuality)
- {
- }
-
- QImageEncoderSettingsPrivate(const QImageEncoderSettingsPrivate &other):
- QSharedData(other),
- isNull(other.isNull),
- codec(other.codec),
- resolution(other.resolution),
- quality(other.quality)
- {
- }
-
- bool isNull;
- QString codec;
- QSize resolution;
- QtMultimedia::EncodingQuality quality;
-
-private:
- QImageEncoderSettingsPrivate& operator=(const QImageEncoderSettingsPrivate &other);
-};
-
-/*!
- \class QImageEncoderSettings
-
-
- \brief The QImageEncoderSettings class provides a set of image encoder
- settings.
- \since 1.0
-
- A image encoder settings object is used to specify the image encoder
- settings used by QCameraImageCapture. Image encoder settings are selected
- by constructing a QImageEncoderSettings object, setting the desired
- properties and then passing it to a QCameraImageCapture instance using the
- QCameraImageCapture::setImageSettings() function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Image encoder settings
-
- \sa QImageEncoderControl
-*/
-
-/*!
- Constructs a null image encoder settings object.
-*/
-
-QImageEncoderSettings::QImageEncoderSettings()
- :d(new QImageEncoderSettingsPrivate)
-{
-}
-
-/*!
- Constructs a copy of the image encoder settings object \a other.
- \since 1.0
-*/
-
-QImageEncoderSettings::QImageEncoderSettings(const QImageEncoderSettings& other)
- :d(other.d)
-{
-}
-
-/*!
- Destroys a image encoder settings object.
-*/
-
-QImageEncoderSettings::~QImageEncoderSettings()
-{
-}
-
-/*!
- Assigns the value of \a other to a image encoder settings object.
- \since 1.0
-*/
-QImageEncoderSettings &QImageEncoderSettings::operator=(const QImageEncoderSettings &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Determines if \a other is of equal value to a image encoder settings
- object.
-
- Returns true if the settings objects are of equal value, and false if they
- are not of equal value.
- \since 1.0
-*/
-bool QImageEncoderSettings::operator==(const QImageEncoderSettings &other) const
-{
- return (d == other.d) ||
- (d->isNull == other.d->isNull &&
- d->quality == other.d->quality &&
- d->codec == other.d->codec &&
- d->resolution == other.d->resolution);
-
-}
-
-/*!
- Determines if \a other is of equal value to a image encoder settings
- object.
-
- Returns true if the settings objects are not of equal value, and false if
- they are of equal value.
- \since 1.0
-*/
-bool QImageEncoderSettings::operator!=(const QImageEncoderSettings &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Identifies if a image encoder settings object is uninitalized.
-
- Returns true if the settings are null, and false if they are not.
- \since 1.0
-*/
-bool QImageEncoderSettings::isNull() const
-{
- return d->isNull;
-}
-
-/*!
- Returns the image codec.
- \since 1.0
-*/
-
-QString QImageEncoderSettings::codec() const
-{
- return d->codec;
-}
-
-/*!
- Sets the image \a codec.
- \since 1.0
-*/
-void QImageEncoderSettings::setCodec(const QString& codec)
-{
- d->isNull = false;
- d->codec = codec;
-}
-
-/*!
- Returns the resolution of the encoded image.
- \since 1.0
-*/
-
-QSize QImageEncoderSettings::resolution() const
-{
- return d->resolution;
-}
-
-/*!
- Sets the \a resolution of the encoded image.
-
- An empty QSize indicates the encoder should make an optimal choice based on
- what is available from the image source and the limitations of the codec.
- \since 1.0
-*/
-
-void QImageEncoderSettings::setResolution(const QSize &resolution)
-{
- d->isNull = false;
- d->resolution = resolution;
-}
-
-/*!
- Sets the \a width and \a height of the resolution of the encoded image.
-
- \overload
- \since 1.0
-*/
-
-void QImageEncoderSettings::setResolution(int width, int height)
-{
- d->isNull = false;
- d->resolution = QSize(width, height);
-}
-
-/*!
- Returns the image encoding quality.
- \since 1.0
-*/
-
-QtMultimedia::EncodingQuality QImageEncoderSettings::quality() const
-{
- return d->quality;
-}
-
-/*!
- Sets the image encoding \a quality.
- \since 1.0
-*/
-
-void QImageEncoderSettings::setQuality(QtMultimedia::EncodingQuality quality)
-{
- d->isNull = false;
- d->quality = quality;
-}
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaencodersettings.h b/src/multimedia/qmediaencodersettings.h
deleted file mode 100644
index 28bf6d6..0000000
--- a/src/multimedia/qmediaencodersettings.h
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAENCODERSETTINGS_H
-#define QMEDIAENCODERSETTINGS_H
-
-#include <QtCore/qsharedpointer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qsize.h>
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class QAudioEncoderSettingsPrivate;
-class Q_MULTIMEDIA_EXPORT QAudioEncoderSettings
-{
-public:
- QAudioEncoderSettings();
- QAudioEncoderSettings(const QAudioEncoderSettings& other);
-
- ~QAudioEncoderSettings();
-
- QAudioEncoderSettings& operator=(const QAudioEncoderSettings &other);
- bool operator==(const QAudioEncoderSettings &other) const;
- bool operator!=(const QAudioEncoderSettings &other) const;
-
- bool isNull() const;
-
- QtMultimedia::EncodingMode encodingMode() const;
- void setEncodingMode(QtMultimedia::EncodingMode);
-
- QString codec() const;
- void setCodec(const QString& codec);
-
- int bitRate() const;
- void setBitRate(int bitrate);
-
- int channelCount() const;
- void setChannelCount(int channels);
-
- int sampleRate() const;
- void setSampleRate(int rate);
-
- QtMultimedia::EncodingQuality quality() const;
- void setQuality(QtMultimedia::EncodingQuality quality);
-
-private:
- QSharedDataPointer<QAudioEncoderSettingsPrivate> d;
-};
-
-class QVideoEncoderSettingsPrivate;
-class Q_MULTIMEDIA_EXPORT QVideoEncoderSettings
-{
-public:
- QVideoEncoderSettings();
- QVideoEncoderSettings(const QVideoEncoderSettings& other);
-
- ~QVideoEncoderSettings();
-
- QVideoEncoderSettings& operator=(const QVideoEncoderSettings &other);
- bool operator==(const QVideoEncoderSettings &other) const;
- bool operator!=(const QVideoEncoderSettings &other) const;
-
- bool isNull() const;
-
- QtMultimedia::EncodingMode encodingMode() const;
- void setEncodingMode(QtMultimedia::EncodingMode);
-
- QString codec() const;
- void setCodec(const QString &);
-
- QSize resolution() const;
- void setResolution(const QSize &);
- void setResolution(int width, int height);
-
- qreal frameRate() const;
- void setFrameRate(qreal rate);
-
- int bitRate() const;
- void setBitRate(int bitrate);
-
- QtMultimedia::EncodingQuality quality() const;
- void setQuality(QtMultimedia::EncodingQuality quality);
-
-private:
- QSharedDataPointer<QVideoEncoderSettingsPrivate> d;
-};
-
-class QImageEncoderSettingsPrivate;
-class Q_MULTIMEDIA_EXPORT QImageEncoderSettings
-{
-public:
- QImageEncoderSettings();
- QImageEncoderSettings(const QImageEncoderSettings& other);
-
- ~QImageEncoderSettings();
-
- QImageEncoderSettings& operator=(const QImageEncoderSettings &other);
- bool operator==(const QImageEncoderSettings &other) const;
- bool operator!=(const QImageEncoderSettings &other) const;
-
- bool isNull() const;
-
- QString codec() const;
- void setCodec(const QString &);
-
- QSize resolution() const;
- void setResolution(const QSize &);
- void setResolution(int width, int height);
-
- QtMultimedia::EncodingQuality quality() const;
- void setQuality(QtMultimedia::EncodingQuality quality);
-
-private:
- QSharedDataPointer<QImageEncoderSettingsPrivate> d;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmediaenumdebug.h b/src/multimedia/qmediaenumdebug.h
deleted file mode 100644
index 3fa7ee8..0000000
--- a/src/multimedia/qmediaenumdebug.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAENUMDEBUG_H
-#define QMEDIAENUMDEBUG_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_HEADER
-
-#ifndef QT_NO_DEBUG_STREAM
-
-#define Q_MEDIA_ENUM_DEBUG(Class,Enum) \
-inline QDebug operator<<(QDebug dbg, Class::Enum value) \
-{ \
- int index = Class::staticMetaObject.indexOfEnumerator(#Enum); \
- dbg.nospace() << #Class << "::" << Class::staticMetaObject.enumerator(index).valueToKey(value); \
- return dbg.space(); \
-}
-
-#else
-
-#define Q_MEDIA_ENUM_DEBUG(Class,Enum)
-
-#endif //QT_NO_DEBUG_STREAM
-
-QT_END_HEADER
-
-#endif
-
diff --git a/src/multimedia/qmediaimageviewer.cpp b/src/multimedia/qmediaimageviewer.cpp
deleted file mode 100644
index 9a9a656..0000000
--- a/src/multimedia/qmediaimageviewer.cpp
+++ /dev/null
@@ -1,604 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaimageviewer.h"
-
-#include "qmediaobject_p.h"
-#include "qmediaimageviewerservice_p.h"
-
-#include <qmediaplaylist.h>
-#include <qmediaplaylistsourcecontrol.h>
-#include <qmediacontent.h>
-#include <qmediaresource.h>
-#include "qvideosurfaceoutput_p.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qtextstream.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMediaImageViewerPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaImageViewer)
-public:
- QMediaImageViewerPrivate():
- viewerControl(0), playlist(0),
- state(QMediaImageViewer::StoppedState), timeout(3000), pauseTime(0)
- {
- }
-
- void _q_mediaStatusChanged(QMediaImageViewer::MediaStatus status);
- void _q_playlistMediaChanged(const QMediaContent &content);
- void _q_playlistDestroyed();
-
- QMediaImageViewerControl *viewerControl;
- QMediaPlaylist *playlist;
- QPointer<QObject> videoOutput;
- QVideoSurfaceOutput surfaceOutput;
- QMediaImageViewer::State state;
- int timeout;
- int pauseTime;
- QTime time;
- QBasicTimer timer;
- QMediaContent media;
-};
-
-void QMediaImageViewerPrivate::_q_mediaStatusChanged(QMediaImageViewer::MediaStatus status)
-{
- switch (status) {
- case QMediaImageViewer::NoMedia:
- case QMediaImageViewer::LoadingMedia:
- emit q_func()->mediaStatusChanged(status);
- break;
- case QMediaImageViewer::LoadedMedia:
- if (state == QMediaImageViewer::PlayingState) {
- time.start();
- timer.start(qMax(0, timeout), q_func());
- q_func()->addPropertyWatch("elapsedTime");
- }
- emit q_func()->mediaStatusChanged(status);
- emit q_func()->elapsedTimeChanged(0);
- break;
- case QMediaImageViewer::InvalidMedia:
- emit q_func()->mediaStatusChanged(status);
-
- if (state == QMediaImageViewer::PlayingState) {
- playlist->next();
- if (playlist->currentIndex() < 0)
- emit q_func()->stateChanged(state = QMediaImageViewer::StoppedState);
- }
- break;
- }
-}
-
-void QMediaImageViewerPrivate::_q_playlistMediaChanged(const QMediaContent &content)
-{
- media = content;
- pauseTime = 0;
-
- viewerControl->showMedia(media);
-
- emit q_func()->mediaChanged(media);
-}
-
-void QMediaImageViewerPrivate::_q_playlistDestroyed()
-{
- playlist = 0;
- timer.stop();
-
- if (state != QMediaImageViewer::StoppedState)
- emit q_func()->stateChanged(state = QMediaImageViewer::StoppedState);
-
- q_func()->setMedia(QMediaContent());
-}
-
-/*!
- \class QMediaImageViewer
- \brief The QMediaImageViewer class provides a means of viewing image media.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
-
- QMediaImageViewer is used together with a media display object such as
- QVideoWidget to present an image. A display object is attached to the
- image viewer by means of the bind function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Binding
-
- QMediaImageViewer can be paired with a QMediaPlaylist to create a slide
- show of images. Constructing a QMediaPlaylist with a pointer to an
- instance of QMediaImageViewer will attach it to the image viewer;
- changing the playlist's selection will then change the media displayed
- by the image viewer. With a playlist attached QMediaImageViewer's
- play(), pause(), and stop() slots can be control the progression of the
- playlist. The \l timeout property determines how long an image is
- displayed for before progressing to the next in the playlist, and the
- \l elapsedTime property holds how the duration the current image has
- been displayed for.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Playlist
-*/
-
-/*!
- \enum QMediaImageViewer::State
-
- Enumerates the possible control states an image viewer may be in. The
- control state of an image viewer determines whether the image viewer is
- automatically progressing through images in an attached playlist.
-
- \value StoppedState The image viewer is stopped, and will not automatically move to the next
- image. The \l elapsedTime is fixed at 0.
- \value PlayingState The slide show is playing, and will move to the next image when the
- \l elapsedTime reaches the \l timeout. The \l elapsedTime is being incremented.
- \value PausedState The image viewer is paused, and will not automatically move the to next
- image. The \l elapsedTime is fixed at the time the image viewer was paused.
-*/
-
-/*!
- \enum QMediaImageViewer::MediaStatus
-
- Enumerates the status of an image viewer's current media.
-
- \value NoMedia There is no current media.
- \value LoadingMedia The image viewer is loading the current media.
- \value LoadedMedia The image viewer has loaded the current media.
- \value InvalidMedia The current media cannot be loaded.
-*/
-
-/*!
- Constructs a new image viewer with the given \a parent.
-*/
-QMediaImageViewer::QMediaImageViewer(QObject *parent)
- : QMediaObject(*new QMediaImageViewerPrivate, parent, new QMediaImageViewerService)
-{
- Q_D(QMediaImageViewer);
-
- d->viewerControl = qobject_cast<QMediaImageViewerControl*>(
- d->service->requestControl(QMediaImageViewerControl_iid));
-
- connect(d->viewerControl, SIGNAL(mediaStatusChanged(QMediaImageViewer::MediaStatus)),
- this, SLOT(_q_mediaStatusChanged(QMediaImageViewer::MediaStatus)));
-}
-
-/*!
- Destroys an image viewer.
-*/
-QMediaImageViewer::~QMediaImageViewer()
-{
- Q_D(QMediaImageViewer);
-
- delete d->service;
-}
-
-/*!
- \property QMediaImageViewer::state
- \brief the playlist control state of a slide show.
- \since 1.0
-*/
-
-QMediaImageViewer::State QMediaImageViewer::state() const
-{
- return d_func()->state;
-}
-
-/*!
- \fn QMediaImageViewer::stateChanged(QMediaImageViewer::State state)
-
- Signals that the playlist control \a state of an image viewer has changed.
- \since 1.0
-*/
-
-/*!
- \property QMediaImageViewer::mediaStatus
- \brief the status of the current media.
- \since 1.0
-*/
-
-QMediaImageViewer::MediaStatus QMediaImageViewer::mediaStatus() const
-{
- return d_func()->viewerControl->mediaStatus();
-}
-
-/*!
- \fn QMediaImageViewer::mediaStatusChanged(QMediaImageViewer::MediaStatus status)
-
- Signals the the \a status of the current media has changed.
- \since 1.0
-*/
-
-/*!
- \property QMediaImageViewer::media
- \brief the media an image viewer is presenting.
- \since 1.0
-*/
-
-QMediaContent QMediaImageViewer::media() const
-{
- Q_D(const QMediaImageViewer);
-
- return d->media;
-}
-
-void QMediaImageViewer::setMedia(const QMediaContent &media)
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist && d->playlist->currentMedia() != media) {
- disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- d->playlist = 0;
- }
-
- d->media = media;
-
- if (d->timer.isActive()) {
- d->pauseTime = 0;
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- emit elapsedTimeChanged(0);
- }
-
- if (d->state != QMediaImageViewer::StoppedState)
- emit stateChanged(d->state = QMediaImageViewer::StoppedState);
-
- d->viewerControl->showMedia(d->media);
-
- emit mediaChanged(d->media);
-}
-
-/*!
- Use \a playlist as the source of images to be displayed in the viewer.
- \since 1.0
-*/
-void QMediaImageViewer::setPlaylist(QMediaPlaylist *playlist)
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist) {
- disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- QMediaObject::unbind(d->playlist);
- }
-
- d->playlist = playlist;
-
- if (d->playlist) {
- connect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_playlistMediaChanged(QMediaContent)));
- connect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- QMediaObject::bind(d->playlist);
-
- setMedia(d->playlist->currentMedia());
- } else {
- setMedia(QMediaContent());
- }
-}
-
-/*!
- Returns the current playlist, or 0 if none.
- \since 1.0
-*/
-QMediaPlaylist *QMediaImageViewer::playlist() const
-{
- return d_func()->playlist;
-}
-
-/*!
- \fn QMediaImageViewer::mediaChanged(const QMediaContent &media)
-
- Signals that the \a media an image viewer is presenting has changed.
- \since 1.0
-*/
-
-/*!
- \property QMediaImageViewer::timeout
- \brief the amount of time in milliseconds an image is displayed for before moving to the next
- image.
-
- The timeout only applies if the image viewer has a playlist attached and is in the PlayingState.
- \since 1.0
-*/
-
-int QMediaImageViewer::timeout() const
-{
- return d_func()->timeout;
-}
-
-void QMediaImageViewer::setTimeout(int timeout)
-{
- Q_D(QMediaImageViewer);
-
- d->timeout = qMax(0, timeout);
-
- if (d->timer.isActive())
- d->timer.start(qMax(0, d->timeout - d->pauseTime - d->time.elapsed()), this);
-}
-
-/*!
- \property QMediaImageViewer::elapsedTime
- \brief the amount of time in milliseconds that has elapsed since the current image was loaded.
-
- The elapsed time only increases while the image viewer is in the PlayingState. If stopped the
- elapsed time will be reset to 0.
- \since 1.0
-*/
-
-int QMediaImageViewer::elapsedTime() const
-{
- Q_D(const QMediaImageViewer);
-
- int elapsedTime = d->pauseTime;
-
- if (d->timer.isActive())
- elapsedTime += d->time.elapsed();
-
- return elapsedTime;
-}
-
-/*!
- \fn QMediaImageViewer::elapsedTimeChanged(int time)
-
- Signals that the amount of \a time in milliseconds since the current
- image was loaded has changed.
-
- This signal is emitted at a regular interval when the image viewer is
- in the PlayingState and an image is loaded. The notification interval
- is controlled by the QMediaObject::notifyInterval property.
-
- \since 1.0
- \sa timeout, QMediaObject::notifyInterval
-*/
-
-/*!
- Sets a video \a widget as the current video output.
-
- This will unbind any previous video output bound with setVideoOutput().
- \since 1.1
-*/
-
-void QMediaImageViewer::setVideoOutput(QVideoWidget *widget)
-{
- Q_D(QMediaImageViewer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QVideoWidget inherits QObject
- QObject *widgetObject = reinterpret_cast<QObject*>(widget);
-
- d->videoOutput = widgetObject && bind(widgetObject) ? widgetObject : 0;
-}
-
-/*!
- Sets a video \a item as the current video output.
-
- This will unbind any previous video output bound with setVideoOutput().
- \since 1.1
-*/
-
-void QMediaImageViewer::setVideoOutput(QGraphicsVideoItem *item)
-{
- Q_D(QMediaImageViewer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject
- // but QObject inheritance depends on QObject coming first, so try this out.
- QObject *itemObject = reinterpret_cast<QObject*>(item);
-
- d->videoOutput = itemObject && bind(itemObject) ? itemObject : 0;
-}
-
-/*!
- Sets a video \a surface as the video output of a image viewer.
-
- If a video output has already been set on the image viewer the new surface
- will replace it.
- \since 1.2
-*/
-
-void QMediaImageViewer::setVideoOutput(QAbstractVideoSurface *surface)
-{
- Q_D(QMediaImageViewer);
-
- d->surfaceOutput.setVideoSurface(surface);
-
- if (d->videoOutput != &d->surfaceOutput) {
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- d->videoOutput = bind(&d->surfaceOutput) ? &d->surfaceOutput : 0;
- }
-}
-
-/*!
- \internal
- \since 1.0
-*/
-bool QMediaImageViewer::bind(QObject *object)
-{
- if (QMediaPlaylist *playlist = qobject_cast<QMediaPlaylist *>(object)) {
- setPlaylist(playlist);
-
- return true;
- } else {
- return QMediaObject::bind(object);
- }
-}
-
-/*!
- \internal
- \since 1.0
- */
-void QMediaImageViewer::unbind(QObject *object)
-{
- if (object == d_func()->playlist)
- setPlaylist(0);
- else
- QMediaObject::unbind(object);
-}
-
-/*!
- Starts a slide show.
-
- If the playlist has no current media this will start at the beginning of the playlist, otherwise
- it will resume from the current media.
-
- If no playlist is attached to an image viewer this will do nothing.
- \since 1.0
-*/
-void QMediaImageViewer::play()
-{
- Q_D(QMediaImageViewer);
-
- if (d->playlist && d->playlist->mediaCount() > 0 && d->state != PlayingState) {
- d->state = PlayingState;
-
- switch (d->viewerControl->mediaStatus()) {
- case NoMedia:
- case InvalidMedia:
- d->playlist->next();
- if (d->playlist->currentIndex() < 0)
- d->state = StoppedState;
- break;
- case LoadingMedia:
- break;
- case LoadedMedia:
- d->time.start();
- d->timer.start(qMax(0, d->timeout - d->pauseTime), this);
- break;
- }
-
- if (d->state == PlayingState)
- emit stateChanged(d->state);
- }
-}
-
-/*!
- Pauses a slide show.
-
- The current media and elapsed time are retained. If resumed, the current image will be
- displayed for the remainder of the time out period before the next image is loaded.
- \since 1.0
-*/
-void QMediaImageViewer::pause()
-{
- Q_D(QMediaImageViewer);
-
- if (d->state == PlayingState) {
- if (d->viewerControl->mediaStatus() == LoadedMedia) {
- d->pauseTime += d->timeout - d->time.elapsed();
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- }
-
- emit stateChanged(d->state = PausedState);
- emit elapsedTimeChanged(d->pauseTime);
- }
-}
-
-/*!
- Stops a slide show.
-
- The current media is retained, but the elapsed time is discarded. If resumed, the current
- image will be displayed for the full time out period before the next image is loaded.
- \since 1.0
-*/
-void QMediaImageViewer::stop()
-{
- Q_D(QMediaImageViewer);
-
- switch (d->state) {
- case PlayingState:
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- // fall through.
- case PausedState:
- d->pauseTime = 0;
- d->state = QMediaImageViewer::StoppedState;
-
- emit stateChanged(d->state);
- emit elapsedTimeChanged(0);
- break;
- case StoppedState:
- break;
- }
-}
-
-/*!
- \reimp
-
- \internal
- \since 1.0
-*/
-void QMediaImageViewer::timerEvent(QTimerEvent *event)
-{
- Q_D(QMediaImageViewer);
-
- if (event->timerId() == d->timer.timerId()) {
- d->timer.stop();
- removePropertyWatch("elapsedTime");
- emit elapsedTimeChanged(d->pauseTime = d->timeout);
-
- d->playlist->next();
-
- if (d->playlist->currentIndex() < 0) {
- d->pauseTime = 0;
- emit stateChanged(d->state = StoppedState);
- emit elapsedTimeChanged(0);
- }
- } else {
- QMediaObject::timerEvent(event);
- }
-}
-
-#include "moc_qmediaimageviewer.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaimageviewer.h b/src/multimedia/qmediaimageviewer.h
deleted file mode 100644
index 7010fad..0000000
--- a/src/multimedia/qmediaimageviewer.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAIMAGEVIEWER_H
-#define QMEDIAIMAGEVIEWER_H
-
-#include "qmediaobject.h"
-#include "qmediacontent.h"
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoSurface;
-class QGraphicsVideoItem;
-class QMediaPlaylist;
-class QVideoWidget;
-
-class QMediaImageViewerPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaImageViewer : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(MediaStatus mediaStatus READ mediaStatus NOTIFY mediaStatusChanged)
- Q_PROPERTY(QMediaContent media READ media WRITE setMedia NOTIFY mediaChanged)
- Q_PROPERTY(int timeout READ timeout WRITE setTimeout)
- Q_PROPERTY(int elapsedTime READ elapsedTime NOTIFY elapsedTimeChanged)
- Q_ENUMS(State MediaStatus)
-
-public:
- enum State
- {
- StoppedState,
- PlayingState,
- PausedState
- };
-
- enum MediaStatus
- {
- NoMedia,
- LoadingMedia,
- LoadedMedia,
- InvalidMedia
- };
-
- explicit QMediaImageViewer(QObject *parent = 0);
- ~QMediaImageViewer();
-
- State state() const;
- MediaStatus mediaStatus() const;
-
- QMediaContent media() const;
- QMediaPlaylist *playlist() const;
-
- int timeout() const;
- int elapsedTime() const;
-
- void setVideoOutput(QVideoWidget *widget);
- void setVideoOutput(QGraphicsVideoItem *item);
- void setVideoOutput(QAbstractVideoSurface *surface);
-
- bool bind(QObject *);
- void unbind(QObject *);
-
-public Q_SLOTS:
- void setMedia(const QMediaContent &media);
- void setPlaylist(QMediaPlaylist *playlist);
-
- void play();
- void pause();
- void stop();
-
- void setTimeout(int timeout);
-
-Q_SIGNALS:
- void stateChanged(QMediaImageViewer::State state);
- void mediaStatusChanged(QMediaImageViewer::MediaStatus status);
- void mediaChanged(const QMediaContent &media);
- void elapsedTimeChanged(int time);
-protected:
- void timerEvent(QTimerEvent *event);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewer)
- Q_PRIVATE_SLOT(d_func(), void _q_mediaStatusChanged(QMediaImageViewer::MediaStatus))
- Q_PRIVATE_SLOT(d_func(), void _q_playlistMediaChanged(const QMediaContent &))
- Q_PRIVATE_SLOT(d_func(), void _q_playlistDestroyed())
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaImageViewer::State)
-Q_DECLARE_METATYPE(QMediaImageViewer::MediaStatus)
-
-Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, State)
-Q_MEDIA_ENUM_DEBUG(QMediaImageViewer, MediaStatus)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimedia/qmediaimageviewerservice.cpp b/src/multimedia/qmediaimageviewerservice.cpp
deleted file mode 100644
index 94c6d2e..0000000
--- a/src/multimedia/qmediaimageviewerservice.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaimageviewerservice_p.h"
-
-#include "qmediacontrol_p.h"
-#include "qmediaservice_p.h"
-
-#include <qmediacontent.h>
-#include <qmediaresource.h>
-#include "qmediaobject_p.h"
-#include <qvideorenderercontrol.h>
-
-#include <QtCore/qdebug.h>
-
-#include <QtCore/qurl.h>
-#include <QtGui/qimagereader.h>
-
-#include <QtNetwork/qnetworkaccessmanager.h>
-#include <QtNetwork/qnetworkreply.h>
-#include <QtNetwork/qnetworkrequest.h>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMediaImageViewerServicePrivate : public QMediaServicePrivate
-{
-public:
- QMediaImageViewerServicePrivate()
- : viewerControl(0)
- , rendererControl(0)
- , network(0)
- , internalNetwork(0)
- {
- }
-
- bool load(QIODevice *device);
- void clear();
-
- QMediaImageViewerControl *viewerControl;
- QMediaImageViewerRenderer *rendererControl;
- QNetworkAccessManager *network;
- QNetworkAccessManager *internalNetwork;
- QImage m_image;
-};
-
-
-QMediaImageViewerRenderer::QMediaImageViewerRenderer(QObject *parent)
- : QVideoRendererControl(parent)
- , m_surface(0)
-{
-}
-
-QMediaImageViewerRenderer::~QMediaImageViewerRenderer()
-{
- if (m_surface)
- m_surface->stop();
-}
-
-QAbstractVideoSurface *QMediaImageViewerRenderer::surface() const
-{
- return m_surface;
-}
-
-void QMediaImageViewerRenderer::setSurface(QAbstractVideoSurface *surface)
-{
- if (m_surface)
- m_surface->stop();
-
- m_surface = surface;
-
- if (m_surface && !m_image.isNull())
- showImage(m_image);
-}
-
-void QMediaImageViewerRenderer::showImage(const QImage &image)
-{
- m_image = image;
-
- if (m_surface) {
- if (m_image.isNull()) {
- m_surface->stop();
- } else {
- QVideoSurfaceFormat format(
- image.size(), QVideoFrame::pixelFormatFromImageFormat(image.format()));
-
- if (!m_surface->isFormatSupported(format)) {
- foreach (QVideoFrame::PixelFormat pixelFormat, m_surface->supportedPixelFormats()) {
- const QImage::Format imageFormat
- = QVideoFrame::imageFormatFromPixelFormat(pixelFormat);
-
- if (imageFormat != QImage::Format_Invalid) {
- format = QVideoSurfaceFormat(image.size(), pixelFormat);
-
- if (m_surface->isFormatSupported(format) && m_surface->start(format)) {
- m_image = image.convertToFormat(imageFormat);
-
- m_surface->present(QVideoFrame(m_image));
-
- return;
- }
- }
- }
- } else if (m_surface->start(format)) {
- m_surface->present(QVideoFrame(image));
- }
- }
- }
-}
-
-bool QMediaImageViewerServicePrivate::load(QIODevice *device)
-{
- QImageReader reader(device);
-
- if (!reader.canRead()) {
- m_image = QImage();
- } else {
- m_image = reader.read();
- }
-
- if (rendererControl)
- rendererControl->showImage(m_image);
-
- return !m_image.isNull();
-}
-
-void QMediaImageViewerServicePrivate::clear()
-{
- m_image = QImage();
-
- if (rendererControl)
- rendererControl->showImage(m_image);
-}
-
-/*!
- \class QMediaImageViewerService
- \since 1.0
- \internal
-*/
-
-/*!
-*/
-QMediaImageViewerService::QMediaImageViewerService(QObject *parent)
- : QMediaService(*new QMediaImageViewerServicePrivate, parent)
-{
- Q_D(QMediaImageViewerService);
-
- d->viewerControl = new QMediaImageViewerControl(this);
-}
-
-/*!
-*/
-QMediaImageViewerService::~QMediaImageViewerService()
-{
- Q_D(QMediaImageViewerService);
-
- delete d->rendererControl;
- delete d->viewerControl;
-}
-
-/*!
-*/
-QMediaControl *QMediaImageViewerService::requestControl(const char *name)
-{
- Q_D(QMediaImageViewerService);
-
- if (qstrcmp(name, QMediaImageViewerControl_iid) == 0) {
- return d->viewerControl;
- } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- if (!d->rendererControl) {
- d->rendererControl = new QMediaImageViewerRenderer;
- d->rendererControl->showImage(d->m_image);
-
- return d->rendererControl;
- }
- }
- return 0;
-}
-
-void QMediaImageViewerService::releaseControl(QMediaControl *control)
-{
- Q_D(QMediaImageViewerService);
-
- if (!control) {
- qWarning("QMediaService::releaseControl():"
- " Attempted release of null control");
- } else if (control == d->rendererControl) {
- delete d->rendererControl;
-
- d->rendererControl = 0;
- }
-}
-
-/*!
-*/
-QNetworkAccessManager *QMediaImageViewerService::networkManager() const
-{
- Q_D(const QMediaImageViewerService);
-
- if (!d->network) {
- QMediaImageViewerServicePrivate *_d = const_cast<QMediaImageViewerServicePrivate *>(d);
-
- if (!_d->internalNetwork)
- _d->internalNetwork = new QNetworkAccessManager(
- const_cast<QMediaImageViewerService *>(this));
-
- _d->network = d->internalNetwork;
- }
-
- return d->network;
-}
-
-
-void QMediaImageViewerService::setNetworkManager(QNetworkAccessManager *manager)
-{
- d_func()->network = manager;
-}
-
-class QMediaImageViewerControlPrivate : public QMediaControlPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaImageViewerControl)
-public:
- QMediaImageViewerControlPrivate()
- : service(0)
- , getReply(0)
- , headReply(0)
- , status(QMediaImageViewer::NoMedia)
- {
- foreach (const QByteArray &format, QImageReader::supportedImageFormats()) {
- supportedExtensions.append(
- QLatin1Char('.') + QString::fromLatin1(format.data(), format.size()));
- }
- }
-
- bool isImageType(const QUrl &url, const QString &mimeType) const;
-
- void loadImage();
- void cancelRequests();
-
- void _q_getFinished();
- void _q_headFinished();
-
- QMediaImageViewerService *service;
- QNetworkReply *getReply;
- QNetworkReply *headReply;
- QMediaImageViewer::MediaStatus status;
- QMediaContent media;
- QMediaResource currentMedia;
- QList<QMediaResource> possibleResources;
- QStringList supportedExtensions;
-};
-
-bool QMediaImageViewerControlPrivate::isImageType(const QUrl &url, const QString &mimeType) const
-{
- if (!mimeType.isEmpty()) {
- return mimeType.startsWith(QLatin1String("image/"))
- || mimeType == QLatin1String("application/xml+svg");
- } else if (url.scheme() == QLatin1String("file")) {
- QString path = url.path();
-
- foreach (const QString &extension, supportedExtensions) {
- if (path.endsWith(extension, Qt::CaseInsensitive))
- return true;
- }
- }
- return false;
-}
-
-void QMediaImageViewerControlPrivate::loadImage()
-{
- cancelRequests();
-
- QMediaImageViewer::MediaStatus currentStatus = status;
- status = QMediaImageViewer::InvalidMedia;
-
- QNetworkAccessManager *network = service->networkManager();
-
- while (!possibleResources.isEmpty() && !headReply && !getReply) {
- currentMedia = possibleResources.takeFirst();
-
- QUrl url = currentMedia.url();
- QString mimeType = currentMedia.mimeType();
-
- if (isImageType(url, mimeType)) {
- getReply = network->get(QNetworkRequest(url));
- QObject::connect(getReply, SIGNAL(finished()), q_func(), SLOT(_q_getFinished()));
-
- status = QMediaImageViewer::LoadingMedia;
- } else if (mimeType.isEmpty() && url.scheme() != QLatin1String("file")) {
- headReply = network->head(QNetworkRequest(currentMedia.url()));
- QObject::connect(headReply, SIGNAL(finished()), q_func(), SLOT(_q_headFinished()));
-
- status = QMediaImageViewer::LoadingMedia;
- }
- }
-
- if (status == QMediaImageViewer::InvalidMedia)
- currentMedia = QMediaResource();
-
- if (status != currentStatus)
- emit q_func()->mediaStatusChanged(status);
-}
-
-void QMediaImageViewerControlPrivate::cancelRequests()
-{
- if (getReply) {
- getReply->abort();
- getReply->deleteLater();
- getReply = 0;
- }
-
- if (headReply) {
- headReply->abort();
- headReply->deleteLater();
- headReply = 0;
- }
-}
-
-void QMediaImageViewerControlPrivate::_q_getFinished()
-{
- if (getReply != q_func()->sender())
- return;
-
- QImage image;
-
- if (service->d_func()->load(getReply)) {
- possibleResources.clear();
-
- status = QMediaImageViewer::LoadedMedia;
-
- emit q_func()->mediaStatusChanged(status);
- } else {
- loadImage();
- }
-}
-
-void QMediaImageViewerControlPrivate::_q_headFinished()
-{
- if (headReply != q_func()->sender())
- return;
-
- QString mimeType = headReply->header(QNetworkRequest::ContentTypeHeader)
- .toString().section(QLatin1Char(';'), 0, 0);
- QUrl url = headReply->url();
- if (url.isEmpty())
- url = headReply->request().url();
-
- headReply->deleteLater();
- headReply = 0;
-
- if (isImageType(url, mimeType) || mimeType.isEmpty()) {
- QNetworkAccessManager *network = service->networkManager();
-
- getReply = network->get(QNetworkRequest(url));
-
- QObject::connect(getReply, SIGNAL(finished()), q_func(), SLOT(_q_getFinished()));
- } else {
- loadImage();
- }
-}
-
-/*!
- \class QMediaImageViewerControl
- \internal
- \since 1.1
-*/
-QMediaImageViewerControl::QMediaImageViewerControl(QMediaImageViewerService *parent)
- : QMediaControl(*new QMediaImageViewerControlPrivate, parent)
-{
- Q_D(QMediaImageViewerControl);
-
- d->service = parent;
-}
-
-/*!
-*/
-QMediaImageViewerControl::~QMediaImageViewerControl()
-{
- Q_D(QMediaImageViewerControl);
-
- delete d->getReply;
-}
-
-/*!
- \since 1.1
-*/
-QMediaImageViewer::MediaStatus QMediaImageViewerControl::mediaStatus() const
-{
- return d_func()->status;
-}
-
-/*!
- \fn QMediaImageViewerControl::mediaStatusChanged(QMediaImageViewer::MediaStatus status);
- \since 1.1
-*/
-
-/*!
- \since 1.1
-*/
-void QMediaImageViewerControl::showMedia(const QMediaContent &media)
-{
- Q_D(QMediaImageViewerControl);
-
- d->media = media;
- d->currentMedia = QMediaResource();
- d->cancelRequests();
-
- if (media.isNull()) {
- d->service->d_func()->clear();
- if (d->status != QMediaImageViewer::NoMedia) {
- d->status = QMediaImageViewer::NoMedia;
- emit mediaStatusChanged(d->status);
- }
- } else {
- d->possibleResources = media.resources();
- d->loadImage();
- }
-}
-
-
-#include "moc_qmediaimageviewerservice_p.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaimageviewerservice_p.h b/src/multimedia/qmediaimageviewerservice_p.h
deleted file mode 100644
index d1b6956..0000000
--- a/src/multimedia/qmediaimageviewerservice_p.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIASLIDESHOWSERVICE_P_H
-#define QMEDIASLIDESHOWSERVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediadefs.h>
-#include <qmediaservice.h>
-#include <qmediaimageviewer.h>
-#include <qvideorenderercontrol.h>
-
-#include <QtCore/qpointer.h>
-#include <QtGui/qimage.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QAbstractVideoSurface;
-class QNetworkAccessManager;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QMediaImageViewerServicePrivate;
-
-class Q_AUTOTEST_EXPORT QMediaImageViewerService : public QMediaService
-{
- Q_OBJECT
-public:
- explicit QMediaImageViewerService(QObject *parent = 0);
- ~QMediaImageViewerService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
-
- QNetworkAccessManager *networkManager() const;
- void setNetworkManager(QNetworkAccessManager *manager);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewerService)
- friend class QMediaImageViewerControl;
- friend class QMediaImageViewerControlPrivate;
-};
-
-class QMediaImageViewerControlPrivate;
-
-class QMediaImageViewerControl : public QMediaControl
-{
- Q_OBJECT
-public:
- explicit QMediaImageViewerControl(QMediaImageViewerService *parent);
- ~QMediaImageViewerControl();
-
- QMediaImageViewer::MediaStatus mediaStatus() const;
-
- void showMedia(const QMediaContent &media);
-
-Q_SIGNALS:
- void mediaStatusChanged(QMediaImageViewer::MediaStatus status);
-
-private:
- Q_DECLARE_PRIVATE(QMediaImageViewerControl)
- Q_PRIVATE_SLOT(d_func(), void _q_headFinished())
- Q_PRIVATE_SLOT(d_func(), void _q_getFinished())
-};
-
-#define QMediaImageViewerControl_iid "com.nokia.Qt.QMediaImageViewerControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaImageViewerControl, QMediaImageViewerControl_iid)
-
-class QMediaImageViewerRenderer : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- QMediaImageViewerRenderer(QObject *parent = 0);
- ~QMediaImageViewerRenderer();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void showImage(const QImage &image);
-
-Q_SIGNALS:
- void surfaceChanged(QAbstractVideoSurface *surface);
-
-private:
- QPointer<QAbstractVideoSurface> m_surface;
- QImage m_image;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmedianetworkaccesscontrol.cpp b/src/multimedia/qmedianetworkaccesscontrol.cpp
deleted file mode 100644
index a976859..0000000
--- a/src/multimedia/qmedianetworkaccesscontrol.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmedianetworkaccesscontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaNetworkAccessControl
- \preliminary
- \brief The QMediaNetworkAccessControl class allows the setting of the Network Access Point for media related activities.
- \ingroup multimedia-serv
- \inmodule QtMultimedia
- \since 1.2
-
- The functionality provided by this control allows the
- setting of a Network Access Point.
-
- This control can be used to set a network access for various
- network related activities. the exact nature in dependant on the underlying
- usage by the supported QMediaObject
-*/
-
-QMediaNetworkAccessControl::QMediaNetworkAccessControl(QObject *parent) :
- QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a network access control.
-*/
-QMediaNetworkAccessControl::~QMediaNetworkAccessControl()
-{
-}
-
-/*!
- \fn void QMediaNetworkAccessControl::setConfigurations(const QList<QNetworkConfiguration> &configurations);
-
- \a configurations contains a list of network configurations to be used for network access.
-
- It is assumed the list is given in highest to lowest preference order.
- By calling this function all previous configurations will be invalidated
- and replaced with the new list.
- \since 1.2
-*/
-
-/*
- \fn QNetworkConfiguration QMediaNetworkAccessControl::currentConfiguration() const
-
- Returns the current active configuration in use.
- A default constructed QNetworkConfigration is returned if no user supplied configuration are in use.
-*/
-
-
-/*!
- \fn QMediaNetworkAccessControl::configurationChanged(const QNetworkConfiguration &configuration)
- This signal is emitted when the current active network configuration changes
- to \a configuration.
- \since 1.2
-*/
-
-
-
-#include "moc_qmedianetworkaccesscontrol.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimedia/qmedianetworkaccesscontrol.h b/src/multimedia/qmedianetworkaccesscontrol.h
deleted file mode 100644
index 22ee957..0000000
--- a/src/multimedia/qmedianetworkaccesscontrol.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QMEDIANETWORKACCESSCONTROL_H
-#define QMEDIANETWORKACCESSCONTROL_H
-
-#include "qmediacontrol.h"
-
-#include <QtCore/qlist.h>
-#include <QtNetwork/qnetworkconfiguration.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaNetworkAccessControl : public QMediaControl
-{
- Q_OBJECT
-public:
-
- virtual ~QMediaNetworkAccessControl();
-
- virtual void setConfigurations(const QList<QNetworkConfiguration> &configuration) = 0;
- virtual QNetworkConfiguration currentConfiguration() const = 0;
-
-Q_SIGNALS:
- void configurationChanged(const QNetworkConfiguration& configuration);
-
-protected:
- QMediaNetworkAccessControl(QObject *parent = 0);
-};
-
-#define QMediaNetworkAccessControl_iid "com.nokia.Qt.QMediaNetworkAccessControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaNetworkAccessControl, QMediaNetworkAccessControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmediaobject.cpp b/src/multimedia/qmediaobject.cpp
deleted file mode 100644
index 7eb1a2d..0000000
--- a/src/multimedia/qmediaobject.cpp
+++ /dev/null
@@ -1,423 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qdebug.h>
-
-#include "qmediaobject_p.h"
-
-#include <qmediaservice.h>
-#include <qmetadatareadercontrol.h>
-#include <qmediabindableinterface.h>
-
-
-QT_BEGIN_NAMESPACE
-
-void QMediaObjectPrivate::_q_notify()
-{
- Q_Q(QMediaObject);
-
- const QMetaObject* m = q->metaObject();
-
- foreach (int pi, notifyProperties) {
- QMetaProperty p = m->property(pi);
- p.notifySignal().invoke(
- q, QGenericArgument(QMetaType::typeName(p.userType()), p.read(q).data()));
- }
-}
-
-
-/*!
- \class QMediaObject
-
- \brief The QMediaObject class provides a common base for multimedia objects.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- QMediaObject derived classes provide access to the functionality of a
- QMediaService. Each media object hosts a QMediaService and uses the
- QMediaControl interfaces implemented by the service to implement its
- API. Most media objects when constructed will request a new
- QMediaService instance from a QMediaServiceProvider, but some like
- QMediaRecorder will share a service with another object.
-
- QMediaObject itself provides an API for accessing a media
- service's \l {metaData()}{meta-data} and a means of connecting other media objects,
- and peripheral classes like QVideoWidget and QMediaPlaylist.
-
- \sa QMediaService, QMediaControl
-*/
-
-/*!
- Destroys this media object.
-*/
-
-QMediaObject::~QMediaObject()
-{
- delete d_ptr;
-}
-
-/*!
- Returns the service availability error state.
- \since 1.0
-*/
-
-QtMultimedia::AvailabilityError QMediaObject::availabilityError() const
-{
- return d_func()->service == 0 ? QtMultimedia::ServiceMissingError : QtMultimedia::NoError;
-}
-
-/*!
- Returns true if the service is available for use.
- \since 1.0
-*/
-
-bool QMediaObject::isAvailable() const
-{
- return d_func()->service != 0;
-}
-
-/*!
- Returns the media service that provides the functionality of this multimedia object.
- \since 1.0
-*/
-
-QMediaService* QMediaObject::service() const
-{
- return d_func()->service;
-}
-
-int QMediaObject::notifyInterval() const
-{
- return d_func()->notifyTimer->interval();
-}
-
-void QMediaObject::setNotifyInterval(int milliSeconds)
-{
- Q_D(QMediaObject);
-
- if (d->notifyTimer->interval() != milliSeconds) {
- d->notifyTimer->setInterval(milliSeconds);
-
- emit notifyIntervalChanged(milliSeconds);
- }
-}
-
-/*!
- Bind \a object to this QMediaObject instance.
-
- This method establishes a relationship between this media object and a
- helper object. The nature of the relationship depends on both parties. This
- methods returns true if the helper was successfully bound, false otherwise.
-
- Most subclasses of QMediaObject provide more convenient functions
- that wrap this functionality, so this function rarely needs to be
- called directly.
-
- The object passed must implement the QMediaBindableInterface interface.
-
- \since 1.0
- \sa QMediaBindableInterface
-*/
-bool QMediaObject::bind(QObject *object)
-{
- QMediaBindableInterface *helper = qobject_cast<QMediaBindableInterface*>(object);
- if (!helper)
- return false;
-
- QMediaObject *currentObject = helper->mediaObject();
-
- if (currentObject == this)
- return true;
-
- if (currentObject)
- currentObject->unbind(object);
-
- return helper->setMediaObject(this);
-}
-
-/*!
- Detach \a object from the QMediaObject instance.
-
- Unbind the helper object from this media object. A warning
- will be generated if the object was not previously bound to this
- object.
-
- \since 1.0
- \sa QMediaBindableInterface
-*/
-void QMediaObject::unbind(QObject *object)
-{
- QMediaBindableInterface *helper = qobject_cast<QMediaBindableInterface*>(object);
-
- if (helper && helper->mediaObject() == this)
- helper->setMediaObject(0);
- else
- qWarning() << "QMediaObject: Trying to unbind not connected helper object";
-}
-
-/*!
- Constructs a media object which uses the functionality provided by a media \a service.
-
- The \a parent is passed to QObject.
-
- This class is meant as a base class for multimedia objects so this
- constructor is protected.
- \since 1.0
-*/
-
-QMediaObject::QMediaObject(QObject *parent, QMediaService *service):
- QObject(parent),
- d_ptr(new QMediaObjectPrivate)
-
-{
- Q_D(QMediaObject);
-
- d->q_ptr = this;
-
- d->notifyTimer = new QTimer(this);
- d->notifyTimer->setInterval(1000);
- connect(d->notifyTimer, SIGNAL(timeout()), SLOT(_q_notify()));
-
- d->service = service;
-
- setupMetaData();
-}
-
-/*!
- \internal
-*/
-
-QMediaObject::QMediaObject(QMediaObjectPrivate &dd, QObject *parent,
- QMediaService *service):
- QObject(parent),
- d_ptr(&dd)
-{
- Q_D(QMediaObject);
- d->q_ptr = this;
-
- d->notifyTimer = new QTimer(this);
- d->notifyTimer->setInterval(1000);
- connect(d->notifyTimer, SIGNAL(timeout()), SLOT(_q_notify()));
-
- d->service = service;
-
- setupMetaData();
-}
-
-/*!
- Watch the property \a name. The property's notify signal will be emitted
- once every \code notifyInterval milliseconds.
-
- \since 1.0
- \sa notifyInterval
-*/
-
-void QMediaObject::addPropertyWatch(QByteArray const &name)
-{
- Q_D(QMediaObject);
-
- const QMetaObject* m = metaObject();
-
- int index = m->indexOfProperty(name.constData());
-
- if (index != -1 && m->property(index).hasNotifySignal()) {
- d->notifyProperties.insert(index);
-
- if (!d->notifyTimer->isActive())
- d->notifyTimer->start();
- }
-}
-
-/*!
- Remove property \a name from the list of properties whose changes are
- regularly signaled.
-
- \since 1.0
- \sa notifyInterval
-*/
-
-void QMediaObject::removePropertyWatch(QByteArray const &name)
-{
- Q_D(QMediaObject);
-
- int index = metaObject()->indexOfProperty(name.constData());
-
- if (index != -1) {
- d->notifyProperties.remove(index);
-
- if (d->notifyProperties.isEmpty())
- d->notifyTimer->stop();
- }
-}
-
-/*!
- \property QMediaObject::notifyInterval
-
- The interval at which notifiable properties will update.
-
- The interval is expressed in milliseconds, the default value is 1000.
-
- \since 1.0
- \sa addPropertyWatch(), removePropertyWatch()
-*/
-
-/*!
- \fn void QMediaObject::notifyIntervalChanged(int milliseconds)
-
- Signal a change in the notify interval period to \a milliseconds.
- \since 1.0
-*/
-
-/*!
- Returns true if there is meta-data associated with this media object, else false.
- \since 1.0
-*/
-
-bool QMediaObject::isMetaDataAvailable() const
-{
- Q_D(const QMediaObject);
-
- return d->metaDataControl
- ? d->metaDataControl->isMetaDataAvailable()
- : false;
-}
-
-/*!
- \fn QMediaObject::metaDataAvailableChanged(bool available)
-
- Signals that the \a available state of a media object's meta-data has changed.
- \since 1.0
-*/
-
-/*!
- Returns the value associated with a meta-data \a key.
- \since 1.0
-*/
-QVariant QMediaObject::metaData(QtMultimedia::MetaData key) const
-{
- Q_D(const QMediaObject);
-
- return d->metaDataControl
- ? d->metaDataControl->metaData(key)
- : QVariant();
-}
-
-/*!
- Returns a list of keys there is meta-data available for.
- \since 1.0
-*/
-QList<QtMultimedia::MetaData> QMediaObject::availableMetaData() const
-{
- Q_D(const QMediaObject);
-
- return d->metaDataControl
- ? d->metaDataControl->availableMetaData()
- : QList<QtMultimedia::MetaData>();
-}
-
-/*!
- \fn QMediaObject::metaDataChanged()
-
- Signals that this media object's meta-data has changed.
- \since 1.0
-*/
-
-/*!
- Returns the value associated with a meta-data \a key.
-
- The naming and type of extended meta-data is not standardized, so the values and meaning
- of keys may vary between backends.
- \since 1.0
-*/
-QVariant QMediaObject::extendedMetaData(const QString &key) const
-{
- Q_D(const QMediaObject);
-
- return d->metaDataControl
- ? d->metaDataControl->extendedMetaData(key)
- : QVariant();
-}
-
-/*!
- Returns a list of keys there is extended meta-data available for.
- \since 1.0
-*/
-QStringList QMediaObject::availableExtendedMetaData() const
-{
- Q_D(const QMediaObject);
-
- return d->metaDataControl
- ? d->metaDataControl->availableExtendedMetaData()
- : QStringList();
-}
-
-
-void QMediaObject::setupMetaData()
-{
- Q_D(QMediaObject);
-
- if (d->service != 0) {
- d->metaDataControl = qobject_cast<QMetaDataReaderControl*>(
- d->service->requestControl(QMetaDataReaderControl_iid));
-
- if (d->metaDataControl) {
- connect(d->metaDataControl, SIGNAL(metaDataChanged()), SIGNAL(metaDataChanged()));
- connect(d->metaDataControl,
- SIGNAL(metaDataAvailableChanged(bool)),
- SIGNAL(metaDataAvailableChanged(bool)));
- }
- }
-}
-
-/*!
- \fn QMediaObject::availabilityChanged(bool available)
-
- Signal emitted when the availability state has changed to \a available
- \since 1.0
-*/
-
-
-#include "moc_qmediaobject.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaobject.h b/src/multimedia/qmediaobject.h
deleted file mode 100644
index aba8f70..0000000
--- a/src/multimedia/qmediaobject.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIAOBJECT_H
-#define QABSTRACTMEDIAOBJECT_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstringlist.h>
-
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaService;
-class QMediaBindableInterface;
-
-class QMediaObjectPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaObject : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int notifyInterval READ notifyInterval WRITE setNotifyInterval NOTIFY notifyIntervalChanged)
-public:
- ~QMediaObject();
-
- virtual bool isAvailable() const;
- virtual QtMultimedia::AvailabilityError availabilityError() const;
-
- virtual QMediaService* service() const;
-
- int notifyInterval() const;
- void setNotifyInterval(int milliSeconds);
-
- virtual bool bind(QObject *);
- virtual void unbind(QObject *);
-
- bool isMetaDataAvailable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const;
- QStringList availableExtendedMetaData() const;
-
-Q_SIGNALS:
- void notifyIntervalChanged(int milliSeconds);
-
- void metaDataAvailableChanged(bool available);
- void metaDataChanged();
-
- void availabilityChanged(bool available);
-
-protected:
- QMediaObject(QObject *parent, QMediaService *service);
- QMediaObject(QMediaObjectPrivate &dd, QObject *parent, QMediaService *service);
-
- void addPropertyWatch(QByteArray const &name);
- void removePropertyWatch(QByteArray const &name);
-
- QMediaObjectPrivate *d_ptr;
-
-private:
- void setupMetaData();
-
- Q_DECLARE_PRIVATE(QMediaObject)
- Q_PRIVATE_SLOT(d_func(), void _q_notify())
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QABSTRACTMEDIAOBJECT_H
diff --git a/src/multimedia/qmediaobject_p.h b/src/multimedia/qmediaobject_p.h
deleted file mode 100644
index f27420c..0000000
--- a/src/multimedia/qmediaobject_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIAOBJECT_P_H
-#define QABSTRACTMEDIAOBJECT_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qset.h>
-#include <QtCore/qtimer.h>
-
-#include "qmediaobject.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMetaDataReaderControl;
-
-#define Q_DECLARE_NON_CONST_PUBLIC(Class) \
- inline Class* q_func() { return static_cast<Class *>(q_ptr); } \
- friend class Class;
-
-
-class QMediaObjectPrivate
-{
- Q_DECLARE_PUBLIC(QMediaObject)
-
-public:
- QMediaObjectPrivate():metaDataControl(0), notifyTimer(0) {}
- virtual ~QMediaObjectPrivate() {}
-
- void _q_notify();
-
- QMediaService *service;
- QMetaDataReaderControl *metaDataControl;
- QTimer* notifyTimer;
- QSet<int> notifyProperties;
-
- QMediaObject *q_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmediaplayer.cpp b/src/multimedia/qmediaplayer.cpp
deleted file mode 100644
index 312122d..0000000
--- a/src/multimedia/qmediaplayer.cpp
+++ /dev/null
@@ -1,1139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplayer.h"
-#include "qvideosurfaceoutput_p.h"
-
-#include "qmediaobject_p.h"
-#include <qmediaservice.h>
-#include <qmediaplayercontrol.h>
-#include <qmediaserviceprovider.h>
-#include <qmediaplaylist.h>
-#include <qmediaplaylistcontrol.h>
-#include <qmediaplaylistsourcecontrol.h>
-
-#include <qmedianetworkaccesscontrol.h>
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qpointer.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaPlayer
- \brief The QMediaPlayer class allows the playing of a media source.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
-
-
- The QMediaPlayer class is a high level media playback class. It can be used
- to playback such content as songs, movies and internet radio. The content
- to playback is specified as a QMediaContent, which can be thought of as a
- main or canonical URL with addition information attached. When provided
- with a QMediaContent playback may be able to commence.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Player
-
- QVideoWidget can be used with QMediaPlayer for video rendering and QMediaPlaylist
- for accessing playlist functionality.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Movie playlist
-
- \sa QMediaObject, QMediaService, QVideoWidget, QMediaPlaylist
-*/
-
-namespace
-{
-class MediaPlayerRegisterMetaTypes
-{
-public:
- MediaPlayerRegisterMetaTypes()
- {
- qRegisterMetaType<QMediaPlayer::State>("QMediaPlayer::State");
- qRegisterMetaType<QMediaPlayer::MediaStatus>("QMediaPlayer::MediaStatus");
- qRegisterMetaType<QMediaPlayer::Error>("QMediaPlayer::Error");
- }
-} _registerPlayerMetaTypes;
-}
-
-class QMediaPlayerPrivate : public QMediaObjectPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaPlayer)
-
-public:
- QMediaPlayerPrivate()
- : provider(0)
- , control(0)
- , playlistSourceControl(0)
- , state(QMediaPlayer::StoppedState)
- , error(QMediaPlayer::NoError)
- , filterStates(false)
- , playlist(0)
- {}
-
- QMediaServiceProvider *provider;
- QMediaPlayerControl* control;
- QMediaPlaylistSourceControl* playlistSourceControl;
- QMediaPlayer::State state;
- QMediaPlayer::Error error;
- QString errorString;
- bool filterStates;
-
- QPointer<QObject> videoOutput;
- QMediaPlaylist *playlist;
- QMediaNetworkAccessControl *networkAccessControl;
- QVideoSurfaceOutput surfaceOutput;
-
- void _q_stateChanged(QMediaPlayer::State state);
- void _q_mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void _q_error(int error, const QString &errorString);
- void _q_updateMedia(const QMediaContent&);
- void _q_playlistDestroyed();
-};
-
-void QMediaPlayerPrivate::_q_stateChanged(QMediaPlayer::State ps)
-{
- Q_Q(QMediaPlayer);
-
- if (filterStates)
- return;
-
- if (playlist
- && ps != state && ps == QMediaPlayer::StoppedState
- && (control->mediaStatus() == QMediaPlayer::EndOfMedia ||
- control->mediaStatus() == QMediaPlayer::InvalidMedia)) {
- playlist->next();
- ps = control->state();
- }
-
- if (ps != state) {
- state = ps;
-
- if (ps == QMediaPlayer::PlayingState)
- q->addPropertyWatch("position");
- else
- q->removePropertyWatch("position");
-
- emit q->stateChanged(ps);
- }
-}
-
-void QMediaPlayerPrivate::_q_mediaStatusChanged(QMediaPlayer::MediaStatus status)
-{
- Q_Q(QMediaPlayer);
-
- switch (status) {
- case QMediaPlayer::StalledMedia:
- case QMediaPlayer::BufferingMedia:
- q->addPropertyWatch("bufferStatus");
- emit q->mediaStatusChanged(status);
- break;
- default:
- q->removePropertyWatch("bufferStatus");
- emit q->mediaStatusChanged(status);
- break;
- }
-
-}
-
-void QMediaPlayerPrivate::_q_error(int error, const QString &errorString)
-{
- Q_Q(QMediaPlayer);
-
- this->error = QMediaPlayer::Error(error);
- this->errorString = errorString;
-
- emit q->error(this->error);
-}
-
-void QMediaPlayerPrivate::_q_updateMedia(const QMediaContent &media)
-{
- Q_Q(QMediaPlayer);
-
- if (!control)
- return;
-
- const QMediaPlayer::State currentState = state;
-
- filterStates = true;
- control->setMedia(media, 0);
-
- if (!media.isNull()) {
- switch (currentState) {
- case QMediaPlayer::PlayingState:
- control->play();
- break;
- case QMediaPlayer::PausedState:
- control->pause();
- break;
- default:
- break;
- }
- }
- filterStates = false;
-
- state = control->state();
-
- if (state != currentState) {
- if (state == QMediaPlayer::PlayingState)
- q->addPropertyWatch("position");
- else
- q->removePropertyWatch("position");
-
- emit q->stateChanged(state);
- }
-}
-
-void QMediaPlayerPrivate::_q_playlistDestroyed()
-{
- playlist = 0;
-
- if (!control)
- return;
-
- if (playlistSourceControl)
- playlistSourceControl->setPlaylist(0);
-
- control->setMedia(QMediaContent(), 0);
-}
-
-static QMediaService *playerService(QMediaPlayer::Flags flags, QMediaServiceProvider *provider)
-{
- if (flags) {
- QMediaServiceProviderHint::Features features = 0;
- if (flags & QMediaPlayer::LowLatency)
- features |= QMediaServiceProviderHint::LowLatencyPlayback;
-
- if (flags & QMediaPlayer::StreamPlayback)
- features |= QMediaServiceProviderHint::StreamPlayback;
-
- if (flags & QMediaPlayer::VideoSurface)
- features |= QMediaServiceProviderHint::VideoSurface;
-
- return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER,
- QMediaServiceProviderHint(features));
- } else
- return provider->requestService(Q_MEDIASERVICE_MEDIAPLAYER);
-}
-
-
-/*!
- Construct a QMediaPlayer that uses the playback service from \a provider,
- parented to \a parent and with \a flags.
-
- If a playback service is not specified the system default will be used.
- \since 1.0
-*/
-
-QMediaPlayer::QMediaPlayer(QObject *parent, QMediaPlayer::Flags flags, QMediaServiceProvider *provider):
- QMediaObject(*new QMediaPlayerPrivate,
- parent,
- playerService(flags,provider))
-{
- Q_D(QMediaPlayer);
-
- d->provider = provider;
-
- if (d->service == 0) {
- d->error = ServiceMissingError;
- } else {
- d->control = qobject_cast<QMediaPlayerControl*>(d->service->requestControl(QMediaPlayerControl_iid));
- d->playlistSourceControl = qobject_cast<QMediaPlaylistSourceControl*>(d->service->requestControl(QMediaPlaylistSourceControl_iid));
- d->networkAccessControl = qobject_cast<QMediaNetworkAccessControl*>(d->service->requestControl(QMediaNetworkAccessControl_iid));
- if (d->control != 0) {
- connect(d->control, SIGNAL(mediaChanged(QMediaContent)), SIGNAL(mediaChanged(QMediaContent)));
- connect(d->control, SIGNAL(stateChanged(QMediaPlayer::State)), SLOT(_q_stateChanged(QMediaPlayer::State)));
- connect(d->control, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- SLOT(_q_mediaStatusChanged(QMediaPlayer::MediaStatus)));
- connect(d->control, SIGNAL(error(int,QString)), SLOT(_q_error(int,QString)));
-
- connect(d->control, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(d->control, SIGNAL(positionChanged(qint64)), SIGNAL(positionChanged(qint64)));
- connect(d->control, SIGNAL(audioAvailableChanged(bool)), SIGNAL(audioAvailableChanged(bool)));
- connect(d->control, SIGNAL(videoAvailableChanged(bool)), SIGNAL(videoAvailableChanged(bool)));
- connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int)));
- connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(d->control, SIGNAL(seekableChanged(bool)), SIGNAL(seekableChanged(bool)));
- connect(d->control, SIGNAL(playbackRateChanged(qreal)), SIGNAL(playbackRateChanged(qreal)));
- connect(d->control, SIGNAL(bufferStatusChanged(int)), SIGNAL(bufferStatusChanged(int)));
-
- if (d->control->state() == PlayingState)
- addPropertyWatch("position");
-
- if (d->control->mediaStatus() == StalledMedia || d->control->mediaStatus() == BufferingMedia)
- addPropertyWatch("bufferStatus");
- }
- if (d->networkAccessControl != 0) {
- connect(d->networkAccessControl, SIGNAL(configurationChanged(QNetworkConfiguration)),
- this, SIGNAL(networkConfigurationChanged(QNetworkConfiguration)));
- }
- }
-}
-
-
-/*!
- Destroys the player object.
-*/
-
-QMediaPlayer::~QMediaPlayer()
-{
- Q_D(QMediaPlayer);
-
- if (d->service) {
- if (d->control)
- d->service->releaseControl(d->control);
- }
-
- d->provider->releaseService(d->service);
-}
-
-QMediaContent QMediaPlayer::media() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->media();
-
- return QMediaContent();
-}
-
-/*!
- Returns the stream source of media data.
-
- This is only valid if a stream was passed to setMedia().
-
- \since 1.0
- \sa setMedia()
-*/
-
-const QIODevice *QMediaPlayer::mediaStream() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->mediaStream();
-
- return 0;
-}
-
-QMediaPlaylist *QMediaPlayer::playlist() const
-{
- return d_func()->playlistSourceControl ?
- d_func()->playlistSourceControl->playlist() :
- d_func()->playlist;
-}
-
-void QMediaPlayer::setPlaylist(QMediaPlaylist *playlist)
-{
- Q_D(QMediaPlayer);
-
- if (d->playlistSourceControl) {
- if (d->playlistSourceControl->playlist())
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- d->playlistSourceControl->setPlaylist(playlist);
-
- if (playlist)
- connect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
- } else {
- if (d->playlist) {
- disconnect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_updateMedia(QMediaContent)));
- disconnect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
- }
-
- d->playlist = playlist;
-
- if (d->playlist) {
- connect(d->playlist, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SLOT(_q_updateMedia(QMediaContent)));
- connect(d->playlist, SIGNAL(destroyed()), this, SLOT(_q_playlistDestroyed()));
-
- if (d->control != 0)
- d->control->setMedia(playlist->currentMedia(), 0);
- } else {
- setMedia(QMediaContent(), 0);
- }
-
- }
-}
-
-/*!
- Sets the network access points for remote media playback.
- \a configurations contains, in ascending preferential order, a list of
- configuration that can be used for network access.
-
- This will invalidate the choice of previous configurations.
- \since 1.2
-*/
-void QMediaPlayer::setNetworkConfigurations(const QList<QNetworkConfiguration> &configurations)
-{
- Q_D(QMediaPlayer);
-
- if (d->networkAccessControl)
- d->networkAccessControl->setConfigurations(configurations);
-}
-
-QMediaPlayer::State QMediaPlayer::state() const
-{
- return d_func()->state;
-}
-
-QMediaPlayer::MediaStatus QMediaPlayer::mediaStatus() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->mediaStatus();
-
- return QMediaPlayer::UnknownMediaStatus;
-}
-
-qint64 QMediaPlayer::duration() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->duration();
-
- return -1;
-}
-
-qint64 QMediaPlayer::position() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->position();
-
- return 0;
-}
-
-int QMediaPlayer::volume() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->volume();
-
- return 0;
-}
-
-bool QMediaPlayer::isMuted() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->isMuted();
-
- return false;
-}
-
-int QMediaPlayer::bufferStatus() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->bufferStatus();
-
- return 0;
-}
-
-bool QMediaPlayer::isAudioAvailable() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->isAudioAvailable();
-
- return false;
-}
-
-bool QMediaPlayer::isVideoAvailable() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->isVideoAvailable();
-
- return false;
-}
-
-bool QMediaPlayer::isSeekable() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->isSeekable();
-
- return false;
-}
-
-qreal QMediaPlayer::playbackRate() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->control != 0)
- return d->control->playbackRate();
-
- return 0.0;
-}
-
-/*!
- Returns the current error state.
- \since 1.0
-*/
-
-QMediaPlayer::Error QMediaPlayer::error() const
-{
- return d_func()->error;
-}
-
-QString QMediaPlayer::errorString() const
-{
- return d_func()->errorString;
-}
-
-/*!
- Returns the current network access point in use.
- If a default contructed QNetworkConfiguration is returned
- this feature is not available or that none of the
- current supplied configurations are in use.
- \since 1.2
-*/
-QNetworkConfiguration QMediaPlayer::currentNetworkConfiguration() const
-{
- Q_D(const QMediaPlayer);
-
- if (d->networkAccessControl)
- return d_func()->networkAccessControl->currentConfiguration();
-
- return QNetworkConfiguration();
-}
-
-//public Q_SLOTS:
-/*!
- Start or resume playing the current source.
- \since 1.0
-*/
-
-void QMediaPlayer::play()
-{
- Q_D(QMediaPlayer);
-
- if (d->control == 0) {
- QMetaObject::invokeMethod(this, "_q_error", Qt::QueuedConnection,
- Q_ARG(int, QMediaPlayer::ServiceMissingError),
- Q_ARG(QString, tr("The QMediaPlayer object does not have a valid service")));
- return;
- }
-
- //if playlist control is available, the service should advance itself
- if (d->playlist && d->playlist->currentIndex() == -1 && !d->playlist->isEmpty())
- d->playlist->setCurrentIndex(0);
-
- // Reset error conditions
- d->error = NoError;
- d->errorString = QString();
-
- d->control->play();
-}
-
-/*!
- Pause playing the current source.
- \since 1.0
-*/
-
-void QMediaPlayer::pause()
-{
- Q_D(QMediaPlayer);
-
- if (d->control != 0)
- d->control->pause();
-}
-
-/*!
- Stop playing, and reset the play position to the beginning.
- \since 1.0
-*/
-
-void QMediaPlayer::stop()
-{
- Q_D(QMediaPlayer);
-
- if (d->control != 0)
- d->control->stop();
-}
-
-void QMediaPlayer::setPosition(qint64 position)
-{
- Q_D(QMediaPlayer);
-
- if (d->control == 0 || !isSeekable())
- return;
-
- d->control->setPosition(qBound(qint64(0), position, duration()));
-}
-
-void QMediaPlayer::setVolume(int v)
-{
- Q_D(QMediaPlayer);
-
- if (d->control == 0)
- return;
-
- int clamped = qBound(0, v, 100);
- if (clamped == volume())
- return;
-
- d->control->setVolume(clamped);
-}
-
-void QMediaPlayer::setMuted(bool muted)
-{
- Q_D(QMediaPlayer);
-
- if (d->control == 0 || muted == isMuted())
- return;
-
- d->control->setMuted(muted);
-}
-
-void QMediaPlayer::setPlaybackRate(qreal rate)
-{
- Q_D(QMediaPlayer);
-
- if (d->control != 0)
- d->control->setPlaybackRate(rate);
-}
-
-/*!
- Sets the current \a media source.
-
- If a \a stream is supplied; media data will be read from it instead of resolving the media
- source. In this case the media source may still be used to resolve additional information
- about the media such as mime type.
-
- Setting the media to a null QMediaContent will cause the player to discard all
- information relating to the current media source and to cease all I/O operations related
- to that media.
- \since 1.0
-*/
-
-void QMediaPlayer::setMedia(const QMediaContent &media, QIODevice *stream)
-{
- Q_D(QMediaPlayer);
-
- if (playlist() && playlist()->currentMedia() != media)
- setPlaylist(0);
-
- if (d->control != 0)
- d_func()->control->setMedia(media, stream);
-}
-
-/*!
- \internal
- \since 1.0
-*/
-
-bool QMediaPlayer::bind(QObject *obj)
-{
- return QMediaObject::bind(obj);
-}
-
-/*!
- \internal
- \since 1.0
-*/
-
-void QMediaPlayer::unbind(QObject *obj)
-{
- QMediaObject::unbind(obj);
-}
-
-/*!
- Returns the level of support a media player has for a \a mimeType and a set of \a codecs.
-
- The \a flags argument allows additional requirements such as performance indicators to be
- specified.
- \since 1.0
-*/
-QtMultimedia::SupportEstimate QMediaPlayer::hasSupport(const QString &mimeType,
- const QStringList& codecs,
- Flags flags)
-{
- return QMediaServiceProvider::defaultServiceProvider()->hasSupport(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER),
- mimeType,
- codecs,
- flags);
-}
-
-/*!
- \deprecated
- Returns a list of MIME types supported by the media player.
-
- The \a flags argument causes the resultant list to be restricted to MIME types which can be supported
- given additional requirements, such as performance indicators.
-
- This function may not return useful results on some platforms, and support for a specific file of a
- given mime type is not guaranteed even if the mime type is in general supported. In addition, in some
- cases this function will need to load all available media plugins and query them for their support, which
- may take some time.
- \since 1.0
-*/
-QStringList QMediaPlayer::supportedMimeTypes(Flags flags)
-{
- return QMediaServiceProvider::defaultServiceProvider()->supportedMimeTypes(QByteArray(Q_MEDIASERVICE_MEDIAPLAYER),
- flags);
-}
-
-/*!
- \fn void QMediaPlayer::setVideoOutput(QVideoWidget* output)
-
- Attach a QVideoWidget video \a output to the media player.
-
- If the media player has already video output attached,
- it will be replaced with a new one.
- \since 1.0
-*/
-void QMediaPlayer::setVideoOutput(QVideoWidget *output)
-{
- Q_D(QMediaPlayer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QVideoWidget inherits QObject
- QObject *outputObject = reinterpret_cast<QObject*>(output);
-
- d->videoOutput = outputObject && bind(outputObject) ? outputObject : 0;
-}
-
-/*!
- \fn void QMediaPlayer::setVideoOutput(QGraphicsVideoItem* output)
-
- Attach a QGraphicsVideoItem video \a output to the media player.
-
- If the media player has already video output attached,
- it will be replaced with a new one.
- \since 1.0
-*/
-void QMediaPlayer::setVideoOutput(QGraphicsVideoItem *output)
-{
- Q_D(QMediaPlayer);
-
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- // We don't know (in this library) that QGraphicsVideoItem (multiply) inherits QObject
- // but QObject inheritance depends on QObject coming first, so try this out.
- QObject *outputObject = reinterpret_cast<QObject*>(output);
-
- d->videoOutput = outputObject && bind(outputObject) ? outputObject : 0;
-}
-
-/*!
- Sets a video \a surface as the video output of a media player.
-
- If a video output has already been set on the media player the new surface
- will replace it.
- \since 1.2
-*/
-
-void QMediaPlayer::setVideoOutput(QAbstractVideoSurface *surface)
-{
- Q_D(QMediaPlayer);
-
- d->surfaceOutput.setVideoSurface(surface);
-
- if (d->videoOutput != &d->surfaceOutput) {
- if (d->videoOutput)
- unbind(d->videoOutput);
-
- d->videoOutput = bind(&d->surfaceOutput) ? &d->surfaceOutput : 0;
- }
-}
-
-// Enums
-/*!
- \enum QMediaPlayer::State
-
- Defines the current state of a media player.
-
- \value PlayingState The media player is currently playing content.
- \value PausedState The media player has paused playback, playback of the current track will
- resume from the position the player was paused at.
- \value StoppedState The media player is not playing content, playback will begin from the start
- of the current track.
-*/
-
-/*!
- \enum QMediaPlayer::MediaStatus
-
- Defines the status of a media player's current media.
-
- \value UnknownMediaStatus The status of the media cannot be determined.
- \value NoMedia The is no current media. The player is in the StoppedState.
- \value LoadingMedia The current media is being loaded. The player may be in any state.
- \value LoadedMedia The current media has been loaded. The player is in the StoppedState.
- \value StalledMedia Playback of the current media has stalled due to insufficient buffering or
- some other temporary interruption. The player is in the PlayingState or PausedState.
- \value BufferingMedia The player is buffering data but has enough data buffered for playback to
- continue for the immediate future. The player is in the PlayingState or PausedState.
- \value BufferedMedia The player has fully buffered the current media. The player is in the
- PlayingState or PausedState.
- \value EndOfMedia Playback has reached the end of the current media. The player is in the
- StoppedState.
- \value InvalidMedia The current media cannot be played. The player is in the StoppedState.
-*/
-
-/*!
- \enum QMediaPlayer::Error
-
- Defines a media player error condition.
-
- \value NoError No error has occurred.
- \value ResourceError A media resource couldn't be resolved.
- \value FormatError The format of a media resource isn't (fully) supported. Playback may still
- be possible, but without an audio or video component.
- \value NetworkError A network error occurred.
- \value AccessDeniedError There are not the appropriate permissions to play a media resource.
- \value ServiceMissingError A valid playback service was not found, playback cannot proceed.
-*/
-
-// Signals
-/*!
- \fn QMediaPlayer::error(QMediaPlayer::Error error)
-
- Signals that an \a error condition has occurred.
-
- \since 1.0
- \sa errorString()
-*/
-
-/*!
- \fn void QMediaPlayer::stateChanged(State state)
-
- \since 1.0
- Signal the \a state of the Player object has changed.
-*/
-
-/*!
- \fn QMediaPlayer::mediaStatusChanged(QMediaPlayer::MediaStatus status)
-
- Signals that the \a status of the current media has changed.
-
- \since 1.0
- \sa mediaStatus()
-*/
-
-/*!
- \fn void QMediaPlayer::mediaChanged(const QMediaContent &media);
-
- Signals that the current playing content will be obtained from \a media.
-
- \since 1.0
- \sa media()
-*/
-
-/*!
- \fn void QMediaPlayer::playbackRateChanged(qreal rate);
-
- Signals the playbackRate has changed to \a rate.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::seekableChanged(bool seekable);
-
- Signals the \a seekable status of the player object has changed.
- \since 1.0
-*/
-
-// Properties
-/*!
- \property QMediaPlayer::state
- \brief the media player's playback state.
-
- By default this property is QMediaPlayer::Stopped
-
- \since 1.0
- \sa mediaStatus(), play(), pause(), stop()
-*/
-
-/*!
- \property QMediaPlayer::error
- \brief a string describing the last error condition.
-
- \since 1.0
- \sa error()
-*/
-
-/*!
- \property QMediaPlayer::media
- \brief the active media source being used by the player object.
-
- The player object will use the QMediaContent for selection of the content to
- be played.
-
- By default this property has a null QMediaContent.
-
- Setting this property to a null QMediaContent will cause the player to discard all
- information relating to the current media source and to cease all I/O operations related
- to that media.
-
- \since 1.0
- \sa QMediaContent
-*/
-
-/*!
- \property QMediaPlayer::playlist
- \brief the media playlist being used by the player object.
-
- The player object will use the current playlist item for selection of the content to
- be played.
-
- By default this property is set to null.
-
- If the media playlist is used as a source, QMediaPlayer::media is updated with
- a current playlist item. The current source should be selected with
- QMediaPlaylist::setCurrentIndex(int) instead of QMediaPlayer::setMedia(),
- otherwise the current playlist will be discarded.
-
- \since 1.0
- \sa QMediaContent
-*/
-
-
-/*!
- \property QMediaPlayer::mediaStatus
- \brief the status of the current media stream.
-
- The stream status describes how the playback of the current stream is
- progressing.
-
- By default this property is QMediaPlayer::NoMedia
-
- \since 1.0
- \sa state
-*/
-
-/*!
- \property QMediaPlayer::duration
- \brief the duration of the current media.
-
- The value is the total playback time in milliseconds of the current media.
- The value may change across the life time of the QMediaPlayer object and
- may not be available when initial playback begins, connect to the
- durationChanged() signal to receive status notifications.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::position
- \brief the playback position of the current media.
-
- The value is the current playback position, expressed in milliseconds since
- the beginning of the media. Periodically changes in the position will be
- indicated with the signal positionChanged(), the interval between updates
- can be set with QMediaObject's method setNotifyInterval().
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::volume
- \brief the current playback volume.
-
- The playback volume is a linear in effect and the value can range from 0 -
- 100, values outside this range will be clamped.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::muted
- \brief the muted state of the current media.
-
- The value will be true if the playback volume is muted; otherwise false.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::bufferStatus
- \brief the percentage of the temporary buffer filled before playback begins.
-
- When the player object is buffering; this property holds the percentage of
- the temporary buffer that is filled. The buffer will need to reach 100%
- filled before playback can resume, at which time the MediaStatus will be
- BufferedMedia.
-
- \since 1.0
- \sa mediaStatus()
-*/
-
-/*!
- \property QMediaPlayer::audioAvailable
- \brief the audio availabilty status for the current media.
-
- As the life time of QMediaPlayer can be longer than the playback of one
- QMediaContent, this property may change over time, the
- audioAvailableChanged signal can be used to monitor it's status.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::videoAvailable
- \brief the video availability status for the current media.
-
- If available, the QVideoWidget class can be used to view the video. As the
- life time of QMediaPlayer can be longer than the playback of one
- QMediaContent, this property may change over time, the
- videoAvailableChanged signal can be used to monitor it's status.
-
- \since 1.0
- \sa QVideoWidget, QMediaContent
-*/
-
-/*!
- \property QMediaPlayer::seekable
- \brief the seek-able status of the current media
-
- If seeking is supported this property will be true; false otherwise. The
- status of this property may change across the life time of the QMediaPlayer
- object, use the seekableChanged signal to monitor changes.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlayer::playbackRate
- \brief the playback rate of the current media.
-
- This value is a multiplier applied to the media's standard play rate. By
- default this value is 1.0, indicating that the media is playing at the
- standard pace. Values higher than 1.0 will increase the rate of play.
- Values less than zero can be set and indicate the media will rewind at the
- multiplier of the standard pace.
-
- Not all playback services support change of the playback rate. It is
- framework defined as to the status and quality of audio and video
- while fast forwarding or rewinding.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::durationChanged(qint64 duration)
-
- Signal the duration of the content has changed to \a duration, expressed in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::positionChanged(qint64 position)
-
- Signal the position of the content has changed to \a position, expressed in
- milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::volumeChanged(int volume)
-
- Signal the playback volume has changed to \a volume.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::mutedChanged(bool muted)
-
- Signal the mute state has changed to \a muted.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::videoAvailableChanged(bool videoAvailable)
-
- Signal the availability of visual content has changed to \a videoAvailable.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::audioAvailableChanged(bool available)
-
- Signals the availability of audio content has changed to \a available.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::bufferStatusChanged(int percentFilled)
-
- Signal the amount of the local buffer filled as a percentage by \a percentFilled.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlayer::networkConfigurationChanged(const QNetworkConfiguration &configuration)
-
- Signal that the active in use network access point has been changed to \a configuration and all subsequent network access will use this \a configuration.
- \since 1.2
-*/
-
-/*!
- \enum QMediaPlayer::Flag
-
- \value LowLatency The player is expected to be used with simple audio formats,
- but playback should start without significant delay.
- Such playback service can be used for beeps, ringtones, etc.
-
- \value StreamPlayback The player is expected to play QIODevice based streams.
- If passed to QMediaPlayer constructor, the service supporting
- streams playback will be chosen.
-
- \value VideoSurface The player is expected to be able to render to a
- QAbstractVideoSurface \l {setVideoOutput()}{output}.
-*/
-
-#include "moc_qmediaplayer.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplayer.h b/src/multimedia/qmediaplayer.h
deleted file mode 100644
index f53b50c..0000000
--- a/src/multimedia/qmediaplayer.h
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYER_H
-#define QMEDIAPLAYER_H
-
-
-#include "qmediaserviceprovider.h"
-#include "qmediaobject.h"
-#include "qmediacontent.h"
-#include "qmediaenumdebug.h"
-
-#include <QtNetwork/qnetworkconfiguration.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoSurface;
-class QMediaPlaylist;
-class QVideoWidget;
-class QGraphicsVideoItem;
-
-class QMediaPlayerPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaPlayer : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(QMediaContent media READ media WRITE setMedia NOTIFY mediaChanged)
- Q_PROPERTY(QMediaPlaylist * playlist READ playlist WRITE setPlaylist)
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(qint64 position READ position WRITE setPosition NOTIFY positionChanged)
- Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(int bufferStatus READ bufferStatus NOTIFY bufferStatusChanged)
- Q_PROPERTY(bool audioAvailable READ isAudioAvailable NOTIFY audioAvailableChanged)
- Q_PROPERTY(bool videoAvailable READ isVideoAvailable NOTIFY videoAvailableChanged)
- Q_PROPERTY(bool seekable READ isSeekable NOTIFY seekableChanged)
- Q_PROPERTY(qreal playbackRate READ playbackRate WRITE setPlaybackRate NOTIFY playbackRateChanged)
- Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(MediaStatus mediaStatus READ mediaStatus NOTIFY mediaStatusChanged)
- Q_PROPERTY(QString error READ errorString)
- Q_ENUMS(State)
- Q_ENUMS(MediaStatus)
- Q_ENUMS(Error)
-
-public:
- enum State
- {
- StoppedState,
- PlayingState,
- PausedState
- };
-
- enum MediaStatus
- {
- UnknownMediaStatus,
- NoMedia,
- LoadingMedia,
- LoadedMedia,
- StalledMedia,
- BufferingMedia,
- BufferedMedia,
- EndOfMedia,
- InvalidMedia
- };
-
- enum Flag
- {
- LowLatency = 0x01,
- StreamPlayback = 0x02,
- VideoSurface = 0x04
- };
- Q_DECLARE_FLAGS(Flags, Flag)
-
- enum Error
- {
- NoError,
- ResourceError,
- FormatError,
- NetworkError,
- AccessDeniedError,
- ServiceMissingError
- };
-
- QMediaPlayer(QObject *parent = 0, Flags flags = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
- ~QMediaPlayer();
-
- static QtMultimedia::SupportEstimate hasSupport(const QString &mimeType,
- const QStringList& codecs = QStringList(),
- Flags flags = 0);
- static QStringList supportedMimeTypes(Flags flags = 0);
-
- void setVideoOutput(QVideoWidget *);
- void setVideoOutput(QGraphicsVideoItem *);
- void setVideoOutput(QAbstractVideoSurface *surface);
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- QMediaPlaylist *playlist() const;
-
- State state() const;
- MediaStatus mediaStatus() const;
-
- qint64 duration() const;
- qint64 position() const;
-
- int volume() const;
- bool isMuted() const;
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
-
- int bufferStatus() const;
-
- bool isSeekable() const;
- qreal playbackRate() const;
-
- Error error() const;
- QString errorString() const;
-
- QNetworkConfiguration currentNetworkConfiguration() const;
-
-public Q_SLOTS:
- void play();
- void pause();
- void stop();
-
- void setPosition(qint64 position);
- void setVolume(int volume);
- void setMuted(bool muted);
-
- void setPlaybackRate(qreal rate);
-
- void setMedia(const QMediaContent &media, QIODevice *stream = 0);
- void setPlaylist(QMediaPlaylist *playlist);
-
- void setNetworkConfigurations(const QList<QNetworkConfiguration> &configurations);
-
-Q_SIGNALS:
- void mediaChanged(const QMediaContent &media);
-
- void stateChanged(QMediaPlayer::State newState);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
-
- void durationChanged(qint64 duration);
- void positionChanged(qint64 position);
-
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void audioAvailableChanged(bool available);
- void videoAvailableChanged(bool videoAvailable);
-
- void bufferStatusChanged(int percentFilled);
-
- void seekableChanged(bool seekable);
- void playbackRateChanged(qreal rate);
-
- void error(QMediaPlayer::Error error);
-
- void networkConfigurationChanged(const QNetworkConfiguration &configuration);
-public:
- virtual bool bind(QObject *);
- virtual void unbind(QObject *);
-
-private:
- Q_DISABLE_COPY(QMediaPlayer)
- Q_DECLARE_PRIVATE(QMediaPlayer)
- Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QMediaPlayer::State))
- Q_PRIVATE_SLOT(d_func(), void _q_mediaStatusChanged(QMediaPlayer::MediaStatus))
- Q_PRIVATE_SLOT(d_func(), void _q_error(int, const QString &))
- Q_PRIVATE_SLOT(d_func(), void _q_updateMedia(const QMediaContent&))
- Q_PRIVATE_SLOT(d_func(), void _q_playlistDestroyed())
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaPlayer::State)
-Q_DECLARE_METATYPE(QMediaPlayer::MediaStatus)
-Q_DECLARE_METATYPE(QMediaPlayer::Error)
-
-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/qmediaplayercontrol.cpp b/src/multimedia/qmediaplayercontrol.cpp
deleted file mode 100644
index 2585b04..0000000
--- a/src/multimedia/qmediaplayercontrol.cpp
+++ /dev/null
@@ -1,414 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplayercontrol.h"
-#include "qmediacontrol_p.h"
-#include "qmediaplayer.h"
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMediaPlayerControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMediaPlayerControl class provides access to the media playing
- functionality of a QMediaService.
-
- If a QMediaService can play media is will implement QMediaPlayerControl.
- This control provides a means to set the \l {setMedia()}{media} to play,
- \l {play()}{start}, \l {pause()} {pause} and \l {stop()}{stop} playback,
- \l {setPosition()}{seek}, and control the \l {setVolume()}{volume}.
- It also provides feedback on the \l {duration()}{duration} of the media,
- the current \l {position()}{position}, and \l {bufferStatus()}{buffering}
- progress.
-
- The functionality provided by this control is exposed to application
- code through the QMediaPlayer class.
-
- The interface name of QMediaPlayerControl is \c com.nokia.Qt.QMediaPlayerControl/1.0 as
- defined in QMediaPlayerControl_iid.
-
- \sa QMediaService::requestControl(), QMediaPlayer
-*/
-
-/*!
- \macro QMediaPlayerControl_iid
-
- \c com.nokia.Qt.QMediaPlayerControl/1.0
-
- Defines the interface name of the QMediaPlayerControl class.
-
- \relates QMediaPlayerControl
-*/
-
-/*!
- Destroys a media player control.
-*/
-QMediaPlayerControl::~QMediaPlayerControl()
-{
-}
-
-/*!
- Constructs a new media player control with the given \a parent.
-*/
-QMediaPlayerControl::QMediaPlayerControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- \fn QMediaPlayerControl::state() const
-
- Returns the state of a player control.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::stateChanged(QMediaPlayer::State state)
-
- Signals that the \a state of a player control has changed.
-
- \since 1.0
- \sa state()
-*/
-
-/*!
- \fn QMediaPlayerControl::mediaStatus() const
-
- Returns the status of the current media.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::mediaStatusChanged(QMediaPlayer::MediaStatus status)
-
- Signals that the \a status of the current media has changed.
-
- \since 1.0
- \sa mediaStatus()
-*/
-
-
-/*!
- \fn QMediaPlayerControl::duration() const
-
- Returns the duration of the current media in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::durationChanged(qint64 duration)
-
- Signals that the \a duration of the current media has changed.
-
- \since 1.0
- \sa duration()
-*/
-
-/*!
- \fn QMediaPlayerControl::position() const
-
- Returns the current playback position in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::setPosition(qint64 position)
-
- Sets the playback \a position of the current media. This will initiate a seek and it may take
- some time for playback to reach the position set.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::positionChanged(qint64 position)
-
- Signals the playback \a position has changed.
-
- This is only emitted in when there has been a discontinous change in the playback postion, such
- as a seek or the position being reset.
-
- \since 1.0
- \sa position()
-*/
-
-/*!
- \fn QMediaPlayerControl::volume() const
-
- Returns the audio volume of a player control.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::setVolume(int volume)
-
- Sets the audio \a volume of a player control.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::volumeChanged(int volume)
-
- Signals the audio \a volume of a player control has changed.
-
- \since 1.0
- \sa volume()
-*/
-
-/*!
- \fn QMediaPlayerControl::isMuted() const
-
- Returns the mute state of a player control.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::setMuted(bool mute)
-
- Sets the \a mute state of a player control.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::mutedChanged(bool mute)
-
- Signals a change in the \a mute status of a player control.
-
- \since 1.0
- \sa isMuted()
-*/
-
-/*!
- \fn QMediaPlayerControl::bufferStatus() const
-
- Returns the buffering progress of the current media. Progress is measured in the percentage
- of the buffer filled.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::bufferStatusChanged(int progress)
-
- Signals that buffering \a progress has changed.
-
- \since 1.0
- \sa bufferStatus()
-*/
-
-/*!
- \fn QMediaPlayerControl::isAudioAvailable() const
-
- Identifies if there is audio output available for the current media.
-
- Returns true if audio output is available and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::audioAvailableChanged(bool audio)
-
- Signals that there has been a change in the availability of \a audio output.
-
- \since 1.0
- \sa isAudioAvailable()
-*/
-
-/*!
- \fn QMediaPlayerControl::isVideoAvailable() const
-
- Identifies if there is video output available for the current media.
-
- Returns true if video output is available and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::videoAvailableChanged(bool video)
-
- Signals that there has been a change in the availability of \a video output.
-
- \since 1.0
- \sa isVideoAvailable()
-*/
-
-/*!
- \fn QMediaPlayerControl::isSeekable() const
-
- Identifies if the current media is seekable.
-
- Returns true if it possible to seek within the current media, and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::seekableChanged(bool seekable)
-
- Signals that the \a seekable state of a player control has changed.
-
- \since 1.0
- \sa isSeekable()
-*/
-
-/*!
- \fn QMediaPlayerControl::availablePlaybackRanges() const
-
- Returns a range of times in milliseconds that can be played back.
-
- Usually for local files this is a continuous interval equal to [0..duration()]
- or an empty time range if seeking is not supported, but for network sources
- it refers to the buffered parts of the media.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::availablePlaybackRangesChanged(const QMediaTimeRange &ranges)
-
- Signals that the available media playback \a ranges have changed.
-
- \since 1.0
- \sa QMediaPlayerControl::availablePlaybackRanges()
-*/
-
-/*!
- \fn qreal QMediaPlayerControl::playbackRate() const
-
- Returns the rate of playback.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::setPlaybackRate(qreal rate)
-
- Sets the \a rate of playback.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::media() const
-
- Returns the current media source.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::mediaStream() const
-
- Returns the current media stream. This is only a valid if a stream was passed to setMedia().
-
- \since 1.0
- \sa setMedia()
-*/
-
-/*!
- \fn QMediaPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream)
-
- Sets the current \a media source. If a \a stream is supplied; data will be read from that
- instead of attempting to resolve the media source. The media source may still be used to
- supply media information such as mime type.
-
- Setting the media to a null QMediaContent will cause the control to discard all
- information relating to the current media source and to cease all I/O operations related
- to that media.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::mediaChanged(const QMediaContent& content)
-
- Signals that the current media \a content has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::play()
-
- Starts playback of the current media.
-
- If successful the player control will immediately enter the \l {QMediaPlayer::PlayingState}
- {playing} state.
-
- \since 1.0
- \sa state()
-*/
-
-/*!
- \fn QMediaPlayerControl::pause()
-
- Pauses playback of the current media.
-
- If sucessful the player control will immediately enter the \l {QMediaPlayer::PausedState}
- {paused} state.
-
- \since 1.0
- \sa state(), play(), stop()
-*/
-
-/*!
- \fn QMediaPlayerControl::stop()
-
- Stops playback of the current media.
-
- If successful the player control will immediately enter the \l {QMediaPlayer::StoppedState}
- {stopped} state.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::error(int error, const QString &errorString)
-
- Signals that an \a error has occurred. The \a errorString provides a more detailed explanation.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlayerControl::playbackRateChanged(qreal rate)
-
- Signal emitted when playback rate changes to \a rate.
- \since 1.0
-*/
-
-#include "moc_qmediaplayercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplayercontrol.h b/src/multimedia/qmediaplayercontrol.h
deleted file mode 100644
index a6e02ee..0000000
--- a/src/multimedia/qmediaplayercontrol.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYERCONTROL_H
-#define QMEDIAPLAYERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediaplayer.h"
-#include "qmediatimerange.h"
-
-#include <QtCore/qpair.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylist;
-
-class Q_MULTIMEDIA_EXPORT QMediaPlayerControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QMediaPlayerControl();
-
- virtual QMediaPlayer::State state() const = 0;
-
- virtual QMediaPlayer::MediaStatus mediaStatus() const = 0;
-
- virtual qint64 duration() const = 0;
-
- virtual qint64 position() const = 0;
- virtual void setPosition(qint64 position) = 0;
-
- virtual int volume() const = 0;
- virtual void setVolume(int volume) = 0;
-
- virtual bool isMuted() const = 0;
- virtual void setMuted(bool muted) = 0;
-
- virtual int bufferStatus() const = 0;
-
- virtual bool isAudioAvailable() const = 0;
- virtual bool isVideoAvailable() const = 0;
-
- virtual bool isSeekable() const = 0;
-
- virtual QMediaTimeRange availablePlaybackRanges() const = 0;
-
- virtual qreal playbackRate() const = 0;
- virtual void setPlaybackRate(qreal rate) = 0;
-
- virtual QMediaContent media() const = 0;
- virtual const QIODevice *mediaStream() const = 0;
- virtual void setMedia(const QMediaContent &media, QIODevice *stream) = 0;
-
- virtual void play() = 0;
- virtual void pause() = 0;
- virtual void stop() = 0;
-
-Q_SIGNALS:
- void mediaChanged(const QMediaContent& content);
- void durationChanged(qint64 duration);
- void positionChanged(qint64 position);
- void stateChanged(QMediaPlayer::State newState);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void audioAvailableChanged(bool audioAvailable);
- void videoAvailableChanged(bool videoAvailable);
- void bufferStatusChanged(int percentFilled);
- void seekableChanged(bool);
- void availablePlaybackRangesChanged(const QMediaTimeRange&);
- void playbackRateChanged(qreal rate);
- void error(int error, const QString &errorString);
-
-protected:
- QMediaPlayerControl(QObject* parent = 0);
-};
-
-#define QMediaPlayerControl_iid "com.nokia.Qt.QMediaPlayerControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaPlayerControl, QMediaPlayerControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYERCONTROL_H
-
diff --git a/src/multimedia/qmediaplaylist.cpp b/src/multimedia/qmediaplaylist.cpp
deleted file mode 100644
index a5618ad..0000000
--- a/src/multimedia/qmediaplaylist.cpp
+++ /dev/null
@@ -1,756 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplaylist.h"
-#include "qmediaplaylist_p.h"
-#include "qmediaplaylistprovider.h"
-#include "qlocalmediaplaylistprovider.h"
-#include "qmediaplaylistioplugin.h"
-#include "qmediaservice.h"
-#include "qmediaplaylistcontrol.h"
-#include "qmediaplayercontrol.h"
-
-#include <QtCore/qlist.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qcoreapplication.h>
-
-#include "qmediapluginloader_p.h"
-
-QT_BEGIN_NAMESPACE
-
-Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, playlistIOLoader,
- (QMediaPlaylistIOInterface_iid, QLatin1String("playlistformats"), Qt::CaseInsensitive))
-
-
-/*!
- \class QMediaPlaylist
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
-
- \brief The QMediaPlaylist class provides a list of media content to play.
-
- QMediaPlaylist is intended to be used with other media objects,
- like QMediaPlayer or QMediaImageViewer.
-
- QMediaPlaylist allows to access the service intrinsic playlist functionality
- if available, otherwise it provides the the local memory playlist implementation.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Movie playlist
-
- Depending on playlist source implementation, most of the playlist mutating
- operations can be asynchronous.
-
- \sa QMediaContent
-*/
-
-
-/*!
- \enum QMediaPlaylist::PlaybackMode
-
- The QMediaPlaylist::PlaybackMode describes the order items in playlist are played.
-
- \value CurrentItemOnce The current item is played only once.
-
- \value CurrentItemInLoop The current item is played repeatedly in a loop.
-
- \value Sequential Playback starts from the current and moves through each successive item until the last is reached and then stops.
- The next item is a null item when the last one is currently playing.
-
- \value Loop Playback restarts at the first item after the last has finished playing.
-
- \value Random Play items in random order.
-*/
-
-
-
-/*!
- Create a new playlist object for with the given \a parent.
-*/
-
-QMediaPlaylist::QMediaPlaylist(QObject *parent)
- : QObject(parent)
- , d_ptr(new QMediaPlaylistPrivate)
-{
- Q_D(QMediaPlaylist);
-
- d->q_ptr = this;
- d->localPlaylistControl = new QLocalMediaPlaylistControl(this);
-
- setMediaObject(0);
-}
-
-/*!
- Destroys the playlist.
- */
-
-QMediaPlaylist::~QMediaPlaylist()
-{
- Q_D(QMediaPlaylist);
-
- if (d->mediaObject)
- d->mediaObject->unbind(this);
-
- delete d_ptr;
-}
-
-/*!
- Returns the QMediaObject instance that this QMediaPlaylist is bound too,
- or 0 otherwise.
- \since 1.0
-*/
-QMediaObject *QMediaPlaylist::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \internal
- If \a mediaObject is null or doesn't have an intrinsic playlist,
- internal local memory playlist source will be created.
- \since 1.0
-*/
-bool QMediaPlaylist::setMediaObject(QMediaObject *mediaObject)
-{
- Q_D(QMediaPlaylist);
-
- if (mediaObject && mediaObject == d->mediaObject)
- return true;
-
- QMediaService *service = mediaObject
- ? mediaObject->service() : 0;
-
- QMediaPlaylistControl *newControl = 0;
-
- if (service)
- newControl = qobject_cast<QMediaPlaylistControl*>(service->requestControl(QMediaPlaylistControl_iid));
-
- if (!newControl)
- newControl = d->localPlaylistControl;
-
- if (d->control != newControl) {
- int oldSize = 0;
- if (d->control) {
- QMediaPlaylistProvider *playlist = d->control->playlistProvider();
- oldSize = playlist->mediaCount();
- disconnect(playlist, SIGNAL(loadFailed(QMediaPlaylist::Error,QString)),
- this, SLOT(_q_loadFailed(QMediaPlaylist::Error,QString)));
-
- disconnect(playlist, SIGNAL(mediaChanged(int,int)), this, SIGNAL(mediaChanged(int,int)));
- disconnect(playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SIGNAL(mediaAboutToBeInserted(int,int)));
- disconnect(playlist, SIGNAL(mediaInserted(int,int)), this, SIGNAL(mediaInserted(int,int)));
- disconnect(playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SIGNAL(mediaAboutToBeRemoved(int,int)));
- disconnect(playlist, SIGNAL(mediaRemoved(int,int)), this, SIGNAL(mediaRemoved(int,int)));
-
- disconnect(playlist, SIGNAL(loaded()), this, SIGNAL(loaded()));
-
- disconnect(d->control, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)),
- this, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
- disconnect(d->control, SIGNAL(currentIndexChanged(int)),
- this, SIGNAL(currentIndexChanged(int)));
- disconnect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SIGNAL(currentMediaChanged(QMediaContent)));
-
- if (d->mediaObject)
- d->mediaObject->service()->releaseControl(d->control);
- }
-
- d->control = newControl;
- QMediaPlaylistProvider *playlist = d->control->playlistProvider();
- connect(playlist, SIGNAL(loadFailed(QMediaPlaylist::Error,QString)),
- this, SLOT(_q_loadFailed(QMediaPlaylist::Error,QString)));
-
- connect(playlist, SIGNAL(mediaChanged(int,int)), this, SIGNAL(mediaChanged(int,int)));
- connect(playlist, SIGNAL(mediaAboutToBeInserted(int,int)), this, SIGNAL(mediaAboutToBeInserted(int,int)));
- connect(playlist, SIGNAL(mediaInserted(int,int)), this, SIGNAL(mediaInserted(int,int)));
- connect(playlist, SIGNAL(mediaAboutToBeRemoved(int,int)), this, SIGNAL(mediaAboutToBeRemoved(int,int)));
- connect(playlist, SIGNAL(mediaRemoved(int,int)), this, SIGNAL(mediaRemoved(int,int)));
-
- connect(playlist, SIGNAL(loaded()), this, SIGNAL(loaded()));
-
- connect(d->control, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)),
- this, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
- connect(d->control, SIGNAL(currentIndexChanged(int)),
- this, SIGNAL(currentIndexChanged(int)));
- connect(d->control, SIGNAL(currentMediaChanged(QMediaContent)),
- this, SIGNAL(currentMediaChanged(QMediaContent)));
-
- if (oldSize)
- emit mediaRemoved(0, oldSize-1);
-
- if (playlist->mediaCount()) {
- emit mediaAboutToBeInserted(0,playlist->mediaCount()-1);
- emit mediaInserted(0,playlist->mediaCount()-1);
- }
- }
-
- d->mediaObject = mediaObject;
-
- return true;
-}
-
-/*!
- \property QMediaPlaylist::playbackMode
-
- This property defines the order, items in playlist are played.
-
- \since 1.0
- \sa QMediaPlaylist::PlaybackMode
-*/
-
-QMediaPlaylist::PlaybackMode QMediaPlaylist::playbackMode() const
-{
- return d_func()->control->playbackMode();
-}
-
-void QMediaPlaylist::setPlaybackMode(QMediaPlaylist::PlaybackMode mode)
-{
- Q_D(QMediaPlaylist);
- d->control->setPlaybackMode(mode);
-}
-
-/*!
- Returns position of the current media content in the playlist.
- \since 1.0
-*/
-int QMediaPlaylist::currentIndex() const
-{
- return d_func()->control->currentIndex();
-}
-
-/*!
- Returns the current media content.
- \since 1.0
-*/
-
-QMediaContent QMediaPlaylist::currentMedia() const
-{
- return d_func()->playlist()->media(currentIndex());
-}
-
-/*!
- Returns the index of the item, which would be current after calling next()
- \a steps times.
-
- Returned value depends on the size of playlist, current position
- and playback mode.
-
- \since 1.0
- \sa QMediaPlaylist::playbackMode
-*/
-int QMediaPlaylist::nextIndex(int steps) const
-{
- return d_func()->control->nextIndex(steps);
-}
-
-/*!
- Returns the index of the item, which would be current after calling previous()
- \a steps times.
-
- \since 1.0
- \sa QMediaPlaylist::playbackMode
-*/
-
-int QMediaPlaylist::previousIndex(int steps) const
-{
- return d_func()->control->previousIndex(steps);
-}
-
-
-/*!
- Returns the number of items in the playlist.
-
- \since 1.0
- \sa isEmpty()
- */
-int QMediaPlaylist::mediaCount() const
-{
- return d_func()->playlist()->mediaCount();
-}
-
-/*!
- Returns true if the playlist contains no items; otherwise returns false.
-
- \since 1.0
- \sa mediaCount()
- */
-bool QMediaPlaylist::isEmpty() const
-{
- return mediaCount() == 0;
-}
-
-/*!
- Returns true if the playlist can be modified; otherwise returns false.
-
- \since 1.0
- \sa mediaCount()
- */
-bool QMediaPlaylist::isReadOnly() const
-{
- return d_func()->playlist()->isReadOnly();
-}
-
-/*!
- Returns the media content at \a index in the playlist.
- \since 1.0
-*/
-
-QMediaContent QMediaPlaylist::media(int index) const
-{
- return d_func()->playlist()->media(index);
-}
-
-/*!
- Append the media \a content to the playlist.
-
- Returns true if the operation is successful, otherwise return false.
- \since 1.0
- */
-bool QMediaPlaylist::addMedia(const QMediaContent &content)
-{
- return d_func()->control->playlistProvider()->addMedia(content);
-}
-
-/*!
- Append multiple media content \a items to the playlist.
-
- Returns true if the operation is successful, otherwise return false.
- \since 1.0
- */
-bool QMediaPlaylist::addMedia(const QList<QMediaContent> &items)
-{
- return d_func()->control->playlistProvider()->addMedia(items);
-}
-
-/*!
- Insert the media \a content to the playlist at position \a pos.
-
- Returns true if the operation is successful, otherwise false.
- \since 1.0
-*/
-
-bool QMediaPlaylist::insertMedia(int pos, const QMediaContent &content)
-{
- return d_func()->playlist()->insertMedia(pos, content);
-}
-
-/*!
- Insert multiple media content \a items to the playlist at position \a pos.
-
- Returns true if the operation is successful, otherwise false.
- \since 1.0
-*/
-
-bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> &items)
-{
- return d_func()->playlist()->insertMedia(pos, items);
-}
-
-/*!
- Remove the item from the playlist at position \a pos.
-
- Returns true if the operation is successful, otherwise return false.
- \since 1.0
- */
-bool QMediaPlaylist::removeMedia(int pos)
-{
- Q_D(QMediaPlaylist);
- return d->playlist()->removeMedia(pos);
-}
-
-/*!
- Remove items in the playlist from \a start to \a end inclusive.
-
- Returns true if the operation is successful, otherwise return false.
- \since 1.0
- */
-bool QMediaPlaylist::removeMedia(int start, int end)
-{
- Q_D(QMediaPlaylist);
- return d->playlist()->removeMedia(start, end);
-}
-
-/*!
- Remove all the items from the playlist.
-
- Returns true if the operation is successful, otherwise return false.
- \since 1.0
- */
-bool QMediaPlaylist::clear()
-{
- Q_D(QMediaPlaylist);
- return d->playlist()->clear();
-}
-
-bool QMediaPlaylistPrivate::readItems(QMediaPlaylistReader *reader)
-{
- while (!reader->atEnd())
- playlist()->addMedia(reader->readItem());
-
- return true;
-}
-
-bool QMediaPlaylistPrivate::writeItems(QMediaPlaylistWriter *writer)
-{
- for (int i=0; i<playlist()->mediaCount(); i++) {
- if (!writer->writeItem(playlist()->media(i)))
- return false;
- }
- writer->close();
- return true;
-}
-
-/*!
- Load playlist from \a location. If \a format is specified, it is used,
- otherwise format is guessed from location name and data.
-
- New items are appended to playlist.
-
- QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully,
- otherwise the playlist emits loadFailed().
- \since 1.0
-*/
-void QMediaPlaylist::load(const QUrl &location, const char *format)
-{
- Q_D(QMediaPlaylist);
-
- d->error = NoError;
- d->errorString.clear();
-
- if (d->playlist()->load(location,format))
- return;
-
- if (isReadOnly()) {
- d->error = AccessDeniedError;
- d->errorString = tr("Could not add items to read only playlist.");
- emit loadFailed();
- return;
- }
-
- foreach (QString const& key, playlistIOLoader()->keys()) {
- QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key));
- if (plugin && plugin->canRead(location,format)) {
- QMediaPlaylistReader *reader = plugin->createReader(location,QByteArray(format));
- if (reader && d->readItems(reader)) {
- delete reader;
- emit loaded();
- return;
- }
- delete reader;
- }
- }
-
- d->error = FormatNotSupportedError;
- d->errorString = tr("Playlist format is not supported");
- emit loadFailed();
-
- return;
-}
-
-/*!
- Load playlist from QIODevice \a device. If \a format is specified, it is used,
- otherwise format is guessed from device data.
-
- New items are appended to playlist.
-
- QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully,
- otherwise the playlist emits loadFailed().
- \since 1.0
-*/
-void QMediaPlaylist::load(QIODevice * device, const char *format)
-{
- Q_D(QMediaPlaylist);
-
- d->error = NoError;
- d->errorString.clear();
-
- if (d->playlist()->load(device,format))
- return;
-
- if (isReadOnly()) {
- d->error = AccessDeniedError;
- d->errorString = tr("Could not add items to read only playlist.");
- emit loadFailed();
- return;
- }
-
- foreach (QString const& key, playlistIOLoader()->keys()) {
- QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key));
- if (plugin && plugin->canRead(device,format)) {
- QMediaPlaylistReader *reader = plugin->createReader(device,QByteArray(format));
- if (reader && d->readItems(reader)) {
- delete reader;
- emit loaded();
- return;
- }
- delete reader;
- }
- }
-
- d->error = FormatNotSupportedError;
- d->errorString = tr("Playlist format is not supported");
- emit loadFailed();
-
- return;
-}
-
-/*!
- Save playlist to \a location. If \a format is specified, it is used,
- otherwise format is guessed from location name.
-
- Returns true if playlist was saved successfully, otherwise returns false.
- \since 1.0
- */
-bool QMediaPlaylist::save(const QUrl &location, const char *format)
-{
- Q_D(QMediaPlaylist);
-
- d->error = NoError;
- d->errorString.clear();
-
- if (d->playlist()->save(location,format))
- return true;
-
- QFile file(location.toLocalFile());
-
- if (!file.open(QIODevice::WriteOnly | QIODevice::Truncate)) {
- d->error = AccessDeniedError;
- d->errorString = tr("The file could not be accessed.");
- return false;
- }
-
- return save(&file, format);
-}
-
-/*!
- Save playlist to QIODevice \a device using format \a format.
-
- Returns true if playlist was saved successfully, otherwise returns false.
- \since 1.0
-*/
-bool QMediaPlaylist::save(QIODevice * device, const char *format)
-{
- Q_D(QMediaPlaylist);
-
- d->error = NoError;
- d->errorString.clear();
-
- if (d->playlist()->save(device,format))
- return true;
-
- foreach (QString const& key, playlistIOLoader()->keys()) {
- QMediaPlaylistIOInterface* plugin = qobject_cast<QMediaPlaylistIOInterface*>(playlistIOLoader()->instance(key));
- if (plugin && plugin->canWrite(device,format)) {
- QMediaPlaylistWriter *writer = plugin->createWriter(device,QByteArray(format));
- if (writer && d->writeItems(writer)) {
- delete writer;
- return true;
- }
- delete writer;
- }
- }
-
- d->error = FormatNotSupportedError;
- d->errorString = tr("Playlist format is not supported.");
-
- return false;
-}
-
-/*!
- Returns the last error condition.
- \since 1.0
-*/
-QMediaPlaylist::Error QMediaPlaylist::error() const
-{
- return d_func()->error;
-}
-
-/*!
- Returns the string describing the last error condition.
- \since 1.0
-*/
-QString QMediaPlaylist::errorString() const
-{
- return d_func()->errorString;
-}
-
-/*!
- Shuffle items in the playlist.
- \since 1.0
-*/
-void QMediaPlaylist::shuffle()
-{
- d_func()->playlist()->shuffle();
-}
-
-
-/*!
- Advance to the next media content in playlist.
- \since 1.0
-*/
-void QMediaPlaylist::next()
-{
- d_func()->control->next();
-}
-
-/*!
- Return to the previous media content in playlist.
- \since 1.0
-*/
-void QMediaPlaylist::previous()
-{
- d_func()->control->previous();
-}
-
-/*!
- Activate media content from playlist at position \a playlistPosition.
- \since 1.0
-*/
-
-void QMediaPlaylist::setCurrentIndex(int playlistPosition)
-{
- d_func()->control->setCurrentIndex(playlistPosition);
-}
-
-/*!
- \fn void QMediaPlaylist::mediaInserted(int start, int end)
-
- This signal is emitted after media has been inserted into the playlist.
- The new items are those between \a start and \a end inclusive.
- \since 1.0
- */
-
-/*!
- \fn void QMediaPlaylist::mediaRemoved(int start, int end)
-
- This signal is emitted after media has been removed from the playlist.
- The removed items are those between \a start and \a end inclusive.
- \since 1.0
- */
-
-/*!
- \fn void QMediaPlaylist::mediaChanged(int start, int end)
-
- This signal is emitted after media has been changed in the playlist
- between \a start and \a end positions inclusive.
- \since 1.0
- */
-
-/*!
- \fn void QMediaPlaylist::currentIndexChanged(int position)
-
- Signal emitted when playlist position changed to \a position.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylist::playbackModeChanged(QMediaPlaylist::PlaybackMode mode)
-
- Signal emitted when playback mode changed to \a mode.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylist::mediaAboutToBeInserted(int start, int end)
-
- Signal emitted when items are to be inserted at \a start and ending at \a end.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylist::mediaAboutToBeRemoved(int start, int end)
-
- Signal emitted when item are to be deleted at \a start and ending at \a end.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylist::currentMediaChanged(const QMediaContent &content)
-
- Signal emitted when current media changes to \a content.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlaylist::currentIndex
- \brief Current position.
- \since 1.0
-*/
-
-/*!
- \property QMediaPlaylist::currentMedia
- \brief Current media content.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylist::loaded()
-
- Signal emitted when playlist finished loading.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylist::loadFailed()
-
- Signal emitted if failed to load playlist.
- \since 1.0
-*/
-
-/*!
- \enum QMediaPlaylist::Error
-
- This enum describes the QMediaPlaylist error codes.
-
- \value NoError No errors.
- \value FormatError Format error.
- \value FormatNotSupportedError Format not supported.
- \value NetworkError Network error.
- \value AccessDeniedError Access denied error.
-*/
-
-#include "moc_qmediaplaylist.cpp"
-#include "moc_qmediaplaylist_p.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylist.h b/src/multimedia/qmediaplaylist.h
deleted file mode 100644
index 7b4b622..0000000
--- a/src/multimedia/qmediaplaylist.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLIST_H
-#define QMEDIAPLAYLIST_H
-
-#include <QtCore/qobject.h>
-
-#include <qmediacontent.h>
-#include <qmediaobject.h>
-#include <qmediabindableinterface.h>
-#include <qmediaenumdebug.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylistProvider;
-
-class QMediaPlaylistPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaPlaylist : public QObject, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
- Q_PROPERTY(QMediaPlaylist::PlaybackMode playbackMode READ playbackMode WRITE setPlaybackMode NOTIFY playbackModeChanged)
- Q_PROPERTY(QMediaContent currentMedia READ currentMedia NOTIFY currentMediaChanged)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged)
- Q_ENUMS(PlaybackMode Error)
-
-public:
- enum PlaybackMode { CurrentItemOnce, CurrentItemInLoop, Sequential, Loop, Random };
- enum Error { NoError, FormatError, FormatNotSupportedError, NetworkError, AccessDeniedError };
-
- QMediaPlaylist(QObject *parent = 0);
- virtual ~QMediaPlaylist();
-
- QMediaObject *mediaObject() const;
-
- PlaybackMode playbackMode() const;
- void setPlaybackMode(PlaybackMode mode);
-
- int currentIndex() const;
- QMediaContent currentMedia() const;
-
- int nextIndex(int steps = 1) const;
- int previousIndex(int steps = 1) const;
-
- QMediaContent media(int index) const;
-
- int mediaCount() const;
- bool isEmpty() const;
- bool isReadOnly() const;
-
- bool addMedia(const QMediaContent &content);
- bool addMedia(const QList<QMediaContent> &items);
- bool insertMedia(int index, const QMediaContent &content);
- bool insertMedia(int index, const QList<QMediaContent> &items);
- bool removeMedia(int pos);
- bool removeMedia(int start, int end);
- bool clear();
-
- void load(const QUrl &location, const char *format = 0);
- void load(QIODevice * device, const char *format = 0);
-
- bool save(const QUrl &location, const char *format = 0);
- bool save(QIODevice * device, const char *format);
-
- Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void shuffle();
-
- void next();
- void previous();
-
- void setCurrentIndex(int index);
-
-Q_SIGNALS:
- void currentIndexChanged(int index);
- void playbackModeChanged(QMediaPlaylist::PlaybackMode mode);
- void currentMediaChanged(const QMediaContent&);
-
- void mediaAboutToBeInserted(int start, int end);
- void mediaInserted(int start, int end);
- void mediaAboutToBeRemoved(int start, int end);
- void mediaRemoved(int start, int end);
- void mediaChanged(int start, int end);
-
- void loaded();
- void loadFailed();
-
-protected:
- bool setMediaObject(QMediaObject *object);
- QMediaPlaylistPrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QMediaPlaylist)
- Q_PRIVATE_SLOT(d_func(), void _q_loadFailed(QMediaPlaylist::Error, const QString &))
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaPlaylist::PlaybackMode)
-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/qmediaplaylist_p.h b/src/multimedia/qmediaplaylist_p.h
deleted file mode 100644
index c04483c..0000000
--- a/src/multimedia/qmediaplaylist_p.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLIST_P_H
-#define QMEDIAPLAYLIST_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qmediaplaylist.h"
-#include "qmediaplaylistcontrol.h"
-#include "qmediaplayer.h"
-#include "qmediaplayercontrol.h"
-#include "qlocalmediaplaylistprovider.h"
-#include "qmediaobject_p.h"
-
-#include <QtCore/qdebug.h>
-
-#ifdef Q_MOC_RUN
-# pragma Q_MOC_EXPAND_MACROS
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylistControl;
-class QMediaPlaylistProvider;
-class QMediaPlaylistReader;
-class QMediaPlaylistWriter;
-class QMediaPlayerControl;
-
-class QMediaPlaylistPrivate
-{
- Q_DECLARE_PUBLIC(QMediaPlaylist)
-public:
- QMediaPlaylistPrivate()
- :mediaObject(0),
- control(0),
- localPlaylistControl(0),
- error(QMediaPlaylist::NoError)
- {
- }
-
- virtual ~QMediaPlaylistPrivate() {}
-
- void _q_loadFailed(QMediaPlaylist::Error error, const QString &errorString)
- {
- this->error = error;
- this->errorString = errorString;
-
- emit q_ptr->loadFailed();
- }
-
- void _q_mediaObjectDeleted()
- {
- Q_Q(QMediaPlaylist);
- mediaObject = 0;
- if (control != localPlaylistControl)
- control = 0;
- q->setMediaObject(0);
- }
-
- QMediaObject *mediaObject;
-
- QMediaPlaylistControl *control;
- QMediaPlaylistProvider *playlist() const { return control->playlistProvider(); }
-
- QMediaPlaylistControl *localPlaylistControl;
-
- bool readItems(QMediaPlaylistReader *reader);
- bool writeItems(QMediaPlaylistWriter *writer);
-
- QMediaPlaylist::Error error;
- QString errorString;
-
- QMediaPlaylist *q_ptr;
-};
-
-
-class QLocalMediaPlaylistControl : public QMediaPlaylistControl
-{
- Q_OBJECT
-public:
- QLocalMediaPlaylistControl(QObject *parent)
- :QMediaPlaylistControl(parent)
- {
- QMediaPlaylistProvider *playlist = new QLocalMediaPlaylistProvider(this);
- m_navigator = new QMediaPlaylistNavigator(playlist,this);
- m_navigator->setPlaybackMode(QMediaPlaylist::Sequential);
-
- connect(m_navigator, SIGNAL(currentIndexChanged(int)), SIGNAL(currentIndexChanged(int)));
- connect(m_navigator, SIGNAL(activated(QMediaContent)), SIGNAL(currentMediaChanged(QMediaContent)));
- connect(m_navigator, SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)), SIGNAL(playbackModeChanged(QMediaPlaylist::PlaybackMode)));
- }
-
- virtual ~QLocalMediaPlaylistControl() {};
-
- QMediaPlaylistProvider* playlistProvider() const { return m_navigator->playlist(); }
- bool setPlaylistProvider(QMediaPlaylistProvider *mediaPlaylist)
- {
- m_navigator->setPlaylist(mediaPlaylist);
- emit playlistProviderChanged();
- return true;
- }
-
- int currentIndex() const { return m_navigator->currentIndex(); }
- void setCurrentIndex(int position) { m_navigator->jump(position); }
- int nextIndex(int steps) const { return m_navigator->nextIndex(steps); }
- int previousIndex(int steps) const { return m_navigator->previousIndex(steps); }
-
- void next() { m_navigator->next(); }
- void previous() { m_navigator->previous(); }
-
- QMediaPlaylist::PlaybackMode playbackMode() const { return m_navigator->playbackMode(); }
- void setPlaybackMode(QMediaPlaylist::PlaybackMode mode) { m_navigator->setPlaybackMode(mode); }
-
-private:
- QMediaPlaylistNavigator *m_navigator;
-};
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLIST_P_H
diff --git a/src/multimedia/qmediaplaylistcontrol.cpp b/src/multimedia/qmediaplaylistcontrol.cpp
deleted file mode 100644
index dc23489..0000000
--- a/src/multimedia/qmediaplaylistcontrol.cpp
+++ /dev/null
@@ -1,219 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qmediaplaylistcontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaPlaylistControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMediaPlaylistControl class provides access to the playlist
- functionality of a QMediaService.
-
- If a QMediaService contains an internal playlist it will implement
- QMediaPlaylistControl. This control provides access to the contents of the
- \l {playlistProvider()}{playlist}, as well as the \l
- {currentIndex()}{position} of the current media, and a means of navigating
- to the \l {next()}{next} and \l {previous()}{previous} media.
-
- The functionality provided by the control is exposed to application code
- through the QMediaPlaylist class.
-
- The interface name of QMediaPlaylistControl is \c com.nokia.Qt.QMediaPlaylistControl/1.0 as
- defined in QMediaPlaylistControl_iid.
-
- \sa QMediaService::requestControl(), QMediaPlayer
-*/
-
-/*!
- \macro QMediaPlaylistControl_iid
-
- \c com.nokia.Qt.QMediaPlaylistControl/1.0
-
- Defines the interface name of the QMediaPlaylistControl class.
-
- \relates QMediaPlaylistControl
-*/
-
-/*!
- Create a new playlist control object with the given \a parent.
-*/
-QMediaPlaylistControl::QMediaPlaylistControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys the playlist control.
-*/
-QMediaPlaylistControl::~QMediaPlaylistControl()
-{
-}
-
-
-/*!
- \fn QMediaPlaylistControl::playlistProvider() const
-
- Returns the playlist used by this media player.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::setPlaylistProvider(QMediaPlaylistProvider *playlist)
-
- Set the playlist of this media player to \a playlist.
-
- In many cases it is possible just to use the playlist
- constructed by player, but sometimes replacing the whole
- playlist allows to avoid copyting of all the items bettween playlists.
-
- Returns true if player can use this passed playlist; otherwise returns false.
-
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::currentIndex() const
-
- Returns position of the current media source in the playlist.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::setCurrentIndex(int position)
-
- Jump to the item at the given \a position.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::nextIndex(int step) const
-
- Returns the index of item, which were current after calling next()
- \a step times.
-
- Returned value depends on the size of playlist, current position
- and playback mode.
-
- \since 1.0
- \sa QMediaPlaylist::playbackMode
-*/
-
-/*!
- \fn QMediaPlaylistControl::previousIndex(int step) const
-
- Returns the index of item, which were current after calling previous()
- \a step times.
-
- \since 1.0
- \sa QMediaPlaylist::playbackMode
-*/
-
-/*!
- \fn QMediaPlaylistControl::next()
-
- Moves to the next item in playlist.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::previous()
-
- Returns to the previous item in playlist.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::playbackMode() const
-
- Returns the playlist navigation mode.
-
- \since 1.0
- \sa QMediaPlaylist::PlaybackMode
-*/
-
-/*!
- \fn QMediaPlaylistControl::setPlaybackMode(QMediaPlaylist::PlaybackMode mode)
-
- Sets the playback \a mode.
-
- \since 1.0
- \sa QMediaPlaylist::PlaybackMode
-*/
-
-/*!
- \fn QMediaPlaylistControl::playlistProviderChanged()
-
- Signal emitted when the playlist provider has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::currentIndexChanged(int position)
-
- Signal emitted when the playlist \a position is changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::playbackModeChanged(QMediaPlaylist::PlaybackMode mode)
-
- Signal emitted when the playback \a mode is changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistControl::currentMediaChanged(const QMediaContent& content)
-
- Signal emitted when current media changes to \a content.
- \since 1.0
-*/
-
-#include "moc_qmediaplaylistcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylistcontrol.h b/src/multimedia/qmediaplaylistcontrol.h
deleted file mode 100644
index 2cce448..0000000
--- a/src/multimedia/qmediaplaylistcontrol.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QMEDIAPLAYLISTCONTROL_H
-#define QMEDIAPLAYLISTCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediaplaylistnavigator.h"
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylistProvider;
-
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QMediaPlaylistControl();
-
- virtual QMediaPlaylistProvider* playlistProvider() const = 0;
- virtual bool setPlaylistProvider(QMediaPlaylistProvider *playlist) = 0;
-
- virtual int currentIndex() const = 0;
- virtual void setCurrentIndex(int position) = 0;
- virtual int nextIndex(int steps) const = 0;
- virtual int previousIndex(int steps) const = 0;
-
- virtual void next() = 0;
- virtual void previous() = 0;
-
- virtual QMediaPlaylist::PlaybackMode playbackMode() const = 0;
- virtual void setPlaybackMode(QMediaPlaylist::PlaybackMode mode) = 0;
-
-Q_SIGNALS:
- void playlistProviderChanged();
- void currentIndexChanged(int position);
- void currentMediaChanged(const QMediaContent&);
- void playbackModeChanged(QMediaPlaylist::PlaybackMode mode);
-
-protected:
- QMediaPlaylistControl(QObject* parent = 0);
-};
-
-#define QMediaPlaylistControl_iid "com.nokia.Qt.QMediaPlaylistControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistControl, QMediaPlaylistControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLISTCONTROL_H
diff --git a/src/multimedia/qmediaplaylistioplugin.cpp b/src/multimedia/qmediaplaylistioplugin.cpp
deleted file mode 100644
index 80fe0ef..0000000
--- a/src/multimedia/qmediaplaylistioplugin.cpp
+++ /dev/null
@@ -1,204 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplaylistioplugin.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaPlaylistReader
-
- \brief The QMediaPlaylistReader class provides an interface for reading a playlist file.
- \inmodule QtMultimedia
- \since 1.0
-
- \sa QMediaPlaylistIOPlugin
-*/
-
-/*!
- Destroys a media playlist reader.
-*/
-QMediaPlaylistReader::~QMediaPlaylistReader()
-{
-}
-
-/*!
- \fn QMediaPlaylistReader::atEnd() const
-
- Identifies if a playlist reader has reached the end of its input.
-
- Returns true if the reader has reached the end; and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistReader::readItem()
-
- Reads an item of media from a playlist file.
-
- Returns the read media, or a null QMediaContent if no more media is available.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistReader::close()
-
- Closes a playlist reader's input device.
- \since 1.0
-*/
-
-/*!
- \class QMediaPlaylistWriter
-
- \brief The QMediaPlaylistWriter class provides an interface for writing a playlist file.
-
- \since 1.0
- \sa QMediaPlaylistIOPlugin
-*/
-
-/*!
- Destroys a media playlist writer.
-*/
-QMediaPlaylistWriter::~QMediaPlaylistWriter()
-{
-}
-
-/*!
- \fn QMediaPlaylistWriter::writeItem(const QMediaContent &media)
-
- Writes an item of \a media to a playlist file.
-
- Returns true if the media was written successfully; and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistWriter::close()
-
- Finalizes the writing of a playlist and closes the output device.
- \since 1.0
-*/
-
-/*!
- \class QMediaPlaylistIOPlugin
- \brief The QMediaPlaylistIOPlugin class provides an interface for media playlist I/O plug-ins.
- \since 1.0
-*/
-
-/*!
- Constructs a media playlist I/O plug-in with the given \a parent.
-*/
-QMediaPlaylistIOPlugin::QMediaPlaylistIOPlugin(QObject *parent)
- :QObject(parent)
-{
-}
-
-/*!
- Destroys a media playlist I/O plug-in.
-*/
-QMediaPlaylistIOPlugin::~QMediaPlaylistIOPlugin()
-{
-}
-
-/*!
- \fn QMediaPlaylistIOPlugin::canRead(QIODevice *device, const QByteArray &format) const
-
- Identifies if plug-in can read \a format data from an I/O \a device.
-
- Returns true if the data can be read; and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::canRead(const QUrl& location, const QByteArray &format) const
-
- Identifies if a plug-in can read \a format data from a URL \a location.
-
- Returns true if the data can be read; and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::canWrite(QIODevice *device, const QByteArray &format) const
-
- Identifies if a plug-in can write \a format data to an I/O \a device.
-
- Returns true if the data can be written; and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::keys() const
-
- Returns a list of format keys supported by a plug-in.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::createReader(QIODevice *device, const QByteArray &format)
-
- Returns a new QMediaPlaylistReader which reads \a format data from an I/O \a device.
-
- If the device is invalid or the format is unsupported this will return a null pointer.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::createReader(const QUrl& location, const QByteArray &format)
-
- Returns a new QMediaPlaylistReader which reads \a format data from a URL \a location.
-
- If the location or the format is unsupported this will return a null pointer.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistIOPlugin::createWriter(QIODevice *device, const QByteArray &format)
-
- Returns a new QMediaPlaylistWriter which writes \a format data to an I/O \a device.
-
- If the device is invalid or the format is unsupported this will return a null pointer.
- \since 1.0
-*/
-
-#include "moc_qmediaplaylistioplugin.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylistioplugin.h b/src/multimedia/qmediaplaylistioplugin.h
deleted file mode 100644
index 97ded8b..0000000
--- a/src/multimedia/qmediaplaylistioplugin.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLISTIOPLUGIN_H
-#define QMEDIAPLAYLISTIOPLUGIN_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-
-#include <qtmultimediadefs.h>
-
-#include "qmediacontent.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QString;
-class QUrl;
-class QByteArray;
-class QIODevice;
-class QStringList;
-
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistReader
-{
-public:
- virtual ~QMediaPlaylistReader();
-
- virtual bool atEnd() const = 0;
- virtual QMediaContent readItem() = 0;
- virtual void close() = 0;
-};
-
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistWriter
-{
-public:
- virtual ~QMediaPlaylistWriter();
-
- virtual bool writeItem(const QMediaContent &content) = 0;
- virtual void close() = 0;
-};
-
-struct Q_MULTIMEDIA_EXPORT QMediaPlaylistIOInterface : public QFactoryInterface
-{
- virtual bool canRead(QIODevice *device, const QByteArray &format = QByteArray() ) const = 0;
- virtual bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const = 0;
-
- virtual bool canWrite(QIODevice *device, const QByteArray &format) const = 0;
-
- virtual QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray()) = 0;
- virtual QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray()) = 0;
-
- virtual QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format) = 0;
-};
-
-#define QMediaPlaylistIOInterface_iid "com.nokia.Qt.QMediaPlaylistIOInterface"
-Q_DECLARE_INTERFACE(QMediaPlaylistIOInterface, QMediaPlaylistIOInterface_iid);
-
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistIOPlugin : public QObject, public QMediaPlaylistIOInterface
-{
-Q_OBJECT
-Q_INTERFACES(QMediaPlaylistIOInterface:QFactoryInterface)
-public:
- explicit QMediaPlaylistIOPlugin(QObject *parent = 0);
- virtual ~QMediaPlaylistIOPlugin();
-
- virtual bool canRead(QIODevice *device, const QByteArray &format = QByteArray() ) const = 0;
- virtual bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const = 0;
-
- virtual bool canWrite(QIODevice *device, const QByteArray &format) const = 0;
-
- virtual QStringList keys() const = 0;
-
- virtual QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray()) = 0;
- virtual QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray()) = 0;
-
- virtual QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format) = 0;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLISTIOPLUGIN_H
diff --git a/src/multimedia/qmediaplaylistnavigator.cpp b/src/multimedia/qmediaplaylistnavigator.cpp
deleted file mode 100644
index d78e6ef..0000000
--- a/src/multimedia/qmediaplaylistnavigator.cpp
+++ /dev/null
@@ -1,568 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplaylistnavigator.h"
-#include "qmediaplaylistprovider.h"
-#include "qmediaplaylist.h"
-#include "qmediaobject_p.h"
-
-#include <QtCore/qdebug.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlaylistNullProvider : public QMediaPlaylistProvider
-{
-public:
- QMediaPlaylistNullProvider() :QMediaPlaylistProvider() {}
- virtual ~QMediaPlaylistNullProvider() {}
- virtual int mediaCount() const {return 0;}
- virtual QMediaContent media(int) const { return QMediaContent(); }
-};
-
-Q_GLOBAL_STATIC(QMediaPlaylistNullProvider, _q_nullMediaPlaylist)
-
-class QMediaPlaylistNavigatorPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaPlaylistNavigator)
-public:
- QMediaPlaylistNavigatorPrivate()
- :playlist(0),
- currentPos(-1),
- lastValidPos(-1),
- playbackMode(QMediaPlaylist::Sequential),
- randomPositionsOffset(-1)
- {
- }
-
- QMediaPlaylistProvider *playlist;
- int currentPos;
- int lastValidPos; //to be used with CurrentItemOnce playback mode
- QMediaPlaylist::PlaybackMode playbackMode;
- QMediaContent currentItem;
-
- mutable QList<int> randomModePositions;
- mutable int randomPositionsOffset;
-
- int nextItemPos(int steps = 1) const;
- int previousItemPos(int steps = 1) const;
-
- void _q_mediaInserted(int start, int end);
- void _q_mediaRemoved(int start, int end);
- void _q_mediaChanged(int start, int end);
-
- QMediaPlaylistNavigator *q_ptr;
-};
-
-
-int QMediaPlaylistNavigatorPrivate::nextItemPos(int steps) const
-{
- if (playlist->mediaCount() == 0)
- return -1;
-
- if (steps == 0)
- return currentPos;
-
- switch (playbackMode) {
- case QMediaPlaylist::CurrentItemOnce:
- return /*currentPos == -1 ? lastValidPos :*/ -1;
- case QMediaPlaylist::CurrentItemInLoop:
- return currentPos;
- case QMediaPlaylist::Sequential:
- {
- int nextPos = currentPos+steps;
- return nextPos < playlist->mediaCount() ? nextPos : -1;
- }
- case QMediaPlaylist::Loop:
- return (currentPos+steps) % playlist->mediaCount();
- case QMediaPlaylist::Random:
- {
- //TODO: limit the history size
-
- if (randomPositionsOffset == -1) {
- randomModePositions.clear();
- randomModePositions.append(currentPos);
- randomPositionsOffset = 0;
- }
-
- while (randomModePositions.size() < randomPositionsOffset+steps+1)
- randomModePositions.append(-1);
- int res = randomModePositions[randomPositionsOffset+steps];
- if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
- randomModePositions[randomPositionsOffset+steps] = res;
- }
-
- return res;
- }
- }
-
- return -1;
-}
-
-int QMediaPlaylistNavigatorPrivate::previousItemPos(int steps) const
-{
- if (playlist->mediaCount() == 0)
- return -1;
-
- if (steps == 0)
- return currentPos;
-
- switch (playbackMode) {
- case QMediaPlaylist::CurrentItemOnce:
- return /*currentPos == -1 ? lastValidPos :*/ -1;
- case QMediaPlaylist::CurrentItemInLoop:
- return currentPos;
- case QMediaPlaylist::Sequential:
- {
- int prevPos = currentPos == -1 ? playlist->mediaCount() - steps : currentPos - steps;
- return prevPos>=0 ? prevPos : -1;
- }
- case QMediaPlaylist::Loop:
- {
- int prevPos = currentPos - steps;
- while (prevPos<0)
- prevPos += playlist->mediaCount();
- return prevPos;
- }
- case QMediaPlaylist::Random:
- {
- //TODO: limit the history size
-
- if (randomPositionsOffset == -1) {
- randomModePositions.clear();
- randomModePositions.append(currentPos);
- randomPositionsOffset = 0;
- }
-
- while (randomPositionsOffset-steps < 0) {
- randomModePositions.prepend(-1);
- randomPositionsOffset++;
- }
-
- int res = randomModePositions[randomPositionsOffset-steps];
- if (res<0 || res >= playlist->mediaCount()) {
- res = qrand() % playlist->mediaCount();
- randomModePositions[randomPositionsOffset-steps] = res;
- }
-
- return res;
- }
- }
-
- return -1;
-}
-
-/*!
- \class QMediaPlaylistNavigator
-
- \brief The QMediaPlaylistNavigator class provides navigation for a media playlist.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- \sa QMediaPlaylist, QMediaPlaylistProvider
-*/
-
-
-/*!
- Constructs a media playlist navigator for a \a playlist.
-
- The \a parent is passed to QObject.
- \since 1.0
- */
-QMediaPlaylistNavigator::QMediaPlaylistNavigator(QMediaPlaylistProvider *playlist, QObject *parent)
- : QObject(parent)
- , d_ptr(new QMediaPlaylistNavigatorPrivate)
-{
- d_ptr->q_ptr = this;
-
- setPlaylist(playlist ? playlist : _q_nullMediaPlaylist());
-}
-
-/*!
- Destroys a media playlist navigator.
- */
-
-QMediaPlaylistNavigator::~QMediaPlaylistNavigator()
-{
- delete d_ptr;
-}
-
-
-/*! \property QMediaPlaylistNavigator::playbackMode
- Contains the playback mode.
- \since 1.0
- */
-QMediaPlaylist::PlaybackMode QMediaPlaylistNavigator::playbackMode() const
-{
- return d_func()->playbackMode;
-}
-
-/*!
- Sets the playback \a mode.
- \since 1.0
- */
-void QMediaPlaylistNavigator::setPlaybackMode(QMediaPlaylist::PlaybackMode mode)
-{
- Q_D(QMediaPlaylistNavigator);
- if (d->playbackMode == mode)
- return;
-
- if (mode == QMediaPlaylist::Random) {
- d->randomPositionsOffset = 0;
- d->randomModePositions.append(d->currentPos);
- } else if (d->playbackMode == QMediaPlaylist::Random) {
- d->randomPositionsOffset = -1;
- d->randomModePositions.clear();
- }
-
- d->playbackMode = mode;
-
- emit playbackModeChanged(mode);
- emit surroundingItemsChanged();
-}
-
-/*!
- Returns the playlist being navigated.
- \since 1.0
-*/
-
-QMediaPlaylistProvider *QMediaPlaylistNavigator::playlist() const
-{
- return d_func()->playlist;
-}
-
-/*!
- Sets the \a playlist to navigate.
- \since 1.0
-*/
-void QMediaPlaylistNavigator::setPlaylist(QMediaPlaylistProvider *playlist)
-{
- Q_D(QMediaPlaylistNavigator);
-
- if (d->playlist == playlist)
- return;
-
- if (d->playlist) {
- d->playlist->disconnect(this);
- }
-
- if (playlist) {
- d->playlist = playlist;
- } else {
- //assign to shared readonly null playlist
- d->playlist = _q_nullMediaPlaylist();
- }
-
- connect(d->playlist, SIGNAL(mediaInserted(int,int)), SLOT(_q_mediaInserted(int,int)));
- connect(d->playlist, SIGNAL(mediaRemoved(int,int)), SLOT(_q_mediaRemoved(int,int)));
- connect(d->playlist, SIGNAL(mediaChanged(int,int)), SLOT(_q_mediaChanged(int,int)));
-
- d->randomPositionsOffset = -1;
- d->randomModePositions.clear();
-
- if (d->currentPos != -1) {
- d->currentPos = -1;
- emit currentIndexChanged(-1);
- }
-
- if (!d->currentItem.isNull()) {
- d->currentItem = QMediaContent();
- emit activated(d->currentItem); //stop playback
- }
-}
-
-/*! \property QMediaPlaylistNavigator::currentItem
-
- Contains the media at the current position in the playlist.
-
- \since 1.0
- \sa currentIndex()
-*/
-
-QMediaContent QMediaPlaylistNavigator::currentItem() const
-{
- return itemAt(d_func()->currentPos);
-}
-
-/*! \fn QMediaContent QMediaPlaylistNavigator::nextItem(int steps) const
-
- Returns the media that is \a steps positions ahead of the current
- position in the playlist.
-
- \since 1.0
- \sa nextIndex()
-*/
-QMediaContent QMediaPlaylistNavigator::nextItem(int steps) const
-{
- return itemAt(nextIndex(steps));
-}
-
-/*!
- Returns the media that is \a steps positions behind the current
- position in the playlist.
-
- \since 1.0
- \sa previousIndex()
- */
-QMediaContent QMediaPlaylistNavigator::previousItem(int steps) const
-{
- return itemAt(previousIndex(steps));
-}
-
-/*!
- Returns the media at a \a position in the playlist.
- \since 1.0
- */
-QMediaContent QMediaPlaylistNavigator::itemAt(int position) const
-{
- return d_func()->playlist->media(position);
-}
-
-/*! \property QMediaPlaylistNavigator::currentIndex
-
- Contains the position of the current media.
-
- If no media is current, the property contains -1.
-
- \since 1.0
- \sa nextIndex(), previousIndex()
-*/
-
-int QMediaPlaylistNavigator::currentIndex() const
-{
- return d_func()->currentPos;
-}
-
-/*!
- Returns a position \a steps ahead of the current position
- accounting for the playbackMode().
-
- If the position is beyond the end of the playlist, this value
- returned is -1.
-
- \since 1.0
- \sa currentIndex(), previousIndex(), playbackMode()
-*/
-
-int QMediaPlaylistNavigator::nextIndex(int steps) const
-{
- return d_func()->nextItemPos(steps);
-}
-
-/*!
-
- Returns a position \a steps behind the current position accounting
- for the playbackMode().
-
- If the position is prior to the beginning of the playlist this will
- return -1.
-
- \since 1.0
- \sa currentIndex(), nextIndex(), playbackMode()
-*/
-int QMediaPlaylistNavigator::previousIndex(int steps) const
-{
- return d_func()->previousItemPos(steps);
-}
-
-/*!
- Advances to the next item in the playlist.
-
- \since 1.0
- \sa previous(), jump(), playbackMode()
- */
-void QMediaPlaylistNavigator::next()
-{
- Q_D(QMediaPlaylistNavigator);
-
- int nextPos = d->nextItemPos();
-
- if ( playbackMode() == QMediaPlaylist::Random )
- d->randomPositionsOffset++;
-
- jump(nextPos);
-}
-
-/*!
- Returns to the previous item in the playlist,
-
- \since 1.0
- \sa next(), jump(), playbackMode()
- */
-void QMediaPlaylistNavigator::previous()
-{
- Q_D(QMediaPlaylistNavigator);
-
- int prevPos = d->previousItemPos();
- if ( playbackMode() == QMediaPlaylist::Random )
- d->randomPositionsOffset--;
-
- jump(prevPos);
-}
-
-/*!
- Jumps to a new \a position in the playlist.
- \since 1.0
- */
-void QMediaPlaylistNavigator::jump(int position)
-{
- Q_D(QMediaPlaylistNavigator);
-
- if (position<-1 || position>=d->playlist->mediaCount()) {
- qWarning() << "QMediaPlaylistNavigator: Jump outside playlist range";
- position = -1;
- }
-
- if (position != -1)
- d->lastValidPos = position;
-
- if (playbackMode() == QMediaPlaylist::Random) {
- if (d->randomModePositions[d->randomPositionsOffset] != position) {
- d->randomModePositions.clear();
- d->randomModePositions.append(position);
- d->randomPositionsOffset = 0;
- }
- }
-
- if (position != -1)
- d->currentItem = d->playlist->media(position);
- else
- d->currentItem = QMediaContent();
-
- if (position != d->currentPos) {
- d->currentPos = position;
- emit currentIndexChanged(d->currentPos);
- emit surroundingItemsChanged();
- }
-
- emit activated(d->currentItem);
-}
-
-/*!
- \internal
- \since 1.0
-*/
-void QMediaPlaylistNavigatorPrivate::_q_mediaInserted(int start, int end)
-{
- Q_Q(QMediaPlaylistNavigator);
-
- if (currentPos >= start) {
- currentPos = end-start+1;
- q->jump(currentPos);
- }
-
- //TODO: check if they really changed
- emit q->surroundingItemsChanged();
-}
-
-/*!
- \internal
- \since 1.0
-*/
-void QMediaPlaylistNavigatorPrivate::_q_mediaRemoved(int start, int end)
-{
- Q_Q(QMediaPlaylistNavigator);
-
- if (currentPos > end) {
- currentPos = currentPos - end-start+1;
- q->jump(currentPos);
- } else if (currentPos >= start) {
- //current item was removed
- currentPos = qMin(start, playlist->mediaCount()-1);
- q->jump(currentPos);
- }
-
- //TODO: check if they really changed
- emit q->surroundingItemsChanged();
-}
-
-/*!
- \internal
- \since 1.0
-*/
-void QMediaPlaylistNavigatorPrivate::_q_mediaChanged(int start, int end)
-{
- Q_Q(QMediaPlaylistNavigator);
-
- if (currentPos >= start && currentPos<=end) {
- QMediaContent src = playlist->media(currentPos);
- if (src != currentItem) {
- currentItem = src;
- emit q->activated(src);
- }
- }
-
- //TODO: check if they really changed
- emit q->surroundingItemsChanged();
-}
-
-/*!
- \fn QMediaPlaylistNavigator::activated(const QMediaContent &media)
-
- Signals that the current \a media has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistNavigator::currentIndexChanged(int position)
-
- Signals the \a position of the current media has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistNavigator::playbackModeChanged(QMediaPlaylist::PlaybackMode mode)
-
- Signals that the playback \a mode has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistNavigator::surroundingItemsChanged()
-
- Signals that media immediately surrounding the current position has changed.
- \since 1.0
-*/
-
-#include "moc_qmediaplaylistnavigator.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylistnavigator.h b/src/multimedia/qmediaplaylistnavigator.h
deleted file mode 100644
index 72e4520..0000000
--- a/src/multimedia/qmediaplaylistnavigator.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLISTNAVIGATOR_H
-#define QMEDIAPLAYLISTNAVIGATOR_H
-
-#include "qmediaplaylistprovider.h"
-#include "qmediaplaylist.h"
-#include <QtCore/qobject.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylistNavigatorPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistNavigator : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QMediaPlaylist::PlaybackMode playbackMode READ playbackMode WRITE setPlaybackMode NOTIFY playbackModeChanged)
- Q_PROPERTY(int currentIndex READ currentIndex WRITE jump NOTIFY currentIndexChanged)
- Q_PROPERTY(QMediaContent currentItem READ currentItem)
-
-public:
- QMediaPlaylistNavigator(QMediaPlaylistProvider *playlist, QObject *parent = 0);
- virtual ~QMediaPlaylistNavigator();
-
- QMediaPlaylistProvider *playlist() const;
- void setPlaylist(QMediaPlaylistProvider *playlist);
-
- QMediaPlaylist::PlaybackMode playbackMode() const;
-
- QMediaContent currentItem() const;
- QMediaContent nextItem(int steps = 1) const;
- QMediaContent previousItem(int steps = 1) const;
-
- QMediaContent itemAt(int position) const;
-
- int currentIndex() const;
- int nextIndex(int steps = 1) const;
- int previousIndex(int steps = 1) const;
-
-public Q_SLOTS:
- void next();
- void previous();
-
- void jump(int);
-
- void setPlaybackMode(QMediaPlaylist::PlaybackMode mode);
-
-Q_SIGNALS:
- void activated(const QMediaContent &content);
- void currentIndexChanged(int);
- void playbackModeChanged(QMediaPlaylist::PlaybackMode mode);
-
- void surroundingItemsChanged();
-
-protected:
- QMediaPlaylistNavigatorPrivate *d_ptr;
-
-private:
- Q_DISABLE_COPY(QMediaPlaylistNavigator)
- Q_DECLARE_PRIVATE(QMediaPlaylistNavigator)
-
- Q_PRIVATE_SLOT(d_func(), void _q_mediaInserted(int start, int end))
- Q_PRIVATE_SLOT(d_func(), void _q_mediaRemoved(int start, int end))
- Q_PRIVATE_SLOT(d_func(), void _q_mediaChanged(int start, int end))
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLISTNAVIGATOR_H
diff --git a/src/multimedia/qmediaplaylistprovider.cpp b/src/multimedia/qmediaplaylistprovider.cpp
deleted file mode 100644
index 75e927b..0000000
--- a/src/multimedia/qmediaplaylistprovider.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaplaylistprovider.h"
-#include "qmediaplaylistprovider_p.h"
-
-#include <QtCore/qurl.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaPlaylistProvider
-
- \brief The QMediaPlaylistProvider class provides an abstract list of media.
- \inmodule QtMultimedia
- \since 1.0
-
- \sa QMediaPlaylist
-*/
-
-/*!
- Constructs a playlist provider with the given \a parent.
-*/
-QMediaPlaylistProvider::QMediaPlaylistProvider(QObject *parent)
- :QObject(parent), d_ptr(new QMediaPlaylistProviderPrivate)
-{
-}
-
-/*!
- \internal
-*/
-QMediaPlaylistProvider::QMediaPlaylistProvider(QMediaPlaylistProviderPrivate &dd, QObject *parent)
- :QObject(parent), d_ptr(&dd)
-{
-}
-
-/*!
- Destroys a playlist provider.
-*/
-QMediaPlaylistProvider::~QMediaPlaylistProvider()
-{
- delete d_ptr;
-}
-
-/*!
- \fn QMediaPlaylistProvider::mediaCount() const;
-
- Returns the size of playlist.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistProvider::media(int index) const;
-
- Returns the media at \a index in the playlist.
-
- If the index is invalid this will return a null media content.
- \since 1.0
-*/
-
-
-/*!
- Loads a playlist from from a URL \a location. If no playlist \a format is specified the loader
- will inspect the URL or probe the headers to guess the format.
-
- New items are appended to playlist.
-
- Returns true if the provider supports the format and loading from the locations URL protocol,
- otherwise this will return false.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::load(const QUrl &location, const char *format)
-{
- Q_UNUSED(location);
- Q_UNUSED(format);
- return false;
-}
-
-/*!
- Loads a playlist from from an I/O \a device. If no playlist \a format is specified the loader
- will probe the headers to guess the format.
-
- New items are appended to playlist.
-
- Returns true if the provider supports the format and loading from an I/O device, otherwise this
- will return false.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::load(QIODevice * device, const char *format)
-{
- Q_UNUSED(device);
- Q_UNUSED(format);
- return false;
-}
-
-/*!
- Saves the contents of a playlist to a URL \a location. If no playlist \a format is specified
- the writer will inspect the URL to guess the format.
-
- Returns true if the playlist was saved successfully; and false otherwise.
- \since 1.0
- */
-bool QMediaPlaylistProvider::save(const QUrl &location, const char *format)
-{
- Q_UNUSED(location);
- Q_UNUSED(format);
- return false;
-}
-
-/*!
- Saves the contents of a playlist to an I/O \a device in the specified \a format.
-
- Returns true if the playlist was saved successfully; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::save(QIODevice * device, const char *format)
-{
- Q_UNUSED(device);
- Q_UNUSED(format);
- return false;
-}
-
-/*!
- Returns true if a playlist is read-only; otherwise returns false.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::isReadOnly() const
-{
- return true;
-}
-
-/*!
- Append \a media to a playlist.
-
- Returns true if the media was appended; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::addMedia(const QMediaContent &media)
-{
- Q_UNUSED(media);
- return false;
-}
-
-/*!
- Append multiple media \a items to a playlist.
-
- Returns true if the media items were appended; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::addMedia(const QList<QMediaContent> &items)
-{
- foreach(const QMediaContent &item, items) {
- if (!addMedia(item))
- return false;
- }
-
- return true;
-}
-
-/*!
- Inserts \a media into a playlist at \a position.
-
- Returns true if the media was inserted; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::insertMedia(int position, const QMediaContent &media)
-{
- Q_UNUSED(position);
- Q_UNUSED(media);
- return false;
-}
-
-/*!
- Inserts multiple media \a items into a playlist at \a position.
-
- Returns true if the media \a items were inserted; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::insertMedia(int position, const QList<QMediaContent> &items)
-{
- for (int i=0; i<items.count(); i++) {
- if (!insertMedia(position+i,items.at(i)))
- return false;
- }
-
- return true;
-}
-
-
-/*!
- Removes the media at \a position from a playlist.
-
- Returns true if the media was removed; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::removeMedia(int position)
-{
- Q_UNUSED(position);
- return false;
-}
-
-/*!
- Removes the media between the given \a start and \a end positions from a playlist.
-
- Returns true if the media was removed; and false otherwise.
- \since 1.0
- */
-bool QMediaPlaylistProvider::removeMedia(int start, int end)
-{
- for (int pos=start; pos<=end; pos++) {
- if (!removeMedia(pos))
- return false;
- }
-
- return true;
-}
-
-/*!
- Removes all media from a playlist.
-
- Returns true if the media was removed; and false otherwise.
- \since 1.0
-*/
-bool QMediaPlaylistProvider::clear()
-{
- return removeMedia(0, mediaCount()-1);
-}
-
-/*!
- Shuffles the contents of a playlist.
- \since 1.0
-*/
-void QMediaPlaylistProvider::shuffle()
-{
-}
-
-/*!
- \fn void QMediaPlaylistProvider::mediaAboutToBeInserted(int start, int end);
-
- Signals that new media is about to be inserted into a playlist between the \a start and \a end
- positions.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::mediaInserted(int start, int end);
-
- Signals that new media has been inserted into a playlist between the \a start and \a end
- positions.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::mediaAboutToBeRemoved(int start, int end);
-
- Signals that media is about to be removed from a playlist between the \a start and \a end
- positions.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::mediaRemoved(int start, int end);
-
- Signals that media has been removed from a playlist between the \a start and \a end positions.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::mediaChanged(int start, int end);
-
- Signals that media in playlist between the \a start and \a end positions inclusive has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::loaded()
-
- Signals that a load() finished successfully.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaPlaylistProvider::loadFailed(QMediaPlaylist::Error error, const QString& errorMessage)
-
- Signals that a load failed() due to an \a error. The \a errorMessage provides more information.
- \since 1.0
-*/
-
-#include "moc_qmediaplaylistprovider.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylistprovider.h b/src/multimedia/qmediaplaylistprovider.h
deleted file mode 100644
index 79167e8..0000000
--- a/src/multimedia/qmediaplaylistprovider.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLISTPROVIDER_H
-#define QMEDIAPLAYLISTPROVIDER_H
-
-#include <QObject>
-
-#include "qmediacontent.h"
-#include "qmediaplaylist.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QString;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlaylistProviderPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistProvider : public QObject
-{
-Q_OBJECT
-public:
- QMediaPlaylistProvider(QObject *parent=0);
- virtual ~QMediaPlaylistProvider();
-
- virtual bool load(const QUrl &location, const char *format = 0);
- virtual bool load(QIODevice * device, const char *format = 0);
- virtual bool save(const QUrl &location, const char *format = 0);
- virtual bool save(QIODevice * device, const char *format);
-
- virtual int mediaCount() const = 0;
- virtual QMediaContent media(int index) const = 0;
-
- virtual bool isReadOnly() const;
-
- virtual bool addMedia(const QMediaContent &content);
- virtual bool addMedia(const QList<QMediaContent> &contentList);
- virtual bool insertMedia(int index, const QMediaContent &content);
- virtual bool insertMedia(int index, const QList<QMediaContent> &content);
- virtual bool removeMedia(int pos);
- virtual bool removeMedia(int start, int end);
- virtual bool clear();
-
-public Q_SLOTS:
- virtual void shuffle();
-
-Q_SIGNALS:
- void mediaAboutToBeInserted(int start, int end);
- void mediaInserted(int start, int end);
-
- void mediaAboutToBeRemoved(int start, int end);
- void mediaRemoved(int start, int end);
-
- void mediaChanged(int start, int end);
-
- void loaded();
- void loadFailed(QMediaPlaylist::Error, const QString& errorMessage);
-
-protected:
- QMediaPlaylistProviderPrivate *d_ptr;
- QMediaPlaylistProvider(QMediaPlaylistProviderPrivate &dd, QObject *parent);
-
-private:
- Q_DECLARE_PRIVATE(QMediaPlaylistProvider)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLISTPROVIDER_H
diff --git a/src/multimedia/qmediaplaylistprovider_p.h b/src/multimedia/qmediaplaylistprovider_p.h
deleted file mode 100644
index 71fb86f..0000000
--- a/src/multimedia/qmediaplaylistprovider_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLAYLISTPROVIDER_P_H
-#define QMEDIAPLAYLISTPROVIDER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qmediaplaylist.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylistProviderPrivate
-{
-public:
- QMediaPlaylistProviderPrivate()
- {}
- virtual ~QMediaPlaylistProviderPrivate()
- {}
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-
-#endif // QMEDIAPLAYLISTSOURCE_P_H
diff --git a/src/multimedia/qmediaplaylistsourcecontrol.cpp b/src/multimedia/qmediaplaylistsourcecontrol.cpp
deleted file mode 100644
index 2ab8aee..0000000
--- a/src/multimedia/qmediaplaylistsourcecontrol.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#include "qmediaplaylistsourcecontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaPlaylistSourceControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMediaPlaylistSourceControl class provides access to the playlist playback
- functionality of a QMediaService.
-
- This control allows QMediaPlaylist to be passed directly to the service
- instead of playing media sources one by one. This control should be
- implemented if backend benefits from knowing the next media source to be
- played, for example for preloading, cross fading or gap-less playback.
-
- If QMediaPlaylistSourceControl is provided, the backend must listen for
- current playlist item changes to load corresponding media source and
- advance the playlist with QMediaPlaylist::next() when playback of the
- current media is finished.
-
- The interface name of QMediaPlaylistSourceControl is \c com.nokia.Qt.QMediaPlaylistSourceControl/1.0 as
- defined in QMediaPlaylistSourceControl_iid.
-
- \sa QMediaService::requestControl(), QMediaPlayer
-*/
-
-/*!
- \macro QMediaPlaylistSourceControl_iid
-
- \c com.nokia.Qt.QMediaPlaylistSourceControl/1.0
-
- Defines the interface name of the QMediaPlaylistSourceControl class.
-
- \relates QMediaPlaylistSourceControl
-*/
-
-/*!
- Create a new playlist source control object with the given \a parent.
-*/
-QMediaPlaylistSourceControl::QMediaPlaylistSourceControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys the playlist control.
-*/
-QMediaPlaylistSourceControl::~QMediaPlaylistSourceControl()
-{
-}
-
-
-/*!
- \fn QMediaPlaylistSourceControl::playlist() const
-
- Returns the current playlist.
- Should return a null pointer if no playlist is assigned.
- \since 1.0
-*/
-
-/*!
- \fn QMediaPlaylistSourceControl::setPlaylist(QMediaPlaylist *playlist)
-
- Set the playlist of this media player to \a playlist.
- If a null pointer is passed, the playlist source should be disabled.
-
- The current media should be replaced with the current item of the media playlist.
- \since 1.0
-*/
-
-
-/*!
- \fn QMediaPlaylistSourceControl::playlistChanged(QMediaPlaylist* playlist)
-
- Signal emitted when the playlist has changed to \a playlist.
- \since 1.0
-*/
-
-#include "moc_qmediaplaylistsourcecontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaplaylistsourcecontrol.h b/src/multimedia/qmediaplaylistsourcecontrol.h
deleted file mode 100644
index 040bb64..0000000
--- a/src/multimedia/qmediaplaylistsourcecontrol.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QMEDIAPLAYLISTSOURCECONTROL_H
-#define QMEDIAPLAYLISTSOURCECONTROL_H
-
-#include <qmediacontrol.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaPlaylist;
-
-class Q_MULTIMEDIA_EXPORT QMediaPlaylistSourceControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QMediaPlaylistSourceControl();
-
- virtual QMediaPlaylist *playlist() const = 0;
- virtual void setPlaylist(QMediaPlaylist *) = 0;
-
-Q_SIGNALS:
- void playlistChanged(QMediaPlaylist* playlist);
-
-protected:
- QMediaPlaylistSourceControl(QObject* parent = 0);
-};
-
-#define QMediaPlaylistSourceControl_iid "com.nokia.Qt.QMediaPlaylistSourceControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaPlaylistSourceControl, QMediaPlaylistSourceControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLAYLISTCONTROL_H
diff --git a/src/multimedia/qmediapluginloader.cpp b/src/multimedia/qmediapluginloader.cpp
deleted file mode 100644
index 284ff59..0000000
--- a/src/multimedia/qmediapluginloader.cpp
+++ /dev/null
@@ -1,234 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediapluginloader_p.h"
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qpluginloader.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qdebug.h>
-
-#include "qmediaserviceproviderplugin.h"
-
-#if defined(Q_OS_MAC)
-# include <CoreFoundation/CoreFoundation.h>
-#endif
-
-QT_BEGIN_NAMESPACE
-
-typedef QMap<QString,QObjectList> ObjectListMap;
-Q_GLOBAL_STATIC(ObjectListMap, staticMediaPlugins);
-
-
-QMediaPluginLoader::QMediaPluginLoader(const char *iid, const QString &location, Qt::CaseSensitivity):
- m_iid(iid)
-{
- m_location = QString::fromLatin1("/%1").arg(location);
- load();
-}
-
-QStringList QMediaPluginLoader::keys() const
-{
- return m_instances.keys();
-}
-
-QObject* QMediaPluginLoader::instance(QString const &key)
-{
- return m_instances.value(key).value(0);
-}
-
-QList<QObject*> QMediaPluginLoader::instances(QString const &key)
-{
- return m_instances.value(key);
-}
-
-//to be used for testing purposes only
-void QMediaPluginLoader::setStaticPlugins(const QString &location, const QObjectList& objects)
-{
- staticMediaPlugins()->insert(QString::fromLatin1("/%1").arg(location), objects);
-}
-
-QStringList QMediaPluginLoader::availablePlugins() const
-{
- QStringList paths;
- QStringList plugins;
-
-#if defined(Q_OS_MAC)
- QString imageSuffix(qgetenv("DYLD_IMAGE_SUFFIX"));
-
- // Bundle plugin directory
- CFBundleRef mainBundle = CFBundleGetMainBundle();
- if (mainBundle != 0) {
- CFURLRef baseUrl = CFBundleCopyBundleURL(mainBundle);
- CFURLRef pluginUrlPart = CFBundleCopyBuiltInPlugInsURL(mainBundle);
- CFStringRef pluginPathPart = CFURLCopyFileSystemPath(pluginUrlPart, kCFURLPOSIXPathStyle);
- CFURLRef pluginUrl = CFURLCreateCopyAppendingPathComponent(0, baseUrl, pluginPathPart, true);
- CFStringRef pluginPath = CFURLCopyFileSystemPath(pluginUrl, kCFURLPOSIXPathStyle);
-
- CFIndex length = CFStringGetLength(pluginPath);
- UniChar buffer[length];
- CFStringGetCharacters(pluginPath, CFRangeMake(0, length), buffer);
-
- paths << QString(reinterpret_cast<const QChar *>(buffer), length);
-
- CFRelease(pluginPath);
- CFRelease(pluginUrl);
- CFRelease(pluginPathPart);
- CFRelease(pluginUrlPart);
- CFRelease(baseUrl);
- }
-#endif
-
- // Qt paths
- paths << QCoreApplication::libraryPaths();
-
- foreach (const QString &path, paths) {
- QDir typeDir(path + m_location);
- foreach (const QString &file, typeDir.entryList(QDir::Files, QDir::Name)) {
-#if defined(Q_OS_MAC)
- if (!imageSuffix.isEmpty()) { // Only add appropriate images
- if (file.lastIndexOf(imageSuffix, -6) == -1)
- continue;
- } else {
- int foundSuffix = file.lastIndexOf(QLatin1String("_debug.dylib"));
- if (foundSuffix == -1) {
- foundSuffix = file.lastIndexOf(QLatin1String("_profile.dylib"));
- }
- if (foundSuffix != -1) {
- /*
- If this is a "special" version of the plugin, prefer the release
- version, where available.
- Avoids warnings like:
-
- objc[23101]: Class TransparentQTMovieView is implemented in both
- libqqt7engine_debug.dylib and libqqt7engine.dylib. One of the two
- will be used. Which one is undefined.
-
- Note, this code relies on QDir::Name sorting!
- */
-
- QString preferred =
- typeDir.absoluteFilePath(file.left(foundSuffix) + QLatin1String(".dylib"));
-
- if (plugins.contains(preferred)) {
- continue;
- }
- }
- }
-#elif defined(Q_OS_UNIX)
- // Ignore separate debug files
- if (file.endsWith(QLatin1String(".debug")))
- continue;
-#elif defined(Q_OS_WIN)
- // Ignore non-dlls
- if (!file.endsWith(QLatin1String(".dll"), Qt::CaseInsensitive))
- continue;
-#endif
- plugins << typeDir.absoluteFilePath(file);
- }
- }
-
- return plugins;
-}
-
-void QMediaPluginLoader::load()
-{
- if (!m_instances.isEmpty())
- return;
-
-#if !defined QT_NO_DEBUG
- const bool showDebug = qgetenv("QT_DEBUG_PLUGINS").toInt() > 0;
-#endif
-
- if (staticMediaPlugins() && staticMediaPlugins()->contains(m_location)) {
- foreach(QObject *o, staticMediaPlugins()->value(m_location)) {
- if (o != 0 && o->qt_metacast(m_iid) != 0) {
- QFactoryInterface* p = qobject_cast<QFactoryInterface*>(o);
- if (p != 0) {
- foreach (QString const &key, p->keys())
- m_instances[key].append(o);
- }
- }
- }
- } else {
- QSet<QString> loadedPlugins;
-
- foreach (const QString &plugin, availablePlugins()) {
- QString fileName = QFileInfo(plugin).fileName();
- //don't try to load plugin with the same name if it's already loaded
- if (loadedPlugins.contains(fileName)) {
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug() << "Skip loading plugin" << plugin;
-#endif
- continue;
- }
-
- QPluginLoader loader(plugin);
-
- QObject *o = loader.instance();
- if (o != 0 && o->qt_metacast(m_iid) != 0) {
- QFactoryInterface* p = qobject_cast<QFactoryInterface*>(o);
- if (p != 0) {
- foreach (const QString &key, p->keys())
- m_instances[key].append(o);
-
- loadedPlugins.insert(fileName);
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qDebug() << "Loaded plugin" << plugin << "services:" << p->keys();
-#endif
- }
-
- continue;
- } else {
-#if !defined QT_NO_DEBUG
- if (showDebug)
- qWarning() << "QMediaPluginLoader: Failed to load plugin: " << plugin << loader.errorString();
-#endif
- }
-
- delete o;
- }
- }
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediapluginloader_p.h b/src/multimedia/qmediapluginloader_p.h
deleted file mode 100644
index 1800a41..0000000
--- a/src/multimedia/qmediapluginloader_p.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIAPLUGINLOADER_H
-#define QMEDIAPLUGINLOADER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediadefs.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaServiceProviderPlugin;
-
-class Q_AUTOTEST_EXPORT QMediaPluginLoader
-{
-public:
- QMediaPluginLoader(const char *iid,
- const QString &suffix = QString(),
- Qt::CaseSensitivity = Qt::CaseSensitive);
-
- QStringList keys() const;
- QObject* instance(QString const &key);
- QList<QObject*> instances(QString const &key);
-
- static void setStaticPlugins(const QString &location, const QObjectList& objects);
-
-private:
- void load();
- QStringList availablePlugins() const;
-
- QByteArray m_iid;
- QString m_location;
- QMap<QString, QList<QObject *> > m_instances;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIAPLUGINLOADER_H
diff --git a/src/multimedia/qmediarecorder.cpp b/src/multimedia/qmediarecorder.cpp
deleted file mode 100644
index 6be462d..0000000
--- a/src/multimedia/qmediarecorder.cpp
+++ /dev/null
@@ -1,904 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediarecorder.h"
-
-#include <qmediarecordercontrol.h>
-#include "qmediaobject_p.h"
-#include <qmediaservice.h>
-#include <qmediaserviceprovider.h>
-#include <qmetadatawritercontrol.h>
-#include <qaudioencodercontrol.h>
-#include <qvideoencodercontrol.h>
-#include <qmediacontainercontrol.h>
-#include <qcamera.h>
-#include <qcameracontrol.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmetaobject.h>
-
-#include <qaudioformat.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaRecorder
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
-
- \brief The QMediaRecorder class is used for the recording of media content.
-
- The QMediaRecorder class is a high level media recording class. It's not
- intended to be used alone but for accessing the media recording functions
- of other media objects, like QRadioTuner, or QAudioCaptureSource.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Media recorder
-
- \sa QAudioCaptureSource
-*/
-
-namespace
-{
-class MediaRecorderRegisterMetaTypes
-{
-public:
- MediaRecorderRegisterMetaTypes()
- {
- qRegisterMetaType<QMediaRecorder::State>("QMediaRecorder::State");
- qRegisterMetaType<QMediaRecorder::Error>("QMediaRecorder::Error");
- }
-} _registerRecorderMetaTypes;
-}
-
-
-class QMediaRecorderPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QMediaRecorder)
-
-public:
- QMediaRecorderPrivate();
-
- QMediaObject *mediaObject;
-
- QMediaRecorderControl *control;
- QMediaContainerControl *formatControl;
- QAudioEncoderControl *audioControl;
- QVideoEncoderControl *videoControl;
- QMetaDataWriterControl *metaDataControl;
-
- QTimer* notifyTimer;
-
- QMediaRecorder::State state;
- QMediaRecorder::Error error;
- QString errorString;
-
- void _q_stateChanged(QMediaRecorder::State state);
- void _q_error(int error, const QString &errorString);
- void _q_serviceDestroyed();
- void _q_notify();
- void _q_updateNotifyInterval(int ms);
-
- QMediaRecorder *q_ptr;
-};
-
-QMediaRecorderPrivate::QMediaRecorderPrivate():
- mediaObject(0),
- control(0),
- formatControl(0),
- audioControl(0),
- videoControl(0),
- metaDataControl(0),
- notifyTimer(0),
- state(QMediaRecorder::StoppedState),
- error(QMediaRecorder::NoError)
-{
-}
-
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
-void QMediaRecorderPrivate::_q_stateChanged(QMediaRecorder::State ps)
-{
- Q_Q(QMediaRecorder);
-
- if (ps == QMediaRecorder::RecordingState)
- notifyTimer->start();
- else
- notifyTimer->stop();
-
-// qDebug() << "Recorder state changed:" << ENUM_NAME(QMediaRecorder,"State",ps);
- if (state != ps) {
- emit q->stateChanged(ps);
- }
-
- state = ps;
-}
-
-
-void QMediaRecorderPrivate::_q_error(int error, const QString &errorString)
-{
- Q_Q(QMediaRecorder);
-
- this->error = QMediaRecorder::Error(error);
- this->errorString = errorString;
-
- emit q->error(this->error);
-}
-
-void QMediaRecorderPrivate::_q_serviceDestroyed()
-{
- mediaObject = 0;
- control = 0;
- formatControl = 0;
- audioControl = 0;
- videoControl = 0;
- metaDataControl = 0;
-}
-
-void QMediaRecorderPrivate::_q_notify()
-{
- emit q_func()->durationChanged(q_func()->duration());
-}
-
-void QMediaRecorderPrivate::_q_updateNotifyInterval(int ms)
-{
- notifyTimer->setInterval(ms);
-}
-
-
-/*!
- Constructs a media recorder which records the media produced by \a mediaObject.
-
- The \a parent is passed to QMediaObject.
- \since 1.0
-*/
-
-QMediaRecorder::QMediaRecorder(QMediaObject *mediaObject, QObject *parent):
- QObject(parent),
- d_ptr(new QMediaRecorderPrivate)
-{
- Q_D(QMediaRecorder);
- d->q_ptr = this;
- setMediaObject(mediaObject);
-
- d->notifyTimer = new QTimer(this);
- d->notifyTimer->setInterval(mediaObject->notifyInterval());
- connect(d->notifyTimer, SIGNAL(timeout()), SLOT(_q_notify()));
- connect(mediaObject, SIGNAL(notifyIntervalChanged(int)), SLOT(_q_updateNotifyInterval(int)));
-}
-
-/*!
- Destroys a media recorder object.
-*/
-
-QMediaRecorder::~QMediaRecorder()
-{
-}
-
-/*!
- Returns the QMediaObject instance that this QMediaRecorder is bound too,
- or 0 otherwise.
- \since 1.0
-*/
-QMediaObject *QMediaRecorder::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \internal
- \since 1.0
-*/
-bool QMediaRecorder::setMediaObject(QMediaObject *object)
-{
- Q_D(QMediaRecorder);
-
- if (object == d->mediaObject)
- return true;
-
- if (d->mediaObject) {
- if (d->control) {
- disconnect(d->control, SIGNAL(stateChanged(QMediaRecorder::State)),
- this, SLOT(_q_stateChanged(QMediaRecorder::State)));
-
- disconnect(d->control, SIGNAL(mutedChanged(bool)),
- this, SIGNAL(mutedChanged(bool)));
-
- disconnect(d->control, SIGNAL(durationChanged(qint64)),
- this, SIGNAL(durationChanged(qint64)));
-
- disconnect(d->control, SIGNAL(error(int,QString)),
- this, SLOT(_q_error(int,QString)));
- }
-
- QMediaService *service = d->mediaObject->service();
-
- if (service) {
- disconnect(service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
-
- if (d->control)
- service->releaseControl(d->control);
- if (d->formatControl)
- service->releaseControl(d->formatControl);
- if (d->audioControl)
- service->releaseControl(d->audioControl);
- if (d->videoControl)
- service->releaseControl(d->videoControl);
- if (d->metaDataControl) {
- disconnect(d->metaDataControl, SIGNAL(metaDataChanged()),
- this, SIGNAL(metaDataChanged()));
- disconnect(d->metaDataControl, SIGNAL(metaDataAvailableChanged(bool)),
- this, SIGNAL(metaDataAvailableChanged(bool)));
- disconnect(d->metaDataControl, SIGNAL(writableChanged(bool)),
- this, SIGNAL(metaDataWritableChanged(bool)));
-
- service->releaseControl(d->metaDataControl);
- }
- }
- }
-
- d->control = 0;
- d->formatControl = 0;
- d->audioControl = 0;
- d->videoControl = 0;
- d->metaDataControl = 0;
-
- d->mediaObject = object;
-
- if (d->mediaObject) {
- QMediaService *service = d->mediaObject->service();
-
- if (service) {
- d->control = qobject_cast<QMediaRecorderControl*>(service->requestControl(QMediaRecorderControl_iid));
-
- if (d->control) {
- d->formatControl = qobject_cast<QMediaContainerControl *>(service->requestControl(QMediaContainerControl_iid));
- d->audioControl = qobject_cast<QAudioEncoderControl *>(service->requestControl(QAudioEncoderControl_iid));
- d->videoControl = qobject_cast<QVideoEncoderControl *>(service->requestControl(QVideoEncoderControl_iid));
-
- QMediaControl *control = service->requestControl(QMetaDataWriterControl_iid);
- if (control) {
- d->metaDataControl = qobject_cast<QMetaDataWriterControl *>(control);
- if (!d->metaDataControl) {
- service->releaseControl(control);
- } else {
- connect(d->metaDataControl,
- SIGNAL(metaDataChanged()),
- SIGNAL(metaDataChanged()));
- connect(d->metaDataControl,
- SIGNAL(metaDataAvailableChanged(bool)),
- SIGNAL(metaDataAvailableChanged(bool)));
- connect(d->metaDataControl,
- SIGNAL(writableChanged(bool)),
- SIGNAL(metaDataWritableChanged(bool)));
- }
- }
-
- connect(d->control, SIGNAL(stateChanged(QMediaRecorder::State)),
- this, SLOT(_q_stateChanged(QMediaRecorder::State)));
-
- connect(d->control, SIGNAL(mutedChanged(bool)),
- this, SIGNAL(mutedChanged(bool)));
-
- connect(d->control, SIGNAL(durationChanged(qint64)),
- this, SIGNAL(durationChanged(qint64)));
-
- connect(d->control, SIGNAL(error(int,QString)),
- this, SLOT(_q_error(int,QString)));
-
- connect(service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
-
-
- return true;
- }
- }
-
- d->mediaObject = 0;
- return false;
- }
-
- return true;
-}
-
-/*!
- \property QMediaRecorder::outputLocation
- \brief the destination location of media content.
-
- Setting the location can fail, for example when the service supports only
- local file system locations but a network URL was passed. If the service
- does not support media recording this setting the output location will
- always fail.
-
- The \a location can be relative or empty;
- in this case the recorder uses the system specific place and file naming scheme.
- After recording has stated, QMediaRecorder::outputLocation() returns the actual output location.
- \since 1.0
-*/
-
-/*!
- Returns true if media recorder service ready to use.
- \since 1.0
-*/
-bool QMediaRecorder::isAvailable() const
-{
- if (d_func()->control != NULL)
- return true;
- else
- return false;
-}
-
-/*!
- Returns the availability error code.
- \since 1.0
-*/
-QtMultimedia::AvailabilityError QMediaRecorder::availabilityError() const
-{
- if (d_func()->control != NULL)
- return QtMultimedia::NoError;
- else
- return QtMultimedia::ServiceMissingError;
-}
-
-QUrl QMediaRecorder::outputLocation() const
-{
- return d_func()->control ? d_func()->control->outputLocation() : QUrl();
-}
-
-bool QMediaRecorder::setOutputLocation(const QUrl &location)
-{
- Q_D(QMediaRecorder);
- return d->control ? d->control->setOutputLocation(location) : false;
-}
-
-/*!
- Returns the current media recorder state.
-
- \since 1.0
- \sa QMediaRecorder::State
-*/
-
-QMediaRecorder::State QMediaRecorder::state() const
-{
- return d_func()->control ? QMediaRecorder::State(d_func()->control->state()) : StoppedState;
-}
-
-/*!
- Returns the current error state.
-
- \since 1.0
- \sa errorString()
-*/
-
-QMediaRecorder::Error QMediaRecorder::error() const
-{
- return d_func()->error;
-}
-
-/*!
- Returns a string describing the current error state.
-
- \since 1.0
- \sa error()
-*/
-
-QString QMediaRecorder::errorString() const
-{
- return d_func()->errorString;
-}
-
-/*!
- \property QMediaRecorder::duration
-
- \brief the recorded media duration in milliseconds.
- \since 1.0
-*/
-
-qint64 QMediaRecorder::duration() const
-{
- return d_func()->control ? d_func()->control->duration() : 0;
-}
-
-/*!
- \property QMediaRecorder::muted
-
- \brief whether a recording audio stream is muted.
- \since 1.0
-*/
-
-bool QMediaRecorder::isMuted() const
-{
- return d_func()->control ? d_func()->control->isMuted() : 0;
-}
-
-void QMediaRecorder::setMuted(bool muted)
-{
- Q_D(QMediaRecorder);
-
- if (d->control)
- d->control->setMuted(muted);
-}
-
-/*!
- Returns a list of MIME types of supported container formats.
- \since 1.0
-*/
-QStringList QMediaRecorder::supportedContainers() const
-{
- return d_func()->formatControl ?
- d_func()->formatControl->supportedContainers() : QStringList();
-}
-
-/*!
- Returns a description of a container format \a mimeType.
- \since 1.0
-*/
-QString QMediaRecorder::containerDescription(const QString &mimeType) const
-{
- return d_func()->formatControl ?
- d_func()->formatControl->containerDescription(mimeType) : QString();
-}
-
-/*!
- Returns the MIME type of the selected container format.
- \since 1.0
-*/
-
-QString QMediaRecorder::containerMimeType() const
-{
- return d_func()->formatControl ?
- d_func()->formatControl->containerMimeType() : QString();
-}
-
-/*!
- Returns a list of supported audio codecs.
- \since 1.0
-*/
-QStringList QMediaRecorder::supportedAudioCodecs() const
-{
- return d_func()->audioControl ?
- d_func()->audioControl->supportedAudioCodecs() : QStringList();
-}
-
-/*!
- Returns a description of an audio \a codec.
- \since 1.0
-*/
-QString QMediaRecorder::audioCodecDescription(const QString &codec) const
-{
- return d_func()->audioControl ?
- d_func()->audioControl->codecDescription(codec) : QString();
-}
-
-/*!
- Returns a list of supported audio sample rates.
-
- If non null audio \a settings parameter is passed, the returned list is
- reduced to sample rates supported with partial settings applied.
-
- This can be used to query the list of sample rates, supported by specific
- audio codec.
-
- If the encoder supports arbitrary sample rates within the supported rates
- range, *\a continuous is set to true, otherwise *\a continuous is set to
- false.
- \since 1.0
-*/
-
-QList<int> QMediaRecorder::supportedAudioSampleRates(const QAudioEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return d_func()->audioControl ?
- d_func()->audioControl->supportedSampleRates(settings, continuous) : QList<int>();
-}
-
-/*!
- Returns a list of resolutions video can be encoded at.
-
- If non null video \a settings parameter is passed, the returned list is
- reduced to resolution supported with partial settings like video codec or
- framerate applied.
-
- If the encoder supports arbitrary resolutions within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
-
- \since 1.0
- \sa QVideoEncoderSettings::resolution()
-*/
-QList<QSize> QMediaRecorder::supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return d_func()->videoControl ?
- d_func()->videoControl->supportedResolutions(settings, continuous) : QList<QSize>();
-}
-
-/*!
- Returns a list of frame rates video can be encoded at.
-
- If non null video \a settings parameter is passed, the returned list is
- reduced to frame rates supported with partial settings like video codec or
- resolution applied.
-
- If the encoder supports arbitrary frame rates within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
-
- \since 1.0
- \sa QVideoEncoderSettings::frameRate()
-*/
-QList<qreal> QMediaRecorder::supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return d_func()->videoControl ?
- d_func()->videoControl->supportedFrameRates(settings, continuous) : QList<qreal>();
-}
-
-/*!
- Returns a list of supported video codecs.
- \since 1.0
-*/
-QStringList QMediaRecorder::supportedVideoCodecs() const
-{
- return d_func()->videoControl ?
- d_func()->videoControl->supportedVideoCodecs() : QStringList();
-}
-
-/*!
- Returns a description of a video \a codec.
-
- \since 1.0
- \sa setEncodingSettings()
-*/
-QString QMediaRecorder::videoCodecDescription(const QString &codec) const
-{
- return d_func()->videoControl ?
- d_func()->videoControl->videoCodecDescription(codec) : QString();
-}
-
-/*!
- Returns the audio encoder settings being used.
-
- \since 1.0
- \sa setEncodingSettings()
-*/
-
-QAudioEncoderSettings QMediaRecorder::audioSettings() const
-{
- return d_func()->audioControl ?
- d_func()->audioControl->audioSettings() : QAudioEncoderSettings();
-}
-
-/*!
- Returns the video encoder settings being used.
-
- \since 1.0
- \sa setEncodingSettings()
-*/
-
-QVideoEncoderSettings QMediaRecorder::videoSettings() const
-{
- return d_func()->videoControl ?
- d_func()->videoControl->videoSettings() : QVideoEncoderSettings();
-}
-
-/*!
- Sets the \a audio and \a video encoder settings and \a container format MIME type.
-
- If some parameters are not specified, or null settings are passed, the
- encoder will choose default encoding parameters, depending on media
- source properties.
- While setEncodingSettings is optional, the backend can preload
- encoding pipeline to improve recording startup time.
-
- It's only possible to change settings when the encoder is in the
- QMediaEncoder::StoppedState state.
-
- \since 1.0
- \sa audioSettings(), videoSettings(), containerMimeType()
-*/
-
-void QMediaRecorder::setEncodingSettings(const QAudioEncoderSettings &audio,
- const QVideoEncoderSettings &video,
- const QString &container)
-{
- Q_D(QMediaRecorder);
-
- QCamera *camera = qobject_cast<QCamera*>(d->mediaObject);
- if (camera && camera->captureMode() == QCamera::CaptureVideo) {
- QMetaObject::invokeMethod(camera,
- "_q_preparePropertyChange",
- Qt::DirectConnection,
- Q_ARG(int, QCameraControl::VideoEncodingSettings));
- }
-
- if (d->audioControl)
- d->audioControl->setAudioSettings(audio);
-
- if (d->videoControl)
- d->videoControl->setVideoSettings(video);
-
- if (d->formatControl)
- d->formatControl->setContainerMimeType(container);
-
- if (d->control)
- d->control->applySettings();
-}
-
-
-/*!
- Start recording.
-
- This is an asynchronous call, with signal
- stateCahnged(QMediaRecorder::RecordingState) being emitted when recording
- started, otherwise the error() signal is emitted.
- \since 1.0
-*/
-
-void QMediaRecorder::record()
-{
- Q_D(QMediaRecorder);
-
- // reset error
- d->error = NoError;
- d->errorString = QString();
-
- if (d->control)
- d->control->record();
-}
-
-/*!
- Pause recording.
- \since 1.0
-*/
-
-void QMediaRecorder::pause()
-{
- Q_D(QMediaRecorder);
- if (d->control)
- d->control->pause();
-}
-
-/*!
- Stop recording.
- \since 1.0
-*/
-
-void QMediaRecorder::stop()
-{
- Q_D(QMediaRecorder);
- if (d->control)
- d->control->stop();
-}
-
-/*!
- \enum QMediaRecorder::State
-
- \value StoppedState The recorder is not active.
- \value RecordingState The recorder is currently active and producing data.
- \value PausedState The recorder is paused.
-*/
-
-/*!
- \enum QMediaRecorder::Error
-
- \value NoError No Errors.
- \value ResourceError Device is not ready or not available.
- \value FormatError Current format is not supported.
-*/
-
-/*!
- \fn QMediaRecorder::stateChanged(State state)
-
- Signals that a media recorder's \a state has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaRecorder::durationChanged(qint64 duration)
-
- Signals that the \a duration of the recorded media has changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaRecorder::error(QMediaRecorder::Error error)
-
- Signals that an \a error has occurred.
- \since 1.0
-*/
-
-/*!
- \fn QMediaRecorder::mutedChanged(bool muted)
-
- Signals that the \a muted state has changed. If true the recording is being muted.
- \since 1.0
-*/
-
-/*!
- \property QMediaRecorder::metaDataAvailable
- \brief whether access to a media object's meta-data is available.
-
- If this is true there is meta-data available, otherwise there is no meta-data available.
- \since 1.0
-*/
-
-bool QMediaRecorder::isMetaDataAvailable() const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->isMetaDataAvailable()
- : false;
-}
-
-/*!
- \fn QMediaRecorder::metaDataAvailableChanged(bool available)
-
- Signals that the \a available state of a media object's meta-data has changed.
- \since 1.0
-*/
-
-/*!
- \property QMediaRecorder::metaDataWritable
- \brief whether a media object's meta-data is writable.
-
- If this is true the meta-data is writable, otherwise the meta-data is read-only.
- \since 1.0
-*/
-
-bool QMediaRecorder::isMetaDataWritable() const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->isWritable()
- : false;
-}
-
-/*!
- \fn QMediaRecorder::metaDataWritableChanged(bool writable)
-
- Signals that the \a writable state of a media object's meta-data has changed.
- \since 1.0
-*/
-
-/*!
- Returns the value associated with a meta-data \a key.
- \since 1.0
-*/
-QVariant QMediaRecorder::metaData(QtMultimedia::MetaData key) const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->metaData(key)
- : QVariant();
-}
-
-/*!
- Sets a \a value for a meta-data \a key.
-
- \note To ensure that meta data is set corretly, it should be set before starting the recording.
- Once the recording is stopped, any meta data set will be attached to the next recording.
- \since 1.0
-*/
-void QMediaRecorder::setMetaData(QtMultimedia::MetaData key, const QVariant &value)
-{
- Q_D(QMediaRecorder);
-
- if (d->metaDataControl)
- d->metaDataControl->setMetaData(key, value);
-}
-
-/*!
- Returns a list of keys there is meta-data available for.
- \since 1.0
-*/
-QList<QtMultimedia::MetaData> QMediaRecorder::availableMetaData() const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->availableMetaData()
- : QList<QtMultimedia::MetaData>();
-}
-
-/*!
- \fn QMediaRecorder::metaDataChanged()
-
- Signals that a media object's meta-data has changed.
- \since 1.0
-*/
-
-/*!
- Returns the value associated with a meta-data \a key.
-
- The naming and type of extended meta-data is not standardized, so the values and meaning
- of keys may vary between backends.
- \since 1.0
-*/
-QVariant QMediaRecorder::extendedMetaData(const QString &key) const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->extendedMetaData(key)
- : QVariant();
-}
-
-/*!
- Sets a \a value for a meta-data \a key.
-
- The naming and type of extended meta-data is not standardized, so the values and meaning
- of keys may vary between backends.
- \since 1.0
-*/
-void QMediaRecorder::setExtendedMetaData(const QString &key, const QVariant &value)
-{
- Q_D(QMediaRecorder);
-
- if (d->metaDataControl)
- d->metaDataControl->setExtendedMetaData(key, value);
-}
-
-/*!
- Returns a list of keys there is extended meta-data available for.
- \since 1.0
-*/
-QStringList QMediaRecorder::availableExtendedMetaData() const
-{
- Q_D(const QMediaRecorder);
-
- return d->metaDataControl
- ? d->metaDataControl->availableExtendedMetaData()
- : QStringList();
-}
-
-#include "moc_qmediarecorder.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediarecorder.h b/src/multimedia/qmediarecorder.h
deleted file mode 100644
index fbd47dd..0000000
--- a/src/multimedia/qmediarecorder.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIARECORDER_H
-#define QMEDIARECORDER_H
-
-#include <qmediaobject.h>
-#include <qmediaserviceprovider.h>
-#include <qmediaencodersettings.h>
-#include <qmediabindableinterface.h>
-#include <qmediaenumdebug.h>
-
-#include <QtCore/qpair.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QUrl;
-class QSize;
-class QAudioFormat;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QMediaRecorderService;
-class QAudioEncoderSettings;
-class QVideoEncoderSettings;
-
-class QMediaRecorderPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaRecorder : public QObject, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
- Q_ENUMS(State)
- Q_ENUMS(Error)
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_PROPERTY(QUrl outputLocation READ outputLocation WRITE setOutputLocation)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(bool metaDataAvailable READ isMetaDataAvailable NOTIFY metaDataAvailableChanged)
- Q_PROPERTY(bool metaDataWritable READ isMetaDataWritable NOTIFY metaDataWritableChanged)
-public:
-
- enum State
- {
- StoppedState,
- RecordingState,
- PausedState
- };
-
- enum Error
- {
- NoError,
- ResourceError,
- FormatError
- };
-
- QMediaRecorder(QMediaObject *mediaObject, QObject *parent = 0);
- ~QMediaRecorder();
-
- QMediaObject *mediaObject() const;
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &location);
-
- State state() const;
-
- Error error() const;
- QString errorString() const;
-
- qint64 duration() const;
-
- bool isMuted() const;
-
- QStringList supportedContainers() const;
- QString containerDescription(const QString &containerMimeType) const;
-
- QStringList supportedAudioCodecs() const;
- QString audioCodecDescription(const QString &codecName) const;
-
- QList<int> supportedAudioSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *continuous = 0) const;
-
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QAudioEncoderSettings audioSettings() const;
- QVideoEncoderSettings videoSettings() const;
- QString containerMimeType() const;
-
- void setEncodingSettings(const QAudioEncoderSettings &audioSettings,
- const QVideoEncoderSettings &videoSettings = QVideoEncoderSettings(),
- const QString &containerMimeType = QString());
-
-
- bool isMetaDataAvailable() const;
- bool isMetaDataWritable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- void setMetaData(QtMultimedia::MetaData key, const QVariant &value);
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const;
- void setExtendedMetaData(const QString &key, const QVariant &value);
- QStringList availableExtendedMetaData() const;
-
-public Q_SLOTS:
- void record();
- void pause();
- void stop();
- void setMuted(bool muted);
-
-Q_SIGNALS:
- void stateChanged(QMediaRecorder::State state);
- void durationChanged(qint64 duration);
- void mutedChanged(bool muted);
-
- void error(QMediaRecorder::Error error);
-
- void metaDataAvailableChanged(bool available);
- void metaDataWritableChanged(bool writable);
- void metaDataChanged();
-
-protected:
- bool setMediaObject(QMediaObject *object);
-
-private:
- QMediaRecorderPrivate *d_ptr;
- Q_DISABLE_COPY(QMediaRecorder)
- Q_DECLARE_PRIVATE(QMediaRecorder)
- Q_PRIVATE_SLOT(d_func(), void _q_stateChanged(QMediaRecorder::State))
- Q_PRIVATE_SLOT(d_func(), void _q_error(int, const QString &))
- Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed())
- Q_PRIVATE_SLOT(d_func(), void _q_notify())
- Q_PRIVATE_SLOT(d_func(), void _q_updateNotifyInterval(int))
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaRecorder::State)
-Q_DECLARE_METATYPE(QMediaRecorder::Error)
-
-Q_MEDIA_ENUM_DEBUG(QMediaRecorder, State)
-Q_MEDIA_ENUM_DEBUG(QMediaRecorder, Error)
-
-QT_END_HEADER
-
-#endif // QMEDIARECORDER_H
diff --git a/src/multimedia/qmediarecordercontrol.cpp b/src/multimedia/qmediarecordercontrol.cpp
deleted file mode 100644
index ffc5102..0000000
--- a/src/multimedia/qmediarecordercontrol.cpp
+++ /dev/null
@@ -1,209 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediarecordercontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMediaRecorderControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMediaRecorderControl class provides access to the recording
- functionality of a QMediaService.
-
- If a QMediaService can record media it will implement QMediaRecorderControl.
- This control provides a means to set the \l {outputLocation()}{output location},
- and \l {record()}{start}, \l {pause()}{pause} and \l {stop()}{stop}
- recording. It also provides feedback on the \l {duration()}{duration}
- of the recording.
-
- The functionality provided by this control is exposed to application
- code through the QMediaRecorder class.
-
- The interface name of QMediaRecorderControl is \c com.nokia.Qt.QMediaRecorderControl/1.0 as
- defined in QMediaRecorderControl_iid.
-
- \sa QMediaService::requestControl(), QMediaRecorder
-
-*/
-
-/*!
- \macro QMediaRecorderControl_iid
-
- \c com.nokia.Qt.QMediaRecorderControl/1.0
-
- Defines the interface name of the QMediaRecorderControl class.
-
- \relates QMediaRecorderControl
-*/
-
-/*!
- Constructs a media recorder control with the given \a parent.
-*/
-
-QMediaRecorderControl::QMediaRecorderControl(QObject* parent)
- : QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a media recorder control.
-*/
-
-QMediaRecorderControl::~QMediaRecorderControl()
-{
-}
-
-/*!
- \fn QUrl QMediaRecorderControl::outputLocation() const
-
- Returns the current output location being used.
- \since 1.0
-*/
-
-/*!
- \fn bool QMediaRecorderControl::setOutputLocation(const QUrl &location)
-
- Sets the output \a location and returns if this operation is successful.
- If file at the output location already exists, it should be overwritten.
-
- The \a location can be relative or empty;
- in this case the service should use the system specific place and file naming scheme.
- After recording has stated, QMediaRecorderControl::outputLocation() should return the actual output location.
- \since 1.0
-*/
-
-/*!
- \fn int QMediaRecorderControl::state() const
-
- Return the current recording state.
- \since 1.0
-*/
-
-/*!
- \fn qint64 QMediaRecorderControl::duration() const
-
- Return the current duration in milliseconds.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::record()
-
- Start recording.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::pause()
-
- Pause recording.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::stop()
-
- Stop recording.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::applySettings()
-
- Commits the encoder settings and performs pre-initialization to reduce delays when recording
- is started.
- \since 1.0
-*/
-
-/*!
- \fn bool QMediaRecorderControl::isMuted() const
-
- Returns true if the recorder is muted, and false if it is not.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::setMuted(bool muted)
-
- Sets the \a muted state of a media recorder.
- \since 1.0
-*/
-
-
-/*!
- \fn void QMediaRecorderControl::stateChanged(QMediaRecorder::State state)
-
- Signals that the \a state of a media recorder has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::durationChanged(qint64 duration)
-
- Signals that the \a duration of the recorded media has changed.
-
- This only emitted when there is a discontinuous change in the duration such as being reset to 0.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::mutedChanged(bool muted)
-
- Signals that the \a muted state of a media recorder has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaRecorderControl::error(int error, const QString &errorString)
-
- Signals that an \a error has occurred. The \a errorString describes the error.
- \since 1.0
-*/
-
-#include "moc_qmediarecordercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediarecordercontrol.h b/src/multimedia/qmediarecordercontrol.h
deleted file mode 100644
index 26f244c..0000000
--- a/src/multimedia/qmediarecordercontrol.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIARECORDERCONTROL_H
-#define QMEDIARECORDERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediarecorder.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QUrl;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT QMediaRecorderControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QMediaRecorderControl();
-
- virtual QUrl outputLocation() const = 0;
- virtual bool setOutputLocation(const QUrl &location) = 0;
-
- virtual QMediaRecorder::State state() const = 0;
-
- virtual qint64 duration() const = 0;
-
- virtual bool isMuted() const = 0;
-
- virtual void applySettings() = 0;
-
-Q_SIGNALS:
- void stateChanged(QMediaRecorder::State state);
- void durationChanged(qint64 position);
- void mutedChanged(bool muted);
- void error(int error, const QString &errorString);
-
-public Q_SLOTS:
- virtual void record() = 0;
- virtual void pause() = 0;
- virtual void stop() = 0;
- virtual void setMuted(bool muted) = 0;
-
-protected:
- QMediaRecorderControl(QObject* parent = 0);
-};
-
-#define QMediaRecorderControl_iid "com.nokia.Qt.QMediaRecorderControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaRecorderControl, QMediaRecorderControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qmediaresource.cpp b/src/multimedia/qmediaresource.cpp
deleted file mode 100644
index a801688..0000000
--- a/src/multimedia/qmediaresource.cpp
+++ /dev/null
@@ -1,440 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaresource.h"
-
-#include <QtCore/qsize.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaResource
-
- \brief The QMediaResource class provides a description of a media resource.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- A media resource is composed of a \l {url()}{URL} containing the
- location of the resource and a set of properties that describe the
- format of the resource. The properties provide a means to assess a
- resource without first attempting to load it, and in situations where
- media be represented by multiple alternative representations provide a
- means to select the appropriate resource.
-
- Media made available by a remote services can often be available in
- multiple encodings or quality levels, this allows a client to select
- an appropriate resource based on considerations such as codecs supported,
- network bandwidth, and display constraints. QMediaResource includes
- information such as the \l {mimeType()}{MIME type}, \l {audioCodec()}{audio}
- and \l {videoCodec()}{video} codecs, \l {audioBitRate()}{audio} and
- \l {videoBitRate()}{video} bit rates, and \l {resolution()}{resolution}
- so these constraints and others can be evaluated.
-
- The only mandatory property of a QMediaResource is the url().
-
- \sa QMediaContent
-*/
-
-/*!
- \typedef QMediaResourceList
-
- Synonym for \c QList<QMediaResource>
-*/
-
-/*!
- Constructs a null media resource.
-*/
-QMediaResource::QMediaResource()
-{
-}
-
-/*!
- Constructs a media resource with the given \a mimeType from a \a url.
- \since 1.0
-*/
-QMediaResource::QMediaResource(const QUrl &url, const QString &mimeType)
-{
- values.insert(Url, url);
- values.insert(MimeType, mimeType);
-}
-
-/*!
- Constructs a media resource with the given \a mimeType from a network \a request.
- \since 1.0
-*/
-QMediaResource::QMediaResource(const QNetworkRequest &request, const QString &mimeType)
-{
- values.insert(Request, QVariant::fromValue(request));
- values.insert(Url, request.url());
- values.insert(MimeType, mimeType);
-}
-
-/*!
- Constructs a copy of a media resource \a other.
- \since 1.0
-*/
-QMediaResource::QMediaResource(const QMediaResource &other)
- : values(other.values)
-{
-}
-
-/*!
- Assigns the value of \a other to a media resource.
- \since 1.0
-*/
-QMediaResource &QMediaResource::operator =(const QMediaResource &other)
-{
- values = other.values;
-
- return *this;
-}
-
-/*!
- Destroys a media resource.
-*/
-QMediaResource::~QMediaResource()
-{
-}
-
-
-/*!
- Compares a media resource to \a other.
-
- Returns true if the resources are identical, and false otherwise.
- \since 1.0
-*/
-bool QMediaResource::operator ==(const QMediaResource &other) const
-{
- // Compare requests directly as QNetworkRequests are "custom types".
- foreach (int key, values.keys()) {
- switch (key) {
- case Request:
- if (request() != other.request())
- return false;
- break;
- default:
- if (values.value(key) != other.values.value(key))
- return false;
- }
- }
- return true;
-}
-
-/*!
- Compares a media resource to \a other.
-
- Returns true if they are different, and false otherwise.
- \since 1.0
-*/
-bool QMediaResource::operator !=(const QMediaResource &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Identifies if a media resource is null.
-
- Returns true if the resource is null, and false otherwise.
- \since 1.0
-*/
-bool QMediaResource::isNull() const
-{
- return values.isEmpty();
-}
-
-/*!
- Returns the URL of a media resource.
- \since 1.0
-*/
-QUrl QMediaResource::url() const
-{
- return qvariant_cast<QUrl>(values.value(Url));
-}
-
-/*!
- Returns the network request associated with this media resource.
- \since 1.0
-*/
-QNetworkRequest QMediaResource::request() const
-{
- if(values.contains(Request))
- return qvariant_cast<QNetworkRequest>(values.value(Request));
-
- return QNetworkRequest(url());
-}
-
-/*!
- Returns the MIME type of a media resource.
-
- This may be null if the MIME type is unknown.
- \since 1.0
-*/
-QString QMediaResource::mimeType() const
-{
- return qvariant_cast<QString>(values.value(MimeType));
-}
-
-/*!
- Returns the language of a media resource as an ISO 639-2 code.
-
- This may be null if the language is unknown.
- \since 1.0
-*/
-QString QMediaResource::language() const
-{
- return qvariant_cast<QString>(values.value(Language));
-}
-
-/*!
- Sets the \a language of a media resource.
- \since 1.0
-*/
-void QMediaResource::setLanguage(const QString &language)
-{
- if (!language.isNull())
- values.insert(Language, language);
- else
- values.remove(Language);
-}
-
-/*!
- Returns the audio codec of a media resource.
-
- This may be null if the media resource does not contain an audio stream, or the codec is
- unknown.
- \since 1.0
-*/
-QString QMediaResource::audioCodec() const
-{
- return qvariant_cast<QString>(values.value(AudioCodec));
-}
-
-/*!
- Sets the audio \a codec of a media resource.
- \since 1.0
-*/
-void QMediaResource::setAudioCodec(const QString &codec)
-{
- if (!codec.isNull())
- values.insert(AudioCodec, codec);
- else
- values.remove(AudioCodec);
-}
-
-/*!
- Returns the video codec of a media resource.
-
- This may be null if the media resource does not contain a video stream, or the codec is
- unknonwn.
- \since 1.0
-*/
-QString QMediaResource::videoCodec() const
-{
- return qvariant_cast<QString>(values.value(VideoCodec));
-}
-
-/*!
- Sets the video \a codec of media resource.
- \since 1.0
-*/
-void QMediaResource::setVideoCodec(const QString &codec)
-{
- if (!codec.isNull())
- values.insert(VideoCodec, codec);
- else
- values.remove(VideoCodec);
-}
-
-/*!
- Returns the size in bytes of a media resource.
-
- This may be zero if the size is unknown.
- \since 1.0
-*/
-qint64 QMediaResource::dataSize() const
-{
- return qvariant_cast<qint64>(values.value(DataSize));
-}
-
-/*!
- Sets the \a size in bytes of a media resource.
- \since 1.0
-*/
-void QMediaResource::setDataSize(const qint64 size)
-{
- if (size != 0)
- values.insert(DataSize, size);
- else
- values.remove(DataSize);
-}
-
-/*!
- Returns the bit rate in bits per second of a media resource's audio stream.
-
- This may be zero if the bit rate is unknown, or the resource contains no audio stream.
- \since 1.0
-*/
-int QMediaResource::audioBitRate() const
-{
- return values.value(AudioBitRate).toInt();
-}
-
-/*!
- Sets the bit \a rate in bits per second of a media resource's video stream.
- \since 1.0
-*/
-void QMediaResource::setAudioBitRate(int rate)
-{
- if (rate != 0)
- values.insert(AudioBitRate, rate);
- else
- values.remove(AudioBitRate);
-}
-
-/*!
- Returns the audio sample rate of a media resource.
-
- This may be zero if the sample size is unknown, or the resource contains no audio stream.
- \since 1.0
-*/
-int QMediaResource::sampleRate() const
-{
- return qvariant_cast<int>(values.value(SampleRate));
-}
-
-/*!
- Sets the audio \a sampleRate of a media resource.
- \since 1.0
-*/
-void QMediaResource::setSampleRate(int sampleRate)
-{
- if (sampleRate != 0)
- values.insert(SampleRate, sampleRate);
- else
- values.remove(SampleRate);
-}
-
-/*!
- Returns the number of audio channels in a media resource.
-
- This may be zero if the sample size is unknown, or the resource contains no audio stream.
- \since 1.0
-*/
-int QMediaResource::channelCount() const
-{
- return qvariant_cast<int>(values.value(ChannelCount));
-}
-
-/*!
- Sets the number of audio \a channels in a media resource.
- \since 1.0
-*/
-void QMediaResource::setChannelCount(int channels)
-{
- if (channels != 0)
- values.insert(ChannelCount, channels);
- else
- values.remove(ChannelCount);
-}
-
-/*!
- Returns the bit rate in bits per second of a media resource's video stream.
-
- This may be zero if the bit rate is unknown, or the resource contains no video stream.
- \since 1.0
-*/
-int QMediaResource::videoBitRate() const
-{
- return values.value(VideoBitRate).toInt();
-}
-
-/*!
- Sets the bit \a rate in bits per second of a media resource's video stream.
- \since 1.0
-*/
-void QMediaResource::setVideoBitRate(int rate)
-{
- if (rate != 0)
- values.insert(VideoBitRate, rate);
- else
- values.remove(VideoBitRate);
-}
-
-/*!
- Returns the resolution in pixels of a media resource.
-
- This may be null is the resolution is unknown, or the resource contains no pixel data (i.e. the
- resource is an audio stream.
- \since 1.0
-*/
-QSize QMediaResource::resolution() const
-{
- return qvariant_cast<QSize>(values.value(Resolution));
-}
-
-/*!
- Sets the \a resolution in pixels of a media resource.
- \since 1.0
-*/
-void QMediaResource::setResolution(const QSize &resolution)
-{
- if (resolution.width() != -1 || resolution.height() != -1)
- values.insert(Resolution, resolution);
- else
- values.remove(Resolution);
-}
-
-/*!
- Sets the \a width and \a height in pixels of a media resource.
- \since 1.0
-*/
-void QMediaResource::setResolution(int width, int height)
-{
- if (width != -1 || height != -1)
- values.insert(Resolution, QSize(width, height));
- else
- values.remove(Resolution);
-}
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaresource.h b/src/multimedia/qmediaresource.h
deleted file mode 100644
index b06c61d..0000000
--- a/src/multimedia/qmediaresource.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIARESOURCE_H
-#define QMEDIARESOURCE_H
-
-#include <QtCore/qmap.h>
-#include <QtCore/qmetatype.h>
-#include <QtNetwork/qnetworkrequest.h>
-
-#include <qtmultimediadefs.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaResource
-{
-public:
- QMediaResource();
- QMediaResource(const QUrl &url, const QString &mimeType = QString());
- QMediaResource(const QNetworkRequest &request, const QString &mimeType = QString());
- QMediaResource(const QMediaResource &other);
- QMediaResource &operator =(const QMediaResource &other);
- ~QMediaResource();
-
- bool isNull() const;
-
- bool operator ==(const QMediaResource &other) const;
- bool operator !=(const QMediaResource &other) const;
-
- QUrl url() const;
- QNetworkRequest request() const;
- QString mimeType() const;
-
- QString language() const;
- void setLanguage(const QString &language);
-
- QString audioCodec() const;
- void setAudioCodec(const QString &codec);
-
- QString videoCodec() const;
- void setVideoCodec(const QString &codec);
-
- qint64 dataSize() const;
- void setDataSize(const qint64 size);
-
- int audioBitRate() const;
- void setAudioBitRate(int rate);
-
- int sampleRate() const;
- void setSampleRate(int frequency);
-
- int channelCount() const;
- void setChannelCount(int channels);
-
- int videoBitRate() const;
- void setVideoBitRate(int rate);
-
- QSize resolution() const;
- void setResolution(const QSize &resolution);
- void setResolution(int width, int height);
-
-
-private:
- enum Property
- {
- Url,
- Request,
- MimeType,
- Language,
- AudioCodec,
- VideoCodec,
- DataSize,
- AudioBitRate,
- VideoBitRate,
- SampleRate,
- ChannelCount,
- Resolution
- };
- QMap<int, QVariant> values;
-};
-
-typedef QList<QMediaResource> QMediaResourceList;
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaResource)
-Q_DECLARE_METATYPE(QMediaResourceList)
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimedia/qmediaservice.cpp b/src/multimedia/qmediaservice.cpp
deleted file mode 100644
index d97b361..0000000
--- a/src/multimedia/qmediaservice.cpp
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediaservice.h"
-#include "qmediaservice_p.h"
-
-#include <QtCore/qtimer.h>
-
-
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMediaService
- \brief The QMediaService class provides a common base class for media
- service implementations.
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- Media services provide implementations of the functionality promised
- by media objects, and allow multiple providers to implement a QMediaObject.
-
- To provide the functionality of a QMediaObject media services implement
- QMediaControl interfaces. Services typically implement one core media
- control which provides the core feature of a media object, and some
- number of additional controls which provide either optional features of
- the media object, or features of a secondary media object or peripheral
- object.
-
- A pointer to media service's QMediaControl implementation can be obtained
- by passing the control's interface name to the requestControl() function.
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Request control
-
- Media objects can use services loaded dynamically from plug-ins or
- implemented statically within an applications. Plug-in based services
- should also implement the QMediaServiceProviderPlugin interface. Static
- services should implement the QMediaServiceProvider interface.
-
- \sa QMediaObject, QMediaControl, QMediaServiceProvider, QMediaServiceProviderPlugin
-*/
-
-/*!
- Construct a media service with the given \a parent. This class is meant as a
- base class for Multimedia services so this constructor is protected.
-*/
-
-QMediaService::QMediaService(QObject *parent)
- : QObject(parent)
- , d_ptr(new QMediaServicePrivate)
-{
- d_ptr->q_ptr = this;
-}
-
-/*!
- \internal
-*/
-QMediaService::QMediaService(QMediaServicePrivate &dd, QObject *parent)
- : QObject(parent)
- , d_ptr(&dd)
-{
- d_ptr->q_ptr = this;
-}
-
-/*!
- Destroys a media service.
-*/
-
-QMediaService::~QMediaService()
-{
- delete d_ptr;
-}
-
-/*!
- \fn QMediaControl* QMediaService::requestControl(const char *interface)
-
- Returns a pointer to the media control implementing \a interface.
-
- If the service does not implement the control, or if it is unavailable a
- null pointer is returned instead.
-
- Controls must be returned to the service when no longer needed using the
- releaseControl() function.
- \since 1.0
-*/
-
-/*!
- \fn T QMediaService::requestControl()
-
- Returns a pointer to the media control of type T implemented by a media service.
-
- If the service does not implement the control, or if it is unavailable a
- null pointer is returned instead.
-
- Controls must be returned to the service when no longer needed using the
- releaseControl() function.
- \since 1.0
-*/
-
-/*!
- \fn void QMediaService::releaseControl(QMediaControl *control);
-
- Releases a \a control back to the service.
- \since 1.0
-*/
-
-#include "moc_qmediaservice.cpp"
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaservice.h b/src/multimedia/qmediaservice.h
deleted file mode 100644
index 64aa709..0000000
--- a/src/multimedia/qmediaservice.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIASERVICE_H
-#define QABSTRACTMEDIASERVICE_H
-
-#include <qtmultimediadefs.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qstringlist.h>
-
-#include "qmediacontrol.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaServicePrivate;
-class Q_MULTIMEDIA_EXPORT QMediaService : public QObject
-{
- Q_OBJECT
-
-public:
- ~QMediaService();
-
- virtual QMediaControl* requestControl(const char *name) = 0;
-
-#ifndef QT_NO_MEMBER_TEMPLATES
- template <typename T> inline T requestControl() {
- if (QMediaControl *control = requestControl(qmediacontrol_iid<T>())) {
- if (T typedControl = qobject_cast<T>(control))
- return typedControl;
- releaseControl(control);
- }
- return 0;
- }
-#endif
-
- virtual void releaseControl(QMediaControl *control) = 0;
-
-protected:
- QMediaService(QObject* parent);
- QMediaService(QMediaServicePrivate &dd, QObject *parent);
-
- QMediaServicePrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QMediaService)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QABSTRACTMEDIASERVICE_H
-
diff --git a/src/multimedia/qmediaservice_p.h b/src/multimedia/qmediaservice_p.h
deleted file mode 100644
index 83fd728..0000000
--- a/src/multimedia/qmediaservice_p.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTMEDIASERVICE_P_H
-#define QABSTRACTMEDIASERVICE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAudioDeviceControl;
-
-class QMediaServicePrivate
-{
-public:
- QMediaServicePrivate(): q_ptr(0) {}
- virtual ~QMediaServicePrivate() {}
-
- QMediaService *q_ptr;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-
-#endif
diff --git a/src/multimedia/qmediaserviceprovider.cpp b/src/multimedia/qmediaserviceprovider.cpp
deleted file mode 100644
index 0017349..0000000
--- a/src/multimedia/qmediaserviceprovider.cpp
+++ /dev/null
@@ -1,783 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qmap.h>
-
-#include "qmediaservice.h"
-#include "qmediaserviceprovider.h"
-#include "qmediaserviceproviderplugin.h"
-#include "qmediapluginloader_p.h"
-#include "qmediaplayer.h"
-
-QT_BEGIN_NAMESPACE
-
-class QMediaServiceProviderHintPrivate : public QSharedData
-{
-public:
- QMediaServiceProviderHintPrivate(QMediaServiceProviderHint::Type type)
- :type(type), features(0)
- {
- }
-
- QMediaServiceProviderHintPrivate(const QMediaServiceProviderHintPrivate &other)
- :QSharedData(other),
- type(other.type),
- device(other.device),
- mimeType(other.mimeType),
- codecs(other.codecs),
- features(other.features)
- {
- }
-
- ~QMediaServiceProviderHintPrivate()
- {
- }
-
- QMediaServiceProviderHint::Type type;
- QByteArray device;
- QString mimeType;
- QStringList codecs;
- QMediaServiceProviderHint::Features features;
-};
-
-/*!
- \class QMediaServiceProviderHint
-
- \brief The QMediaServiceProviderHint class describes what is required of a QMediaService.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- The QMediaServiceProvider class uses hints to select an appropriate media service.
-*/
-
-/*!
- \enum QMediaServiceProviderHint::Feature
-
- Enumerates features a media service may provide.
-
- \value LowLatencyPlayback
- The service is expected to play simple audio formats,
- but playback should start without significant delay.
- Such playback service can be used for beeps, ringtones, etc.
-
- \value RecordingSupport
- The service provides audio or video recording functions.
-
- \value StreamPlayback
- The service is capable of playing QIODevice based streams.
-
- \value VideoSurface
- The service is capable of renderering to a QAbstractVideoSurface
- output.
-
- \value BackgroundPlayback
- The service is capable of doing playback in the background
-*/
-
-/*!
- \enum QMediaServiceProviderHint::Type
-
- Enumerates the possible types of media service provider hint.
-
- \value Null En empty hint, use the default service.
- \value ContentType Select media service most suitable for certain content type.
- \value Device Select media service which supports certain device.
- \value SupportedFeatures Select media service supporting the set of optional features.
-*/
-
-
-/*!
- Constructs an empty media service provider hint.
-*/
-QMediaServiceProviderHint::QMediaServiceProviderHint()
- :d(new QMediaServiceProviderHintPrivate(Null))
-{
-}
-
-/*!
- Constructs a ContentType media service provider hint.
-
- This type of hint describes a service that is able to play content of a specific MIME \a type
- encoded with one or more of the listed \a codecs.
- \since 1.0
-*/
-QMediaServiceProviderHint::QMediaServiceProviderHint(const QString &type, const QStringList& codecs)
- :d(new QMediaServiceProviderHintPrivate(ContentType))
-{
- d->mimeType = type;
- d->codecs = codecs;
-}
-
-/*!
- Constructs a Device media service provider hint.
-
- This type of hint describes a media service that utilizes a specific \a device.
- \since 1.0
-*/
-QMediaServiceProviderHint::QMediaServiceProviderHint(const QByteArray &device)
- :d(new QMediaServiceProviderHintPrivate(Device))
-{
- d->device = device;
-}
-
-/*!
- Constructs a SupportedFeatures media service provider hint.
-
- This type of hint describes a service which supports a specific set of \a features.
- \since 1.0
-*/
-QMediaServiceProviderHint::QMediaServiceProviderHint(QMediaServiceProviderHint::Features features)
- :d(new QMediaServiceProviderHintPrivate(SupportedFeatures))
-{
- d->features = features;
-}
-
-/*!
- Constructs a copy of the media service provider hint \a other.
- \since 1.0
-*/
-QMediaServiceProviderHint::QMediaServiceProviderHint(const QMediaServiceProviderHint &other)
- :d(other.d)
-{
-}
-
-/*!
- Destroys a media service provider hint.
-*/
-QMediaServiceProviderHint::~QMediaServiceProviderHint()
-{
-}
-
-/*!
- Assigns the value \a other to a media service provider hint.
- \since 1.0
-*/
-QMediaServiceProviderHint& QMediaServiceProviderHint::operator=(const QMediaServiceProviderHint &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- Identifies if \a other is of equal value to a media service provider hint.
-
- Returns true if the hints are equal, and false if they are not.
- \since 1.0
-*/
-bool QMediaServiceProviderHint::operator == (const QMediaServiceProviderHint &other) const
-{
- return (d == other.d) ||
- (d->type == other.d->type &&
- d->device == other.d->device &&
- d->mimeType == other.d->mimeType &&
- d->codecs == other.d->codecs &&
- d->features == other.d->features);
-}
-
-/*!
- Identifies if \a other is not of equal value to a media service provider hint.
-
- Returns true if the hints are not equal, and false if they are.
- \since 1.0
-*/
-bool QMediaServiceProviderHint::operator != (const QMediaServiceProviderHint &other) const
-{
- return !(*this == other);
-}
-
-/*!
- Returns true if a media service provider is null.
- \since 1.0
-*/
-bool QMediaServiceProviderHint::isNull() const
-{
- return d->type == Null;
-}
-
-/*!
- Returns the type of a media service provider hint.
- \since 1.0
-*/
-QMediaServiceProviderHint::Type QMediaServiceProviderHint::type() const
-{
- return d->type;
-}
-
-/*!
- Returns the mime type of the media a service is expected to be able play.
- \since 1.0
-*/
-QString QMediaServiceProviderHint::mimeType() const
-{
- return d->mimeType;
-}
-
-/*!
- Returns a list of codes a media service is expected to be able to decode.
- \since 1.0
-*/
-QStringList QMediaServiceProviderHint::codecs() const
-{
- return d->codecs;
-}
-
-/*!
- Returns the name of a device a media service is expected to utilize.
- \since 1.0
-*/
-QByteArray QMediaServiceProviderHint::device() const
-{
- return d->device;
-}
-
-/*!
- Returns a set of features a media service is expected to provide.
- \since 1.0
-*/
-QMediaServiceProviderHint::Features QMediaServiceProviderHint::features() const
-{
- return d->features;
-}
-
-
-Q_GLOBAL_STATIC_WITH_ARGS(QMediaPluginLoader, loader,
- (QMediaServiceProviderFactoryInterface_iid, QLatin1String("mediaservice"), Qt::CaseInsensitive))
-
-
-class QPluginServiceProvider : public QMediaServiceProvider
-{
- QMap<QMediaService*, QMediaServiceProviderPlugin*> pluginMap;
-
-public:
- QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint)
- {
- QString key(QLatin1String(type.constData()));
-
- QList<QMediaServiceProviderPlugin *>plugins;
- foreach (QObject *obj, loader()->instances(key)) {
- QMediaServiceProviderPlugin *plugin =
- qobject_cast<QMediaServiceProviderPlugin*>(obj);
- if (plugin)
- plugins << plugin;
- }
-
- if (!plugins.isEmpty()) {
- QMediaServiceProviderPlugin *plugin = 0;
-
- switch (hint.type()) {
- case QMediaServiceProviderHint::Null:
- plugin = plugins[0];
- //special case for media player, if low latency was not asked,
- //prefer services not offering it, since they are likely to support
- //more formats
- if (type == QByteArray(Q_MEDIASERVICE_MEDIAPLAYER)) {
- foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
- QMediaServiceFeaturesInterface *iface =
- qobject_cast<QMediaServiceFeaturesInterface*>(currentPlugin);
-
- if (!iface || !(iface->supportedFeatures(type) &
- QMediaServiceProviderHint::LowLatencyPlayback)) {
- plugin = currentPlugin;
- break;
- }
-
- }
- }
- break;
- case QMediaServiceProviderHint::SupportedFeatures:
- plugin = plugins[0];
- foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
- QMediaServiceFeaturesInterface *iface =
- qobject_cast<QMediaServiceFeaturesInterface*>(currentPlugin);
-
- if (iface) {
- if ((iface->supportedFeatures(type) & hint.features()) == hint.features()) {
- plugin = currentPlugin;
- break;
- }
- }
- }
- break;
- case QMediaServiceProviderHint::Device: {
- foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
- QMediaServiceSupportedDevicesInterface *iface =
- qobject_cast<QMediaServiceSupportedDevicesInterface*>(currentPlugin);
-
- if (!iface) {
- // the plugin may support the device,
- // but this choice still can be overridden
- plugin = currentPlugin;
- } else {
- if (iface->devices(type).contains(hint.device())) {
- plugin = currentPlugin;
- break;
- }
- }
- }
- }
- break;
- case QMediaServiceProviderHint::ContentType: {
- QtMultimedia::SupportEstimate estimate = QtMultimedia::NotSupported;
- foreach (QMediaServiceProviderPlugin *currentPlugin, plugins) {
- QtMultimedia::SupportEstimate currentEstimate = QtMultimedia::MaybeSupported;
- QMediaServiceSupportedFormatsInterface *iface =
- qobject_cast<QMediaServiceSupportedFormatsInterface*>(currentPlugin);
-
- if (iface)
- currentEstimate = iface->hasSupport(hint.mimeType(), hint.codecs());
-
- if (currentEstimate > estimate) {
- estimate = currentEstimate;
- plugin = currentPlugin;
-
- if (currentEstimate == QtMultimedia::PreferredService)
- break;
- }
- }
- }
- break;
- }
-
- if (plugin != 0) {
- QMediaService *service = plugin->create(key);
- if (service != 0)
- pluginMap.insert(service, plugin);
-
- return service;
- }
- }
-
- qWarning() << "defaultServiceProvider::requestService(): no service found for -" << key;
- return 0;
- }
-
- void releaseService(QMediaService *service)
- {
- if (service != 0) {
- QMediaServiceProviderPlugin *plugin = pluginMap.take(service);
-
- if (plugin != 0)
- plugin->release(service);
- }
- }
-
- QtMultimedia::SupportEstimate hasSupport(const QByteArray &serviceType,
- const QString &mimeType,
- const QStringList& codecs,
- int flags) const
- {
- QList<QObject*> instances = loader()->instances(QLatin1String(serviceType));
-
- if (instances.isEmpty())
- return QtMultimedia::NotSupported;
-
- bool allServicesProvideInterface = true;
- QtMultimedia::SupportEstimate supportEstimate = QtMultimedia::NotSupported;
-
- foreach(QObject *obj, instances) {
- QMediaServiceSupportedFormatsInterface *iface =
- qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
-
-
- if (flags) {
- QMediaServiceFeaturesInterface *iface =
- qobject_cast<QMediaServiceFeaturesInterface*>(obj);
-
- if (iface) {
- QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
-
- //if low latency playback was asked, skip services known
- //not to provide low latency playback
- if ((flags & QMediaPlayer::LowLatency) &&
- !(features & QMediaServiceProviderHint::LowLatencyPlayback))
- continue;
-
- //the same for QIODevice based streams support
- if ((flags & QMediaPlayer::StreamPlayback) &&
- !(features & QMediaServiceProviderHint::StreamPlayback))
- continue;
- }
- }
-
- if (iface)
- supportEstimate = qMax(supportEstimate, iface->hasSupport(mimeType, codecs));
- else
- allServicesProvideInterface = false;
- }
-
- //don't return PreferredService
- supportEstimate = qMin(supportEstimate, QtMultimedia::ProbablySupported);
-
- //Return NotSupported only if no services are available of serviceType
- //or all the services returned NotSupported, otherwise return at least MaybeSupported
- if (!allServicesProvideInterface)
- supportEstimate = qMax(QtMultimedia::MaybeSupported, supportEstimate);
-
- return supportEstimate;
- }
-
- QStringList supportedMimeTypes(const QByteArray &serviceType, int flags) const
- {
- QList<QObject*> instances = loader()->instances(QLatin1String(serviceType));
-
- QStringList supportedTypes;
-
- foreach(QObject *obj, instances) {
- QMediaServiceSupportedFormatsInterface *iface =
- qobject_cast<QMediaServiceSupportedFormatsInterface*>(obj);
-
-
- if (flags) {
- QMediaServiceFeaturesInterface *iface =
- qobject_cast<QMediaServiceFeaturesInterface*>(obj);
-
- if (iface) {
- QMediaServiceProviderHint::Features features = iface->supportedFeatures(serviceType);
-
- // If low latency playback was asked for, skip MIME types from services known
- // not to provide low latency playback
- if ((flags & QMediaPlayer::LowLatency) &&
- !(features & QMediaServiceProviderHint::LowLatencyPlayback))
- continue;
-
- //the same for QIODevice based streams support
- if ((flags & QMediaPlayer::StreamPlayback) &&
- !(features & QMediaServiceProviderHint::StreamPlayback))
- continue;
-
- //the same for QAbstractVideoSurface support
- if ((flags & QMediaPlayer::VideoSurface) &&
- !(features & QMediaServiceProviderHint::VideoSurface))
- continue;
- }
- }
-
- if (iface) {
- supportedTypes << iface->supportedMimeTypes();
- }
- }
-
- // Multiple services may support the same MIME type
- supportedTypes.removeDuplicates();
-
- return supportedTypes;
- }
-
- QList<QByteArray> devices(const QByteArray &serviceType) const
- {
- QList<QByteArray> res;
-
- foreach (QObject *obj, loader()->instances(QLatin1String(serviceType))) {
- QMediaServiceSupportedDevicesInterface *iface =
- qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
-
- if (iface) {
- res.append(iface->devices(serviceType));
- }
- }
-
- return res;
- }
-
- QString deviceDescription(const QByteArray &serviceType, const QByteArray &device)
- {
- foreach (QObject *obj, loader()->instances(QLatin1String(serviceType))) {
- QMediaServiceSupportedDevicesInterface *iface =
- qobject_cast<QMediaServiceSupportedDevicesInterface*>(obj);
-
- if (iface) {
- if (iface->devices(serviceType).contains(device))
- return iface->deviceDescription(serviceType, device);
- }
- }
-
- return QString();
- }
-};
-
-Q_GLOBAL_STATIC(QPluginServiceProvider, pluginProvider);
-
-/*!
- \class QMediaServiceProvider
-
- \brief The QMediaServiceProvider class provides an abstract allocator for media services.
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceProvider::requestService(const QByteArray &type, const QMediaServiceProviderHint &hint)
-
- Requests an instance of a \a type service which best matches the given \a
- hint.
-
- Returns a pointer to the requested service, or a null pointer if there is
- no suitable service.
-
- The returned service must be released with releaseService when it is
- finished with.
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceProvider::releaseService(QMediaService *service)
-
- Releases a media \a service requested with requestService().
- \since 1.0
-*/
-
-/*!
- \fn QtMultimedia::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray &serviceType, const QString &mimeType, const QStringList& codecs, int flags) const
-
- Returns how confident a media service provider is that is can provide a \a
- serviceType service that is able to play media of a specific \a mimeType
- that is encoded using the listed \a codecs while adhering to constraints
- identified in \a flags.
- \since 1.0
-*/
-QtMultimedia::SupportEstimate QMediaServiceProvider::hasSupport(const QByteArray &serviceType,
- const QString &mimeType,
- const QStringList& codecs,
- int flags) const
-{
- Q_UNUSED(serviceType);
- Q_UNUSED(mimeType);
- Q_UNUSED(codecs);
- Q_UNUSED(flags);
-
- return QtMultimedia::MaybeSupported;
-}
-
-/*!
- \fn QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType, int flags) const
-
- Returns a list of MIME types supported by the service provider for the
- specified \a serviceType.
-
- The resultant list is restricted to MIME types which can be supported given
- the constraints in \a flags.
- \since 1.0
-*/
-QStringList QMediaServiceProvider::supportedMimeTypes(const QByteArray &serviceType, int flags) const
-{
- Q_UNUSED(serviceType);
- Q_UNUSED(flags);
-
- return QStringList();
-}
-
-/*!
- Returns the list of devices related to \a service type.
- \since 1.0
-*/
-QList<QByteArray> QMediaServiceProvider::devices(const QByteArray &service) const
-{
- Q_UNUSED(service);
- return QList<QByteArray>();
-}
-
-/*!
- Returns the description of \a device related to \a serviceType, suitable for use by
- an application for display.
- \since 1.0
-*/
-QString QMediaServiceProvider::deviceDescription(const QByteArray &serviceType, const QByteArray &device)
-{
- Q_UNUSED(serviceType);
- Q_UNUSED(device);
- return QString();
-}
-
-
-#ifdef QT_BUILD_INTERNAL
-
-static QMediaServiceProvider *qt_defaultMediaServiceProvider = 0;
-
-/*!
- Sets a media service \a provider as the default.
-
- \internal
- \since 1.0
-*/
-void QMediaServiceProvider::setDefaultServiceProvider(QMediaServiceProvider *provider)
-{
- qt_defaultMediaServiceProvider = provider;
-}
-
-#endif
-
-/*!
- Returns a default provider of media services.
-*/
-QMediaServiceProvider *QMediaServiceProvider::defaultServiceProvider()
-{
-#ifdef QT_BUILD_INTERNAL
- return qt_defaultMediaServiceProvider != 0
- ? qt_defaultMediaServiceProvider
- : static_cast<QMediaServiceProvider *>(pluginProvider());
-#else
- return pluginProvider();
-#endif
-}
-
-/*!
- \class QMediaServiceProviderPlugin
-
- \brief The QMediaServiceProviderPlugin class interface provides an interface for QMediaService
- plug-ins.
- \since 1.0
-
- A media service provider plug-in may implement one or more of
- QMediaServiceSupportedFormatsInterface,
- QMediaServiceSupportedDevicesInterface, and QMediaServiceFeaturesInterface
- to identify the features it supports.
-*/
-
-/*!
- \fn QMediaServiceProviderPlugin::keys() const
-
- Returns a list of keys for media services a plug-in can create.
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceProviderPlugin::create(const QString &key)
-
- Constructs a new instance of the QMediaService identified by \a key.
-
- The QMediaService returned must be destroyed with release().
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceProviderPlugin::release(QMediaService *service)
-
- Destroys a media \a service constructed with create().
- \since 1.0
-*/
-
-
-/*!
- \class QMediaServiceSupportedFormatsInterface
- \brief The QMediaServiceSupportedFormatsInterface class interface
- identifies if a media service plug-in supports a media format.
- \since 1.0
-
- A QMediaServiceProviderPlugin may implement this interface.
-*/
-
-/*!
- \fn QMediaServiceSupportedFormatsInterface::~QMediaServiceSupportedFormatsInterface()
-
- Destroys a media service supported formats interface.
-*/
-
-/*!
- \fn QMediaServiceSupportedFormatsInterface::hasSupport(const QString &mimeType, const QStringList& codecs) const
-
- Returns the level of support a media service plug-in has for a \a mimeType
- and set of \a codecs.
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceSupportedFormatsInterface::supportedMimeTypes() const
-
- Returns a list of MIME types supported by the media service plug-in.
- \since 1.0
-*/
-
-/*!
- \class QMediaServiceSupportedDevicesInterface
- \brief The QMediaServiceSupportedDevicesInterface class interface
- identifies the devices supported by a media service plug-in.
- \since 1.0
-
- A QMediaServiceProviderPlugin may implement this interface.
-*/
-
-/*!
- \fn QMediaServiceSupportedDevicesInterface::~QMediaServiceSupportedDevicesInterface()
-
- Destroys a media service supported devices interface.
-*/
-
-/*!
- \fn QMediaServiceSupportedDevicesInterface::devices(const QByteArray &service) const
-
- Returns a list of devices supported by a plug-in \a service.
- \since 1.0
-*/
-
-/*!
- \fn QMediaServiceSupportedDevicesInterface::deviceDescription(const QByteArray &service, const QByteArray &device)
-
- Returns a description of a \a device supported by a plug-in \a service.
- \since 1.0
-*/
-
-/*!
- \class QMediaServiceFeaturesInterface
- \brief The QMediaServiceFeaturesInterface class interface identifies
- features supported by a media service plug-in.
- \since 1.0
-
- A QMediaServiceProviderPlugin may implement this interface.
-*/
-
-/*!
- \fn QMediaServiceFeaturesInterface::~QMediaServiceFeaturesInterface()
-
- Destroys a media service features interface.
-*/
-/*!
- \fn QMediaServiceFeaturesInterface::supportedFeatures(const QByteArray &service) const
-
- Returns a set of features supported by a plug-in \a service.
- \since 1.0
-*/
-
-#include "moc_qmediaserviceprovider.cpp"
-#include "moc_qmediaserviceproviderplugin.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediaserviceprovider.h b/src/multimedia/qmediaserviceprovider.h
deleted file mode 100644
index 8ad2e2f..0000000
--- a/src/multimedia/qmediaserviceprovider.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIASERVICEPROVIDER_H
-#define QMEDIASERVICEPROVIDER_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qshareddata.h>
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaService;
-
-class QMediaServiceProviderHintPrivate;
-class Q_MULTIMEDIA_EXPORT QMediaServiceProviderHint
-{
-public:
- enum Type { Null, ContentType, Device, SupportedFeatures };
-
- enum Feature {
- LowLatencyPlayback = 0x01,
- RecordingSupport = 0x02,
- StreamPlayback = 0x04,
- VideoSurface = 0x08,
- BackgroundPlayback = 0x10,
- };
- Q_DECLARE_FLAGS(Features, Feature)
-
- QMediaServiceProviderHint();
- QMediaServiceProviderHint(const QString &mimeType, const QStringList& codecs);
- QMediaServiceProviderHint(const QByteArray &device);
- QMediaServiceProviderHint(Features features);
- QMediaServiceProviderHint(const QMediaServiceProviderHint &other);
- ~QMediaServiceProviderHint();
-
- QMediaServiceProviderHint& operator=(const QMediaServiceProviderHint &other);
-
- bool operator == (const QMediaServiceProviderHint &other) const;
- bool operator != (const QMediaServiceProviderHint &other) const;
-
- bool isNull() const;
-
- Type type() const;
-
- QString mimeType() const;
- QStringList codecs() const;
-
- QByteArray device() const;
-
- Features features() const;
-
- //to be extended, if necessary
-
-private:
- QSharedDataPointer<QMediaServiceProviderHintPrivate> d;
-};
-
-Q_DECLARE_OPERATORS_FOR_FLAGS(QMediaServiceProviderHint::Features)
-
-class Q_MULTIMEDIA_EXPORT QMediaServiceProvider : public QObject
-{
- Q_OBJECT
-
-public:
- virtual QMediaService* requestService(const QByteArray &type, const QMediaServiceProviderHint &hint = QMediaServiceProviderHint()) = 0;
- virtual void releaseService(QMediaService *service) = 0;
-
- virtual QtMultimedia::SupportEstimate hasSupport(const QByteArray &serviceType,
- const QString &mimeType,
- const QStringList& codecs,
- int flags = 0) const;
- virtual QStringList supportedMimeTypes(const QByteArray &serviceType, int flags = 0) const;
-
- virtual QList<QByteArray> devices(const QByteArray &serviceType) const;
- virtual QString deviceDescription(const QByteArray &serviceType, const QByteArray &device);
-
- static QMediaServiceProvider* defaultServiceProvider();
-
-#ifdef QT_BUILD_INTERNAL
- static void setDefaultServiceProvider(QMediaServiceProvider *provider);
-#endif
-};
-
-/*!
- Service with support for media playback
- Required Controls: QMediaPlayerControl
- Optional Controls: QMediaPlaylistControl, QAudioDeviceControl
- Video Output Controls (used by QWideoWidget and QGraphicsVideoItem):
- Required: QVideoOutputControl
- Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
-*/
-#define Q_MEDIASERVICE_MEDIAPLAYER "com.nokia.qt.mediaplayer"
-
-/*!
- Service with support for background media playback
- Required Controls: QMediaPlayerControl, QMediaBackgroundPlaybackControl
- Optional Controls: QMediaPlaylistControl, QAudioDeviceControl
-*/
-#define Q_MEDIASERVICE_BACKGROUNDMEDIAPLAYER "com.nokia.qt.backgroundmediaplayer"
-
-/*!
- Service with support for recording from audio sources
- Required Controls: QAudioDeviceControl
- Recording Controls (QMediaRecorder):
- Required: QMediaRecorderControl
- Recommended: QAudioEncoderControl
- Optional: QMediaContainerControl
-*/
-#define Q_MEDIASERVICE_AUDIOSOURCE "com.nokia.qt.audiosource"
-
-/*!
- Service with support for camera use.
- Required Controls: QCameraControl
- Optional Controls: QCameraExposureControl, QCameraFocusControl, QCameraImageProcessingControl
- Still Capture Controls: QCameraImageCaptureControl
- Video Capture Controls (QMediaRecorder):
- Required: QMediaRecorderControl
- Recommended: QAudioEncoderControl, QVideoEncoderControl, QMediaContainerControl
- Viewfinder Video Output Controls (used by QCameraViewfinder and QGraphicsVideoItem):
- Required: QVideoOutputControl
- Optional: QVideoWindowControl, QVideoRendererControl, QVideoWidgetControl
-*/
-#define Q_MEDIASERVICE_CAMERA "com.nokia.qt.camera"
-
-/*!
- Service with support for radio tuning.
- Required Controls: QRadioTunerControl
- Recording Controls (Optional, used by QMediaRecorder):
- Required: QMediaRecorderControl
- Recommended: QAudioEncoderControl
- Optional: QMediaContainerControl
-*/
-#define Q_MEDIASERVICE_RADIO "com.nokia.qt.radio"
-
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIASERVICEPROVIDER_H
diff --git a/src/multimedia/qmediaserviceproviderplugin.h b/src/multimedia/qmediaserviceproviderplugin.h
deleted file mode 100644
index 669723e..0000000
--- a/src/multimedia/qmediaserviceproviderplugin.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIASERVICEPROVIDERPLUGIN_H
-#define QMEDIASERVICEPROVIDERPLUGIN_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qplugin.h>
-#include <QtCore/qfactoryinterface.h>
-#include <qtmultimediadefs.h>
-#include "qmediaserviceprovider.h"
-
-#ifdef Q_MOC_RUN
-# pragma Q_MOC_EXPAND_MACROS
-#endif
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaService;
-
-struct Q_MULTIMEDIA_EXPORT QMediaServiceProviderFactoryInterface : public QFactoryInterface
-{
- virtual QStringList keys() const = 0;
- virtual QMediaService* create(QString const& key) = 0;
- virtual void release(QMediaService *service) = 0;
-};
-
-#define QMediaServiceProviderFactoryInterface_iid \
- "com.nokia.Qt.QMediaServiceProviderFactoryInterface/1.0"
-Q_DECLARE_INTERFACE(QMediaServiceProviderFactoryInterface, QMediaServiceProviderFactoryInterface_iid)
-
-
-struct Q_MULTIMEDIA_EXPORT QMediaServiceSupportedFormatsInterface
-{
- virtual ~QMediaServiceSupportedFormatsInterface() {}
- virtual QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const = 0;
- virtual QStringList supportedMimeTypes() const = 0;
-};
-
-#define QMediaServiceSupportedFormatsInterface_iid \
- "com.nokia.Qt.QMediaServiceSupportedFormatsInterface/1.0"
-Q_DECLARE_INTERFACE(QMediaServiceSupportedFormatsInterface, QMediaServiceSupportedFormatsInterface_iid)
-
-
-struct Q_MULTIMEDIA_EXPORT QMediaServiceSupportedDevicesInterface
-{
- virtual ~QMediaServiceSupportedDevicesInterface() {}
- virtual QList<QByteArray> devices(const QByteArray &service) const = 0;
- virtual QString deviceDescription(const QByteArray &service, const QByteArray &device) = 0;
-};
-
-#define QMediaServiceSupportedDevicesInterface_iid \
- "com.nokia.Qt.QMediaServiceSupportedDevicesInterface/1.0"
-Q_DECLARE_INTERFACE(QMediaServiceSupportedDevicesInterface, QMediaServiceSupportedDevicesInterface_iid)
-
-
-
-struct Q_MULTIMEDIA_EXPORT QMediaServiceFeaturesInterface
-{
- virtual ~QMediaServiceFeaturesInterface() {}
- virtual QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const = 0;
-};
-
-#define QMediaServiceFeaturesInterface_iid \
- "com.nokia.Qt.QMediaServiceFeaturesInterface/1.0"
-Q_DECLARE_INTERFACE(QMediaServiceFeaturesInterface, QMediaServiceFeaturesInterface_iid)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaServiceProviderPlugin : public QObject, public QMediaServiceProviderFactoryInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceProviderFactoryInterface:QFactoryInterface)
-
-public:
- virtual QStringList keys() const = 0;
- virtual QMediaService* create(const QString& key) = 0;
- virtual void release(QMediaService *service) = 0;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-
-#endif // QMEDIASERVICEPROVIDERPLUGIN_H
diff --git a/src/multimedia/qmediastreamscontrol.cpp b/src/multimedia/qmediastreamscontrol.cpp
deleted file mode 100644
index 65614b6..0000000
--- a/src/multimedia/qmediastreamscontrol.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediastreamscontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaStreamsControl
- \preliminary
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \brief The QMediaStreamsControl class provides a media stream selection control.
-
- \since 1.0
-
- The QMediaStreamsControl class provides descriptions of the available media streams
- and allows individual streams to be activated and deactivated.
-
- The interface name of QMediaStreamsControl is \c com.nokia.Qt.MediaStreamsControl as
- defined in QMediaStreamsControl_iid.
-
- \sa QMediaService::requestControl()
-*/
-
-/*!
- \macro QMediaStreamsControl_iid
-
- \c com.nokia.Qt.MediaStreamsControl
-
- Defines the interface name of the QMediaStreamsControl class.
-
- \relates QMediaStreamsControl
- \since 1.0
-*/
-
-/*!
- Constructs a new media streams control with the given \a parent.
-*/
-QMediaStreamsControl::QMediaStreamsControl(QObject *parent)
- :QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys a media streams control.
-*/
-QMediaStreamsControl::~QMediaStreamsControl()
-{
-}
-
-/*!
- \enum QMediaStreamsControl::StreamType
-
- Media stream type.
-
- \value AudioStream Audio stream.
- \value VideoStream Video stream.
- \value SubPictureStream Subpicture or teletext stream.
- \value UnknownStream The stream type is unknown.
- \value DataStream
-*/
-
-/*!
- \fn QMediaStreamsControl::streamCount()
-
- Returns the number of media streams.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::streamType(int stream)
-
- Return the type of a media \a stream.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::metaData(int stream, QtMultimedia::MetaData key)
-
- Returns the meta-data value of \a key for a given \a stream.
-
- Useful metadata keya are QtMultimedia::Title, QtMultimedia::Description and QtMultimedia::Language.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::isActive(int stream)
-
- Returns true if the media \a stream is active.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::setActive(int stream, bool state)
-
- Sets the active \a state of a media \a stream.
-
- Setting the active state of a media stream to true will activate it. If any other stream
- of the same type was previously active it will be deactivated. Setting the active state fo a
- media stream to false will deactivate it.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::streamsChanged()
-
- The signal is emitted when the available streams list is changed.
- \since 1.0
-*/
-
-/*!
- \fn QMediaStreamsControl::activeStreamsChanged()
-
- The signal is emitted when the active streams list is changed.
- \since 1.0
-*/
-
-#include "moc_qmediastreamscontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediastreamscontrol.h b/src/multimedia/qmediastreamscontrol.h
deleted file mode 100644
index bbd8a2a..0000000
--- a/src/multimedia/qmediastreamscontrol.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QMEDIASTREAMSCONTROL_H
-#define QMEDIASTREAMSCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qtmedianamespace.h"
-#include "qtmultimediadefs.h"
-#include <qmediaenumdebug.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QMediaStreamsControl : public QMediaControl
-{
- Q_OBJECT
- Q_ENUMS(SteamType)
-public:
- enum StreamType { UnknownStream, VideoStream, AudioStream, SubPictureStream, DataStream };
-
- virtual ~QMediaStreamsControl();
-
- virtual int streamCount() = 0;
- virtual StreamType streamType(int streamNumber) = 0;
-
- virtual QVariant metaData(int streamNumber, QtMultimedia::MetaData key) = 0;
-
- virtual bool isActive(int streamNumber) = 0;
- virtual void setActive(int streamNumber, bool state) = 0;
-
-Q_SIGNALS:
- void streamsChanged();
- void activeStreamsChanged();
-
-protected:
- QMediaStreamsControl(QObject *parent = 0);
-};
-
-#define QMediaStreamsControl_iid "com.nokia.Qt.QMediaStreamsControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMediaStreamsControl, QMediaStreamsControl_iid)
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QMediaStreamsControl::StreamType)
-
-Q_MEDIA_ENUM_DEBUG(QMediaStreamsControl, StreamType)
-
-QT_END_HEADER
-
-#endif // QMEDIASTREAMSCONTROL_H
-
diff --git a/src/multimedia/qmediatimerange.cpp b/src/multimedia/qmediatimerange.cpp
deleted file mode 100644
index 34252de..0000000
--- a/src/multimedia/qmediatimerange.cpp
+++ /dev/null
@@ -1,759 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-
-#include "qmediatimerange.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QMediaTimeInterval
- \brief The QMediaTimeInterval class represents a time interval with integer precision.
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- An interval is specified by an inclusive start() and end() time. These
- must be set in the constructor, as this is an immutable class. The
- specific units of time represented by the class have not been defined - it
- is suitable for any times which can be represented by a signed 64 bit
- integer.
-
- The isNormal() method determines if a time interval is normal (a normal
- time interval has start() <= end()). An abnormal interval can be converted
- in to a normal interval by calling the normalized() method.
-
- The contains() method determines if a specified time lies within the time
- interval.
-
- The translated() method returns a time interval which has been translated
- forwards or backwards through time by a specified offset.
-
- \sa QMediaTimeRange
-*/
-
-/*!
- \fn QMediaTimeInterval::QMediaTimeInterval()
-
- Constructs an empty interval.
-*/
-QMediaTimeInterval::QMediaTimeInterval()
- : s(0)
- , e(0)
-{
-
-}
-
-/*!
- \fn QMediaTimeInterval::QMediaTimeInterval(qint64 start, qint64 end)
-
- Constructs an interval with the specified \a start and \a end times.
- \since 1.0
-*/
-QMediaTimeInterval::QMediaTimeInterval(qint64 start, qint64 end)
- : s(start)
- , e(end)
-{
-
-}
-
-/*!
- \fn QMediaTimeInterval::QMediaTimeInterval(const QMediaTimeInterval &other)
-
- Constructs an interval by taking a copy of \a other.
- \since 1.0
-*/
-QMediaTimeInterval::QMediaTimeInterval(const QMediaTimeInterval &other)
- : s(other.s)
- , e(other.e)
-{
-
-}
-
-/*!
- \fn QMediaTimeInterval::start() const
-
- Returns the start time of the interval.
-
- \since 1.0
- \sa end()
-*/
-qint64 QMediaTimeInterval::start() const
-{
- return s;
-}
-
-/*!
- \fn QMediaTimeInterval::end() const
-
- Returns the end time of the interval.
-
- \since 1.0
- \sa start()
-*/
-qint64 QMediaTimeInterval::end() const
-{
- return e;
-}
-
-/*!
- \fn QMediaTimeInterval::contains(qint64 time) const
-
- Returns true if the time interval contains the specified \a time.
- That is, start() <= time <= end().
- \since 1.0
-*/
-bool QMediaTimeInterval::contains(qint64 time) const
-{
- return isNormal() ? (s <= time && time <= e)
- : (e <= time && time <= s);
-}
-
-/*!
- \fn QMediaTimeInterval::isNormal() const
-
- Returns true if this time interval is normal.
- A normal time interval has start() <= end().
-
- \since 1.0
- \sa normalized()
-*/
-bool QMediaTimeInterval::isNormal() const
-{
- return s <= e;
-}
-
-/*!
- \fn QMediaTimeInterval::normalized() const
-
- Returns a normalized version of this interval.
-
- If the start() time of the interval is greater than the end() time,
- then the returned interval has the start and end times swapped.
- \since 1.0
-*/
-QMediaTimeInterval QMediaTimeInterval::normalized() const
-{
- if(s > e)
- return QMediaTimeInterval(e, s);
-
- return *this;
-}
-
-/*!
- \fn QMediaTimeInterval::translated(qint64 offset) const
-
- Returns a copy of this time interval, translated by a value of \a offset.
- An interval can be moved forward through time with a positive offset, or backward
- through time with a negative offset.
- \since 1.0
-*/
-QMediaTimeInterval QMediaTimeInterval::translated(qint64 offset) const
-{
- return QMediaTimeInterval(s + offset, e + offset);
-}
-
-/*!
- \fn operator==(const QMediaTimeInterval &a, const QMediaTimeInterval &b)
- \relates QMediaTimeRange
-
- Returns true if \a a is exactly equal to \a b.
- \since 1.0
-*/
-bool operator==(const QMediaTimeInterval &a, const QMediaTimeInterval &b)
-{
- return a.start() == b.start() && a.end() == b.end();
-}
-
-/*!
- \fn operator!=(const QMediaTimeInterval &a, const QMediaTimeInterval &b)
- \relates QMediaTimeRange
-
- Returns true if \a a is not exactly equal to \a b.
- \since 1.0
-*/
-bool operator!=(const QMediaTimeInterval &a, const QMediaTimeInterval &b)
-{
- return a.start() != b.start() || a.end() != b.end();
-}
-
-class QMediaTimeRangePrivate : public QSharedData
-{
-public:
-
- QMediaTimeRangePrivate();
- QMediaTimeRangePrivate(const QMediaTimeRangePrivate &other);
- QMediaTimeRangePrivate(const QMediaTimeInterval &interval);
-
- QList<QMediaTimeInterval> intervals;
-
- void addInterval(const QMediaTimeInterval &interval);
- void removeInterval(const QMediaTimeInterval &interval);
-};
-
-QMediaTimeRangePrivate::QMediaTimeRangePrivate()
- : QSharedData()
-{
-
-}
-
-QMediaTimeRangePrivate::QMediaTimeRangePrivate(const QMediaTimeRangePrivate &other)
- : QSharedData()
- , intervals(other.intervals)
-{
-
-}
-
-QMediaTimeRangePrivate::QMediaTimeRangePrivate(const QMediaTimeInterval &interval)
- : QSharedData()
-{
- if(interval.isNormal())
- intervals << interval;
-}
-
-void QMediaTimeRangePrivate::addInterval(const QMediaTimeInterval &interval)
-{
- // Handle normalized intervals only
- if(!interval.isNormal())
- return;
-
- // Find a place to insert the interval
- int i;
- for (i = 0; i < intervals.count(); i++) {
- // Insert before this element
- if(interval.s < intervals[i].s) {
- intervals.insert(i, interval);
- break;
- }
- }
-
- // Interval needs to be added to the end of the list
- if (i == intervals.count())
- intervals.append(interval);
-
- // Do we need to correct the element before us?
- if(i > 0 && intervals[i - 1].e >= interval.s - 1)
- i--;
-
- // Merge trailing ranges
- while (i < intervals.count() - 1
- && intervals[i].e >= intervals[i + 1].s - 1) {
- intervals[i].e = qMax(intervals[i].e, intervals[i + 1].e);
- intervals.removeAt(i + 1);
- }
-}
-
-void QMediaTimeRangePrivate::removeInterval(const QMediaTimeInterval &interval)
-{
- // Handle normalized intervals only
- if(!interval.isNormal())
- return;
-
- for (int i = 0; i < intervals.count(); i++) {
- QMediaTimeInterval r = intervals[i];
-
- if (r.e < interval.s) {
- // Before the removal interval
- continue;
- } else if (interval.e < r.s) {
- // After the removal interval - stop here
- break;
- } else if (r.s < interval.s && interval.e < r.e) {
- // Split case - a single range has a chunk removed
- intervals[i].e = interval.s -1;
- addInterval(QMediaTimeInterval(interval.e + 1, r.e));
- break;
- } else if (r.s < interval.s) {
- // Trimming Tail Case
- intervals[i].e = interval.s - 1;
- } else if (interval.e < r.e) {
- // Trimming Head Case - we can stop after this
- intervals[i].s = interval.e + 1;
- break;
- } else {
- // Complete coverage case
- intervals.removeAt(i);
- --i;
- }
- }
-}
-
-/*!
- \class QMediaTimeRange
- \brief The QMediaTimeRange class represents a set of zero or more disjoint
- time intervals.
- \ingroup multimedia
- \since 1.0
-
- \reentrant
-
- The earliestTime(), latestTime(), intervals() and isEmpty()
- methods are used to get information about the current time range.
-
- The addInterval(), removeInterval() and clear() methods are used to modify
- the current time range.
-
- When adding or removing intervals from the time range, existing intervals
- within the range may be expanded, trimmed, deleted, merged or split to ensure
- that all intervals within the time range remain distinct and disjoint. As a
- consequence, all intervals added or removed from a time range must be
- \l{QMediaTimeInterval::isNormal()}{normal}.
-
- \sa QMediaTimeInterval
-*/
-
-/*!
- \fn QMediaTimeRange::QMediaTimeRange()
-
- Constructs an empty time range.
-*/
-QMediaTimeRange::QMediaTimeRange()
- : d(new QMediaTimeRangePrivate)
-{
-
-}
-
-/*!
- \fn QMediaTimeRange::QMediaTimeRange(qint64 start, qint64 end)
-
- Constructs a time range that contains an initial interval from
- \a start to \a end inclusive.
-
- If the interval is not \l{QMediaTimeInterval::isNormal()}{normal},
- the resulting time range will be empty.
-
- \since 1.0
- \sa addInterval()
-*/
-QMediaTimeRange::QMediaTimeRange(qint64 start, qint64 end)
- : d(new QMediaTimeRangePrivate(QMediaTimeInterval(start, end)))
-{
-
-}
-
-/*!
- \fn QMediaTimeRange::QMediaTimeRange(const QMediaTimeInterval &interval)
-
- Constructs a time range that contains an intitial interval, \a interval.
-
- If \a interval is not \l{QMediaTimeInterval::isNormal()}{normal},
- the resulting time range will be empty.
-
- \since 1.0
- \sa addInterval()
-*/
-QMediaTimeRange::QMediaTimeRange(const QMediaTimeInterval &interval)
- : d(new QMediaTimeRangePrivate(interval))
-{
-
-}
-
-/*!
- \fn QMediaTimeRange::QMediaTimeRange(const QMediaTimeRange &range)
-
- Constructs a time range by copying another time \a range.
- \since 1.0
-*/
-QMediaTimeRange::QMediaTimeRange(const QMediaTimeRange &range)
- : d(range.d)
-{
-
-}
-
-/*!
- \fn QMediaTimeRange::~QMediaTimeRange()
-
- Destructor.
-*/
-QMediaTimeRange::~QMediaTimeRange()
-{
-
-}
-
-/*!
- \fn QMediaTimeRange::operator=(const QMediaTimeRange &other)
-
- Takes a copy of the \a other time range and returns itself.
- \since 1.0
-*/
-QMediaTimeRange &QMediaTimeRange::operator=(const QMediaTimeRange &other)
-{
- d = other.d;
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::operator=(const QMediaTimeInterval &interval)
-
- Sets the time range to a single continuous interval, \a interval.
- \since 1.0
-*/
-QMediaTimeRange &QMediaTimeRange::operator=(const QMediaTimeInterval &interval)
-{
- d = new QMediaTimeRangePrivate(interval);
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::earliestTime() const
-
- Returns the earliest time within the time range.
-
- For empty time ranges, this value is equal to zero.
-
- \since 1.0
- \sa latestTime()
-*/
-qint64 QMediaTimeRange::earliestTime() const
-{
- if (!d->intervals.isEmpty())
- return d->intervals[0].s;
-
- return 0;
-}
-
-/*!
- \fn QMediaTimeRange::latestTime() const
-
- Returns the latest time within the time range.
-
- For empty time ranges, this value is equal to zero.
-
- \since 1.0
- \sa earliestTime()
-*/
-qint64 QMediaTimeRange::latestTime() const
-{
- if (!d->intervals.isEmpty())
- return d->intervals[d->intervals.count() - 1].e;
-
- return 0;
-}
-
-/*!
- \fn QMediaTimeRange::addInterval(qint64 start, qint64 end)
- \overload
-
- Adds the interval specified by \a start and \a end
- to the time range.
-
- \since 1.0
- \sa addInterval()
-*/
-void QMediaTimeRange::addInterval(qint64 start, qint64 end)
-{
- d->addInterval(QMediaTimeInterval(start, end));
-}
-
-/*!
- \fn QMediaTimeRange::addInterval(const QMediaTimeInterval &interval)
-
- Adds the specified \a interval to the time range.
-
- Adding intervals which are not \l{QMediaTimeInterval::isNormal()}{normal}
- is invalid, and will be ignored.
-
- If the specified interval is adjacent to, or overlaps existing
- intervals within the time range, these intervals will be merged.
-
- This operation takes \l{linear time}
-
- \since 1.0
- \sa removeInterval()
-*/
-void QMediaTimeRange::addInterval(const QMediaTimeInterval &interval)
-{
- d->addInterval(interval);
-}
-
-/*!
- \fn QMediaTimeRange::addTimeRange(const QMediaTimeRange &range)
-
- Adds each of the intervals in \a range to this time range.
-
- Equivalent to calling addInterval() for each interval in \a range.
- \since 1.0
-*/
-void QMediaTimeRange::addTimeRange(const QMediaTimeRange &range)
-{
- foreach(const QMediaTimeInterval &i, range.intervals()) {
- d->addInterval(i);
- }
-}
-
-/*!
- \fn QMediaTimeRange::removeInterval(qint64 start, qint64 end)
- \overload
-
- Removes the interval specified by \a start and \a end
- from the time range.
-
- \since 1.0
- \sa removeInterval()
-*/
-void QMediaTimeRange::removeInterval(qint64 start, qint64 end)
-{
- d->removeInterval(QMediaTimeInterval(start, end));
-}
-
-/*!
- \fn QMediaTimeRange::removeInterval(const QMediaTimeInterval &interval)
-
- Removes the specified \a interval from the time range.
-
- Removing intervals which are not \l{QMediaTimeInterval::isNormal()}{normal}
- is invalid, and will be ignored.
-
- Intervals within the time range will be trimmed, split or deleted
- such that no intervals within the time range include any part of the
- target interval.
-
- This operation takes \l{linear time}
-
- \since 1.0
- \sa addInterval()
-*/
-void QMediaTimeRange::removeInterval(const QMediaTimeInterval &interval)
-{
- d->removeInterval(interval);
-}
-
-/*!
- \fn QMediaTimeRange::removeTimeRange(const QMediaTimeRange &range)
-
- Removes each of the intervals in \a range from this time range.
-
- Equivalent to calling removeInterval() for each interval in \a range.
- \since 1.0
-*/
-void QMediaTimeRange::removeTimeRange(const QMediaTimeRange &range)
-{
- foreach(const QMediaTimeInterval &i, range.intervals()) {
- d->removeInterval(i);
- }
-}
-
-/*!
- \fn QMediaTimeRange::operator+=(const QMediaTimeRange &other)
-
- Adds each interval in \a other to the time range and returns the result.
- \since 1.0
-*/
-QMediaTimeRange& QMediaTimeRange::operator+=(const QMediaTimeRange &other)
-{
- addTimeRange(other);
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::operator+=(const QMediaTimeInterval &interval)
-
- Adds the specified \a interval to the time range and returns the result.
- \since 1.0
-*/
-QMediaTimeRange& QMediaTimeRange::operator+=(const QMediaTimeInterval &interval)
-{
- addInterval(interval);
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::operator-=(const QMediaTimeRange &other)
-
- Removes each interval in \a other from the time range and returns the result.
- \since 1.0
-*/
-QMediaTimeRange& QMediaTimeRange::operator-=(const QMediaTimeRange &other)
-{
- removeTimeRange(other);
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::operator-=(const QMediaTimeInterval &interval)
-
- Removes the specified \a interval from the time range and returns the result.
- \since 1.0
-*/
-QMediaTimeRange& QMediaTimeRange::operator-=(const QMediaTimeInterval &interval)
-{
- removeInterval(interval);
- return *this;
-}
-
-/*!
- \fn QMediaTimeRange::clear()
-
- Removes all intervals from the time range.
-
- \since 1.0
- \sa removeInterval()
-*/
-void QMediaTimeRange::clear()
-{
- d->intervals.clear();
-}
-
-/*!
- \fn QMediaTimeRange::intervals() const
-
- Returns the list of intervals covered by this time range.
- \since 1.0
-*/
-QList<QMediaTimeInterval> QMediaTimeRange::intervals() const
-{
- return d->intervals;
-}
-
-/*!
- \fn QMediaTimeRange::isEmpty() const
-
- Returns true if there are no intervals within the time range.
-
- \since 1.0
- \sa intervals()
-*/
-bool QMediaTimeRange::isEmpty() const
-{
- return d->intervals.isEmpty();
-}
-
-/*!
- \fn QMediaTimeRange::isContinuous() const
-
- Returns true if the time range consists of a continuous interval.
- That is, there is one or fewer disjoint intervals within the time range.
- \since 1.0
-*/
-bool QMediaTimeRange::isContinuous() const
-{
- return (d->intervals.count() <= 1);
-}
-
-/*!
- \fn QMediaTimeRange::contains(qint64 time) const
-
- Returns true if the specified \a time lies within the time range.
- \since 1.0
-*/
-bool QMediaTimeRange::contains(qint64 time) const
-{
- for (int i = 0; i < d->intervals.count(); i++) {
- if (d->intervals[i].contains(time))
- return true;
-
- if (time < d->intervals[i].s)
- break;
- }
-
- return false;
-}
-
-/*!
- \fn operator==(const QMediaTimeRange &a, const QMediaTimeRange &b)
- \relates QMediaTimeRange
-
- Returns true if all intervals in \a a are present in \a b.
- \since 1.0
-*/
-bool operator==(const QMediaTimeRange &a, const QMediaTimeRange &b)
-{
- if (a.intervals().count() != b.intervals().count())
- return false;
-
- for (int i = 0; i < a.intervals().count(); i++)
- {
- if(a.intervals()[i] != b.intervals()[i])
- return false;
- }
-
- return true;
-}
-
-/*!
- \fn operator!=(const QMediaTimeRange &a, const QMediaTimeRange &b)
- \relates QMediaTimeRange
-
- Returns true if one or more intervals in \a a are not present in \a b.
- \since 1.0
-*/
-bool operator!=(const QMediaTimeRange &a, const QMediaTimeRange &b)
-{
- return !(a == b);
-}
-
-/*!
- \fn operator+(const QMediaTimeRange &r1, const QMediaTimeRange &r2)
-
- Returns a time range containing the union between \a r1 and \a r2.
- \since 1.0
- */
-QMediaTimeRange operator+(const QMediaTimeRange &r1, const QMediaTimeRange &r2)
-{
- return (QMediaTimeRange(r1) += r2);
-}
-
-/*!
- \fn operator-(const QMediaTimeRange &r1, const QMediaTimeRange &r2)
-
- Returns a time range containing \a r2 subtracted from \a r1.
- \since 1.0
- */
-QMediaTimeRange operator-(const QMediaTimeRange &r1, const QMediaTimeRange &r2)
-{
- return (QMediaTimeRange(r1) -= r2);
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, const QMediaTimeRange &range)
-{
- dbg.nospace() << "QMediaTimeRange( ";
- foreach (const QMediaTimeInterval &interval, range.intervals()) {
- dbg.nospace() << "(" << interval.start() << ", " << interval.end() << ") ";
- }
- dbg.space() << ")";
- return dbg;
-}
-#endif
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmediatimerange.h b/src/multimedia/qmediatimerange.h
deleted file mode 100644
index d506bbe..0000000
--- a/src/multimedia/qmediatimerange.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEDIATIMERANGE_H
-#define QMEDIATIMERANGE_H
-
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-#include <QtCore/qshareddata.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaTimeRangePrivate;
-
-class Q_MULTIMEDIA_EXPORT QMediaTimeInterval
-{
-public:
- QMediaTimeInterval();
- QMediaTimeInterval(qint64 start, qint64 end);
- QMediaTimeInterval(const QMediaTimeInterval&);
-
- qint64 start() const;
- qint64 end() const;
-
- bool contains(qint64 time) const;
-
- bool isNormal() const;
- QMediaTimeInterval normalized() const;
- QMediaTimeInterval translated(qint64 offset) const;
-
-private:
- friend class QMediaTimeRangePrivate;
- friend class QMediaTimeRange;
-
- qint64 s;
- qint64 e;
-};
-
-Q_MULTIMEDIA_EXPORT bool operator==(const QMediaTimeInterval&, const QMediaTimeInterval&);
-Q_MULTIMEDIA_EXPORT bool operator!=(const QMediaTimeInterval&, const QMediaTimeInterval&);
-
-class Q_MULTIMEDIA_EXPORT QMediaTimeRange
-{
-public:
-
- QMediaTimeRange();
- QMediaTimeRange(qint64 start, qint64 end);
- QMediaTimeRange(const QMediaTimeInterval&);
- QMediaTimeRange(const QMediaTimeRange &range);
- ~QMediaTimeRange();
-
- QMediaTimeRange &operator=(const QMediaTimeRange&);
- QMediaTimeRange &operator=(const QMediaTimeInterval&);
-
- qint64 earliestTime() const;
- qint64 latestTime() const;
-
- QList<QMediaTimeInterval> intervals() const;
- bool isEmpty() const;
- bool isContinuous() const;
-
- bool contains(qint64 time) const;
-
- void addInterval(qint64 start, qint64 end);
- void addInterval(const QMediaTimeInterval &interval);
- void addTimeRange(const QMediaTimeRange&);
-
- void removeInterval(qint64 start, qint64 end);
- void removeInterval(const QMediaTimeInterval &interval);
- void removeTimeRange(const QMediaTimeRange&);
-
- QMediaTimeRange& operator+=(const QMediaTimeRange&);
- QMediaTimeRange& operator+=(const QMediaTimeInterval&);
- QMediaTimeRange& operator-=(const QMediaTimeRange&);
- QMediaTimeRange& operator-=(const QMediaTimeInterval&);
-
- void clear();
-
-private:
- QSharedDataPointer<QMediaTimeRangePrivate> d;
-};
-
-Q_MULTIMEDIA_EXPORT bool operator==(const QMediaTimeRange&, const QMediaTimeRange&);
-Q_MULTIMEDIA_EXPORT bool operator!=(const QMediaTimeRange&, const QMediaTimeRange&);
-Q_MULTIMEDIA_EXPORT QMediaTimeRange operator+(const QMediaTimeRange&, const QMediaTimeRange&);
-Q_MULTIMEDIA_EXPORT QMediaTimeRange operator-(const QMediaTimeRange&, const QMediaTimeRange&);
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QMediaTimeRange &);
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMEDIATIMERANGE_H
diff --git a/src/multimedia/qmetadatareadercontrol.cpp b/src/multimedia/qmetadatareadercontrol.cpp
deleted file mode 100644
index 63dd375..0000000
--- a/src/multimedia/qmetadatareadercontrol.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediacontrol_p.h"
-#include <qmetadatareadercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMetaDataReaderControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMetaDataReaderControl class provides read access to the
- meta-data of a QMediaService's media.
-
- If a QMediaService can provide read or write access to the meta-data of
- its current media it will implement QMetaDataReaderControl. This control
- provides functions for both retrieving and setting meta-data values.
- Meta-data may be addressed by the well defined keys in the
- QtMultimedia::MetaData enumeration using the metaData() functions, or by
- string keys using the extendedMetaData() functions.
-
- The functionality provided by this control is exposed to application
- code by the meta-data members of QMediaObject, and so meta-data access
- is potentially available in any of the media object classes. Any media
- service may implement QMetaDataReaderControl.
-
- The interface name of QMetaDataReaderControl is
- \c com.nokia.Qt.QMetaDataReaderControl/1.0 as defined in
- QMetaDataReaderControl_iid.
-
- \sa QMediaService::requestControl(), QMediaObject
-*/
-
-/*!
- \macro QMetaDataReaderControl_iid
-
- \c com.nokia.Qt.QMetaDataReaderControl/1.0
-
- Defines the interface name of the QMetaDataReaderControl class.
-
- \relates QMetaDataReaderControl
-*/
-
-/*!
- Construct a QMetaDataReaderControl with \a parent. This class is meant as a base class
- for service specific meta data providers so this constructor is protected.
-*/
-
-QMetaDataReaderControl::QMetaDataReaderControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroy the meta-data object.
-*/
-
-QMetaDataReaderControl::~QMetaDataReaderControl()
-{
-}
-
-/*!
- \fn bool QMetaDataReaderControl::isMetaDataAvailable() const
-
- Identifies if meta-data is available from a media service.
-
- Returns true if the meta-data is available and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QVariant QMetaDataReaderControl::metaData(QtMultimedia::MetaData key) const
-
- Returns the meta-data for the given \a key.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataReaderControl::availableMetaData() const
-
- Returns a list of keys there is meta-data available for.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataReaderControl::extendedMetaData(const QString &key) const
-
- Returns the metaData for an abitrary string \a key.
-
- The valid selection of keys for extended meta-data is determined by the provider and the meaning
- and type may differ between providers.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataReaderControl::availableExtendedMetaData() const
-
- Returns a list of keys there is extended meta-data available for.
- \since 1.0
-*/
-
-
-/*!
- \fn void QMetaDataReaderControl::metaDataChanged()
-
- Signal the changes of meta-data.
- \since 1.0
-*/
-
-/*!
- \fn void QMetaDataReaderControl::metaDataAvailableChanged(bool available)
-
- Signal the availability of meta-data has changed, \a available will
- be true if the multimedia object has meta-data.
- \since 1.0
-*/
-
-#include "moc_qmetadatareadercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmetadatareadercontrol.h b/src/multimedia/qmetadatareadercontrol.h
deleted file mode 100644
index 0d370b5..0000000
--- a/src/multimedia/qmetadatareadercontrol.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMETADATAREADERCONTROL_H
-#define QMETADATAREADERCONTROL_H
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-
-#include <qmediaresource.h>
-
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class Q_MULTIMEDIA_EXPORT QMetaDataReaderControl : public QMediaControl
-{
- Q_OBJECT
-public:
- ~QMetaDataReaderControl();
-
- virtual bool isMetaDataAvailable() const = 0;
-
- virtual QVariant metaData(QtMultimedia::MetaData key) const = 0;
- virtual QList<QtMultimedia::MetaData> availableMetaData() const = 0;
-
- virtual QVariant extendedMetaData(const QString &key) const = 0;
- virtual QStringList availableExtendedMetaData() const = 0;
-
-Q_SIGNALS:
- void metaDataChanged();
-
- void metaDataAvailableChanged(bool available);
-
-protected:
- QMetaDataReaderControl(QObject *parent = 0);
-};
-
-#define QMetaDataReaderControl_iid "com.nokia.Qt.QMetaDataReaderControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMetaDataReaderControl, QMetaDataReaderControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QMETADATAPROVIDER_H
diff --git a/src/multimedia/qmetadatawritercontrol.cpp b/src/multimedia/qmetadatawritercontrol.cpp
deleted file mode 100644
index 9d01662..0000000
--- a/src/multimedia/qmetadatawritercontrol.cpp
+++ /dev/null
@@ -1,195 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediacontrol_p.h"
-#include <qmetadatawritercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QMetaDataWriterControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QMetaDataWriterControl class provides write access to the
- meta-data of a QMediaService's media.
-
- If a QMediaService can provide write access to the meta-data of its
- current media it will implement QMetaDataWriterControl. This control
- provides functions for both retrieving and setting meta-data values.
- Meta-data may be addressed by the well defined keys in the
- QtMultimedia::MetaData enumeration using the metaData() functions, or
- by string keys using the extendedMetaData() functions.
-
- The functionality provided by this control is exposed to application code
- by the meta-data members of QMediaObject, and so meta-data access is
- potentially available in any of the media object classes. Any media
- service may implement QMetaDataControl.
-
- The interface name of QMetaDataWriterControl is \c com.nokia.Qt.QMetaDataWriterControl/1.0 as
- defined in QMetaDataWriterControl_iid.
-
- \sa QMediaService::requestControl(), QMediaObject
-*/
-
-/*!
- \macro QMetaDataWriterControl_iid
-
- \c com.nokia.Qt.QMetaDataWriterControl/1.0
-
- Defines the interface name of the QMetaDataWriterControl class.
-
- \relates QMetaDataWriterControl
-*/
-
-/*!
- Construct a QMetaDataWriterControl with \a parent. This class is meant as a base class
- for service specific meta data providers so this constructor is protected.
-*/
-
-QMetaDataWriterControl::QMetaDataWriterControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroy the meta-data writer control.
-*/
-
-QMetaDataWriterControl::~QMetaDataWriterControl()
-{
-}
-
-/*!
- \fn bool QMetaDataWriterControl::isMetaDataAvailable() const
-
- Identifies if meta-data is available from a media service.
-
- Returns true if the meta-data is available and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn bool QMetaDataWriterControl::isWritable() const
-
- Identifies if a media service's meta-data can be edited.
-
- Returns true if the meta-data is writable and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QVariant QMetaDataWriterControl::metaData(QtMultimedia::MetaData key) const
-
- Returns the meta-data for the given \a key.
- \since 1.0
-*/
-
-/*!
- \fn void QMetaDataWriterControl::setMetaData(QtMultimedia::MetaData key, const QVariant &value)
-
- Sets the \a value of the meta-data element with the given \a key.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataWriterControl::availableMetaData() const
-
- Returns a list of keys there is meta-data available for.
-*/
-
-/*!
- \fn QMetaDataWriterControl::extendedMetaData(const QString &key) const
-
- Returns the meta-data for an abitrary string \a key.
-
- The valid selection of keys for extended meta-data is determined by the provider and the meaning
- and type may differ between providers.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataWriterControl::setExtendedMetaData(const QString &key, const QVariant &value)
-
- Change the value of the meta-data element with an abitrary string \a key to \a value.
-
- The valid selection of keys for extended meta-data is determined by the provider and the meaning
- and type may differ between providers.
- \since 1.0
-*/
-
-/*!
- \fn QMetaDataWriterControl::availableExtendedMetaData() const
-
- Returns a list of keys there is extended meta-data available for.
- \since 1.0
-*/
-
-
-/*!
- \fn void QMetaDataWriterControl::metaDataChanged()
-
- Signal the changes of meta-data.
- \since 1.0
-*/
-
-/*!
- \fn void QMetaDataWriterControl::metaDataAvailableChanged(bool available)
-
- Signal the availability of meta-data has changed, \a available will
- be true if the multimedia object has meta-data.
- \since 1.0
-*/
-
-/*!
- \fn void QMetaDataWriterControl::writableChanged(bool writable)
-
- Signal a change in the writable status of meta-data, \a writable will be
- true if meta-data elements can be added or adjusted.
- \since 1.0
-*/
-
-#include "moc_qmetadatawritercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qmetadatawritercontrol.h b/src/multimedia/qmetadatawritercontrol.h
deleted file mode 100644
index 3f8b8c3..0000000
--- a/src/multimedia/qmetadatawritercontrol.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMETADATAWRITERCONTROL_H
-#define QMETADATAWRITERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediaobject.h"
-
-#include "qmediaresource.h"
-
-#include <qtmultimediadefs.h>
-#include "qtmedianamespace.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-
-class Q_MULTIMEDIA_EXPORT QMetaDataWriterControl : public QMediaControl
-{
- Q_OBJECT
-public:
- ~QMetaDataWriterControl();
-
- virtual bool isWritable() const = 0;
- virtual bool isMetaDataAvailable() const = 0;
-
- virtual QVariant metaData(QtMultimedia::MetaData key) const = 0;
- virtual void setMetaData(QtMultimedia::MetaData key, const QVariant &value) = 0;
- virtual QList<QtMultimedia::MetaData> availableMetaData() const = 0;
-
- virtual QVariant extendedMetaData(const QString &key) const = 0;
- virtual void setExtendedMetaData(const QString &key, const QVariant &value) = 0;
- virtual QStringList availableExtendedMetaData() const = 0;
-
-
-Q_SIGNALS:
- void metaDataChanged();
-
- void writableChanged(bool writable);
- void metaDataAvailableChanged(bool available);
-
-protected:
- QMetaDataWriterControl(QObject *parent = 0);
-};
-
-#define QMetaDataWriterControl_iid "com.nokia.Qt.QMetaDataWriterControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QMetaDataWriterControl, QMetaDataWriterControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qradiodata.cpp b/src/multimedia/qradiodata.cpp
deleted file mode 100644
index 1840db2..0000000
--- a/src/multimedia/qradiodata.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qradiodata.h"
-#include "qmediaservice.h"
-#include "qmediaobject_p.h"
-#include "qradiodatacontrol.h"
-
-#include <QPair>
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QRadioData
- \brief The QRadioData class provides interfaces to the RDS functionality of the system radio.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 5.0
-
- The radio data object will emit signals for any changes in radio data. You can enable or disable
- alternative frequency with setAlternativeFrequenciesEnabled().
-
-*/
-
-
-class QRadioDataPrivate : public QMediaObjectPrivate
-{
-public:
- QRadioDataPrivate():provider(0), control(0) {}
- QMediaServiceProvider *provider;
- QRadioDataControl* control;
-};
-
-/*!
- Constructs a radio data based on a media service allocated by a media service \a provider.
-
- The \a parent is passed to QMediaObject.
- \since 5.0
-*/
-
-QRadioData::QRadioData(QObject *parent, QMediaServiceProvider* provider):
- QMediaObject(*new QRadioDataPrivate, parent, provider->requestService(Q_MEDIASERVICE_RADIO))
-{
- Q_D(QRadioData);
-
- d->provider = provider;
-
- if (d->service != 0) {
- d->control = qobject_cast<QRadioDataControl*>(d->service->requestControl(QRadioDataControl_iid));
- if (d->control != 0) {
- connect(d->control, SIGNAL(stationIdChanged(QString)), SIGNAL(stationIdChanged(QString)));
- connect(d->control, SIGNAL(programTypeChanged(QRadioData::ProgramType)),
- SIGNAL(programTypeChanged(QRadioData::ProgramType)));
- connect(d->control, SIGNAL(programTypeNameChanged(QString)), SIGNAL(programTypeNameChanged(QString)));
- connect(d->control, SIGNAL(stationNameChanged(QString)), SIGNAL(stationNameChanged(QString)));
- connect(d->control, SIGNAL(radioTextChanged(QString)), SIGNAL(radioTextChanged(QString)));
- connect(d->control, SIGNAL(alternativeFrequenciesEnabledChanged(bool)), SIGNAL(alternativeFrequenciesEnabledChanged(bool)));
- connect(d->control, SIGNAL(error(QRadioData::Error)), SIGNAL(error(QRadioData::Error)));
- }
- }
-}
-
-/*!
- Destroys a radio data.
-*/
-
-QRadioData::~QRadioData()
-{
- Q_D(QRadioData);
-
- if (d->service && d->control)
- d->service->releaseControl(d->control);
-
- d->provider->releaseService(d->service);
-}
-
-/*!
- Returns true if the radio data service is ready to use.
- \since 5.0
-*/
-bool QRadioData::isAvailable() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d_func()->control->isAvailable();
- else
- return false;
-}
-
-/*!
- Returns the availability error state.
- \since 5.0
-*/
-QtMultimedia::AvailabilityError QRadioData::availabilityError() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d_func()->control->availabilityError();
- else
- return QtMultimedia::ServiceMissingError;
-}
-
-/*!
- \property QRadioData::stationId
- \brief Current Program Identification
-
- \since 5.0
-*/
-
-QString QRadioData::stationId() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->stationId();
- return QString();
-}
-
-/*!
- \property QRadioData::programType
- \brief Current Program Type
-
- \since 5.0
-*/
-
-QRadioData::ProgramType QRadioData::programType() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->programType();
-
- return QRadioData::Undefined;
-}
-
-/*!
- \property QRadioData::programTypeName
- \brief Current Program Type Name
-
- \since 5.0
-*/
-
-QString QRadioData::programTypeName() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->programTypeName();
- return QString();
-}
-
-/*!
- \property QRadioData::stationName
- \brief Current Program Service
-
- \since 5.0
-*/
-
-QString QRadioData::stationName() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->stationName();
- return QString();
-}
-
-/*!
- \property QRadioData::radioText
- \brief Current Radio Text
-
- \since 5.0
-*/
-
-QString QRadioData::radioText() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->radioText();
- return QString();
-}
-
-/*!
- \property QRadioData::alternativeFrequenciesEnabled
- \brief Is Alternative Frequency currently enabled
-
- \since 5.0
-*/
-
-bool QRadioData::isAlternativeFrequenciesEnabled() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->isAlternativeFrequenciesEnabled();
- return false;
-}
-
-void QRadioData::setAlternativeFrequenciesEnabled( bool enabled )
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->setAlternativeFrequenciesEnabled(enabled);
-}
-
-/*!
- Returns the error state of a radio data.
-
- \since 5.0
- \sa errorString()
-*/
-
-QRadioData::Error QRadioData::error() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->error();
- return QRadioData::ResourceError;
-}
-
-/*!
- Returns a description of a radio data's error state.
-
- \since 5.0
- \sa error()
-*/
-QString QRadioData::errorString() const
-{
- Q_D(const QRadioData);
-
- if (d->control != 0)
- return d->control->errorString();
- return QString();
-}
-
-/*!
- \fn void QRadioData::stationIdChanged(QString stationId)
-
- Signals that the Program Identification code has changed to \a stationId
- \since 5.0
-*/
-
-/*!
- \fn void QRadioData::programTypeChanged(QRadioData::ProgramType programType)
-
- Signals that the Program Type code has changed to \a programType
- \since 5.0
-*/
-
-/*!
- \fn void QRadioData::programTypeNameChanged(QString programTypeName)
-
- Signals that the Program Type Name has changed to \a programTypeName
- \since 5.0
-*/
-
-/*!
- \fn void QRadioData::stationNameChanged(int stationName)
-
- Signals that the Program Service has changed to \a stationName
- \since 5.0
-*/
-
-/*!
- \fn void QRadioData::alternativeFrequenciesEnabledChanged(bool enabled)
-
- Signals that the AF has been enabled or disabled
- \since 5.0
-*/
-
-/*!
- \fn void QRadioData::error(QRadioData::Error error)
-
- Signals that an \a error occurred.
- \since 5.0
-*/
-
-/*!
- \enum QRadioData::Error
-
- Enumerates radio data error conditions.
-
- \value NoError No errors have occurred.
- \value ResourceError There is no radio service available.
- \value OpenError Unable to open radio device.
- \value OutOfRangeError An attempt to set a frequency or band that is not supported by radio device.
-*/
-
-/*! \fn void QRadioData::stateChanged(QRadioData::State state)
- This signal is emitted when the state changes to \a state.
- \since 5.0
- */
-
-#include "moc_qradiodata.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qradiodata.h b/src/multimedia/qradiodata.h
deleted file mode 100644
index 71ae222..0000000
--- a/src/multimedia/qradiodata.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRADIODATA_H
-#define QRADIODATA_H
-
-#include <QtCore/qobject.h>
-
-#include "qmediaobject.h"
-#include "qmediaserviceprovider.h"
-#include <qmediaenumdebug.h>
-
-#include <QPair>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QRadioDataPrivate;
-class Q_MULTIMEDIA_EXPORT QRadioData : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(QString stationId READ stationId NOTIFY stationIdChanged)
- Q_PROPERTY(ProgramType programType READ programType NOTIFY programTypeChanged)
- Q_PROPERTY(QString programTypeName READ programTypeName NOTIFY programTypeNameChanged)
- Q_PROPERTY(QString stationName READ stationName NOTIFY stationNameChanged)
- Q_PROPERTY(QString radioText READ radioText NOTIFY radioTextChanged)
- Q_PROPERTY(bool alternativeFrequenciesEnabled READ isAlternativeFrequenciesEnabled
- WRITE setAlternativeFrequenciesEnabled NOTIFY alternativeFrequenciesEnabledChanged)
- Q_ENUMS(Error)
- Q_ENUMS(ProgramType)
-
-public:
- enum Error { NoError, ResourceError, OpenError, OutOfRangeError };
-
- enum ProgramType { Undefined = 0, News, CurrentAffairs, Information,
- Sport, Education, Drama, Culture, Science, Varied,
- PopMusic, RockMusic, EasyListening, LightClassical,
- SeriousClassical, OtherMusic, Weather, Finance,
- ChildrensProgrammes, SocialAffairs, Religion,
- PhoneIn, Travel, Leisure, JazzMusic, CountryMusic,
- NationalMusic, OldiesMusic, FolkMusic, Documentary,
- AlarmTest, Alarm, Talk, ClassicRock, AdultHits,
- SoftRock, Top40, Soft, Nostalgia, Classical,
- RhythmAndBlues, SoftRhythmAndBlues, Language,
- ReligiousMusic, ReligiousTalk, Personality, Public,
- College
- };
-
- QRadioData(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
- ~QRadioData();
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- QString stationId() const;
- ProgramType programType() const;
- QString programTypeName() const;
- QString stationName() const;
- QString radioText() const;
- bool isAlternativeFrequenciesEnabled() const;
-
- Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void setAlternativeFrequenciesEnabled(bool enabled);
-
-Q_SIGNALS:
- void stationIdChanged(QString stationId);
- void programTypeChanged(QRadioData::ProgramType programType);
- void programTypeNameChanged(QString programTypeName);
- void stationNameChanged(QString stationName);
- void radioTextChanged(QString radioText);
- void alternativeFrequenciesEnabledChanged(bool enabled);
-
- void error(QRadioData::Error error);
-
-private:
-
- Q_DISABLE_COPY(QRadioData)
- Q_DECLARE_PRIVATE(QRadioData)
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QRadioData::Error)
-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/qradiodatacontrol.cpp b/src/multimedia/qradiodatacontrol.cpp
deleted file mode 100644
index 28b9a99..0000000
--- a/src/multimedia/qradiodatacontrol.cpp
+++ /dev/null
@@ -1,216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qtmultimediadefs.h>
-#include "qradiodatacontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QRadioDataControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 5.0
-
-
- \brief The QRadioDataControl class provides access to the RDS functionality of the
- radio in the QMediaService.
-
- The functionality provided by this control is exposed to application code
- through the QRadioData class.
-
- The interface name of QRadioDataControl is \c com.nokia.Qt.QRadioDataControl/5.0 as
- defined in QRadioDataControl_iid.
-
- \sa QMediaService::requestControl(), QRadioData
-*/
-
-/*!
- \macro QRadioDataControl_iid
-
- \c com.nokia.Qt.QRadioDataControl/5.0
-
- Defines the interface name of the QRadioDataControl class.
-
- \relates QRadioDataControl
-*/
-
-/*!
- Constructs a radio data control with the given \a parent.
-*/
-
-QRadioDataControl::QRadioDataControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys a radio data control.
-*/
-
-QRadioDataControl::~QRadioDataControl()
-{
-}
-
-/*!
- \fn bool QRadioDataControl::isAvailable() const
-
- Returns true if the radio service is ready to use.
- \since 5.0
-*/
-
-/*!
- \fn QtMultimedia::AvailabilityError QRadioDataControl::availabilityError() const
-
- Returns the error state of the radio service.
- \since 5.0
-*/
-
-/*!
- \fn QRadioData::Error QRadioDataControl::error() const
-
- Returns the error state of a radio data.
- \since 5.0
-*/
-
-/*!
- \fn QString QRadioDataControl::errorString() const
-
- Returns a string describing a radio data's error state.
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::error(QRadioData::Error error)
-
- Signals that an \a error has occurred.
- \since 5.0
-*/
-
-/*!
- \fn int QRadioDataControl::stationId()
-
- Returns the current Program Identification
- \since 5.0
-*/
-
-/*!
- \fn QRadioData::ProgramType QRadioDataControl::programType()
-
- Returns the current Program Type
- \since 5.0
-*/
-
-/*!
- \fn QString QRadioDataControl::programTypeName()
-
- Returns the current Program Type Name
- \since 5.0
-*/
-
-/*!
- \fn QString QRadioDataControl::stationName()
-
- Returns the current Program Service
- \since 5.0
-*/
-
-/*!
- \fn QString QRadioDataControl::radioText()
-
- Returns the current Radio Text
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::setAlternativeFrequenciesEnabled(bool enabled)
-
- Sets the Alternative Frequency to \a enabled
- \since 5.0
-*/
-
-/*!
- \fn bool QRadioDataControl::isAlternativeFrequenciesEnabled()
-
- Returns true if Alternative Frequency is currently enabled
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::stationIdChanged(QString stationId)
-
- Signals that the Program Identification \a stationId has changed
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::programTypeChanged(QRadioData::ProgramType programType)
-
- Signals that the Program Type \a programType has changed
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::programTypeNameChanged(QString programTypeName)
-
- Signals that the Program Type Name \a programTypeName has changed
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::stationNameChanged(QString stationName)
-
- Signals that the Program Service \a stationName has changed
- \since 5.0
-*/
-
-/*!
- \fn void QRadioDataControl::radioTextChanged(QString radioText)
-
- Signals that the Radio Text \a radioText has changed
- \since 5.0
-*/
-
-#include "moc_qradiodatacontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qradiodatacontrol.h b/src/multimedia/qradiodatacontrol.h
deleted file mode 100644
index 487236c..0000000
--- a/src/multimedia/qradiodatacontrol.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRADIODATACONTROL_H
-#define QRADIODATACONTROL_H
-
-#include "qmediacontrol.h"
-#include "qradiodata.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QRadioDataControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QRadioDataControl();
-
- virtual bool isAvailable() const = 0;
- virtual QtMultimedia::AvailabilityError availabilityError() const = 0;
-
- virtual QString stationId() const = 0;
- virtual QRadioData::ProgramType programType() const = 0;
- virtual QString programTypeName() const = 0;
- virtual QString stationName() const = 0;
- virtual QString radioText() const = 0;
- virtual void setAlternativeFrequenciesEnabled(bool enabled) = 0;
- virtual bool isAlternativeFrequenciesEnabled() const = 0;
-
- virtual QRadioData::Error error() const = 0;
- virtual QString errorString() const = 0;
-
-Q_SIGNALS:
- void stationIdChanged(QString stationId);
- void programTypeChanged(QRadioData::ProgramType programType);
- void programTypeNameChanged(QString programTypeName);
- void stationNameChanged(QString stationName);
- void radioTextChanged(QString radioText);
- void alternativeFrequenciesEnabledChanged(bool enabled);
- void error(QRadioData::Error err);
-
-protected:
- QRadioDataControl(QObject *parent = 0);
-};
-
-#define QRadioDataControl_iid "com.nokia.Qt.QRadioDataControl/5.0"
-Q_MEDIA_DECLARE_CONTROL(QRadioDataControl, QRadioDataControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QRADIODATACONTROL_H
diff --git a/src/multimedia/qradiotuner.cpp b/src/multimedia/qradiotuner.cpp
deleted file mode 100644
index 3673d34..0000000
--- a/src/multimedia/qradiotuner.cpp
+++ /dev/null
@@ -1,643 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qradiotuner.h"
-#include "qmediaservice.h"
-#include "qmediaobject_p.h"
-#include "qradiotunercontrol.h"
-
-#include <QPair>
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QRadioTuner
- \brief The QRadioTuner class provides an interface to the systems analog radio device.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- You can control the systems analog radio device using this interface, for example:
-
- \snippet doc/src/snippets/multimedia-snippets/media.cpp Radio tuner
-
- The radio object will emit signals for any changes in state such as:
- bandChanged(), frequencyChanged(), stereoStatusChanged(), searchingChanged(),
- signalStrengthChanged(), volumeChanged(), mutedChanged().
-
- You can change between the frequency bands using setBand() however it is recommended
- that you check to make sure the band is available first using isBandSupported().
-
-*/
-
-
-class QRadioTunerPrivate : public QMediaObjectPrivate
-{
-public:
- QRadioTunerPrivate():provider(0), control(0) {}
- QMediaServiceProvider *provider;
- QRadioTunerControl* control;
-};
-
-
-
-/*!
- Constructs a radio tuner based on a media service allocated by a media service \a provider.
-
- The \a parent is passed to QMediaObject.
- \since 1.0
-*/
-
-QRadioTuner::QRadioTuner(QObject *parent, QMediaServiceProvider* provider):
- QMediaObject(*new QRadioTunerPrivate, parent, provider->requestService(Q_MEDIASERVICE_RADIO))
-{
- Q_D(QRadioTuner);
-
- d->provider = provider;
-
- if (d->service != 0) {
- d->control = qobject_cast<QRadioTunerControl*>(d->service->requestControl(QRadioTunerControl_iid));
- if (d->control != 0) {
- connect(d->control, SIGNAL(stateChanged(QRadioTuner::State)), SIGNAL(stateChanged(QRadioTuner::State)));
- connect(d->control, SIGNAL(bandChanged(QRadioTuner::Band)), SIGNAL(bandChanged(QRadioTuner::Band)));
- connect(d->control, SIGNAL(frequencyChanged(int)), SIGNAL(frequencyChanged(int)));
- connect(d->control, SIGNAL(stereoStatusChanged(bool)), SIGNAL(stereoStatusChanged(bool)));
- connect(d->control, SIGNAL(searchingChanged(bool)), SIGNAL(searchingChanged(bool)));
- connect(d->control, SIGNAL(signalStrengthChanged(int)), SIGNAL(signalStrengthChanged(int)));
- connect(d->control, SIGNAL(volumeChanged(int)), SIGNAL(volumeChanged(int)));
- connect(d->control, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- connect(d->control, SIGNAL(stationFound(int,QString)), SIGNAL(stationFound(int,QString)));
- connect(d->control, SIGNAL(error(QRadioTuner::Error)), SIGNAL(error(QRadioTuner::Error)));
- }
- }
-}
-
-/*!
- Destroys a radio tuner.
-*/
-
-QRadioTuner::~QRadioTuner()
-{
- Q_D(QRadioTuner);
-
- if (d->service && d->control)
- d->service->releaseControl(d->control);
-
- d->provider->releaseService(d->service);
-}
-
-/*!
- Returns true if the radio tuner service is ready to use.
- \since 1.0
-*/
-bool QRadioTuner::isAvailable() const
-{
- if (d_func()->control != NULL)
- return d_func()->control->isAvailable();
- else
- return false;
-}
-
-/*!
- Returns the availability error state.
- \since 1.0
-*/
-QtMultimedia::AvailabilityError QRadioTuner::availabilityError() const
-{
- if (d_func()->control != NULL)
- return d_func()->control->availabilityError();
- else
- return QtMultimedia::ServiceMissingError;
-}
-
-/*!
- \property QRadioTuner::state
- Return the current radio tuner state.
-
- \since 1.0
- \sa QRadioTuner::State
-*/
-
-QRadioTuner::State QRadioTuner::state() const
-{
- return d_func()->control ?
- d_func()->control->state() : QRadioTuner::StoppedState;
-}
-
-/*!
- \property QRadioTuner::band
- \brief the frequency band a radio tuner is tuned to.
-
- \since 1.0
- \sa QRadioTuner::Band
-*/
-
-QRadioTuner::Band QRadioTuner::band() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->band();
-
- return QRadioTuner::FM;
-}
-
-/*!
- \property QRadioTuner::frequency
- \brief the frequency in Hertz a radio tuner is tuned to.
- \since 1.0
-*/
-
-int QRadioTuner::frequency() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->frequency();
-
- return 0;
-}
-
-/*!
- Returns the number of Hertz to increment the frequency by when stepping through frequencies
- within a given \a band.
- \since 1.0
-*/
-
-int QRadioTuner::frequencyStep(QRadioTuner::Band band) const
-{
- Q_D(const QRadioTuner);
-
- if(d->control != 0)
- return d->control->frequencyStep(band);
-
- return 0;
-}
-
-/*!
- Returns a frequency \a band's minimum and maximum frequency.
- \since 1.0
-*/
-
-QPair<int,int> QRadioTuner::frequencyRange(QRadioTuner::Band band) const
-{
- Q_D(const QRadioTuner);
-
- if(d->control != 0)
- return d->control->frequencyRange(band);
-
- return qMakePair<int,int>(0,0);
-}
-
-/*!
- \property QRadioTuner::stereo
- \brief whether a radio tuner is receiving a stereo signal.
- \since 1.0
-*/
-
-bool QRadioTuner::isStereo() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->isStereo();
-
- return false;
-}
-
-
-/*!
- \property QRadioTuner::stereoMode
- \brief the stereo mode of a radio tuner.
- \since 1.0
-*/
-
-QRadioTuner::StereoMode QRadioTuner::stereoMode() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->stereoMode();
-
- return QRadioTuner::Auto;
-}
-
-void QRadioTuner::setStereoMode(QRadioTuner::StereoMode mode)
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- return d->control->setStereoMode(mode);
-}
-
-/*!
- Identifies if a frequency \a band is supported by a radio tuner.
-
- Returns true if the band is supported, and false if it is not.
- \since 1.0
-*/
-
-bool QRadioTuner::isBandSupported(QRadioTuner::Band band) const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->isBandSupported(band);
-
- return false;
-}
-
-/*!
- Activate the radio device.
- \since 1.0
-*/
-
-void QRadioTuner::start()
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- d->control->start();
-}
-
-/*!
- Deactivate the radio device.
- \since 1.0
-*/
-
-void QRadioTuner::stop()
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- d->control->stop();
-}
-
-/*!
- \property QRadioTuner::signalStrength
- \brief the strength of the current radio signal as a percentage.
- \since 1.0
-*/
-
-int QRadioTuner::signalStrength() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->signalStrength();
-
- return 0;
-}
-
-/*!
- \property QRadioTuner::volume
- \brief the volume of a radio tuner's audio output as a percentage.
- \since 1.0
-*/
-
-
-int QRadioTuner::volume() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->volume();
-
- return 0;
-}
-
-/*!
- \property QRadioTuner::muted
- \brief whether a radio tuner's audio output is muted.
- \since 1.0
-*/
-
-bool QRadioTuner::isMuted() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->isMuted();
-
- return false;
-}
-
-/*!
- Sets a radio tuner's frequency \a band.
-
- Changing the band will reset the \l frequency to the new band's minimum frequency.
- \since 1.0
-*/
-
-void QRadioTuner::setBand(QRadioTuner::Band band)
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->setBand(band);
-}
-
-/*!
- Sets a radio tuner's \a frequency.
-
- If the tuner is set to a frequency outside the current \l band, the band will be changed to
- one occupied by the new frequency.
- \since 1.0
-*/
-
-void QRadioTuner::setFrequency(int frequency)
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->setFrequency(frequency);
-}
-
-void QRadioTuner::setVolume(int volume)
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->setVolume(volume);
-}
-
-void QRadioTuner::setMuted(bool muted)
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->setMuted(muted);
-}
-
-/*!
- \property QRadioTuner::searching
- \brief whether a radio tuner is currently scanning for a signal.
-
- \sa searchForward(), searchBackward(), cancelSearch()
- \since 1.0
-*/
-
-bool QRadioTuner::isSearching() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->isSearching();
-
- return false;
-}
-
-/*!
- Starts a forward scan for a signal, starting from the current \l frequency.
-
- \since 1.0
- \sa searchBackward(), cancelSearch(), searching
-*/
-
-void QRadioTuner::searchForward()
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->searchForward();
-}
-
-/*!
- Starts a backwards scan for a signal, starting from the current \l frequency.
-
- \since 1.0
- \sa searchForward(), cancelSearch(), searching
-*/
-
-void QRadioTuner::searchBackward()
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->searchBackward();
-}
-
-/*!
- Search all stations in current band
-
- Emits QRadioTuner::stationFound(int, QString) for every found station.
- After searching is completed, QRadioTuner::searchingChanged(bool) is
- emitted (false). If \a searchMode is set to SearchGetStationId, searching
- waits for station id (PI) on each frequency.
-
- \since 5.0
- \sa searchForward(), searchBackward(), searching
-*/
-
-void QRadioTuner::searchAllStations(QRadioTuner::SearchMode searchMode)
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- d->control->searchAllStations(searchMode);
-}
-
-/*!
- Stops scanning for a signal.
-
- \since 1.0
- \sa searchForward(), searchBackward(), searching
-*/
-
-void QRadioTuner::cancelSearch()
-{
- Q_D(QRadioTuner);
-
- if (d->control != 0)
- d->control->cancelSearch();
-}
-
-/*!
- Returns the error state of a radio tuner.
-
- \since 1.0
- \sa errorString()
-*/
-
-QRadioTuner::Error QRadioTuner::error() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->error();
-
- return QRadioTuner::ResourceError;
-}
-
-/*!
- Returns a description of a radio tuner's error state.
-
- \since 1.0
- \sa error()
-*/
-
-QString QRadioTuner::errorString() const
-{
- Q_D(const QRadioTuner);
-
- if (d->control != 0)
- return d->control->errorString();
-
- return QString();
-}
-
-/*!
- \fn void QRadioTuner::bandChanged(QRadioTuner::Band band)
-
- Signals a radio tuner's \a band has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::frequencyChanged(int frequency)
-
- Signals that the \a frequency a radio tuner is tuned to has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::mutedChanged(bool muted)
-
- Signals that the \a muted state of a radio tuner's audio output has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::volumeChanged(int volume)
-
- Signals that the \a volume of a radio tuner's audio output has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::searchingChanged(bool searching)
-
- Signals that the \a searching state of a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::stereoStatusChanged(bool stereo)
-
- Signals that the \a stereo state of a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::signalStrengthChanged(int strength)
-
- Signals that the \a strength of the signal received by a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTuner::stationFound(int frequency, QString stationId)
-
- Signals that a station was found in \a frequency with \a stationId Program
- Identification code.
- \since 5.0
-*/
-
-/*!
- \fn void QRadioTuner::error(QRadioTuner::Error error)
-
- Signals that an \a error occurred.
- \since 1.0
-*/
-
-/*!
- \enum QRadioTuner::State
-
- Enumerates radio tuner states.
-
- \value ActiveState The tuner is started and active.
- \value StoppedState The tuner device is stopped.
-*/
-
-
-/*!
- \enum QRadioTuner::Band
-
- Enumerates radio frequency bands.
-
- \value AM 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz
- \value FM 87.5 to 108.0 MHz, except Japan 76-90 MHz
- \value SW 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing
- \value LW 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)
- \value FM2 range not defined, used when area supports more than one FM range.
-*/
-
-/*!
- \enum QRadioTuner::Error
-
- Enumerates radio tuner error conditions.
-
- \value NoError No errors have occurred.
- \value ResourceError There is no radio service available.
- \value OpenError Unable to open radio device.
- \value OutOfRangeError An attempt to set a frequency or band that is not supported by radio device.
-*/
-
-/*!
- \enum QRadioTuner::StereoMode
-
- Enumerates radio tuner policy for receiving stereo signals.
-
- \value Auto Uses the stereo mode matching the station.
- \value ForceStereo Provide stereo mode, converting if required.
- \value ForceMono Provide mono mode, converting if required.
-*/
-
-/*! \fn void QRadioTuner::stateChanged(QRadioTuner::State state)
- This signal is emitted when the state changes to \a state.
- \since 1.0
- */
-
-#include "moc_qradiotuner.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qradiotuner.h b/src/multimedia/qradiotuner.h
deleted file mode 100644
index 21497f4..0000000
--- a/src/multimedia/qradiotuner.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRADIOTUNER_H
-#define QRADIOTUNER_H
-
-#include <QtCore/qobject.h>
-
-#include "qmediaobject.h"
-#include "qmediaserviceprovider.h"
-#include <qmediaenumdebug.h>
-
-#include <QPair>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QRadioTunerPrivate;
-class Q_MULTIMEDIA_EXPORT QRadioTuner : public QMediaObject
-{
- Q_OBJECT
- Q_PROPERTY(State state READ state NOTIFY stateChanged)
- Q_PROPERTY(Band band READ band WRITE setBand NOTIFY bandChanged)
- Q_PROPERTY(int frequency READ frequency WRITE setFrequency NOTIFY frequencyChanged)
- Q_PROPERTY(bool stereo READ isStereo NOTIFY stereoStatusChanged)
- Q_PROPERTY(StereoMode stereoMode READ stereoMode WRITE setStereoMode)
- Q_PROPERTY(int signalStrength READ signalStrength NOTIFY signalStrengthChanged)
- Q_PROPERTY(int volume READ volume WRITE setVolume NOTIFY volumeChanged)
- Q_PROPERTY(bool muted READ isMuted WRITE setMuted NOTIFY mutedChanged)
- Q_PROPERTY(bool searching READ isSearching NOTIFY searchingChanged)
- Q_ENUMS(State)
- Q_ENUMS(Band)
- Q_ENUMS(Error)
- Q_ENUMS(StereoMode)
- Q_ENUMS(SearchMode)
-
-public:
- enum State { ActiveState, StoppedState };
- enum Band { AM, FM, SW, LW, FM2 };
- enum Error { NoError, ResourceError, OpenError, OutOfRangeError };
- enum StereoMode { ForceStereo, ForceMono, Auto };
- enum SearchMode { SearchFast, SearchGetStationId };
-
- QRadioTuner(QObject *parent = 0, QMediaServiceProvider *provider = QMediaServiceProvider::defaultServiceProvider());
- ~QRadioTuner();
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- State state() const;
-
- Band band() const;
-
- bool isBandSupported(Band b) const;
-
- int frequency() const;
- int frequencyStep(Band band) const;
- QPair<int,int> frequencyRange(Band band) const;
-
- bool isStereo() const;
- void setStereoMode(QRadioTuner::StereoMode mode);
- StereoMode stereoMode() const;
-
- int signalStrength() const;
-
- int volume() const;
- bool isMuted() const;
-
- bool isSearching() const;
-
- Error error() const;
- QString errorString() const;
-
-public Q_SLOTS:
- void searchForward();
- void searchBackward();
- void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast);
- void cancelSearch();
-
- void setBand(Band band);
- void setFrequency(int frequency);
-
- void setVolume(int volume);
- void setMuted(bool muted);
-
- void start();
- void stop();
-
-Q_SIGNALS:
- void stateChanged(QRadioTuner::State state);
- void bandChanged(QRadioTuner::Band band);
- void frequencyChanged(int frequency);
- void stereoStatusChanged(bool stereo);
- void searchingChanged(bool searching);
- void signalStrengthChanged(int signalStrength);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void stationFound(int frequency, QString stationId);
-
- void error(QRadioTuner::Error error);
-
-private:
- Q_DISABLE_COPY(QRadioTuner)
- Q_DECLARE_PRIVATE(QRadioTuner)
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QRadioTuner::State)
-Q_DECLARE_METATYPE(QRadioTuner::Band)
-Q_DECLARE_METATYPE(QRadioTuner::Error)
-Q_DECLARE_METATYPE(QRadioTuner::StereoMode)
-Q_DECLARE_METATYPE(QRadioTuner::SearchMode)
-
-Q_MEDIA_ENUM_DEBUG(QRadioTuner, State)
-Q_MEDIA_ENUM_DEBUG(QRadioTuner, Band)
-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/qradiotunercontrol.cpp b/src/multimedia/qradiotunercontrol.cpp
deleted file mode 100644
index 6e2b488..0000000
--- a/src/multimedia/qradiotunercontrol.cpp
+++ /dev/null
@@ -1,378 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qtmultimediadefs.h>
-#include "qradiotunercontrol.h"
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-
-/*!
- \class QRadioTunerControl
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
-
- \brief The QRadioTunerControl class provides access to the radio tuning
- functionality of a QMediaService.
-
- If a QMediaService can tune an analog radio device it will implement
- QRadioTunerControl. This control provides a means to tune a radio device
- to a specific \l {setFrequency()}{frequency} as well as search \l
- {searchForward()}{forwards} and \l {searchBackward()}{backwards} for a
- signal.
-
- The functionality provided by this control is exposed to application code
- through the QRadioTuner class.
-
- The interface name of QRadioTunerControl is \c com.nokia.Qt.QRadioTunerControl/1.0 as
- defined in QRadioTunerControl_iid.
-
- \sa QMediaService::requestControl(), QRadioTuner
-*/
-
-/*!
- \macro QRadioTunerControl_iid
-
- \c com.nokia.Qt.QRadioTunerControl/1.0
-
- Defines the interface name of the QRadioTunerControl class.
-
- \relates QRadioTunerControl
-*/
-
-/*!
- Constructs a radio tuner control with the given \a parent.
-*/
-
-QRadioTunerControl::QRadioTunerControl(QObject *parent):
- QMediaControl(*new QMediaControlPrivate, parent)
-{
-}
-
-/*!
- Destroys a radio tuner control.
-*/
-
-QRadioTunerControl::~QRadioTunerControl()
-{
-}
-
-/*!
- \fn bool QRadioTunerControl::isAvailable() const
-
- Returns true if the radio service is ready to use.
- \since 1.0
-*/
-
-/*!
- \fn QtMultimedia::AvailabilityError QRadioTunerControl::availabilityError() const
-
- Returns the error state of the radio service.
- \since 1.0
-*/
-
-/*!
- \fn QRadioTuner::State QRadioTunerControl::state() const
-
- Returns the current radio tuner state.
- \since 1.0
-*/
-
-/*!
- \fn QRadioTuner::Band QRadioTunerControl::band() const
-
- Returns the frequency band a radio tuner is tuned to.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::bandChanged(QRadioTuner::Band band)
-
- Signals that the frequency \a band a radio tuner is tuned to has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::setBand(QRadioTuner::Band band)
-
- Sets the frequecy \a band a radio tuner is tuned to.
-
- Changing the frequency band will reset the frequency to the minimum frequency of the new band.
- \since 1.0
-*/
-
-/*!
- \fn bool QRadioTunerControl::isBandSupported(QRadioTuner::Band band) const
-
- Identifies if a frequency \a band is supported.
-
- Returns true if the band is supported, and false if it is not.
- \since 1.0
-*/
-
-/*!
- \fn int QRadioTunerControl::frequency() const
-
- Returns the frequency a radio tuner is tuned to.
- \since 1.0
-*/
-
-/*!
- \fn int QRadioTunerControl::frequencyStep(QRadioTuner::Band band) const
-
- Returns the number of Hertz to increment the frequency by when stepping through frequencies
- within a given \a band.
- \since 1.0
-*/
-
-/*!
- \fn QPair<int,int> QRadioTunerControl::frequencyRange(QRadioTuner::Band band) const
-
- Returns a frequency \a band's minimum and maximum frequency.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::setFrequency(int frequency)
-
- Sets the \a frequency a radio tuner is tuned to.
- \since 1.0
-*/
-
-/*!
- \fn bool QRadioTunerControl::isStereo() const
-
- Identifies if a radio tuner is receiving a stereo signal.
-
- Returns true if the tuner is receiving a stereo signal, and false if it is not.
- \since 1.0
-*/
-
-/*!
- \fn QRadioTuner::StereoMode QRadioTunerControl::stereoMode() const
-
- Returns a radio tuner's stereo mode.
-
- \since 1.0
- \sa QRadioTuner::StereoMode
-*/
-
-/*!
- \fn void QRadioTunerControl::setStereoMode(QRadioTuner::StereoMode mode)
-
- Sets a radio tuner's stereo \a mode.
-
- \since 1.0
- \sa QRadioTuner::StereoMode
-*/
-
-/*!
- \fn int QRadioTunerControl::signalStrength() const
-
- Return a radio tuner's current signal strength as a percentage.
- \since 1.0
-*/
-
-/*!
- \fn int QRadioTunerControl::volume() const
-
- Returns the volume of a radio tuner's audio output as a percentage.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::setVolume(int volume)
-
- Sets the percentage \a volume of a radio tuner's audio output.
- \since 1.0
-*/
-
-/*!
- \fn bool QRadioTunerControl::isMuted() const
-
- Identifies if a radio tuner's audio output is muted.
-
- Returns true if the audio is muted, and false if it is not.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::setMuted(bool muted)
-
- Sets the \a muted state of a radio tuner's audio output.
- \since 1.0
-*/
-
-/*!
- \fn bool QRadioTunerControl::isSearching() const
-
- Identifies if a radio tuner is currently scanning for signal.
-
- Returns true if the tuner is scanning, and false if it is not.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::searchForward()
-
- Starts a forward scan for a signal, starting from the current \l frequency().
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::searchBackward()
-
- Starts a backwards scan for a signal, starting from the current \l frequency().
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::searchAllStations()
-
- Starts a scan through the whole frequency band searching all stations
- \since 5.0
-*/
-
-/*!
- \fn void QRadioTunerControl::cancelSearch()
-
- Stops scanning for a signal.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::start()
-
- Activate the radio device.
- \since 1.0
-*/
-
-/*!
- \fn QRadioTunerControl::stop()
-
- Deactivate the radio device.
- \since 1.0
-*/
-
-/*!
- \fn QRadioTuner::Error QRadioTunerControl::error() const
-
- Returns the error state of a radio tuner.
- \since 1.0
-*/
-
-/*!
- \fn QString QRadioTunerControl::errorString() const
-
- Returns a string describing a radio tuner's error state.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::stateChanged(QRadioTuner::State state)
-
- Signals that the \a state of a radio tuner has changed.
- \since 1.0
-*/
-
-
-/*!
- \fn void QRadioTunerControl::frequencyChanged(int frequency)
-
- Signals that the \a frequency a radio tuner is tuned to has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::stereoStatusChanged(bool stereo)
-
- Signals that the \a stereo state of a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::searchingChanged(bool searching)
-
- Signals that the \a searching state of a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::signalStrengthChanged(int strength)
-
- Signals that the percentage \a strength of the signal received by a radio tuner has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::volumeChanged(int volume)
-
- Signals that the percentage \a volume of radio tuner's audio output has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::mutedChanged(bool muted)
-
- Signals that the \a muted state of a radio tuner's audio output has changed.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::error(QRadioTuner::Error error)
-
- Signals that an \a error has occurred.
- \since 1.0
-*/
-
-/*!
- \fn void QRadioTunerControl::stationFound(int frequency)
-
- Signals that new station with \a frequency was found when scanning
- \since 5.0
-*/
-
-#include "moc_qradiotunercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qradiotunercontrol.h b/src/multimedia/qradiotunercontrol.h
deleted file mode 100644
index b0ea542..0000000
--- a/src/multimedia/qradiotunercontrol.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QRADIOTUNERCONTROL_H
-#define QRADIOTUNERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qradiotuner.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIA_EXPORT QRadioTunerControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QRadioTunerControl();
-
- virtual bool isAvailable() const = 0;
- virtual QtMultimedia::AvailabilityError availabilityError() const = 0;
-
- virtual QRadioTuner::State state() const = 0;
-
- virtual QRadioTuner::Band band() const = 0;
- virtual void setBand(QRadioTuner::Band b) = 0;
- virtual bool isBandSupported(QRadioTuner::Band b) const = 0;
-
- virtual int frequency() const = 0;
- virtual int frequencyStep(QRadioTuner::Band b) const = 0;
- virtual QPair<int,int> frequencyRange(QRadioTuner::Band b) const = 0;
- virtual void setFrequency(int frequency) = 0;
-
- virtual bool isStereo() const = 0;
- virtual QRadioTuner::StereoMode stereoMode() const = 0;
- virtual void setStereoMode(QRadioTuner::StereoMode mode) = 0;
-
- virtual int signalStrength() const = 0;
-
- virtual int volume() const = 0;
- virtual void setVolume(int volume) = 0;
-
- virtual bool isMuted() const = 0;
- virtual void setMuted(bool muted) = 0;
-
- virtual bool isSearching() const = 0;
-
- virtual void searchForward() = 0;
- virtual void searchBackward() = 0;
- virtual void searchAllStations(QRadioTuner::SearchMode searchMode = QRadioTuner::SearchFast) = 0;
- virtual void cancelSearch() = 0;
-
- virtual void start() = 0;
- virtual void stop() = 0;
-
- virtual QRadioTuner::Error error() const = 0;
- virtual QString errorString() const = 0;
-
-Q_SIGNALS:
- void stateChanged(QRadioTuner::State state);
- void bandChanged(QRadioTuner::Band band);
- void frequencyChanged(int frequency);
- void stereoStatusChanged(bool stereo);
- void searchingChanged(bool searching);
- void signalStrengthChanged(int signalStrength);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void error(QRadioTuner::Error err);
- void stationFound(int frequency, QString stationId);
-
-protected:
- QRadioTunerControl(QObject *parent = 0);
-};
-
-#define QRadioTunerControl_iid "com.nokia.Qt.QRadioTunerControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QRadioTunerControl, QRadioTunerControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QRADIOTUNERCONTROL_H
diff --git a/src/multimedia/qtmedianamespace.h b/src/multimedia/qtmedianamespace.h
deleted file mode 100644
index 34a1a9f..0000000
--- a/src/multimedia/qtmedianamespace.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QTMEDIANAMESPACE_H
-#define QTMEDIANAMESPACE_H
-
-#include <QtCore/qpair.h>
-#include <QtCore/qmetatype.h>
-
-#include <qtmultimediadefs.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-// For now, for backwards source compatibility
-// we have a copy of these enums
-// But if you add a new enum value, you won't need
-// to copy it to the QtMMK enums since it can't have
-// been used before.
-namespace QtMultimedia
-{
- enum MetaData
- {
- // Common
- Title,
- SubTitle,
- Author,
- Comment,
- Description,
- Category,
- Genre,
- Year,
- Date,
- UserRating,
- Keywords,
- Language,
- Publisher,
- Copyright,
- ParentalRating,
- RatingOrganisation,
-
- // Media
- Size,
- MediaType,
- Duration,
-
- // Audio
- AudioBitRate,
- AudioCodec,
- AverageLevel,
- ChannelCount,
- PeakValue,
- SampleRate,
-
- // Music
- AlbumTitle,
- AlbumArtist,
- ContributingArtist,
- Composer,
- Conductor,
- Lyrics,
- Mood,
- TrackNumber,
- TrackCount,
-
- CoverArtUrlSmall,
- CoverArtUrlLarge,
-
- // Image/Video
- Resolution,
- PixelAspectRatio,
-
- // Video
- VideoFrameRate,
- VideoBitRate,
- VideoCodec,
-
- PosterUrl,
-
- // Movie
- ChapterNumber,
- Director,
- LeadPerformer,
- Writer,
-
- // Photos
- CameraManufacturer,
- CameraModel,
- Event,
- Subject,
- Orientation,
- ExposureTime,
- FNumber,
- ExposureProgram,
- ISOSpeedRatings,
- ExposureBiasValue,
- DateTimeOriginal,
- DateTimeDigitized,
- SubjectDistance,
- MeteringMode,
- LightSource,
- Flash,
- FocalLength,
- ExposureMode,
- WhiteBalance,
- DigitalZoomRatio,
- FocalLengthIn35mmFilm,
- SceneCaptureType,
- GainControl,
- Contrast,
- Saturation,
- Sharpness,
- DeviceSettingDescription,
-
- PosterImage,
- CoverArtImage,
- ThumbnailImage
-
- };
-
- enum SupportEstimate
- {
- NotSupported,
- MaybeSupported,
- ProbablySupported,
- PreferredService
- };
-
- enum EncodingQuality
- {
- VeryLowQuality,
- LowQuality,
- NormalQuality,
- HighQuality,
- VeryHighQuality
- };
-
- enum EncodingMode
- {
- ConstantQualityEncoding,
- ConstantBitRateEncoding,
- AverageBitRateEncoding,
- TwoPassEncoding
- };
-
- enum AvailabilityError
- {
- NoError,
- ServiceMissingError,
- BusyError,
- ResourceError
- };
-
-}
-
-// For legacy support
-namespace QtMultimediaKit
-{
- enum MetaData
- {
- // Common
- Title = QtMultimedia::Title,
- SubTitle,
- Author,
- Comment,
- Description,
- Category,
- Genre,
- Year,
- Date,
- UserRating,
- Keywords,
- Language,
- Publisher,
- Copyright,
- ParentalRating,
- RatingOrganisation,
-
- // Media
- Size,
- MediaType,
- Duration,
-
- // Audio
- AudioBitRate,
- AudioCodec,
- AverageLevel,
- ChannelCount,
- PeakValue,
- SampleRate,
-
- // Music
- AlbumTitle,
- AlbumArtist,
- ContributingArtist,
- Composer,
- Conductor,
- Lyrics,
- Mood,
- TrackNumber,
- TrackCount,
-
- CoverArtUrlSmall,
- CoverArtUrlLarge,
-
- // Image/Video
- Resolution,
- PixelAspectRatio,
-
- // Video
- VideoFrameRate,
- VideoBitRate,
- VideoCodec,
-
- PosterUrl,
-
- // Movie
- ChapterNumber,
- Director,
- LeadPerformer,
- Writer,
-
- // Photos
- CameraManufacturer,
- CameraModel,
- Event,
- Subject,
- Orientation,
- ExposureTime,
- FNumber,
- ExposureProgram,
- ISOSpeedRatings,
- ExposureBiasValue,
- DateTimeOriginal,
- DateTimeDigitized,
- SubjectDistance,
- MeteringMode,
- LightSource,
- Flash,
- FocalLength,
- ExposureMode,
- WhiteBalance,
- DigitalZoomRatio,
- FocalLengthIn35mmFilm,
- SceneCaptureType,
- GainControl,
- Contrast,
- Saturation,
- Sharpness,
- DeviceSettingDescription,
-
- PosterImage,
- CoverArtImage,
- ThumbnailImage
-
- };
-
- enum SupportEstimate
- {
- NotSupported = QtMultimedia::NotSupported,
- MaybeSupported,
- ProbablySupported,
- PreferredService
- };
-
- enum EncodingQuality
- {
- VeryLowQuality = QtMultimedia::VeryLowQuality,
- LowQuality,
- NormalQuality,
- HighQuality,
- VeryHighQuality
- };
-
- enum EncodingMode
- {
- ConstantQualityEncoding = QtMultimedia::ConstantQualityEncoding,
- ConstantBitRateEncoding,
- AverageBitRateEncoding,
- TwoPassEncoding
- };
-
- enum AvailabilityError
- {
- NoError = QtMultimedia::NoError,
- ServiceMissingError,
- BusyError,
- ResourceError
- };
-
-}
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QtMultimedia::AvailabilityError)
-Q_DECLARE_METATYPE(QtMultimedia::SupportEstimate)
-Q_DECLARE_METATYPE(QtMultimedia::MetaData)
-Q_DECLARE_METATYPE(QtMultimedia::EncodingMode)
-Q_DECLARE_METATYPE(QtMultimedia::EncodingQuality)
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qtmedianamespace.qdoc b/src/multimedia/qtmedianamespace.qdoc
deleted file mode 100644
index bc998e9..0000000
--- a/src/multimedia/qtmedianamespace.qdoc
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** GNU Free Documentation License
-** 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.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms
-** and conditions contained in a signed written agreement between you
-** and Nokia.
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \namespace QtMultimedia
- \ingroup multimedia
- \inmodule QtMultimedia
-
- \brief The QtMultimedia namespace contains miscellaneous identifiers used throughout the Qt Media services library.
-
- QtMultimedia is a module containing the low level, low latency,
- Multimedia APIs which were introduced in Qt 4.6 and also includes the
- high level QtMultimedia APIs which were introduced in QtMobility 1.0.
-
-*/
-
-/*!
- \enum QtMultimedia::MetaData
-
- This enum provides identifiers for meta-data attributes.
-
- \note Not all identifiers are supported on all platforms. Please consult vendor documentation for specific support
- on different platforms.
-
- Common attributes
- \value Title The title of the media. QString.
- \value SubTitle The sub-title of the media. QString.
- \value Author The authors of the media. QStringList.
- \value Comment A user comment about the media. QString.
- \value Description A description of the media. QString
- \value Category The category of the media. QStringList.
- \value Genre The genre of the media. QStringList.
- \value Year The year of release of the media. int.
- \value Date The date of the media. QDate.
- \value UserRating A user rating of the media. int [0..100].
- \value Keywords A list of keywords describing the media. QStringList.
- \value Language The language of media, as an ISO 639-2 code.
-
- \value Publisher The publisher of the media. QString.
- \value Copyright The media's copyright notice. QString.
- \value ParentalRating The parental rating of the media. QString.
- \value RatingOrganisation The organisation responsible for the parental rating of the media.
- QString.
-
- Media attributes
- \value Size The size in bytes of the media. qint64
- \value MediaType The type of the media (audio, video, etc). QString.
- \value Duration The duration in millseconds of the media. qint64.
-
- Audio attributes
- \value AudioBitRate The bit rate of the media's audio stream in bits per second. int.
- \value AudioCodec The codec of the media's audio stream. QString.
- \value AverageLevel The average volume level of the media. int.
- \value ChannelCount The number of channels in the media's audio stream. int.
- \value PeakValue The peak volume of the media's audio stream. int
- \value SampleRate The sample rate of the media's audio stream in hertz. int
-
- Music attributes
- \value AlbumTitle The title of the album the media belongs to. QString.
- \value AlbumArtist The principal artist of the album the media belongs to. QString.
- \value ContributingArtist The artists contributing to the media. QStringList.
- \value Composer The composer of the media. QStringList.
- \value Conductor The conductor of the media. QString.
- \value Lyrics The lyrics to the media. QString.
- \value Mood The mood of the media. QString.
- \value TrackNumber The track number of the media. int.
- \value TrackCount The number of tracks on the album containing the media. int.
-
- \value CoverArtUrlSmall The URL of a small cover art image. QUrl.
- \value CoverArtUrlLarge The URL of a large cover art image. QUrl.
- \value CoverArtImage An embedded cover art image. QImage.
-
- Image and video attributes
- \value Resolution The dimensions of an image or video. QSize.
- \value PixelAspectRatio The pixel aspect ratio of an image or video. QSize.
-
- Video attributes
- \value VideoFrameRate The frame rate of the media's video stream. qreal.
- \value VideoBitRate The bit rate of the media's video stream in bits per second. int.
- \value VideoCodec The codec of the media's video stream. QString.
-
- \value PosterUrl The URL of a poster image. QUrl.
- \value PosterImage An embedded poster image. QImage.
-
- Movie attributes
- \value ChapterNumber The chapter number of the media. int.
- \value Director The director of the media. QString.
- \value LeadPerformer The lead performer in the media. QStringList.
- \value Writer The writer of the media. QStringList.
-
- Photo attributes.
- \value CameraManufacturer The manufacturer of the camera used to capture the media. QString.
- \value CameraModel The model of the camera used to capture the media. QString.
- \value Event The event during which the media was captured. QString.
- \value Subject The subject of the media. QString.
- \value Orientation Orientation of image.
- \value ExposureTime Exposure time, given in seconds.
- \value FNumber The F Number.
- \value ExposureProgram
- The class of the program used by the camera to set exposure when the picture is taken.
- \value ISOSpeedRatings
- Indicates the ISO Speed and ISO Latitude of the camera or input device as specified in ISO 12232.
- \value ExposureBiasValue
- The exposure bias.
- The unit is the APEX (Additive System of Photographic Exposure) setting.
- \value DateTimeOriginal The date and time when the original image data was generated.
- \value DateTimeDigitized The date and time when the image was stored as digital data.
- \value SubjectDistance The distance to the subject, given in meters.
- \value MeteringMode The metering mode.
- \value LightSource
- The kind of light source.
- \value Flash
- Status of flash when the image was shot.
- \value FocalLength
- The actual focal length of the lens, in mm.
- \value ExposureMode
- Indicates the exposure mode set when the image was shot.
- \value WhiteBalance
- Indicates the white balance mode set when the image was shot.
- \value DigitalZoomRatio
- Indicates the digital zoom ratio when the image was shot.
- \value FocalLengthIn35mmFilm
- Indicates the equivalent focal length assuming a 35mm film camera, in mm.
- \value SceneCaptureType
- Indicates the type of scene that was shot.
- It can also be used to record the mode in which the image was shot.
- \value GainControl
- Indicates the degree of overall image gain adjustment.
- \value Contrast
- Indicates the direction of contrast processing applied by the camera when the image was shot.
- \value Saturation
- Indicates the direction of saturation processing applied by the camera when the image was shot.
- \value Sharpness
- Indicates the direction of sharpness processing applied by the camera when the image was shot.
- \value DeviceSettingDescription
- Exif tag, indicates information on the picture-taking conditions of a particular camera model. QString
-
- \value ThumbnailImage An embedded thumbnail image. QImage.
-*/
-
-/*!
- \enum QtMultimedia::SupportEstimate
-
- Enumerates the levels of support a media service provider may have for a feature.
-
- \value NotSupported The feature is not supported.
- \value MaybeSupported The feature may be supported.
- \value ProbablySupported The feature is probably supported.
- \value PreferredService The service is the preferred provider of a service.
-*/
-
-/*!
- \enum QtMultimedia::EncodingQuality
-
- Enumerates quality encoding levels.
-
- \value VeryLowQuality
- \value LowQuality
- \value NormalQuality
- \value HighQuality
- \value VeryHighQuality
-*/
-
-/*!
- \enum QtMultimedia::EncodingMode
-
- Enumerates encoding modes.
-
- \value ConstantQualityEncoding
- \value ConstantBitRateEncoding
- \value AverageBitRateEncoding
- \value TwoPassEncoding
-*/
-
-/*!
- \enum QtMultimedia::AvailabilityError
-
- Enumerates Service status errors.
-
- \value NoError The service is operating correctly.
- \value ServiceMissingError There is no service available to provide the requested functionality.
- \value ResourceError The service could not allocate resources required to function correctly.
- \value BusyError The service must wait for access to necessary resources.
-*/
diff --git a/src/multimedia/qtmultimediadefs.h b/src/multimedia/qtmultimediadefs.h
deleted file mode 100644
index 3135039..0000000
--- a/src/multimedia/qtmultimediadefs.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QTMULTIMEDIA_P_H
-#define QTMULTIMEDIA_P_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-#if defined(Q_OS_WIN)
-# if defined(QT_NODLL)
-# undef QT_MAKEDLL
-# undef QT_DLL
-# elif defined(QT_MAKEDLL)
-# if defined(QT_DLL)
-# undef QT_DLL
-# endif
-# if defined(QT_BUILD_MULTIMEDIA_LIB)
-# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
-# else
-# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
-# endif
-# elif defined(QT_DLL) /* use a Qt DLL library */
-# define Q_MULTIMEDIA_EXPORT Q_DECL_IMPORT
-# endif
-#endif
-
-#if !defined(Q_MULTIMEDIA_EXPORT)
-# if defined(QT_SHARED)
-# define Q_MULTIMEDIA_EXPORT Q_DECL_EXPORT
-# else
-# define Q_MULTIMEDIA_EXPORT
-# endif
-#endif
-
-QT_END_HEADER
-
-
-#endif // QMULTIMEDIA_P_H
-
diff --git a/src/multimedia/qvideodevicecontrol.cpp b/src/multimedia/qvideodevicecontrol.cpp
deleted file mode 100644
index a864fd5..0000000
--- a/src/multimedia/qvideodevicecontrol.cpp
+++ /dev/null
@@ -1,159 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideodevicecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVideoDeviceControl
-
- \brief The QVideoDeviceControl class provides an video device selector media control.
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- The QVideoDeviceControl class provides descriptions of the video devices
- available on a system and allows one to be selected as the endpoint of a
- media service.
-
- The interface name of QVideoDeviceControl is \c com.nokia.Qt.VideoDeviceControl as
- defined in QVideoDeviceControl_iid.
-*/
-
-/*!
- \macro QVideoDeviceControl_iid
-
- \c com.nokia.Qt.VideoDeviceControl
-
- Defines the interface name of the QVideoDeviceControl class.
-
- \relates QVideoDeviceControl
-*/
-
-/*!
- Constructs a video device control with the given \a parent.
-*/
-QVideoDeviceControl::QVideoDeviceControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a video device control.
-*/
-QVideoDeviceControl::~QVideoDeviceControl()
-{
-}
-
-/*!
- \fn QVideoDeviceControl::deviceCount() const
-
- Returns the number of available video devices;
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::deviceName(int index) const
-
- Returns the name of the video device at \a index.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::deviceDescription(int index) const
-
- Returns a description of the video device at \a index.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::deviceIcon(int index) const
-
- Returns an icon for the video device at \a index.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::defaultDevice() const
-
- Returns the index of the default video device.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::selectedDevice() const
-
- Returns the index of the selected video device.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::setSelectedDevice(int index)
-
- Sets the selected video device \a index.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::devicesChanged()
-
- Signals that the list of available video devices has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::selectedDeviceChanged(int index)
-
- Signals that the selected video device \a index has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoDeviceControl::selectedDeviceChanged(const QString &name)
-
- Signals that the selected video device \a name has changed.
- \since 1.0
-*/
-
-#include "moc_qvideodevicecontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qvideodevicecontrol.h b/src/multimedia/qvideodevicecontrol.h
deleted file mode 100644
index 6f44c46..0000000
--- a/src/multimedia/qvideodevicecontrol.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEODEVICECONTROL_H
-#define QVIDEODEVICECONTROL_H
-
-#include "qmediacontrol.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class Q_MULTIMEDIA_EXPORT QVideoDeviceControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QVideoDeviceControl();
-
- virtual int deviceCount() const = 0;
-
- virtual QString deviceName(int index) const = 0;
- virtual QString deviceDescription(int index) const = 0;
- virtual QIcon deviceIcon(int index) const = 0;
-
- virtual int defaultDevice() const = 0;
- virtual int selectedDevice() const = 0;
-
-public Q_SLOTS:
- virtual void setSelectedDevice(int index) = 0;
-
-Q_SIGNALS:
- void selectedDeviceChanged(int index);
- void selectedDeviceChanged(const QString &deviceName);
- void devicesChanged();
-
-protected:
- QVideoDeviceControl(QObject *parent = 0);
-};
-
-#define QVideoDeviceControl_iid "com.nokia.Qt.QVideoDeviceControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QVideoDeviceControl, QVideoDeviceControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // QVIDEODEVICECONTROL_H
diff --git a/src/multimedia/qvideoencodercontrol.cpp b/src/multimedia/qvideoencodercontrol.cpp
deleted file mode 100644
index 1551f2c..0000000
--- a/src/multimedia/qvideoencodercontrol.cpp
+++ /dev/null
@@ -1,190 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideoencodercontrol.h"
-#include <QtCore/qstringlist.h>
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVideoEncoderControl
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- \brief The QVideoEncoderControl class provides access to the settings
- of a media service that performs video encoding.
-
- If a QMediaService supports encoding video data it will implement
- QVideoEncoderControl. This control provides information about the limits
- of restricted video encoder options and allows the selection of a set of
- video encoder settings as specified in a QVideoEncoderSettings object.
-
- The functionality provided by this control is exposed to application code
- through the QMediaRecorder class.
-
- The interface name of QVideoEncoderControl is \c com.nokia.Qt.QVideoEncoderControl/1.0 as
- defined in QVideoEncoderControl_iid.
-
- \sa QMediaRecorder, QVideoEncoderSettings, QMediaService::requestControl()
-*/
-
-/*!
- \macro QVideoEncoderControl_iid
-
- \c com.nokia.Qt.QVideoEncoderControl/1.0
-
- Defines the interface name of the QVideoEncoderControl class.
-
- \relates QVideoEncoderControl
-*/
-
-/*!
- Create a new video encoder control object with the given \a parent.
-*/
-QVideoEncoderControl::QVideoEncoderControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a video encoder control.
-*/
-QVideoEncoderControl::~QVideoEncoderControl()
-{
-}
-
-/*!
- \fn QVideoEncoderControl::supportedVideoCodecs() const
-
- Returns the list of supported video codecs.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::videoCodecDescription(const QString &codec) const
-
- Returns a description of a video \a codec.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::supportedEncodingOptions(const QString &codec) const
-
- Returns a list of supported encoding options for a video \a codec.
-
- The names and types of the options in the list is system dependent.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::encodingOption(const QString &codec, const QString &option) const
-
- Returns the value of a video \a codec \a option.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::setEncodingOption(const QString &codec, const QString &option, const QVariant &value)
-
- Sets the \a value of a \a codec specific \a option.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const
-
- Returns a list of supported resolutions.
-
- If non null video \a settings parameter is passed,
- the returned list is reduced to resolution supported with partial settings like
- \l {QVideoEncoderSettings::setCodec()}{video codec} or
- \l {QVideoEncoderSettings::setFrameRate()}{frame rate} applied.
-
- If the encoder supports arbitrary resolutions within the supported resolutions range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
-
- \since 1.0
- \sa QVideoEncoderSettings::resolution()
-*/
-
-/*!
- \fn QVideoEncoderControl::supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const
-
- Returns a list of supported frame rates.
-
- If non null video \a settings parameter is passed,
- the returned list is reduced to frame rates supported with partial settings like
- \l {QVideoEncoderSettings::setCodec()}{video codec} or
- \l {QVideoEncoderSettings::setResolution()}{video resolution} applied.
-
- If the encoder supports arbitrary frame rates within the supported range,
- *\a continuous is set to true, otherwise *\a continuous is set to false.
-
- \since 1.0
- \sa QVideoEncoderSettings::frameRate()
-*/
-
-/*!
- \fn QVideoEncoderControl::videoSettings() const
-
- Returns the video encoder settings.
-
- The returned value may be different tha passed to QVideoEncoderControl::setVideoSettings()
- if the settings contains the default or undefined parameters.
- In this case if the undefined parameters are already resolved, they should be returned.
- \since 1.0
-*/
-
-/*!
- \fn QVideoEncoderControl::setVideoSettings(const QVideoEncoderSettings &settings)
-
- Sets the selected video encoder \a settings.
- \since 1.0
-*/
-
-#include "moc_qvideoencodercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qvideoencodercontrol.h b/src/multimedia/qvideoencodercontrol.h
deleted file mode 100644
index 343af80..0000000
--- a/src/multimedia/qvideoencodercontrol.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOENCODERCONTROL_H
-#define QVIDEOENCODERCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qmediarecorder.h"
-
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QByteArray;
-class QStringList;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT QVideoEncoderControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QVideoEncoderControl();
-
- virtual QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings,
- bool *continuous = 0) const = 0;
-
- virtual QList<qreal> supportedFrameRates(const QVideoEncoderSettings &settings,
- bool *continuous = 0) const = 0;
-
- virtual QStringList supportedVideoCodecs() const = 0;
- virtual QString videoCodecDescription(const QString &codecName) const = 0;
-
- virtual QVideoEncoderSettings videoSettings() const = 0;
- virtual void setVideoSettings(const QVideoEncoderSettings &settings) = 0;
-
- virtual QStringList supportedEncodingOptions(const QString &codec) const = 0;
- virtual QVariant encodingOption(const QString &codec, const QString &name) const = 0;
- virtual void setEncodingOption(const QString &codec, const QString &name, const QVariant &value) = 0;
-
-protected:
- QVideoEncoderControl(QObject *parent = 0);
-};
-
-#define QVideoEncoderControl_iid "com.nokia.Qt.QVideoEncoderControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QVideoEncoderControl, QVideoEncoderControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/qvideorenderercontrol.cpp b/src/multimedia/qvideorenderercontrol.cpp
deleted file mode 100644
index 9914226..0000000
--- a/src/multimedia/qvideorenderercontrol.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideorenderercontrol.h"
-
-#include "qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVideoRendererControl
-
-
- \brief The QVideoRendererControl class provides a control for rendering
- to a video surface.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- Using the surface() property of QVideoRendererControl a
- QAbstractVideoSurface may be set as the video render target of a
- QMediaService.
-
- \snippet doc/src/snippets/multimedia-snippets/video.cpp Video renderer control
-
- QVideoRendererControl is one of a number of possible video output controls.
-
- The interface name of QVideoRendererControl is \c com.nokia.Qt.QVideoRendererControl/1.0 as
- defined in QVideoRendererControl_iid.
-
- \sa QMediaService::requestControl(), QVideoWidget
-*/
-
-/*!
- \macro QVideoRendererControl_iid
-
- \c com.nokia.Qt.QVideoRendererControl/1.0
-
- Defines the interface name of the QVideoRendererControl class.
-
- \relates QVideoRendererControl
-*/
-
-/*!
- Constructs a new video renderer media end point with the given \a parent.
-*/
-QVideoRendererControl::QVideoRendererControl(QObject *parent)
- : QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a video renderer media end point.
-*/
-QVideoRendererControl::~QVideoRendererControl()
-{
-}
-
-/*!
- \fn QVideoRendererControl::surface() const
-
- Returns the surface a video producer renders to.
- \since 1.0
-*/
-
-/*!
- \fn QVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-
- Sets the \a surface a video producer renders to.
- \since 1.0
-*/
-
-#include "moc_qvideorenderercontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/qvideorenderercontrol.h b/src/multimedia/qvideorenderercontrol.h
deleted file mode 100644
index b3a7083..0000000
--- a/src/multimedia/qvideorenderercontrol.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEORENDERERCONTROL_H
-#define QVIDEORENDERERCONTROL_H
-
-#include "qmediacontrol.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-
-class Q_MULTIMEDIA_EXPORT QVideoRendererControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QVideoRendererControl();
-
- virtual QAbstractVideoSurface *surface() const = 0;
- virtual void setSurface(QAbstractVideoSurface *surface) = 0;
-
-protected:
- QVideoRendererControl(QObject *parent = 0);
-};
-
-#define QVideoRendererControl_iid "com.nokia.Qt.QVideoRendererControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QVideoRendererControl, QVideoRendererControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QVIDEORENDERERCONTROL_H
diff --git a/src/multimedia/qvideosurfaceoutput.cpp b/src/multimedia/qvideosurfaceoutput.cpp
deleted file mode 100644
index cdbec55..0000000
--- a/src/multimedia/qvideosurfaceoutput.cpp
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideosurfaceoutput_p.h"
-
-#include <qabstractvideosurface.h>
-#include <qmediaservice.h>
-#include <qvideorenderercontrol.h>
-
-
-QVideoSurfaceOutput::QVideoSurfaceOutput(QObject*parent)
- : QObject(parent)
-{
-}
-
-QVideoSurfaceOutput::~QVideoSurfaceOutput()
-{
- if (m_control) {
- m_control.data()->setSurface(0);
- m_service.data()->releaseControl(m_control.data());
- }
-}
-
-QMediaObject *QVideoSurfaceOutput::mediaObject() const
-{
- return m_object.data();
-}
-
-void QVideoSurfaceOutput::setVideoSurface(QAbstractVideoSurface *surface)
-{
- m_surface = surface;
-
- if (m_control)
- m_control.data()->setSurface(surface);
-}
-
-bool QVideoSurfaceOutput::setMediaObject(QMediaObject *object)
-{
- if (m_control) {
- m_control.data()->setSurface(0);
- m_service.data()->releaseControl(m_control.data());
- }
- m_control.clear();
- m_service.clear();
- m_object.clear();
-
- if (object) {
- if (QMediaService *service = object->service()) {
- if (QMediaControl *control = service->requestControl(QVideoRendererControl_iid)) {
- if ((m_control = qobject_cast<QVideoRendererControl *>(control))) {
- m_service = service;
- m_object = object;
- m_control.data()->setSurface(m_surface.data());
-
- return true;
- }
- service->releaseControl(control);
- }
- }
- }
- return false;
-}
diff --git a/src/multimedia/qvideosurfaceoutput_p.h b/src/multimedia/qvideosurfaceoutput_p.h
deleted file mode 100644
index 76ec5e8..0000000
--- a/src/multimedia/qvideosurfaceoutput_p.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOSURFACEOUTPUT_P_H
-#define QVIDEOSURFACEOUTPUT_P_H
-
-#include <qmediabindableinterface.h>
-
-#include <QtCore/qsharedpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoSurface;
-class QVideoRendererControl;
-
-class QVideoSurfaceOutput : public QObject, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
-public:
- QVideoSurfaceOutput(QObject*parent = 0);
- ~QVideoSurfaceOutput();
-
- QMediaObject *mediaObject() const;
-
- void setVideoSurface(QAbstractVideoSurface *surface);
-
-protected:
- bool setMediaObject(QMediaObject *object);
-
-private:
- QWeakPointer<QAbstractVideoSurface> m_surface;
- QWeakPointer<QVideoRendererControl> m_control;
- QWeakPointer<QMediaService> m_service;
- QWeakPointer<QMediaObject> m_object;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/video/qabstractvideobuffer.cpp b/src/multimedia/video/qabstractvideobuffer.cpp
deleted file mode 100644
index d0f07ab..0000000
--- a/src/multimedia/video/qabstractvideobuffer.cpp
+++ /dev/null
@@ -1,224 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qabstractvideobuffer_p.h"
-
-#include <qvariant.h>
-
-#include <QDebug>
-
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QAbstractVideoBuffer
- \brief The QAbstractVideoBuffer class is an abstraction for video data.
- \since 1.0
- \inmodule QtMultimedia
-
- The QVideoFrame class makes use of a QAbstractVideoBuffer internally to reference a buffer of
- video data. Creating a subclass of QAbstractVideoBuffer will allow you to construct video
- frames from preallocated or static buffers.
-
- The contents of a buffer can be accessed by mapping the buffer to memory using the map()
- function which returns a pointer to memory containing the contents of the the video buffer.
- The memory returned by map() is released by calling the unmap() function.
-
- The handle() of a buffer may also be used to manipulate its contents using type specific APIs.
- The type of a buffer's handle is given by the handleType() function.
-
- \sa QVideoFrame
-*/
-
-/*!
- \enum QAbstractVideoBuffer::HandleType
-
- Identifies the type of a video buffers handle.
-
- \value NoHandle The buffer has no handle, its data can only be accessed by mapping the buffer.
- \value GLTextureHandle The handle of the buffer is an OpenGL texture ID.
- \value XvShmImageHandle The handle contains pointer to shared memory XVideo image.
- \value CoreImageHandle The handle contains pointer to Mac OS X CIImage.
- \value QPixmapHandle The handle of the buffer is a QPixmap.
- \value UserHandle Start value for user defined handle types.
-
- \sa handleType()
-*/
-
-/*!
- \enum QAbstractVideoBuffer::MapMode
-
- Enumerates how a video buffer's data is mapped to memory.
-
- \value NotMapped The video buffer has is not mapped to memory.
- \value ReadOnly The mapped memory is populated with data from the video buffer when mapped, but
- the content of the mapped memory may be discarded when unmapped.
- \value WriteOnly The mapped memory is uninitialized when mapped, and the content will be used to
- populate the video buffer when unmapped.
- \value ReadWrite The mapped memory is populated with data from the video buffer, and the
- video buffer is repopulated with the content of the mapped memory.
-
- \sa mapMode(), map()
-*/
-
-/*!
- Constructs an abstract video buffer of the given \a type.
-*/
-QAbstractVideoBuffer::QAbstractVideoBuffer(HandleType type)
- : d_ptr(new QAbstractVideoBufferPrivate)
-{
- Q_D(QAbstractVideoBuffer);
-
- d->handleType = type;
-}
-
-/*!
- \internal
-*/
-QAbstractVideoBuffer::QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type)
- : d_ptr(&dd)
-{
- Q_D(QAbstractVideoBuffer);
-
- d->handleType = type;
-}
-
-/*!
- Destroys an abstract video buffer.
-*/
-QAbstractVideoBuffer::~QAbstractVideoBuffer()
-{
- delete d_ptr;
-}
-
-/*!
- Returns the type of a video buffer's handle.
-
- \since 1.0
- \sa handle()
-*/
-QAbstractVideoBuffer::HandleType QAbstractVideoBuffer::handleType() const
-{
- return d_func()->handleType;
-}
-
-/*!
- \fn QAbstractVideoBuffer::mapMode() const
-
- Returns the mode a video buffer is mapped in.
-
- \since 1.0
- \sa map()
-*/
-
-/*!
- \fn QAbstractVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-
- Maps the contents of a video buffer to memory.
-
- The map \a mode indicates whether the contents of the mapped memory should be read from and/or
- written to the buffer. If the map mode includes the QAbstractVideoBuffer::ReadOnly flag the
- mapped memory will be populated with the content of the video buffer when mapped. If the map
- mode includes the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be
- persisted in the buffer when unmapped.
-
- When access to the data is no longer needed be sure to call the unmap() function to release the
- mapped memory.
-
- Returns a pointer to the mapped memory region, or a null pointer if the mapping failed. The
- size in bytes of the mapped memory region is returned in \a numBytes, and the line stride in \a
- bytesPerLine.
-
- When access to the data is no longer needed be sure to unmap() the buffer.
-
- \note Writing to memory that is mapped as read-only is undefined, and may result in changes
- to shared data.
-
- \since 1.0
- \sa unmap(), mapMode()
-*/
-
-/*!
- \fn QAbstractVideoBuffer::unmap()
-
- Releases the memory mapped by the map() function
-
- If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the QAbstractVideoBuffer::WriteOnly
- flag this will persist the current content of the mapped memory to the video frame.
-
- \since 1.0
- \sa map()
-*/
-
-/*!
- Returns a type specific handle to the data buffer.
-
- The type of the handle is given by handleType() function.
-
- \since 1.0
- \sa handleType()
-*/
-QVariant QAbstractVideoBuffer::handle() const
-{
- return QVariant();
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-QDebug operator<<(QDebug dbg, QAbstractVideoBuffer::HandleType type)
-{
- switch (type) {
- case QAbstractVideoBuffer::NoHandle:
- return dbg.nospace() << "NoHandle";
- case QAbstractVideoBuffer::GLTextureHandle:
- return dbg.nospace() << "GLTextureHandle";
- case QAbstractVideoBuffer::XvShmImageHandle:
- return dbg.nospace() << "XvShmImageHandle";
- case QAbstractVideoBuffer::CoreImageHandle:
- return dbg.nospace() << "CoreImageHandle";
- case QAbstractVideoBuffer::QPixmapHandle:
- return dbg.nospace() << "QPixmapHandle";
- default:
- return dbg.nospace() << QString(QLatin1String("UserHandle(%1)")).arg(int(type)).toAscii().constData();
- }
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/video/qabstractvideobuffer.h b/src/multimedia/video/qabstractvideobuffer.h
deleted file mode 100644
index a7f51f4..0000000
--- a/src/multimedia/video/qabstractvideobuffer.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTVIDEOBUFFER_H
-#define QABSTRACTVIDEOBUFFER_H
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-
-#include <QtCore/qmetatype.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QVariant;
-
-class QAbstractVideoBufferPrivate;
-
-class Q_MULTIMEDIA_EXPORT QAbstractVideoBuffer
-{
-public:
- enum HandleType
- {
- NoHandle,
- GLTextureHandle,
- XvShmImageHandle,
- CoreImageHandle,
- QPixmapHandle,
- UserHandle = 1000
- };
-
- enum MapMode
- {
- NotMapped = 0x00,
- ReadOnly = 0x01,
- WriteOnly = 0x02,
- ReadWrite = ReadOnly | WriteOnly
- };
-
- QAbstractVideoBuffer(HandleType type);
- virtual ~QAbstractVideoBuffer();
-
- HandleType handleType() const;
-
- virtual MapMode mapMode() const = 0;
-
- virtual uchar *map(MapMode mode, int *numBytes, int *bytesPerLine) = 0;
- virtual void unmap() = 0;
-
- virtual QVariant handle() const;
-
-protected:
- QAbstractVideoBuffer(QAbstractVideoBufferPrivate &dd, HandleType type);
-
- QAbstractVideoBufferPrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QAbstractVideoBuffer)
- Q_DISABLE_COPY(QAbstractVideoBuffer)
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QAbstractVideoBuffer::HandleType);
-#endif
-
-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
deleted file mode 100644
index b808e5d..0000000
--- a/src/multimedia/video/qabstractvideobuffer_p.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTVIDEOBUFFER_P_H
-#define QABSTRACTVIDEOBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qshareddata.h>
-#include "qabstractvideobuffer.h"
-
-#include <qtmultimediadefs.h>
-#include <qtmedianamespace.h>
-
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QAbstractVideoBufferPrivate
-{
-public:
- QAbstractVideoBufferPrivate()
- : handleType(QAbstractVideoBuffer::NoHandle)
- {}
-
- virtual ~QAbstractVideoBufferPrivate()
- {}
-
- QAbstractVideoBuffer::HandleType handleType;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/video/qabstractvideosurface.cpp b/src/multimedia/video/qabstractvideosurface.cpp
deleted file mode 100644
index 4d65d7e..0000000
--- a/src/multimedia/video/qabstractvideosurface.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//TESTED_COMPONENT=src/multimedia
-
-#include "qabstractvideosurface.h"
-
-#include "qvideosurfaceformat.h"
-
-#include <QtCore/qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-Q_DECLARE_METATYPE(QVideoSurfaceFormat)
-Q_DECLARE_METATYPE(QAbstractVideoSurface::Error)
-
-/*!
- \class QAbstractVideoSurface
- \brief The QAbstractVideoSurface class is a base class for video presentation surfaces.
- \since 1.0
- \inmodule QtMultimedia
-
- A video surface presents a continuous stream of identically formatted frames, where the format
- of each frame is compatible with a stream format supplied when starting a presentation.
-
- The QAbstractVideoSurface class defines the standard interface that video producers use to
- inter-operate with video presentation surfaces. It is not supposed to be instantiated directly.
- Instead, you should subclass it to create new video surfaces.
-
- A list of pixel formats a surface can present is given by the supportedPixelFormats() function,
- and the isFormatSupported() function will test if a video surface format is supported. If a
- format is not supported the nearestFormat() function may be able to suggest a similar format.
- For example, if a surface supports fixed set of resolutions it may suggest the smallest
- supported resolution that contains the proposed resolution.
-
- The start() function takes a supported format and enables a video surface. Once started a
- surface will begin displaying the frames it receives in the present() function. Surfaces may
- hold a reference to the buffer of a presented video frame until a new frame is presented or
- streaming is stopped. The stop() function will disable a surface and a release any video
- buffers it holds references to.
-*/
-
-/*!
- \enum QAbstractVideoSurface::Error
- This enum describes the errors that may be returned by the error() function.
-
- \value NoError No error occurred.
- \value UnsupportedFormatError A video format was not supported.
- \value IncorrectFormatError A video frame was not compatible with the format of the surface.
- \value StoppedError The surface has not been started.
- \value ResourceError The surface could not allocate some resource.
-*/
-
-/*!
- Constructs a video surface with the given \a parent.
-*/
-QAbstractVideoSurface::QAbstractVideoSurface(QObject *parent)
- : QObject(parent)
-{
- setProperty("_q_surfaceFormat", QVariant::fromValue(QVideoSurfaceFormat()));
- setProperty("_q_active", false);
- setProperty("_q_error", QVariant::fromValue(QAbstractVideoSurface::NoError));
- setProperty("_q_nativeResolution", QSize());
-}
-
-// XXX Qt5
-/*!
- \internal
-
- This is deprecated.
-
- Since we need to build without access to Qt's private headers we can't reliably inherit
- from QObjectPrivate. Binary compatibility means we can't remove this constructor or
- add a d pointer to QAbstractVideoSurface.
-*/
-QAbstractVideoSurface::QAbstractVideoSurface(QAbstractVideoSurfacePrivate &, QObject *parent)
- : QObject(parent)
-{
-}
-
-/*!
- Destroys a video surface.
-*/
-QAbstractVideoSurface::~QAbstractVideoSurface()
-{
-}
-
-/*!
- \fn QAbstractVideoSurface::supportedPixelFormats(QAbstractVideoBuffer::HandleType type) const
-
- Returns a list of pixel formats a video surface can present for a given handle \a type.
-
- The pixel formats returned for the QAbstractVideoBuffer::NoHandle type are valid for any buffer
- that can be mapped in read-only mode.
-
- Types that are first in the list can be assumed to be faster to render.
- \since 1.0
-*/
-
-/*!
- Tests a video surface \a format to determine if a surface can accept it.
-
- Returns true if the format is supported by the surface, and false otherwise.
- \since 1.0
-*/
-bool QAbstractVideoSurface::isFormatSupported(const QVideoSurfaceFormat &format) const
-{
- return supportedPixelFormats(format.handleType()).contains(format.pixelFormat());
-}
-
-/*!
- Returns a supported video surface format that is similar to \a format.
-
- A similar surface format is one that has the same \l {QVideoSurfaceFormat::pixelFormat()}{pixel
- format} and \l {QVideoSurfaceFormat::handleType()}{handle type} but may differ in some of the other
- properties. For example, if there are restrictions on the \l {QVideoSurfaceFormat::frameSize()}
- {frame sizes} a video surface can accept it may suggest a format with a larger frame size and
- a \l {QVideoSurfaceFormat::viewport()}{viewport} the size of the original frame size.
-
- If the format is already supported it will be returned unchanged, or if there is no similar
- supported format an invalid format will be returned.
- \since 1.0
-*/
-QVideoSurfaceFormat QAbstractVideoSurface::nearestFormat(const QVideoSurfaceFormat &format) const
-{
- return isFormatSupported(format)
- ? format
- : QVideoSurfaceFormat();
-}
-
-/*!
- \fn QAbstractVideoSurface::supportedFormatsChanged()
-
- Signals that the set of formats supported by a video surface has changed.
-
- \since 1.0
- \sa supportedPixelFormats(), isFormatSupported()
-*/
-
-/*!
- Returns the format of a video surface.
- \since 1.0
-*/
-QVideoSurfaceFormat QAbstractVideoSurface::surfaceFormat() const
-{
- return property("_q_format").value<QVideoSurfaceFormat>();
-}
-
-/*!
- \fn QAbstractVideoSurface::surfaceFormatChanged(const QVideoSurfaceFormat &format)
-
- Signals that the configured \a format of a video surface has changed.
-
- \since 1.0
- \sa surfaceFormat(), start()
-*/
-
-/*!
- Starts a video surface presenting \a format frames.
-
- Returns true if the surface was started, and false if an error occurred.
-
- \since 1.0
- \sa isActive(), stop()
-*/
-bool QAbstractVideoSurface::start(const QVideoSurfaceFormat &format)
-{
- bool wasActive = property("_q_active").toBool();
-
- setProperty("_q_active", true);
- setProperty("_q_format", QVariant::fromValue(format));
- setProperty("_q_error", QVariant::fromValue(NoError));
-
- emit surfaceFormatChanged(format);
-
- if (!wasActive)
- emit activeChanged(true);
-
- return true;
-}
-
-/*!
- Stops a video surface presenting frames and releases any resources acquired in start().
-
- \since 1.0
- \sa isActive(), start()
-*/
-void QAbstractVideoSurface::stop()
-{
- if (property("_q_active").toBool()) {
- setProperty("_q_format", QVariant::fromValue(QVideoSurfaceFormat()));
- setProperty("_q_active", false);
-
- emit activeChanged(false);
- emit surfaceFormatChanged(surfaceFormat());
- }
-}
-
-/*!
- Indicates whether a video surface has been started.
-
- Returns true if the surface has been started, and false otherwise.
- \since 1.0
-*/
-bool QAbstractVideoSurface::isActive() const
-{
- return property("_q_active").toBool();
-}
-
-/*!
- \fn QAbstractVideoSurface::activeChanged(bool active)
-
- Signals that the \a active state of a video surface has changed.
-
- \since 1.0
- \sa isActive(), start(), stop()
-*/
-
-/*!
- \fn QAbstractVideoSurface::present(const QVideoFrame &frame)
-
- Presents a video \a frame.
-
- Returns true if the frame was presented, and false if an error occurred.
-
- Not all surfaces will block until the presentation of a frame has completed. Calling present()
- on a non-blocking surface may fail if called before the presentation of a previous frame has
- completed. In such cases the surface may not return to a ready state until it has had an
- opportunity to process events.
-
- If present() fails for any other reason the surface will immediately enter the stopped state
- and an error() value will be set.
-
- A video surface must be in the started state for present() to succeed, and the format of the
- video frame must be compatible with the current video surface format.
-
- \since 1.0
- \sa error()
-*/
-
-/*!
- Returns the last error that occurred.
-
- If a surface fails to start(), or stops unexpectedly this function can be called to discover
- what error occurred.
- \since 1.0
-*/
-
-QAbstractVideoSurface::Error QAbstractVideoSurface::error() const
-{
- return property("_q_error").value<QAbstractVideoSurface::Error>();
-}
-
-/*!
- Sets the value of error() to \a error.
- \since 1.0
-*/
-void QAbstractVideoSurface::setError(Error error)
-{
- setProperty("_q_error", QVariant::fromValue(error));
-}
-
-/*!
- \property QAbstractVideoSurface::nativeResolution
-
- The native resolution of video surface.
- This is the resolution of video frames the surface
- can render with optimal quality and/or performance.
-
- The native resolution is not always known and can be changed during playback.
- \since 1.1
- */
-QSize QAbstractVideoSurface::nativeResolution() const
-{
- return property("_q_nativeResolution").toSize();
-}
-
-/*!
- Set the video surface native \a resolution.
- \since 1.1
- */
-void QAbstractVideoSurface::setNativeResolution(const QSize &resolution)
-{
- const QSize nativeResolution = property("_q_nativeResolution").toSize();
-
- if (nativeResolution != resolution) {
- setProperty("_q_nativeResolution", resolution);
-
- emit nativeResolutionChanged(resolution);
- }
-}
-/*!
- \fn QAbstractVideoSurface::nativeResolutionChanged(const QSize &resolution);
-
- Signals the native \a resolution of video surface has changed.
- \since 1.1
-*/
-
-QT_END_NAMESPACE
-
-#include "moc_qabstractvideosurface.cpp"
-
diff --git a/src/multimedia/video/qabstractvideosurface.h b/src/multimedia/video/qabstractvideosurface.h
deleted file mode 100644
index 37c4d38..0000000
--- a/src/multimedia/video/qabstractvideosurface.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QABSTRACTVIDEOSURFACE_H
-#define QABSTRACTVIDEOSURFACE_H
-
-#include <QtCore/qobject.h>
-#include <qvideoframe.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QRectF;
-class QVideoSurfaceFormat;
-
-class QAbstractVideoSurfacePrivate;
-
-class Q_MULTIMEDIA_EXPORT QAbstractVideoSurface : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QSize nativeResolution READ nativeResolution NOTIFY nativeResolutionChanged)
-public:
- enum Error
- {
- NoError,
- UnsupportedFormatError,
- IncorrectFormatError,
- StoppedError,
- ResourceError
- };
-
- explicit QAbstractVideoSurface(QObject *parent = 0);
- ~QAbstractVideoSurface();
-
- virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const = 0;
- virtual bool isFormatSupported(const QVideoSurfaceFormat &format) const;
- virtual QVideoSurfaceFormat nearestFormat(const QVideoSurfaceFormat &format) const;
-
- QVideoSurfaceFormat surfaceFormat() const;
-
- QSize nativeResolution() const;
-
- virtual bool start(const QVideoSurfaceFormat &format);
- virtual void stop();
-
- bool isActive() const;
-
- virtual bool present(const QVideoFrame &frame) = 0;
-
- Error error() const;
-
-Q_SIGNALS:
- void activeChanged(bool active);
- void surfaceFormatChanged(const QVideoSurfaceFormat &format);
- void supportedFormatsChanged();
- void nativeResolutionChanged(const QSize &);
-
-protected:
- QAbstractVideoSurface(QAbstractVideoSurfacePrivate &dd, QObject *parent);
-
- void setError(Error error);
- void setNativeResolution(const QSize &resolution);
-
-private:
- Q_DECLARE_PRIVATE(QAbstractVideoSurface)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimedia/video/qimagevideobuffer.cpp b/src/multimedia/video/qimagevideobuffer.cpp
deleted file mode 100644
index e16abc3..0000000
--- a/src/multimedia/video/qimagevideobuffer.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qimagevideobuffer_p.h"
-
-#include "qabstractvideobuffer_p.h"
-
-#include <qimage.h>
-#include <qvariant.h>
-
-QT_BEGIN_NAMESPACE
-
-class QImageVideoBufferPrivate : public QAbstractVideoBufferPrivate
-{
-public:
- QImageVideoBufferPrivate()
- : mapMode(QAbstractVideoBuffer::NotMapped)
- {
- }
-
- QAbstractVideoBuffer::MapMode mapMode;
- QImage image;
-};
-
-QImageVideoBuffer::QImageVideoBuffer(const QImage &image)
- : QAbstractVideoBuffer(*new QImageVideoBufferPrivate, NoHandle)
-{
- Q_D(QImageVideoBuffer);
-
- d->image = image;
-}
-
-QImageVideoBuffer::~QImageVideoBuffer()
-{
-}
-
-QAbstractVideoBuffer::MapMode QImageVideoBuffer::mapMode() const
-{
- return d_func()->mapMode;
-}
-
-uchar *QImageVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-{
- Q_D(QImageVideoBuffer);
-
- if (d->mapMode == NotMapped && d->image.bits() && mode != NotMapped) {
- d->mapMode = mode;
-
- if (numBytes)
- *numBytes = d->image.byteCount();
-
- if (bytesPerLine)
- *bytesPerLine = d->image.bytesPerLine();
-
- return d->image.bits();
- } else {
- return 0;
- }
-}
-
-void QImageVideoBuffer::unmap()
-{
- Q_D(QImageVideoBuffer);
-
- d->mapMode = NotMapped;
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/video/qimagevideobuffer_p.h b/src/multimedia/video/qimagevideobuffer_p.h
deleted file mode 100644
index dae952e..0000000
--- a/src/multimedia/video/qimagevideobuffer_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QIMAGEVIDEOBUFFER_P_H
-#define QIMAGEVIDEOBUFFER_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qabstractvideobuffer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QImage;
-
-class QImageVideoBufferPrivate;
-
-class Q_MULTIMEDIA_EXPORT QImageVideoBuffer : public QAbstractVideoBuffer
-{
- Q_DECLARE_PRIVATE(QImageVideoBuffer)
-public:
- QImageVideoBuffer(const QImage &image);
- ~QImageVideoBuffer();
-
- MapMode mapMode() const;
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimedia/video/qmemoryvideobuffer.cpp b/src/multimedia/video/qmemoryvideobuffer.cpp
deleted file mode 100644
index d351618..0000000
--- a/src/multimedia/video/qmemoryvideobuffer.cpp
+++ /dev/null
@@ -1,132 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmemoryvideobuffer_p.h"
-
-#include "qabstractvideobuffer_p.h"
-#include <qbytearray.h>
-
-QT_BEGIN_NAMESPACE
-
-class QMemoryVideoBufferPrivate : public QAbstractVideoBufferPrivate
-{
-public:
- QMemoryVideoBufferPrivate()
- : bytesPerLine(0)
- , mapMode(QAbstractVideoBuffer::NotMapped)
- {
- }
-
- int bytesPerLine;
- QAbstractVideoBuffer::MapMode mapMode;
- QByteArray data;
-};
-
-/*!
- \class QMemoryVideoBuffer
- \brief The QMemoryVideoBuffer class provides a system memory allocated video data buffer.
- \internal
-
- QMemoryVideoBuffer is the default video buffer for allocating system memory. It may be used to
- allocate memory for a QVideoFrame without implementing your own QAbstractVideoBuffer.
-*/
-
-/*!
- Constructs a video buffer with an image stride of \a bytesPerLine from a byte \a array.
-*/
-QMemoryVideoBuffer::QMemoryVideoBuffer(const QByteArray &array, int bytesPerLine)
- : QAbstractVideoBuffer(*new QMemoryVideoBufferPrivate, NoHandle)
-{
- Q_D(QMemoryVideoBuffer);
-
- d->data = array;
- d->bytesPerLine = bytesPerLine;
-}
-
-/*!
- Destroys a system memory allocated video buffer.
-*/
-QMemoryVideoBuffer::~QMemoryVideoBuffer()
-{
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-QAbstractVideoBuffer::MapMode QMemoryVideoBuffer::mapMode() const
-{
- return d_func()->mapMode;
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-uchar *QMemoryVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-{
- Q_D(QMemoryVideoBuffer);
-
- if (d->mapMode == NotMapped && d->data.data() && mode != NotMapped) {
- d->mapMode = mode;
-
- if (numBytes)
- *numBytes = d->data.size();
-
- if (bytesPerLine)
- *bytesPerLine = d->bytesPerLine;
-
- return reinterpret_cast<uchar *>(d->data.data());
- } else {
- return 0;
- }
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-void QMemoryVideoBuffer::unmap()
-{
- d_func()->mapMode = NotMapped;
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/video/qmemoryvideobuffer_p.h b/src/multimedia/video/qmemoryvideobuffer_p.h
deleted file mode 100644
index d5bc4e3..0000000
--- a/src/multimedia/video/qmemoryvideobuffer_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QMEMORYVIDEOBUFFER_P_H
-#define QMEMORYVIDEOBUFFER_P_H
-
-#include <qabstractvideobuffer.h>
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMemoryVideoBufferPrivate;
-
-class Q_MULTIMEDIA_EXPORT QMemoryVideoBuffer : public QAbstractVideoBuffer
-{
- Q_DECLARE_PRIVATE(QMemoryVideoBuffer)
-public:
- QMemoryVideoBuffer(const QByteArray &data, int bytesPerLine);
- ~QMemoryVideoBuffer();
-
- MapMode mapMode() const;
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimedia/video/qvideoframe.cpp b/src/multimedia/video/qvideoframe.cpp
deleted file mode 100644
index efcb4d5..0000000
--- a/src/multimedia/video/qvideoframe.cpp
+++ /dev/null
@@ -1,843 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideoframe.h"
-
-#include "qimagevideobuffer_p.h"
-#include "qmemoryvideobuffer_p.h"
-
-#include <qimage.h>
-#include <qpair.h>
-#include <qsize.h>
-#include <qvariant.h>
-#include <qvector.h>
-
-#include <QDebug>
-
-QT_BEGIN_NAMESPACE
-
-namespace
-{
-class QVideoFramePrivateRegisterMetaTypes
-{
-public:
- QVideoFramePrivateRegisterMetaTypes()
- {
- qRegisterMetaType<QVideoFrame::PixelFormat>("QVideoFrame::PixelFormat");
- }
-} _registerMetaTypes;
-}
-
-
-class QVideoFramePrivate : public QSharedData
-{
-public:
- QVideoFramePrivate()
- : startTime(-1)
- , endTime(-1)
- , data(0)
- , mappedBytes(0)
- , bytesPerLine(0)
- , pixelFormat(QVideoFrame::Format_Invalid)
- , fieldType(QVideoFrame::ProgressiveFrame)
- , buffer(0)
- {
- }
-
- QVideoFramePrivate(const QSize &size, QVideoFrame::PixelFormat format)
- : size(size)
- , startTime(-1)
- , endTime(-1)
- , data(0)
- , mappedBytes(0)
- , bytesPerLine(0)
- , pixelFormat(format)
- , fieldType(QVideoFrame::ProgressiveFrame)
- , buffer(0)
- {
- }
-
- ~QVideoFramePrivate()
- {
- delete buffer;
- }
-
- QSize size;
- qint64 startTime;
- qint64 endTime;
- uchar *data;
- int mappedBytes;
- int bytesPerLine;
- QVideoFrame::PixelFormat pixelFormat;
- QVideoFrame::FieldType fieldType;
- QAbstractVideoBuffer *buffer;
-
-private:
- Q_DISABLE_COPY(QVideoFramePrivate)
-};
-
-/*!
- \class QVideoFrame
- \brief The QVideoFrame class provides a representation of a frame of video data.
- \since 1.0
- \inmodule QtMultimedia
-
- A QVideoFrame encapsulates the data of a video frame, and information about the frame.
-
- The contents of a video frame can be mapped to memory using the map() function. While
- mapped, the video data can accessed using the bits() function, which returns a pointer to a
- buffer. The total size of this buffer is given by the mappedBytes() function, and the size of each line is given
- by bytesPerLine(). The return value of the handle() function may be used to access frame data
- using the internal buffer's native APIs.
-
- The video data in a QVideoFrame is encapsulated in a QAbstractVideoBuffer. A QVideoFrame
- may be constructed from any buffer type by subclassing the QAbstractVideoBuffer class.
-
- \note QVideoFrame is explicitly shared, any change made to video frame will also apply to any
- copies.
-*/
-
-/*!
- \enum QVideoFrame::PixelFormat
-
- Enumerates video data types.
-
- \value Format_Invalid
- The frame is invalid.
-
- \value Format_ARGB32
- The frame is stored using a 32-bit ARGB format (0xAARRGGBB). This is equivalent to
- QImage::Format_ARGB32.
-
- \value Format_ARGB32_Premultiplied
- The frame stored using a premultiplied 32-bit ARGB format (0xAARRGGBB). This is equivalent
- to QImage::Format_ARGB32_Premultiplied.
-
- \value Format_RGB32
- The frame stored using a 32-bit RGB format (0xffRRGGBB). This is equivalent to
- QImage::Format_RGB32
-
- \value Format_RGB24
- The frame is stored using a 24-bit RGB format (8-8-8). This is equivalent to
- QImage::Format_RGB888
-
- \value Format_RGB565
- The frame is stored using a 16-bit RGB format (5-6-5). This is equivalent to
- QImage::Format_RGB16.
-
- \value Format_RGB555
- The frame is stored using a 16-bit RGB format (5-5-5). This is equivalent to
- QImage::Format_RGB555.
-
- \value Format_ARGB8565_Premultiplied
- The frame is stored using a 24-bit premultiplied ARGB format (8-6-6-5).
-
- \value Format_BGRA32
- The frame is stored using a 32-bit ARGB format (0xBBGGRRAA).
-
- \value Format_BGRA32_Premultiplied
- The frame is stored using a premultiplied 32bit BGRA format.
-
- \value Format_BGR32
- The frame is stored using a 32-bit BGR format (0xBBGGRRff).
-
- \value Format_BGR24
- The frame is stored using a 24-bit BGR format (0xBBGGRR).
-
- \value Format_BGR565
- The frame is stored using a 16-bit BGR format (5-6-5).
-
- \value Format_BGR555
- The frame is stored using a 16-bit BGR format (5-5-5).
-
- \value Format_BGRA5658_Premultiplied
- The frame is stored using a 24-bit premultiplied BGRA format (5-6-5-8).
-
- \value Format_AYUV444
- The frame is stored using a packed 32-bit AYUV format (0xAAYYUUVV).
-
- \value Format_AYUV444_Premultiplied
- The frame is stored using a packed premultiplied 32-bit AYUV format (0xAAYYUUVV).
-
- \value Format_YUV444
- The frame is stored using a 24-bit packed YUV format (8-8-8).
-
- \value Format_YUV420P
- The frame is stored using an 8-bit per component planar YUV format with the U and V planes
- horizontally and vertically sub-sampled, i.e. the height and width of the U and V planes are
- half that of the Y plane.
-
- \value Format_YV12
- The frame is stored using an 8-bit per component planar YVU format with the V and U planes
- horizontally and vertically sub-sampled, i.e. the height and width of the V and U planes are
- half that of the Y plane.
-
- \value Format_UYVY
- The frame is stored using an 8-bit per component packed YUV format with the U and V planes
- horizontally sub-sampled (U-Y-V-Y), i.e. two horizontally adjacent pixels are stored as a 32-bit
- macropixel which has a Y value for each pixel and common U and V values.
-
- \value Format_YUYV
- The frame is stored using an 8-bit per component packed YUV format with the U and V planes
- horizontally sub-sampled (Y-U-Y-V), i.e. two horizontally adjacent pixels are stored as a 32-bit
- macropixel which has a Y value for each pixel and common U and V values.
-
- \value Format_NV12
- The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y)
- followed by a horizontally and vertically sub-sampled, packed UV plane (U-V).
-
- \value Format_NV21
- The frame is stored using an 8-bit per component semi-planar YUV format with a Y plane (Y)
- followed by a horizontally and vertically sub-sampled, packed VU plane (V-U).
-
- \value Format_IMC1
- The frame is stored using an 8-bit per component planar YUV format with the U and V planes
- horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except
- that the bytes per line of the U and V planes are padded out to the same stride as the Y plane.
-
- \value Format_IMC2
- The frame is stored using an 8-bit per component planar YUV format with the U and V planes
- horizontally and vertically sub-sampled. This is similar to the Format_YUV420P type, except
- that the lines of the U and V planes are interleaved, i.e. each line of U data is followed by a
- line of V data creating a single line of the same stride as the Y data.
-
- \value Format_IMC3
- The frame is stored using an 8-bit per component planar YVU format with the V and U planes
- horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that
- the bytes per line of the V and U planes are padded out to the same stride as the Y plane.
-
- \value Format_IMC4
- The frame is stored using an 8-bit per component planar YVU format with the V and U planes
- horizontally and vertically sub-sampled. This is similar to the Format_YV12 type, except that
- the lines of the V and U planes are interleaved, i.e. each line of V data is followed by a line
- of U data creating a single line of the same stride as the Y data.
-
- \value Format_Y8
- The frame is stored using an 8-bit greyscale format.
-
- \value Format_Y16
- The frame is stored using a 16-bit linear greyscale format. Little endian.
-
- \value Format_Jpeg
- The frame is stored in compressed Jpeg format.
-
- \value Format_CameraRaw
- The frame is stored using a device specific camera raw format.
-
- \value Format_AdobeDng
- The frame is stored using raw Adobe Digital Negative (DNG) format.
-
- \value Format_User
- Start value for user defined pixel formats.
-*/
-
-/*!
- \enum QVideoFrame::FieldType
-
- Specifies the field an interlaced video frame belongs to.
-
- \value ProgressiveFrame The frame is not interlaced.
- \value TopField The frame contains a top field.
- \value BottomField The frame contains a bottom field.
- \value InterlacedFrame The frame contains a merged top and bottom field.
-*/
-
-/*!
- Constructs a null video frame.
-*/
-QVideoFrame::QVideoFrame()
- : d(new QVideoFramePrivate)
-{
-}
-
-/*!
- Constructs a video frame from a \a buffer with the given pixel \a format and \a size in pixels.
-
- \note This doesn't increment the reference count of the video buffer.
- \since 1.0
-*/
-QVideoFrame::QVideoFrame(
- QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format)
- : d(new QVideoFramePrivate(size, format))
-{
- d->buffer = buffer;
-}
-
-/*!
- Constructs a video frame of the given pixel \a format and \a size in pixels.
-
- The \a bytesPerLine (stride) is the length of each scan line in bytes, and \a bytes is the total
- number of bytes that must be allocated for the frame.
- \since 1.0
-*/
-QVideoFrame::QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format)
- : d(new QVideoFramePrivate(size, format))
-{
- if (bytes > 0) {
- QByteArray data;
- data.resize(bytes);
-
- // Check the memory was successfully allocated.
- if (!data.isEmpty())
- d->buffer = new QMemoryVideoBuffer(data, bytesPerLine);
- }
-}
-
-/*!
- Constructs a video frame from an \a image.
-
- \note This will construct an invalid video frame if there is no frame type equivalent to the
- image format.
-
- \since 1.0
- \sa pixelFormatFromImageFormat()
-*/
-QVideoFrame::QVideoFrame(const QImage &image)
- : d(new QVideoFramePrivate(
- image.size(), pixelFormatFromImageFormat(image.format())))
-{
- if (d->pixelFormat != Format_Invalid)
- d->buffer = new QImageVideoBuffer(image);
-}
-
-/*!
- Constructs a copy of \a other.
-
- \since 1.0
-*/
-QVideoFrame::QVideoFrame(const QVideoFrame &other)
- : d(other.d)
-{
-}
-
-/*!
- Assigns the contents of \a other to a video frame.
- \since 1.0
-*/
-QVideoFrame &QVideoFrame::operator =(const QVideoFrame &other)
-{
- d = other.d;
-
- return *this;
-}
-
-/*!
- Destroys a video frame.
-*/
-QVideoFrame::~QVideoFrame()
-{
-}
-
-/*!
- Identifies whether a video frame is valid.
-
- An invalid frame has no video buffer associated with it.
-
- Returns true if the frame is valid, and false if it is not.
- \since 1.0
-*/
-bool QVideoFrame::isValid() const
-{
- return d->buffer != 0;
-}
-
-/*!
- Returns the color format of a video frame.
- \since 1.0
-*/
-QVideoFrame::PixelFormat QVideoFrame::pixelFormat() const
-{
- return d->pixelFormat;
-}
-
-/*!
- Returns the type of a video frame's handle.
-
- \since 1.0
-*/
-QAbstractVideoBuffer::HandleType QVideoFrame::handleType() const
-{
- return d->buffer ? d->buffer->handleType() : QAbstractVideoBuffer::NoHandle;
-}
-
-/*!
- Returns the dimensions of a video frame.
- \since 1.0
-*/
-QSize QVideoFrame::size() const
-{
- return d->size;
-}
-
-/*!
- Returns the width of a video frame.
- \since 1.0
-*/
-int QVideoFrame::width() const
-{
- return d->size.width();
-}
-
-/*!
- Returns the height of a video frame.
- \since 1.0
-*/
-int QVideoFrame::height() const
-{
- return d->size.height();
-}
-
-/*!
- Returns the field an interlaced video frame belongs to.
-
- If the video is not interlaced this will return WholeFrame.
- \since 1.0
-*/
-QVideoFrame::FieldType QVideoFrame::fieldType() const
-{
- return d->fieldType;
-}
-
-/*!
- Sets the \a field an interlaced video frame belongs to.
- \since 1.0
-*/
-void QVideoFrame::setFieldType(QVideoFrame::FieldType field)
-{
- d->fieldType = field;
-}
-
-/*!
- Identifies if a video frame's contents are currently mapped to system memory.
-
- This is a convenience function which checks that the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- of the frame is not equal to QAbstractVideoBuffer::NotMapped.
-
- Returns true if the contents of the video frame are mapped to system memory, and false
- otherwise.
-
- \since 1.0
- \sa mapMode(), QAbstractVideoBuffer::MapMode
-*/
-
-bool QVideoFrame::isMapped() const
-{
- return d->buffer != 0 && d->buffer->mapMode() != QAbstractVideoBuffer::NotMapped;
-}
-
-/*!
- Identifies if the mapped contents of a video frame will be persisted when the frame is unmapped.
-
- This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- contains the QAbstractVideoBuffer::WriteOnly flag.
-
- Returns true if the video frame will be updated when unmapped, and false otherwise.
-
- \note The result of altering the data of a frame that is mapped in read-only mode is undefined.
- Depending on the buffer implementation the changes may be persisted, or worse alter a shared
- buffer.
-
- \since 1.0
- \sa mapMode(), QAbstractVideoBuffer::MapMode
-*/
-bool QVideoFrame::isWritable() const
-{
- return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::WriteOnly);
-}
-
-/*!
- Identifies if the mapped contents of a video frame were read from the frame when it was mapped.
-
- This is a convenience function which checks if the \l {QAbstractVideoBuffer::MapMode}{MapMode}
- contains the QAbstractVideoBuffer::WriteOnly flag.
-
- Returns true if the contents of the mapped memory were read from the video frame, and false
- otherwise.
-
- \since 1.0
- \sa mapMode(), QAbstractVideoBuffer::MapMode
-*/
-bool QVideoFrame::isReadable() const
-{
- return d->buffer != 0 && (d->buffer->mapMode() & QAbstractVideoBuffer::ReadOnly);
-}
-
-/*!
- Returns the mode a video frame was mapped to system memory in.
-
- \since 1.0
- \sa map(), QAbstractVideoBuffer::MapMode
-*/
-QAbstractVideoBuffer::MapMode QVideoFrame::mapMode() const
-{
- return d->buffer != 0 ? d->buffer->mapMode() : QAbstractVideoBuffer::NotMapped;
-}
-
-/*!
- Maps the contents of a video frame to memory.
-
- The map \a mode indicates whether the contents of the mapped memory should be read from and/or
- written to the frame. If the map mode includes the QAbstractVideoBuffer::ReadOnly flag the
- mapped memory will be populated with the content of the video frame when mapped. If the map
- mode inclues the QAbstractVideoBuffer::WriteOnly flag the content of the mapped memory will be
- persisted in the frame when unmapped.
-
- While mapped the contents of a video frame can be accessed directly through the pointer returned
- by the bits() function.
-
- When access to the data is no longer needed be sure to call the unmap() function to release the
- mapped memory and possibly update the video frame contents.
-
- Returns true if the buffer was mapped to memory in the given \a mode and false otherwise.
-
- \since 1.0
- \sa unmap(), mapMode(), bits()
-*/
-bool QVideoFrame::map(QAbstractVideoBuffer::MapMode mode)
-{
- if (d->buffer != 0 && d->data == 0) {
- Q_ASSERT(d->bytesPerLine == 0);
- Q_ASSERT(d->mappedBytes == 0);
-
- d->data = d->buffer->map(mode, &d->mappedBytes, &d->bytesPerLine);
-
- return d->data != 0;
- }
-
- return false;
-}
-
-/*!
- Releases the memory mapped by the map() function.
-
- If the \l {QAbstractVideoBuffer::MapMode}{MapMode} included the QAbstractVideoBuffer::WriteOnly
- flag this will persist the current content of the mapped memory to the video frame.
-
- \since 1.0
- \sa map()
-*/
-void QVideoFrame::unmap()
-{
- if (d->data != 0) {
- d->mappedBytes = 0;
- d->bytesPerLine = 0;
- d->data = 0;
-
- d->buffer->unmap();
- }
-}
-
-/*!
- Returns the number of bytes in a scan line.
-
- \note This is the bytes per line of the first plane only. The bytes per line of subsequent
- planes should be calculated as per the frame type.
-
- This value is only valid while the frame data is \l {map()}{mapped}.
-
- \since 1.0
- \sa bits(), map(), mappedBytes()
-*/
-int QVideoFrame::bytesPerLine() const
-{
- return d->bytesPerLine;
-}
-
-/*!
- Returns a pointer to the start of the frame data buffer.
-
- This value is only valid while the frame data is \l {map()}{mapped}.
-
- Changes made to data accessed via this pointer (when mapped with write access)
- are only guaranteed to have been persisted when unmap() is called.
-
- \since 1.0
- \sa map(), mappedBytes(), bytesPerLine()
-*/
-uchar *QVideoFrame::bits()
-{
- return d->data;
-}
-
-/*!
- Returns a pointer to the start of the frame data buffer.
-
- This value is only valid while the frame data is \l {map()}{mapped}.
-
- If the buffer was not mapped with read access, the contents of this
- buffer will initially be uninitialized.
-
- \since 1.0
- \sa map(), mappedBytes(), bytesPerLine()
-*/
-const uchar *QVideoFrame::bits() const
-{
- return d->data;
-}
-
-/*!
- Returns the number of bytes occupied by the mapped frame data.
-
- This value is only valid while the frame data is \l {map()}{mapped}.
-
- \since 1.0
- \sa map()
-*/
-int QVideoFrame::mappedBytes() const
-{
- return d->mappedBytes;
-}
-
-/*!
- Returns a type specific handle to a video frame's buffer.
-
- For an OpenGL texture this would be the texture ID.
-
- \since 1.0
- \sa QAbstractVideoBuffer::handle()
-*/
-QVariant QVideoFrame::handle() const
-{
- return d->buffer != 0 ? d->buffer->handle() : QVariant();
-}
-
-/*!
- Returns the presentation time when the frame should be displayed.
- \since 1.0
-*/
-qint64 QVideoFrame::startTime() const
-{
- return d->startTime;
-}
-
-/*!
- Sets the presentation \a time when the frame should be displayed.
- \since 1.0
-*/
-void QVideoFrame::setStartTime(qint64 time)
-{
- d->startTime = time;
-}
-
-/*!
- Returns the presentation time when a frame should stop being displayed.
-
- \since 1.0
-*/
-qint64 QVideoFrame::endTime() const
-{
- return d->endTime;
-}
-
-/*!
- Sets the presentation \a time when a frame should stop being displayed.
- \since 1.0
-*/
-void QVideoFrame::setEndTime(qint64 time)
-{
- d->endTime = time;
-}
-
-/*!
- Returns a video pixel format equivalent to an image \a format. If there is no equivalent
- format QVideoFrame::InvalidType is returned instead.
- \since 1.0
-*/
-QVideoFrame::PixelFormat QVideoFrame::pixelFormatFromImageFormat(QImage::Format format)
-{
- switch (format) {
- case QImage::Format_RGB32:
- return Format_RGB32;
- case QImage::Format_ARGB32:
- return Format_ARGB32;
- case QImage::Format_ARGB32_Premultiplied:
- return Format_ARGB32_Premultiplied;
- case QImage::Format_RGB16:
- return Format_RGB565;
- case QImage::Format_ARGB8565_Premultiplied:
- return Format_ARGB8565_Premultiplied;
- case QImage::Format_RGB555:
- return Format_RGB555;
- case QImage::Format_RGB888:
- return Format_RGB24;
- default:
- return Format_Invalid;
- }
-}
-
-/*!
- Returns an image format equivalent to a video frame pixel \a format. If there is no equivalent
- format QImage::Format_Invalid is returned instead.
- \since 1.0
-*/
-QImage::Format QVideoFrame::imageFormatFromPixelFormat(PixelFormat format)
-{
- switch (format) {
- case Format_Invalid:
- return QImage::Format_Invalid;
- case Format_ARGB32:
- return QImage::Format_ARGB32;
- case Format_ARGB32_Premultiplied:
- return QImage::Format_ARGB32_Premultiplied;
- case Format_RGB32:
- return QImage::Format_RGB32;
- case Format_RGB24:
- return QImage::Format_RGB888;
- case Format_RGB565:
- return QImage::Format_RGB16;
- case Format_RGB555:
- return QImage::Format_RGB555;
- case Format_ARGB8565_Premultiplied:
- return QImage::Format_ARGB8565_Premultiplied;
- case Format_BGRA32:
- case Format_BGRA32_Premultiplied:
- case Format_BGR32:
- case Format_BGR24:
- return QImage::Format_Invalid;
- case Format_BGR565:
- case Format_BGR555:
- case Format_BGRA5658_Premultiplied:
- case Format_AYUV444:
- case Format_AYUV444_Premultiplied:
- case Format_YUV444:
- case Format_YUV420P:
- case Format_YV12:
- case Format_UYVY:
- case Format_YUYV:
- case Format_NV12:
- case Format_NV21:
- case Format_IMC1:
- case Format_IMC2:
- case Format_IMC3:
- case Format_IMC4:
- case Format_Y8:
- case Format_Y16:
- case Format_Jpeg:
- case Format_CameraRaw:
- case Format_AdobeDng:
- return QImage::Format_Invalid;
- case Format_User:
- return QImage::Format_Invalid;
- }
- return QImage::Format_Invalid;
-}
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, QVideoFrame::PixelFormat pf)
-{
- switch (pf) {
- case QVideoFrame::Format_Invalid:
- return dbg.nospace() << "Format_Invalid";
- case QVideoFrame::Format_ARGB32:
- return dbg.nospace() << "Format_ARGB32";
- case QVideoFrame::Format_ARGB32_Premultiplied:
- return dbg.nospace() << "Format_ARGB32_Premultiplied";
- case QVideoFrame::Format_RGB32:
- return dbg.nospace() << "Format_RGB32";
- case QVideoFrame::Format_RGB24:
- return dbg.nospace() << "Format_RGB24";
- case QVideoFrame::Format_RGB565:
- return dbg.nospace() << "Format_RGB565";
- case QVideoFrame::Format_RGB555:
- return dbg.nospace() << "Format_RGB555";
- case QVideoFrame::Format_ARGB8565_Premultiplied:
- return dbg.nospace() << "Format_ARGB8565_Premultiplied";
- case QVideoFrame::Format_BGRA32:
- return dbg.nospace() << "Format_BGRA32";
- case QVideoFrame::Format_BGRA32_Premultiplied:
- return dbg.nospace() << "Format_BGRA32_Premultiplied";
- case QVideoFrame::Format_BGR32:
- return dbg.nospace() << "Format_BGR32";
- case QVideoFrame::Format_BGR24:
- return dbg.nospace() << "Format_BGR24";
- case QVideoFrame::Format_BGR565:
- return dbg.nospace() << "Format_BGR565";
- case QVideoFrame::Format_BGR555:
- return dbg.nospace() << "Format_BGR555";
- case QVideoFrame::Format_BGRA5658_Premultiplied:
- return dbg.nospace() << "Format_BGRA5658_Premultiplied";
- case QVideoFrame::Format_AYUV444:
- return dbg.nospace() << "Format_AYUV444";
- case QVideoFrame::Format_AYUV444_Premultiplied:
- return dbg.nospace() << "Format_AYUV444_Premultiplied";
- case QVideoFrame::Format_YUV444:
- return dbg.nospace() << "Format_YUV444";
- case QVideoFrame::Format_YUV420P:
- return dbg.nospace() << "Format_YUV420P";
- case QVideoFrame::Format_YV12:
- return dbg.nospace() << "Format_YV12";
- case QVideoFrame::Format_UYVY:
- return dbg.nospace() << "Format_UYVY";
- case QVideoFrame::Format_YUYV:
- return dbg.nospace() << "Format_YUYV";
- case QVideoFrame::Format_NV12:
- return dbg.nospace() << "Format_NV12";
- case QVideoFrame::Format_NV21:
- return dbg.nospace() << "Format_NV21";
- case QVideoFrame::Format_IMC1:
- return dbg.nospace() << "Format_IMC1";
- case QVideoFrame::Format_IMC2:
- return dbg.nospace() << "Format_IMC2";
- case QVideoFrame::Format_IMC3:
- return dbg.nospace() << "Format_IMC3";
- case QVideoFrame::Format_IMC4:
- return dbg.nospace() << "Format_IMC4";
- case QVideoFrame::Format_Y8:
- return dbg.nospace() << "Format_Y8";
- case QVideoFrame::Format_Y16:
- return dbg.nospace() << "Format_Y16";
- case QVideoFrame::Format_Jpeg:
- return dbg.nospace() << "Format_Jpeg";
- case QVideoFrame::Format_AdobeDng:
- return dbg.nospace() << "Format_AdobeDng";
- case QVideoFrame::Format_CameraRaw:
- return dbg.nospace() << "Format_CameraRaw";
-
- default:
- return dbg.nospace() << QString(QLatin1String("UserType(%1)" )).arg(int(pf)).toAscii().constData();
- }
-}
-
-#endif
-
-QT_END_NAMESPACE
-
diff --git a/src/multimedia/video/qvideoframe.h b/src/multimedia/video/qvideoframe.h
deleted file mode 100644
index 9797a58..0000000
--- a/src/multimedia/video/qvideoframe.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOFRAME_H
-#define QVIDEOFRAME_H
-
-#include <QtCore/qmetatype.h>
-#include <QtCore/qshareddata.h>
-#include <QtGui/qimage.h>
-#include <qabstractvideobuffer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QSize;
-class QVariant;
-
-class QVideoFramePrivate;
-
-class Q_MULTIMEDIA_EXPORT QVideoFrame
-{
-public:
- enum FieldType
- {
- ProgressiveFrame,
- TopField,
- BottomField,
- InterlacedFrame
- };
-
- enum PixelFormat
- {
- Format_Invalid,
- Format_ARGB32,
- Format_ARGB32_Premultiplied,
- Format_RGB32,
- Format_RGB24,
- Format_RGB565,
- Format_RGB555,
- Format_ARGB8565_Premultiplied,
- Format_BGRA32,
- Format_BGRA32_Premultiplied,
- Format_BGR32,
- Format_BGR24,
- Format_BGR565,
- Format_BGR555,
- Format_BGRA5658_Premultiplied,
-
- Format_AYUV444,
- Format_AYUV444_Premultiplied,
- Format_YUV444,
- Format_YUV420P,
- Format_YV12,
- Format_UYVY,
- Format_YUYV,
- Format_NV12,
- Format_NV21,
- Format_IMC1,
- Format_IMC2,
- Format_IMC3,
- Format_IMC4,
- Format_Y8,
- Format_Y16,
-
- Format_Jpeg,
-
- Format_CameraRaw,
- Format_AdobeDng,
-
- Format_User = 1000
- };
-
- QVideoFrame();
- QVideoFrame(QAbstractVideoBuffer *buffer, const QSize &size, PixelFormat format);
- QVideoFrame(int bytes, const QSize &size, int bytesPerLine, PixelFormat format);
- QVideoFrame(const QImage &image);
- QVideoFrame(const QVideoFrame &other);
- ~QVideoFrame();
-
- QVideoFrame &operator =(const QVideoFrame &other);
-
- bool isValid() const;
-
- PixelFormat pixelFormat() const;
-
- QAbstractVideoBuffer::HandleType handleType() const;
-
- QSize size() const;
- int width() const;
- int height() const;
-
- FieldType fieldType() const;
- void setFieldType(FieldType);
-
- bool isMapped() const;
- bool isReadable() const;
- bool isWritable() const;
-
- QAbstractVideoBuffer::MapMode mapMode() const;
-
- bool map(QAbstractVideoBuffer::MapMode mode);
- void unmap();
-
- int bytesPerLine() const;
-
- uchar *bits();
- const uchar *bits() const;
- int mappedBytes() const;
-
- QVariant handle() const;
-
- qint64 startTime() const;
- void setStartTime(qint64 time);
-
- qint64 endTime() const;
- void setEndTime(qint64 time);
-
- static PixelFormat pixelFormatFromImageFormat(QImage::Format format);
- static QImage::Format imageFormatFromPixelFormat(PixelFormat format);
-
-private:
- QExplicitlySharedDataPointer<QVideoFramePrivate> d;
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoFrame::PixelFormat );
-#endif
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QVideoFrame::FieldType)
-Q_DECLARE_METATYPE(QVideoFrame::PixelFormat)
-
-QT_END_HEADER
-
-#endif
-
diff --git a/src/multimedia/video/qvideosurfaceformat.cpp b/src/multimedia/video/qvideosurfaceformat.cpp
deleted file mode 100644
index 3808292..0000000
--- a/src/multimedia/video/qvideosurfaceformat.cpp
+++ /dev/null
@@ -1,632 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideosurfaceformat.h"
-
-#include <qdebug.h>
-#include <qmetatype.h>
-#include <qpair.h>
-#include <qvariant.h>
-#include <qvector.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVideoSurfaceFormatPrivate : public QSharedData
-{
-public:
- QVideoSurfaceFormatPrivate()
- : pixelFormat(QVideoFrame::Format_Invalid)
- , handleType(QAbstractVideoBuffer::NoHandle)
- , scanLineDirection(QVideoSurfaceFormat::TopToBottom)
- , pixelAspectRatio(1, 1)
- , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined)
- , frameRate(0.0)
- {
- }
-
- QVideoSurfaceFormatPrivate(
- const QSize &size,
- QVideoFrame::PixelFormat format,
- QAbstractVideoBuffer::HandleType type)
- : pixelFormat(format)
- , handleType(type)
- , scanLineDirection(QVideoSurfaceFormat::TopToBottom)
- , frameSize(size)
- , pixelAspectRatio(1, 1)
- , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined)
- , viewport(QPoint(0, 0), size)
- , frameRate(0.0)
- {
- }
-
- QVideoSurfaceFormatPrivate(const QVideoSurfaceFormatPrivate &other)
- : QSharedData(other)
- , pixelFormat(other.pixelFormat)
- , handleType(other.handleType)
- , scanLineDirection(other.scanLineDirection)
- , frameSize(other.frameSize)
- , pixelAspectRatio(other.pixelAspectRatio)
- , ycbcrColorSpace(other.ycbcrColorSpace)
- , viewport(other.viewport)
- , frameRate(other.frameRate)
- , propertyNames(other.propertyNames)
- , propertyValues(other.propertyValues)
- {
- }
-
- bool operator ==(const QVideoSurfaceFormatPrivate &other) const
- {
- if (pixelFormat == other.pixelFormat
- && handleType == other.handleType
- && scanLineDirection == other.scanLineDirection
- && frameSize == other.frameSize
- && pixelAspectRatio == other.pixelAspectRatio
- && viewport == other.viewport
- && frameRatesEqual(frameRate, other.frameRate)
- && ycbcrColorSpace == other.ycbcrColorSpace
- && propertyNames.count() == other.propertyNames.count()) {
- for (int i = 0; i < propertyNames.count(); ++i) {
- int j = other.propertyNames.indexOf(propertyNames.at(i));
-
- if (j == -1 || propertyValues.at(i) != other.propertyValues.at(j))
- return false;
- }
- return true;
- } else {
- return false;
- }
- }
-
- inline static bool frameRatesEqual(qreal r1, qreal r2)
- {
- return qAbs(r1 - r2) <= 0.00001 * qMin(qAbs(r1), qAbs(r2));
- }
-
- QVideoFrame::PixelFormat pixelFormat;
- QAbstractVideoBuffer::HandleType handleType;
- QVideoSurfaceFormat::Direction scanLineDirection;
- QSize frameSize;
- QSize pixelAspectRatio;
- QVideoSurfaceFormat::YCbCrColorSpace ycbcrColorSpace;
- QRect viewport;
- qreal frameRate;
- QList<QByteArray> propertyNames;
- QList<QVariant> propertyValues;
-};
-
-/*!
- \class QVideoSurfaceFormat
- \brief The QVideoSurfaceFormat class specifies the stream format of a video presentation
- surface.
- \since 1.0
- \inmodule QtMultimedia
-
- A video surface presents a stream of video frames. The surface's format describes the type of
- the frames and determines how they should be presented.
-
- The core properties of a video stream required to setup a video surface are the pixel format
- given by pixelFormat(), and the frame dimensions given by frameSize().
-
- If the surface is to present frames using a frame's handle a surface format will also include
- a handle type which is given by the handleType() function.
-
- The region of a frame that is actually displayed on a video surface is given by the viewport().
- A stream may have a viewport less than the entire region of a frame to allow for videos smaller
- than the nearest optimal size of a video frame. For example the width of a frame may be
- extended so that the start of each scan line is eight byte aligned.
-
- Other common properties are the pixelAspectRatio(), scanLineDirection(), and frameRate().
- Additionally a stream may have some additional type specific properties which are listed by the
- dynamicPropertyNames() function and can be accessed using the property(), and setProperty()
- functions.
-*/
-
-/*!
- \enum QVideoSurfaceFormat::Direction
-
- Enumerates the layout direction of video scan lines.
-
- \value TopToBottom Scan lines are arranged from the top of the frame to the bottom.
- \value BottomToTop Scan lines are arranged from the bottom of the frame to the top.
-*/
-
-/*!
- \enum QVideoSurfaceFormat::YCbCrColorSpace
-
- Enumerates the Y'CbCr color space of video frames.
-
- \value YCbCr_Undefined
- No color space is specified.
-
- \value YCbCr_BT601
- A Y'CbCr color space defined by ITU-R recommendation BT.601
- with Y value range from 16 to 235, and Cb/Cr range from 16 to 240.
- Used in standard definition video.
-
- \value YCbCr_BT709
- A Y'CbCr color space defined by ITU-R BT.709 with the same values range as YCbCr_BT601. Used
- for HDTV.
-
- \value YCbCr_xvYCC601
- The BT.601 color space with the value range extended to 0 to 255.
- It is backward compatibile with BT.601 and uses values outside BT.601 range to represent a
- wider range of colors.
-
- \value YCbCr_xvYCC709
- The BT.709 color space with the value range extended to 0 to 255.
-
- \value YCbCr_JPEG
- The full range Y'CbCr color space used in JPEG files.
-*/
-
-/*!
- Constructs a null video stream format.
-*/
-QVideoSurfaceFormat::QVideoSurfaceFormat()
- : d(new QVideoSurfaceFormatPrivate)
-{
-}
-
-/*!
- Contructs a description of stream which receives stream of \a type buffers with given frame
- \a size and pixel \a format.
- \since 1.0
-*/
-QVideoSurfaceFormat::QVideoSurfaceFormat(
- const QSize& size, QVideoFrame::PixelFormat format, QAbstractVideoBuffer::HandleType type)
- : d(new QVideoSurfaceFormatPrivate(size, format, type))
-{
-}
-
-/*!
- Constructs a copy of \a other.
- \since 1.0
-*/
-QVideoSurfaceFormat::QVideoSurfaceFormat(const QVideoSurfaceFormat &other)
- : d(other.d)
-{
-}
-
-/*!
- Assigns the values of \a other to this object.
- \since 1.0
-*/
-QVideoSurfaceFormat &QVideoSurfaceFormat::operator =(const QVideoSurfaceFormat &other)
-{
- d = other.d;
-
- return *this;
-}
-
-/*!
- Destroys a video stream description.
-*/
-QVideoSurfaceFormat::~QVideoSurfaceFormat()
-{
-}
-
-/*!
- Identifies if a video surface format has a valid pixel format and frame size.
-
- Returns true if the format is valid, and false otherwise.
- \since 1.0
-*/
-bool QVideoSurfaceFormat::isValid() const
-{
- return d->pixelFormat != QVideoFrame::Format_Invalid && d->frameSize.isValid();
-}
-
-/*!
- Returns true if \a other is the same as this video format, and false if they are different.
- \since 1.0
-*/
-bool QVideoSurfaceFormat::operator ==(const QVideoSurfaceFormat &other) const
-{
- return d == other.d || *d == *other.d;
-}
-
-/*!
- Returns true if \a other is different to a video format, and false if they are the same.
- \since 1.0
-*/
-bool QVideoSurfaceFormat::operator !=(const QVideoSurfaceFormat &other) const
-{
- return d != other.d && !(*d == *other.d);
-}
-
-/*!
- Returns the pixel format of frames in a video stream.
- \since 1.0
-*/
-QVideoFrame::PixelFormat QVideoSurfaceFormat::pixelFormat() const
-{
- return d->pixelFormat;
-}
-
-/*!
- Returns the type of handle the surface uses to present the frame data.
-
- If the handle type is QAbstractVideoBuffer::NoHandle buffers with any handle type are valid
- provided they can be \l {QAbstractVideoBuffer::map()}{mapped} with the
- QAbstractVideoBuffer::ReadOnly flag. If the handleType() is not QAbstractVideoBuffer::NoHandle
- then the handle type of the buffer must be the same as that of the surface format.
- \since 1.0
-*/
-QAbstractVideoBuffer::HandleType QVideoSurfaceFormat::handleType() const
-{
- return d->handleType;
-}
-
-/*!
- Returns the dimensions of frames in a video stream.
-
- \sa frameWidth(), frameHeight()
- \since 1.0
-*/
-QSize QVideoSurfaceFormat::frameSize() const
-{
- return d->frameSize;
-}
-
-/*!
- Returns the width of frames in a video stream.
-
- \sa frameSize(), frameHeight()
- \since 1.0
-*/
-int QVideoSurfaceFormat::frameWidth() const
-{
- return d->frameSize.width();
-}
-
-/*!
- Returns the height of frame in a video stream.
- \since 1.0
-*/
-int QVideoSurfaceFormat::frameHeight() const
-{
- return d->frameSize.height();
-}
-
-/*!
- Sets the size of frames in a video stream to \a size.
-
- This will reset the viewport() to fill the entire frame.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setFrameSize(const QSize &size)
-{
- d->frameSize = size;
- d->viewport = QRect(QPoint(0, 0), size);
-}
-
-/*!
- \overload
-
- Sets the \a width and \a height of frames in a video stream.
-
- This will reset the viewport() to fill the entire frame.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setFrameSize(int width, int height)
-{
- d->frameSize = QSize(width, height);
- d->viewport = QRect(0, 0, width, height);
-}
-
-/*!
- Returns the viewport of a video stream.
-
- The viewport is the region of a video frame that is actually displayed.
-
- By default the viewport covers an entire frame.
- \since 1.0
-*/
-QRect QVideoSurfaceFormat::viewport() const
-{
- return d->viewport;
-}
-
-/*!
- Sets the viewport of a video stream to \a viewport.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setViewport(const QRect &viewport)
-{
- d->viewport = viewport;
-}
-
-/*!
- Returns the direction of scan lines.
- \since 1.0
-*/
-QVideoSurfaceFormat::Direction QVideoSurfaceFormat::scanLineDirection() const
-{
- return d->scanLineDirection;
-}
-
-/*!
- Sets the \a direction of scan lines.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setScanLineDirection(Direction direction)
-{
- d->scanLineDirection = direction;
-}
-
-/*!
- Returns the frame rate of a video stream in frames per second.
- \since 1.0
-*/
-qreal QVideoSurfaceFormat::frameRate() const
-{
- return d->frameRate;
-}
-
-/*!
- Sets the frame \a rate of a video stream in frames per second.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setFrameRate(qreal rate)
-{
- d->frameRate = rate;
-}
-
-/*!
- Returns a video stream's pixel aspect ratio.
- \since 1.0
-*/
-QSize QVideoSurfaceFormat::pixelAspectRatio() const
-{
- return d->pixelAspectRatio;
-}
-
-/*!
- Sets a video stream's pixel aspect \a ratio.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setPixelAspectRatio(const QSize &ratio)
-{
- d->pixelAspectRatio = ratio;
-}
-
-/*!
- \overload
-
- Sets the \a horizontal and \a vertical elements of a video stream's pixel aspect ratio.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical)
-{
- d->pixelAspectRatio = QSize(horizontal, vertical);
-}
-
-/*!
- Returns the Y'CbCr color space of a video stream.
- \since 1.0
-*/
-QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat::yCbCrColorSpace() const
-{
- return d->ycbcrColorSpace;
-}
-
-/*!
- Sets the Y'CbCr color \a space of a video stream.
- It is only used with raw YUV frame types.
- \since 1.0
-*/
-void QVideoSurfaceFormat::setYCbCrColorSpace(QVideoSurfaceFormat::YCbCrColorSpace space)
-{
- d->ycbcrColorSpace = space;
-}
-
-/*!
- Returns a suggested size in pixels for the video stream.
-
- This is the size of the viewport scaled according to the pixel aspect ratio.
- \since 1.0
-*/
-QSize QVideoSurfaceFormat::sizeHint() const
-{
- QSize size = d->viewport.size();
-
- if (d->pixelAspectRatio.height() != 0)
- size.setWidth(size.width() * d->pixelAspectRatio.width() / d->pixelAspectRatio.height());
-
- return size;
-}
-
-/*!
- Returns a list of video format dynamic property names.
- \since 1.0
-*/
-QList<QByteArray> QVideoSurfaceFormat::propertyNames() const
-{
- return (QList<QByteArray>()
- << "handleType"
- << "pixelFormat"
- << "frameSize"
- << "frameWidth"
- << "viewport"
- << "scanLineDirection"
- << "frameRate"
- << "pixelAspectRatio"
- << "sizeHint"
- << "yCbCrColorSpace")
- + d->propertyNames;
-}
-
-/*!
- Returns the value of the video format's \a name property.
- \since 1.0
-*/
-QVariant QVideoSurfaceFormat::property(const char *name) const
-{
- if (qstrcmp(name, "handleType") == 0) {
- return qVariantFromValue(d->handleType);
- } else if (qstrcmp(name, "pixelFormat") == 0) {
- return qVariantFromValue(d->pixelFormat);
- } else if (qstrcmp(name, "frameSize") == 0) {
- return d->frameSize;
- } else if (qstrcmp(name, "frameWidth") == 0) {
- return d->frameSize.width();
- } else if (qstrcmp(name, "frameHeight") == 0) {
- return d->frameSize.height();
- } else if (qstrcmp(name, "viewport") == 0) {
- return d->viewport;
- } else if (qstrcmp(name, "scanLineDirection") == 0) {
- return qVariantFromValue(d->scanLineDirection);
- } else if (qstrcmp(name, "frameRate") == 0) {
- return qVariantFromValue(d->frameRate);
- } else if (qstrcmp(name, "pixelAspectRatio") == 0) {
- return qVariantFromValue(d->pixelAspectRatio);
- } else if (qstrcmp(name, "sizeHint") == 0) {
- return sizeHint();
- } else if (qstrcmp(name, "yCbCrColorSpace") == 0) {
- return qVariantFromValue(d->ycbcrColorSpace);
- } else {
- int id = 0;
- for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {}
-
- return id < d->propertyValues.count()
- ? d->propertyValues.at(id)
- : QVariant();
- }
-}
-
-/*!
- Sets the video format's \a name property to \a value.
-
- Trying to set a read only property will be ignored.
-
- \since 1.0
-*/
-void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value)
-{
- if (qstrcmp(name, "handleType") == 0) {
- // read only.
- } else if (qstrcmp(name, "pixelFormat") == 0) {
- // read only.
- } else if (qstrcmp(name, "frameSize") == 0) {
- if (qVariantCanConvert<QSize>(value)) {
- d->frameSize = qvariant_cast<QSize>(value);
- d->viewport = QRect(QPoint(0, 0), d->frameSize);
- }
- } else if (qstrcmp(name, "frameWidth") == 0) {
- // read only.
- } else if (qstrcmp(name, "frameHeight") == 0) {
- // read only.
- } else if (qstrcmp(name, "viewport") == 0) {
- if (qVariantCanConvert<QRect>(value))
- d->viewport = qvariant_cast<QRect>(value);
- } else if (qstrcmp(name, "scanLineDirection") == 0) {
- if (qVariantCanConvert<Direction>(value))
- d->scanLineDirection = qvariant_cast<Direction>(value);
- } else if (qstrcmp(name, "frameRate") == 0) {
- if (qVariantCanConvert<qreal>(value))
- d->frameRate = qvariant_cast<qreal>(value);
- } else if (qstrcmp(name, "pixelAspectRatio") == 0) {
- if (qVariantCanConvert<QSize>(value))
- d->pixelAspectRatio = qvariant_cast<QSize>(value);
- } else if (qstrcmp(name, "sizeHint") == 0) {
- // read only.
- } else if (qstrcmp(name, "yCbCrColorSpace") == 0) {
- if (qVariantCanConvert<YCbCrColorSpace>(value))
- d->ycbcrColorSpace = qvariant_cast<YCbCrColorSpace>(value);
- } else {
- int id = 0;
- for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {}
-
- if (id < d->propertyValues.count()) {
- if (value.isNull()) {
- d->propertyNames.removeAt(id);
- d->propertyValues.removeAt(id);
- } else {
- d->propertyValues[id] = value;
- }
- } else if (!value.isNull()) {
- d->propertyNames.append(QByteArray(name));
- d->propertyValues.append(value);
- }
- }
-}
-
-
-#ifndef QT_NO_DEBUG_STREAM
-
-QDebug operator<<(QDebug dbg, QVideoSurfaceFormat::YCbCrColorSpace cs)
-{
- switch (cs) {
- case QVideoSurfaceFormat::YCbCr_BT601:
- return dbg.nospace() << "YCbCr_BT601";
- case QVideoSurfaceFormat::YCbCr_BT709:
- return dbg.nospace() << "YCbCr_BT709";
- case QVideoSurfaceFormat::YCbCr_JPEG:
- return dbg.nospace() << "YCbCr_JPEG";
- case QVideoSurfaceFormat::YCbCr_xvYCC601:
- return dbg.nospace() << "YCbCr_xvYCC601";
- case QVideoSurfaceFormat::YCbCr_xvYCC709:
- return dbg.nospace() << "YCbCr_xvYCC709";
- case QVideoSurfaceFormat::YCbCr_CustomMatrix:
- return dbg.nospace() << "YCbCr_CustomMatrix";
- default:
- return dbg.nospace() << "YCbCr_Undefined";
- }
-}
-
-QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f)
-{
- dbg.nospace() << "QVideoSurfaceFormat(" << f.pixelFormat();
- dbg.nospace() << ", " << f.frameSize();
- dbg.nospace() << ", viewport=" << f.viewport();
- dbg.nospace() << ", pixelAspectRatio=" << f.pixelAspectRatio();
- dbg.nospace() << ", handleType=" << f.handleType();
- dbg.nospace() << ", yCbCrColorSpace=" << f.yCbCrColorSpace();
- dbg.nospace() << ")";
-
- foreach(const QByteArray& propertyName, f.propertyNames())
- dbg << "\n " << propertyName.data() << " = " << f.property(propertyName.data());
-
- return dbg.space();
-}
-#endif
-
-QT_END_NAMESPACE
diff --git a/src/multimedia/video/qvideosurfaceformat.h b/src/multimedia/video/qvideosurfaceformat.h
deleted file mode 100644
index 6729917..0000000
--- a/src/multimedia/video/qvideosurfaceformat.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOSURFACEFORMAT_H
-#define QVIDEOSURFACEFORMAT_H
-
-#include <QtCore/qlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qshareddata.h>
-#include <QtCore/qsize.h>
-#include <QtGui/qimage.h>
-#include <qvideoframe.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QDebug;
-
-class QVideoSurfaceFormatPrivate;
-
-class Q_MULTIMEDIA_EXPORT QVideoSurfaceFormat
-{
-public:
- enum Direction
- {
- TopToBottom,
- BottomToTop
- };
-
- enum YCbCrColorSpace
- {
- YCbCr_Undefined,
- YCbCr_BT601,
- YCbCr_BT709,
- YCbCr_xvYCC601,
- YCbCr_xvYCC709,
- YCbCr_JPEG,
-#ifndef qdoc
- YCbCr_CustomMatrix
-#endif
- };
-
- QVideoSurfaceFormat();
- QVideoSurfaceFormat(
- const QSize &size,
- QVideoFrame::PixelFormat pixelFormat,
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle);
- QVideoSurfaceFormat(const QVideoSurfaceFormat &format);
- ~QVideoSurfaceFormat();
-
- QVideoSurfaceFormat &operator =(const QVideoSurfaceFormat &format);
-
- bool operator ==(const QVideoSurfaceFormat &format) const;
- bool operator !=(const QVideoSurfaceFormat &format) const;
-
- bool isValid() const;
-
- QVideoFrame::PixelFormat pixelFormat() const;
- QAbstractVideoBuffer::HandleType handleType() const;
-
- QSize frameSize() const;
- void setFrameSize(const QSize &size);
- void setFrameSize(int width, int height);
-
- int frameWidth() const;
- int frameHeight() const;
-
- QRect viewport() const;
- void setViewport(const QRect &viewport);
-
- Direction scanLineDirection() const;
- void setScanLineDirection(Direction direction);
-
- qreal frameRate() const;
- void setFrameRate(qreal rate);
-
- QSize pixelAspectRatio() const;
- void setPixelAspectRatio(const QSize &ratio);
- void setPixelAspectRatio(int width, int height);
-
- YCbCrColorSpace yCbCrColorSpace() const;
- void setYCbCrColorSpace(YCbCrColorSpace colorSpace);
-
- QSize sizeHint() const;
-
- QList<QByteArray> propertyNames() const;
- QVariant property(const char *name) const;
- void setProperty(const char *name, const QVariant &value);
-
-private:
- QSharedDataPointer<QVideoSurfaceFormatPrivate> d;
-};
-
-#ifndef QT_NO_DEBUG_STREAM
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, const QVideoSurfaceFormat &);
-Q_MULTIMEDIA_EXPORT QDebug operator<<(QDebug, QVideoSurfaceFormat::YCbCrColorSpace);
-#endif
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QVideoSurfaceFormat::Direction)
-Q_DECLARE_METATYPE(QVideoSurfaceFormat::YCbCrColorSpace)
-
-QT_END_HEADER
-
-#endif
-
diff --git a/src/multimedia/video/video.pri b/src/multimedia/video/video.pri
deleted file mode 100644
index accaa33..0000000
--- a/src/multimedia/video/video.pri
+++ /dev/null
@@ -1,22 +0,0 @@
-
-INCLUDEPATH += video
-
-PUBLIC_HEADERS += \
- video/qabstractvideobuffer.h \
- video/qabstractvideosurface.h \
- video/qvideoframe.h \
- video/qvideosurfaceformat.h
-
-PRIVATE_HEADERS += \
- video/qabstractvideobuffer_p.h \
- video/qimagevideobuffer_p.h \
- video/qmemoryvideobuffer_p.h
-
-SOURCES += \
- video/qabstractvideobuffer.cpp \
- video/qabstractvideosurface.cpp \
- video/qimagevideobuffer.cpp \
- video/qmemoryvideobuffer.cpp \
- video/qvideoframe.cpp \
- video/qvideosurfaceformat.cpp
-
diff --git a/src/multimediawidgets/multimediawidgets.pro b/src/multimediawidgets/multimediawidgets.pro
deleted file mode 100644
index 9251f2f..0000000
--- a/src/multimediawidgets/multimediawidgets.pro
+++ /dev/null
@@ -1,68 +0,0 @@
-load(qt_module)
-
-# distinct from QtMultimedia
-TARGET = QtMultimediaWidgets
-QPRO_PWD = $$PWD
-QT = core gui multimedia-private widgets
-
-CONFIG += module no_private_qt_headers_warning
-MODULE_PRI += ../../modules/qt_multimediawidgets.pri
-
-contains(QT_CONFIG, opengl) | contains(QT_CONFIG, opengles2) {
- QT += opengl
-} else {
- DEFINES += QT_NO_OPENGL
-}
-
-!static:DEFINES += QT_MAKEDLL
-DEFINES += QT_BUILD_MULTIMEDIAWIDGETS_LIB
-
-load(qt_module_config)
-
-PRIVATE_HEADERS += \
- qvideowidget_p.h \
- qpaintervideosurface_p.h \
-
-PUBLIC_HEADERS += \
- qtmultimediawidgetdefs.h \
- qtmultimediawidgetsversion.h \
- qcameraviewfinder.h \
- qgraphicsvideoitem.h \
- qvideowidgetcontrol.h \
- qvideowidget.h \
- qvideowindowcontrol.h
-
-SOURCES += \
- qcameraviewfinder.cpp \
- qpaintervideosurface.cpp \
- qvideowidgetcontrol.cpp \
- qvideowidget.cpp \
- qvideowindowcontrol.cpp \
-
-mac:!qpa {
-!simulator {
- PRIVATE_HEADERS += qpaintervideosurface_mac_p.h
- OBJECTIVE_SOURCES += qpaintervideosurface_mac.mm
-}
- LIBS += -framework AppKit -framework QuartzCore -framework QTKit
-}
-
-maemo6 {
- isEqual(QT_ARCH,armv6) {
- PRIVATE_HEADERS += qeglimagetexturesurface_p.h
- SOURCES += qeglimagetexturesurface.cpp
-
- SOURCES += qgraphicsvideoitem_maemo6.cpp
-
- LIBS += -lX11
- } else {
- SOURCES += qgraphicsvideoitem.cpp
- }
-}
-
-!maemo* {
- SOURCES += qgraphicsvideoitem.cpp
-}
-
-HEADERS += $$PUBLIC_HEADERS $$PRIVATE_HEADERS
-
diff --git a/src/multimediawidgets/qcameraviewfinder.cpp b/src/multimediawidgets/qcameraviewfinder.cpp
deleted file mode 100644
index 91a9083..0000000
--- a/src/multimediawidgets/qcameraviewfinder.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcameraviewfinder.h"
-#include "qvideowidget_p.h"
-
-#include <qcamera.h>
-#include <qvideodevicecontrol.h>
-#include <private/qmediaobject_p.h>
-
-#include <QtCore/QDebug>
-
-QT_USE_NAMESPACE
-
-/*!
- \class QCameraViewfinder
-
-
- \brief The QCameraViewfinder class provides a camera viewfinder widget.
-
- \inmodule QtMultimedia
- \ingroup camera
- \since 1.1
-
- \snippet doc/src/snippets/multimedia-snippets/camera.cpp Camera
-
-*/
-
-class QCameraViewfinderPrivate : public QVideoWidgetPrivate
-{
- Q_DECLARE_NON_CONST_PUBLIC(QCameraViewfinder)
-public:
- QCameraViewfinderPrivate():
- QVideoWidgetPrivate()
- {
- }
-};
-
-/*!
- Constructs a new camera viewfinder widget.
-
- The \a parent is passed to QVideoWidget.
-*/
-
-QCameraViewfinder::QCameraViewfinder(QWidget *parent)
- :QVideoWidget(*new QCameraViewfinderPrivate, parent)
-{
-}
-
-/*!
- Destroys a camera viewfinder widget.
-*/
-QCameraViewfinder::~QCameraViewfinder()
-{
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-QMediaObject *QCameraViewfinder::mediaObject() const
-{
- return QVideoWidget::mediaObject();
-}
-
-/*!
- \reimp
- \since 1.1
-*/
-bool QCameraViewfinder::setMediaObject(QMediaObject *object)
-{
- return QVideoWidget::setMediaObject(object);
-}
-
-#include "moc_qcameraviewfinder.cpp"
diff --git a/src/multimediawidgets/qcameraviewfinder.h b/src/multimediawidgets/qcameraviewfinder.h
deleted file mode 100644
index f1ab3f2..0000000
--- a/src/multimediawidgets/qcameraviewfinder.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCAMERAVIEWFINDER_H
-#define QCAMERAVIEWFINDER_H
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qpair.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qpoint.h>
-#include <QtCore/qrect.h>
-
-#include <qmediacontrol.h>
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qvideowidget.h>
-
-#include <qmediaserviceprovider.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QCamera;
-
-class QCameraViewfinderPrivate;
-class Q_MULTIMEDIAWIDGETS_EXPORT QCameraViewfinder : public QVideoWidget
-{
- Q_OBJECT
-public:
- QCameraViewfinder(QWidget *parent = 0);
- ~QCameraViewfinder();
-
- QMediaObject *mediaObject() const;
-
-protected:
- bool setMediaObject(QMediaObject *object);
-
-private:
- Q_DISABLE_COPY(QCameraViewfinder)
- Q_DECLARE_PRIVATE(QCameraViewfinder)
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif // QCAMERA_H
diff --git a/src/multimediawidgets/qeglimagetexturesurface.cpp b/src/multimediawidgets/qeglimagetexturesurface.cpp
deleted file mode 100644
index dfab86c..0000000
--- a/src/multimediawidgets/qeglimagetexturesurface.cpp
+++ /dev/null
@@ -1,554 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qeglimagetexturesurface_p.h>
-#include <qpaintervideosurface_p.h>
-
-#include <QtCore/qmath.h>
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtGui/qpainter.h>
-#include <QtWidgets/qx11info_x11.h>
-#include <qvideosurfaceformat.h>
-
-
-QT_BEGIN_NAMESPACE
-
-//#define DEBUG_OMAPFB_SURFACE
-
-const QAbstractVideoBuffer::HandleType EGLImageTextureHandle =
-QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle+3434);
-
-/*!
- \class QOmapFbVideoSurface
- \internal
- \since 1.2
-*/
-
-/*!
-*/
-QEglImageTextureSurface::QEglImageTextureSurface(QObject *parent)
- : QAbstractVideoSurface(parent)
- , m_context(0)
- , m_program(0)
- , m_pixelFormat(QVideoFrame::Format_Invalid)
- , m_ready(false)
- , m_colorKey(49,0,49)
- , m_fallbackSurface(0)
- , m_fallbackSurfaceActive(false)
-{
- m_fallbackSurface = new QPainterVideoSurface(this);
-}
-
-/*!
-*/
-QEglImageTextureSurface::~QEglImageTextureSurface()
-{
- if (isActive())
- stop();
-}
-
-/*!
- \since 1.2
-*/
-QList<QVideoFrame::PixelFormat> QEglImageTextureSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
-#ifdef DEBUG_OMAPFB_SURFACE
- qDebug() << Q_FUNC_INFO << handleType;
-#endif
-
- if (handleType == EGLImageTextureHandle) {
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32;
- }
-
- return m_fallbackSurface->supportedPixelFormats(handleType);
-}
-
-const char *qt_glsl_eglTextureVertexShaderProgram =
- "attribute highp vec4 vertexCoordArray;\n"
- "attribute mediump vec2 textureCoordArray;\n"
- "uniform highp mat4 positionMatrix;\n"
- "varying mediump vec2 textureCoord;\n"
- "void main (void)\n"
- "{\n"
- " gl_Position = positionMatrix * vertexCoordArray;\n"
- " textureCoord = textureCoordArray;\n"
- "}";
-
-static const char* qt_glsl_eglTextureShaderProgram =
- "#extension GL_OES_EGL_image_external: enable\n"
- "\n"
- "uniform samplerExternalOES texRgb;\n"
- "varying mediump vec2 textureCoord;\n"
- "\n"
- "void main (void)\n"
- "{\n"
- " gl_FragColor = texture2D(texRgb, textureCoord);\n"
- "}";
-
-
-/*!
- \since 1.2
-*/
-bool QEglImageTextureSurface::start(const QVideoSurfaceFormat &format)
-{
-#ifdef DEBUG_OMAPFB_SURFACE
- qDebug() << Q_FUNC_INFO << format;
-#endif
-
- m_fallbackSurfaceActive = false;
- if (format.handleType() != EGLImageTextureHandle) {
- qWarning() << Q_FUNC_INFO << "Non EGLImageTextureHandle based format requested, fallback to QPainterVideoSurface";
- connect(m_fallbackSurface, SIGNAL(activeChanged(bool)),
- this, SIGNAL(activeChanged(bool)));
- connect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
- connect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()),
- this, SIGNAL(supportedFormatsChanged()));
- connect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)),
- this, SIGNAL(nativeResolutionChanged(QSize)));
- connect(m_fallbackSurface, SIGNAL(frameChanged()),
- this, SIGNAL(frameChanged()));
-
- if (m_fallbackSurface->start(format)) {
- m_fallbackSurfaceActive = true;
- QAbstractVideoSurface::start(format);
- } else {
- qWarning() << Q_FUNC_INFO << "failed to start video surface:" << m_fallbackSurface->error();
- setError(m_fallbackSurface->error());
-
- disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)),
- this, SIGNAL(activeChanged(bool)));
- disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
- disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()),
- this, SIGNAL(supportedFormatsChanged()));
- disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)),
- this, SIGNAL(nativeResolutionChanged(QSize)));
- disconnect(m_fallbackSurface, SIGNAL(frameChanged()),
- this, SIGNAL(frameChanged()));
- }
-
- return m_fallbackSurfaceActive;
- }
-
- QAbstractVideoSurface::Error error = NoError;
-
- if (isActive())
- stop();
-
- if (format.frameSize().isEmpty()) {
- setError(UnsupportedFormatError);
- } else if (m_context) {
- m_context->makeCurrent();
- m_program = new QGLShaderProgram(m_context, this);
-
- if (!m_program->addShaderFromSourceCode(QGLShader::Vertex, qt_glsl_eglTextureVertexShaderProgram)) {
- qWarning("QOmapFbVideoSurface: Vertex shader compile error %s",
- qPrintable(m_program->log()));
- error = ResourceError;
- }
-
- if (error == NoError
- && !m_program->addShaderFromSourceCode(QGLShader::Fragment, qt_glsl_eglTextureShaderProgram)) {
- qWarning("QOmapFbVideoSurface: Vertex shader compile error %s",
- qPrintable(m_program->log()));
- error = QAbstractVideoSurface::ResourceError;
- }
-
- if (error == NoError) {
- m_program->bindAttributeLocation("textureCoordArray", 1);
- if(!m_program->link()) {
- qWarning("QOmapFbVideoSurface: Shader link error %s", qPrintable(m_program->log()));
- m_program->removeAllShaders();
- error = QAbstractVideoSurface::ResourceError;
- }
- }
-
- if (error != QAbstractVideoSurface::NoError) {
- delete m_program;
- m_program = 0;
- }
- }
-
- if (error == QAbstractVideoSurface::NoError) {
- m_scanLineDirection = format.scanLineDirection();
- m_frameSize = format.frameSize();
- m_pixelFormat = format.pixelFormat();
- m_frameSize = format.frameSize();
- m_sourceRect = format.viewport();
- m_ready = true;
-
- return QAbstractVideoSurface::start(format);
- }
-
- QAbstractVideoSurface::stop();
- return false;
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::stop()
-{
-#ifdef DEBUG_OMAPFB_SURFACE
- qDebug() << Q_FUNC_INFO;
-#endif
-
- if (m_fallbackSurfaceActive) {
- m_fallbackSurface->stop();
- m_fallbackSurfaceActive = false;
-
- disconnect(m_fallbackSurface, SIGNAL(activeChanged(bool)),
- this, SIGNAL(activeChanged(bool)));
- disconnect(m_fallbackSurface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)));
- disconnect(m_fallbackSurface, SIGNAL(supportedFormatsChanged()),
- this, SIGNAL(supportedFormatsChanged()));
- disconnect(m_fallbackSurface, SIGNAL(nativeResolutionChanged(QSize)),
- this, SIGNAL(nativeResolutionChanged(QSize)));
- disconnect(m_fallbackSurface, SIGNAL(frameChanged()),
- this, SIGNAL(frameChanged()));
-
- m_ready = false;
- QAbstractVideoSurface::stop();
- }
-
- if (isActive()) {
- if (m_context)
- m_context->makeCurrent();
- m_frame = QVideoFrame();
-
- m_program->removeAllShaders();
- delete m_program;
- m_program = 0;
- m_ready = false;
-
- QAbstractVideoSurface::stop();
- }
-}
-
-/*!
- \since 1.2
-*/
-bool QEglImageTextureSurface::present(const QVideoFrame &frame)
-{
- if (m_fallbackSurfaceActive) {
- if (m_fallbackSurface->present(frame)) {
- return true;
- } else {
- setError(m_fallbackSurface->error());
- stop();
- return false;
- }
- }
-
- if (!m_ready) {
- if (!isActive())
- setError(StoppedError);
- else
- m_frame = frame;
- } else if (frame.isValid()
- && (frame.pixelFormat() != m_pixelFormat || frame.size() != m_frameSize)) {
- setError(IncorrectFormatError);
- qWarning() << "Received frame of incorrect format, stopping the surface";
-
- stop();
- } else {
- if (m_context)
- m_context->makeCurrent();
- m_frame = frame;
- m_ready = false;
- emit frameChanged();
- return true;
- }
- return false;
-}
-
-/*!
- \since 1.2
-*/
-int QEglImageTextureSurface::brightness() const
-{
- return m_fallbackSurface->brightness();
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setBrightness(int brightness)
-{
- m_fallbackSurface->setBrightness(brightness);
-}
-
-/*!
- \since 1.2
-*/
-int QEglImageTextureSurface::contrast() const
-{
- return m_fallbackSurface->contrast();
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setContrast(int contrast)
-{
- m_fallbackSurface->setContrast(contrast);
-}
-
-/*!
- \since 1.2
-*/
-int QEglImageTextureSurface::hue() const
-{
- return m_fallbackSurface->hue();
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setHue(int hue)
-{
- m_fallbackSurface->setHue(hue);
-}
-
-/*!
- \since 1.2
-*/
-int QEglImageTextureSurface::saturation() const
-{
- return m_fallbackSurface->saturation();
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setSaturation(int saturation)
-{
- m_fallbackSurface->setSaturation(saturation);
-}
-
-/*!
- \since 1.2
-*/
-bool QEglImageTextureSurface::isReady() const
-{
- return m_fallbackSurfaceActive ? m_fallbackSurface->isReady() : m_ready;
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setReady(bool ready)
-{
- m_ready = ready;
- if (m_fallbackSurfaceActive)
- m_fallbackSurface->setReady(ready);
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::paint(QPainter *painter, const QRectF &target, const QRectF &sourceRect)
-{
- if (m_fallbackSurfaceActive) {
- m_fallbackSurface->paint(painter, target, sourceRect);
- return;
- }
-
- if (!isActive() || !m_frame.isValid()) {
- painter->fillRect(target, QBrush(Qt::black));
- } else {
- const QRectF source(
- m_sourceRect.x() + m_sourceRect.width() * sourceRect.x(),
- m_sourceRect.y() + m_sourceRect.height() * sourceRect.y(),
- m_sourceRect.width() * sourceRect.width(),
- m_sourceRect.height() * sourceRect.height());
-
- bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
- bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
-
- painter->beginNativePainting();
-
- if (stencilTestEnabled)
- glEnable(GL_STENCIL_TEST);
- if (scissorTestEnabled)
- glEnable(GL_SCISSOR_TEST);
-
- const int width = QGLContext::currentContext()->device()->width();
- const int height = QGLContext::currentContext()->device()->height();
-
- const QTransform transform = painter->deviceTransform();
-
- const GLfloat wfactor = 2.0 / width;
- const GLfloat hfactor = -2.0 / height;
-
- const GLfloat positionMatrix[4][4] =
- {
- {
- /*(0,0)*/ GLfloat(wfactor * transform.m11() - transform.m13()),
- /*(0,1)*/ GLfloat(hfactor * transform.m12() + transform.m13()),
- /*(0,2)*/ 0.0,
- /*(0,3)*/ GLfloat(transform.m13())
- }, {
- /*(1,0)*/ GLfloat(wfactor * transform.m21() - transform.m23()),
- /*(1,1)*/ GLfloat(hfactor * transform.m22() + transform.m23()),
- /*(1,2)*/ 0.0,
- /*(1,3)*/ GLfloat(transform.m23())
- }, {
- /*(2,0)*/ 0.0,
- /*(2,1)*/ 0.0,
- /*(2,2)*/ -1.0,
- /*(2,3)*/ 0.0
- }, {
- /*(3,0)*/ GLfloat(wfactor * transform.dx() - transform.m33()),
- /*(3,1)*/ GLfloat(hfactor * transform.dy() + transform.m33()),
- /*(3,2)*/ 0.0,
- /*(3,3)*/ GLfloat(transform.m33())
- }
- };
-
- const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.top()
- : target.bottom() + 1;
- const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.bottom() + 1
- : target.top();
-
-
- const GLfloat vertexCoordArray[] =
- {
- GLfloat(target.left()) , GLfloat(vBottom),
- GLfloat(target.right() + 1), GLfloat(vBottom),
- GLfloat(target.left()) , GLfloat(vTop),
- GLfloat(target.right() + 1), GLfloat(vTop)
- };
-
- const GLfloat txLeft = source.left() / m_frameSize.width();
- const GLfloat txRight = source.right() / m_frameSize.width();
- const GLfloat txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.top() / m_frameSize.height()
- : source.bottom() / m_frameSize.height();
- const GLfloat txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.bottom() / m_frameSize.height()
- : source.top() / m_frameSize.height();
-
- const GLfloat textureCoordArray[] =
- {
- txLeft , txBottom,
- txRight, txBottom,
- txLeft , txTop,
- txRight, txTop
- };
-
- m_program->bind();
-
- m_program->enableAttributeArray("vertexCoordArray");
- m_program->enableAttributeArray("textureCoordArray");
- m_program->setAttributeArray("vertexCoordArray", vertexCoordArray, 2);
- m_program->setAttributeArray("textureCoordArray", textureCoordArray, 2);
- m_program->setUniformValue("positionMatrix", positionMatrix);
- m_program->setUniformValue("texRgb", 0);
-
- //map() binds the external texture
- m_frame.map(QAbstractVideoBuffer::ReadOnly);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- //it's necessary to unbind the external texture
- m_frame.unmap();
-
- m_program->release();
-
- painter->endNativePainting();
- }
-}
-
-/*!
- \fn QOmapFbVideoSurface::frameChanged()
- \since 1.2
-*/
-
-/*!
- \since 1.2
-*/
-const QGLContext *QEglImageTextureSurface::glContext() const
-{
- return m_context;
-}
-
-/*!
- \since 1.2
-*/
-void QEglImageTextureSurface::setGLContext(QGLContext *context)
-{
- if (m_context == context)
- return;
-
- stop();
-
- m_context = context;
-
- m_fallbackSurface->setGLContext(context);
- if (m_fallbackSurface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) {
- m_fallbackSurface->setShaderType(QPainterVideoSurface::GlslShader);
- } else {
- m_fallbackSurface->setShaderType(QPainterVideoSurface::FragmentProgramShader);
- }
-
- emit supportedFormatsChanged();
-}
-
-void QEglImageTextureSurface::viewportDestroyed()
-{
- m_context = 0;
- m_fallbackSurface->viewportDestroyed();
-
- setError(ResourceError);
- stop();
-}
-
-#include "moc_qeglimagetexturesurface_p.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qeglimagetexturesurface_p.h b/src/multimediawidgets/qeglimagetexturesurface_p.h
deleted file mode 100644
index f56c9da..0000000
--- a/src/multimediawidgets/qeglimagetexturesurface_p.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QEGLIMAGETEXTURESURFACE_P_H
-#define QEGLIMAGETEXTURESURFACE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediawidgetdefs.h>
-#include <QtCore/qsize.h>
-#include <QtGui/qimage.h>
-#include <QtGui/qmatrix4x4.h>
-#include <QtGui/qpaintengine.h>
-
-#include <QtOpenGL/qglshaderprogram.h>
-
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-#include <qvideoframe.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QGLContext;
-class QGLShaderProgram;
-class QPainterVideoSurface;
-
-class QEglImageTextureSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
-public:
- explicit QEglImageTextureSurface(QObject *parent = 0);
- ~QEglImageTextureSurface();
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- bool start(const QVideoSurfaceFormat &format);
- void stop();
-
- bool present(const QVideoFrame &frame);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- bool isReady() const;
- void setReady(bool ready);
-
- void paint(QPainter *painter, const QRectF &target, const QRectF &source = QRectF(0, 0, 1, 1));
-
- const QGLContext *glContext() const;
- void setGLContext(QGLContext *context);
-
- bool isOverlayEnabled() const;
- void setOverlayEnabled(bool enabled);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
-public Q_SLOTS:
- void viewportDestroyed();
-
-Q_SIGNALS:
- void frameChanged();
-
-private:
- QGLContext *m_context;
- QGLShaderProgram *m_program;
-
- QVideoFrame m_frame;
-
- QVideoFrame::PixelFormat m_pixelFormat;
- QVideoSurfaceFormat::Direction m_scanLineDirection;
- QSize m_frameSize;
- QRect m_sourceRect;
- bool m_ready;
-
- QRect m_viewport;
- QRect m_displayRect;
- QColor m_colorKey;
-
- QPainterVideoSurface *m_fallbackSurface;
- bool m_fallbackSurfaceActive;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qgraphicsvideoitem.cpp b/src/multimediawidgets/qgraphicsvideoitem.cpp
deleted file mode 100644
index c92fb1e..0000000
--- a/src/multimediawidgets/qgraphicsvideoitem.cpp
+++ /dev/null
@@ -1,431 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicsvideoitem.h"
-#include "qpaintervideosurface_p.h"
-
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qvideorenderercontrol.h>
-#include <qvideosurfaceformat.h>
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qpointer.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-#include <QtOpenGL/qgl.h>
-#endif
-
-Q_DECLARE_METATYPE(QVideoSurfaceFormat)
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsVideoItemPrivate
-{
-public:
- QGraphicsVideoItemPrivate()
- : q_ptr(0)
- , surface(0)
- , mediaObject(0)
- , service(0)
- , rendererControl(0)
- , aspectRatioMode(Qt::KeepAspectRatio)
- , updatePaintDevice(true)
- , rect(0.0, 0.0, 320, 240)
- {
- }
-
- QGraphicsVideoItem *q_ptr;
-
- QPainterVideoSurface *surface;
- QPointer<QMediaObject> mediaObject;
- QMediaService *service;
- QVideoRendererControl *rendererControl;
- Qt::AspectRatioMode aspectRatioMode;
- bool updatePaintDevice;
- QRectF rect;
- QRectF boundingRect;
- QRectF sourceRect;
- QSizeF nativeSize;
-
- void clearService();
- void updateRects();
-
- void _q_present();
- void _q_formatChanged(const QVideoSurfaceFormat &format);
- void _q_updateNativeSize();
- void _q_serviceDestroyed();
-};
-
-void QGraphicsVideoItemPrivate::clearService()
-{
- if (rendererControl) {
- surface->stop();
- rendererControl->setSurface(0);
- service->releaseControl(rendererControl);
- rendererControl = 0;
- }
- if (service) {
- QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed()));
- service = 0;
- }
-}
-
-void QGraphicsVideoItemPrivate::updateRects()
-{
- q_ptr->prepareGeometryChange();
-
- if (nativeSize.isEmpty()) {
- //this is necessary for item to receive the
- //first paint event and configure video surface.
- boundingRect = rect;
- } else if (aspectRatioMode == Qt::IgnoreAspectRatio) {
- boundingRect = rect;
- sourceRect = QRectF(0, 0, 1, 1);
- } else if (aspectRatioMode == Qt::KeepAspectRatio) {
- QSizeF size = nativeSize;
- size.scale(rect.size(), Qt::KeepAspectRatio);
-
- boundingRect = QRectF(0, 0, size.width(), size.height());
- boundingRect.moveCenter(rect.center());
-
- sourceRect = QRectF(0, 0, 1, 1);
- } else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
- boundingRect = rect;
-
- QSizeF size = rect.size();
- size.scale(nativeSize, Qt::KeepAspectRatio);
-
- sourceRect = QRectF(
- 0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height());
- sourceRect.moveCenter(QPointF(0.5, 0.5));
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_present()
-{
- if (q_ptr->isObscured()) {
- q_ptr->update(boundingRect);
- surface->setReady(true);
- } else {
- q_ptr->update(boundingRect);
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_updateNativeSize()
-{
- const QSize &size = surface->surfaceFormat().sizeHint();
- if (nativeSize != size) {
- nativeSize = size;
-
- updateRects();
- emit q_ptr->nativeSizeChanged(nativeSize);
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
-{
- rendererControl = 0;
- service = 0;
-
- surface->stop();
-}
-
-
-/*!
- \class QGraphicsVideoItem
-
- \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
-
- \inmodule QtMultimedia
- \ingroup multimedia
- \since 1.0
-
- Attaching a QGraphicsVideoItem to a QMediaObject allows it to display
- the video or image output of that media object. A QGraphicsVideoItem
- is attached to a media object by passing a pointer to the QMediaObject
- to the setMediaObject() function.
-
- \snippet doc/src/snippets/multimedia-snippets/video.cpp Video graphics item
-
- \bold {Note}: Only a single display output can be attached to a media
- object at one time.
-
- \sa QMediaObject, QMediaPlayer, QVideoWidget
-*/
-
-/*!
- Constructs a graphics item that displays video.
-
- The \a parent is passed to QGraphicsItem.
-*/
-QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent)
- : QGraphicsObject(parent)
- , d_ptr(new QGraphicsVideoItemPrivate)
-{
- d_ptr->q_ptr = this;
- d_ptr->surface = new QPainterVideoSurface;
-
- qRegisterMetaType<QVideoSurfaceFormat>();
-
- connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present()));
- connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection);
-}
-
-/*!
- Destroys a video graphics item.
-*/
-QGraphicsVideoItem::~QGraphicsVideoItem()
-{
- if (d_ptr->rendererControl) {
- d_ptr->rendererControl->setSurface(0);
- d_ptr->service->releaseControl(d_ptr->rendererControl);
- }
-
- delete d_ptr->surface;
- delete d_ptr;
-}
-
-/*!
- \property QGraphicsVideoItem::mediaObject
- \brief the media object which provides the video displayed by a graphics
- item.
- \since 1.0
-*/
-
-QMediaObject *QGraphicsVideoItem::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \internal
- \since 1.0
-*/
-bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
-{
- Q_D(QGraphicsVideoItem);
-
- if (object == d->mediaObject)
- return true;
-
- d->clearService();
-
- d->mediaObject = object;
-
- if (d->mediaObject) {
- d->service = d->mediaObject->service();
-
- if (d->service) {
- QMediaControl *control = d->service->requestControl(QVideoRendererControl_iid);
- if (control) {
- d->rendererControl = qobject_cast<QVideoRendererControl *>(control);
-
- if (d->rendererControl) {
- //don't set the surface untill the item is painted
- //at least once and the surface is configured
- if (!d->updatePaintDevice)
- d->rendererControl->setSurface(d->surface);
- else
- update(boundingRect());
-
- connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
-
- return true;
- }
- if (control)
- d->service->releaseControl(control);
- }
- }
- }
-
- d->mediaObject = 0;
- return false;
-}
-
-/*!
- \property QGraphicsVideoItem::aspectRatioMode
- \brief how a video is scaled to fit the graphics item's size.
- \since 1.0
-*/
-
-Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const
-{
- return d_func()->aspectRatioMode;
-}
-
-void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- Q_D(QGraphicsVideoItem);
-
- d->aspectRatioMode = mode;
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::offset
- \brief the video item's offset.
-
- QGraphicsVideoItem will draw video using the offset for its top left
- corner.
- \since 1.0
-*/
-
-QPointF QGraphicsVideoItem::offset() const
-{
- return d_func()->rect.topLeft();
-}
-
-void QGraphicsVideoItem::setOffset(const QPointF &offset)
-{
- Q_D(QGraphicsVideoItem);
-
- d->rect.moveTo(offset);
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::size
- \brief the video item's size.
-
- QGraphicsVideoItem will draw video scaled to fit size according to its
- fillMode.
- \since 1.0
-*/
-
-QSizeF QGraphicsVideoItem::size() const
-{
- return d_func()->rect.size();
-}
-
-void QGraphicsVideoItem::setSize(const QSizeF &size)
-{
- Q_D(QGraphicsVideoItem);
-
- d->rect.setSize(size.isValid() ? size : QSizeF(0, 0));
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::nativeSize
- \brief the native size of the video.
- \since 1.0
-*/
-
-QSizeF QGraphicsVideoItem::nativeSize() const
-{
- return d_func()->nativeSize;
-}
-
-/*!
- \fn QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size)
-
- Signals that the native \a size of the video has changed.
- \since 1.0
-*/
-
-/*!
- \reimp
- \since 1.0
-*/
-QRectF QGraphicsVideoItem::boundingRect() const
-{
- return d_func()->boundingRect;
-}
-
-/*!
- \reimp
- \since 1.0
-*/
-void QGraphicsVideoItem::paint(
- QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_D(QGraphicsVideoItem);
-
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (d->surface && d->updatePaintDevice) {
- d->updatePaintDevice = false;
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- if (widget)
- connect(widget, SIGNAL(destroyed()), d->surface, SLOT(viewportDestroyed()));
-
- d->surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext()));
- if (d->surface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) {
- d->surface->setShaderType(QPainterVideoSurface::GlslShader);
- } else {
- d->surface->setShaderType(QPainterVideoSurface::FragmentProgramShader);
- }
-#endif
- if (d->rendererControl && d->rendererControl->surface() != d->surface)
- d->rendererControl->setSurface(d->surface);
- }
-
- if (d->surface && d->surface->isActive()) {
- d->surface->paint(painter, d->boundingRect, d->sourceRect);
- d->surface->setReady(true);
- }
-}
-
-/*!
- \reimp
-
- \internal
- \since 1.0
-*/
-QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- return QGraphicsItem::itemChange(change, value);
-}
-
-/*!
- \internal
- \since 1.0
-*/
-void QGraphicsVideoItem::timerEvent(QTimerEvent *event)
-{
- QGraphicsObject::timerEvent(event);
-}
-
-#include "moc_qgraphicsvideoitem.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qgraphicsvideoitem.h b/src/multimediawidgets/qgraphicsvideoitem.h
deleted file mode 100644
index c92d42d..0000000
--- a/src/multimediawidgets/qgraphicsvideoitem.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGRAPHICSVIDEOITEM_H
-#define QGRAPHICSVIDEOITEM_H
-
-#include <QtWidgets/qgraphicsitem.h>
-
-#include <qvideowidget.h>
-#include <qmediabindableinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QVideoSurfaceFormat;
-QT_END_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsVideoItemPrivate;
-class Q_MULTIMEDIAWIDGETS_EXPORT QGraphicsVideoItem : public QGraphicsObject, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
- Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject)
- Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
- Q_PROPERTY(QPointF offset READ offset WRITE setOffset)
- Q_PROPERTY(QSizeF size READ size WRITE setSize)
- Q_PROPERTY(QSizeF nativeSize READ nativeSize NOTIFY nativeSizeChanged)
-public:
- QGraphicsVideoItem(QGraphicsItem *parent = 0);
- ~QGraphicsVideoItem();
-
- QMediaObject *mediaObject() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- QPointF offset() const;
- void setOffset(const QPointF &offset);
-
- QSizeF size() const;
- void setSize(const QSizeF &size);
-
- QSizeF nativeSize() const;
-
- QRectF boundingRect() const;
-
- void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
-
-Q_SIGNALS:
- void nativeSizeChanged(const QSizeF &size);
-
-protected:
- void timerEvent(QTimerEvent *event);
- QVariant itemChange(GraphicsItemChange change, const QVariant &value);
-
- bool setMediaObject(QMediaObject *object);
-
- QGraphicsVideoItemPrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QGraphicsVideoItem)
- Q_PRIVATE_SLOT(d_func(), void _q_present())
- Q_PRIVATE_SLOT(d_func(), void _q_updateNativeSize())
- Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed())
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp b/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp
deleted file mode 100644
index aa55f04..0000000
--- a/src/multimediawidgets/qgraphicsvideoitem_maemo6.cpp
+++ /dev/null
@@ -1,498 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgraphicsvideoitem.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qpointer.h>
-#include <QtCore/qbasictimer.h>
-
-#include <QtWidgets/qgraphicsscene.h>
-
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qpaintervideosurface_p.h>
-#include <qeglimagetexturesurface_p.h>
-#include <qvideorenderercontrol.h>
-
-#include <qvideosurfaceformat.h>
-
-#include <X11/Xlib.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-#include <QtOpenGL/qgl.h>
-#endif
-
-//#define ENABLE_OVERLAY
-
-namespace
-{
-//XInitThreads is necessary for gltexturesink element.
-//To ensure it's called before main() it's better to link to
-//libQtMultimedia.so directly, not when QML multimedia plugin is loaded.
-class InitThreads
-{
-public:
- InitThreads()
- {
- XInitThreads();
- }
-} _initThreads;
-}
-
-Q_DECLARE_METATYPE(QVideoSurfaceFormat)
-
-QT_BEGIN_NAMESPACE
-
-class QGraphicsVideoItemPrivate
-{
-public:
- QGraphicsVideoItemPrivate()
- : q_ptr(0)
- , surface(0)
- , mediaObject(0)
- , service(0)
- , rendererControl(0)
- , aspectRatioMode(Qt::KeepAspectRatio)
- , updatePaintDevice(true)
- , rect(0.0, 0.0, 320, 240)
- {
- }
-
- QGraphicsVideoItem *q_ptr;
-
- QEglImageTextureSurface *surface;
- QPointer<QMediaObject> mediaObject;
- QMediaService *service;
- QVideoRendererControl *rendererControl;
- Qt::AspectRatioMode aspectRatioMode;
- bool updatePaintDevice;
- QRectF rect;
- QRectF boundingRect;
- QRectF sourceRect;
- QSizeF nativeSize;
-
- void clearService();
- void updateRects();
-
- void _q_present();
- void _q_formatChanged(const QVideoSurfaceFormat &format);
- void _q_updateNativeSize();
- void _q_serviceDestroyed();
-};
-
-void QGraphicsVideoItemPrivate::clearService()
-{
- if (rendererControl) {
- surface->stop();
- rendererControl->setSurface(0);
- service->releaseControl(rendererControl);
- rendererControl = 0;
- }
- if (service) {
- QObject::disconnect(service, SIGNAL(destroyed()), q_ptr, SLOT(_q_serviceDestroyed()));
- service = 0;
- }
-}
-
-void QGraphicsVideoItemPrivate::updateRects()
-{
- q_ptr->prepareGeometryChange();
-
- if (nativeSize.isEmpty()) {
- //this is necessary for item to receive the
- //first paint event and configure video surface.
- boundingRect = rect;
- } else if (aspectRatioMode == Qt::IgnoreAspectRatio) {
- boundingRect = rect;
- sourceRect = QRectF(0, 0, 1, 1);
- } else if (aspectRatioMode == Qt::KeepAspectRatio) {
- QSizeF size = nativeSize;
- size.scale(rect.size(), Qt::KeepAspectRatio);
-
- boundingRect = QRectF(0, 0, size.width(), size.height());
- boundingRect.moveCenter(rect.center());
-
- sourceRect = QRectF(0, 0, 1, 1);
- } else if (aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
- boundingRect = rect;
-
- QSizeF size = rect.size();
- size.scale(nativeSize, Qt::KeepAspectRatio);
-
- sourceRect = QRectF(
- 0, 0, size.width() / nativeSize.width(), size.height() / nativeSize.height());
- sourceRect.moveCenter(QPointF(0.5, 0.5));
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_present()
-{
- if (q_ptr->isObscured()) {
- q_ptr->update(boundingRect);
- surface->setReady(true);
- } else {
- q_ptr->update(boundingRect);
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_updateNativeSize()
-{
- QSize size = surface->surfaceFormat().sizeHint();
- if (size.isEmpty())
- size = rendererControl->property("nativeSize").toSize();
-
- if (nativeSize != size) {
- nativeSize = size;
-
- updateRects();
- emit q_ptr->nativeSizeChanged(nativeSize);
- }
-}
-
-void QGraphicsVideoItemPrivate::_q_serviceDestroyed()
-{
- rendererControl = 0;
- service = 0;
-
- surface->stop();
-}
-
-
-/*!
- \class QGraphicsVideoItem
-
- \brief The QGraphicsVideoItem class provides a graphics item which display video produced by a QMediaObject.
-
- \inmodule QtMultimedia
- \ingroup multimedia
-
- Attaching a QGraphicsVideoItem to a QMediaObject allows it to display
- the video or image output of that media object. A QGraphicsVideoItem
- is attached to a media object by passing a pointer to the QMediaObject
- to the setMediaObject() function.
-
- \code
- player = new QMediaPlayer(this);
-
- QGraphicsVideoItem *item = new QGraphicsVideoItem;
- player->setVideoOutput(item);
- graphicsView->scene()->addItem(item);
- graphicsView->show();
-
- player->setMedia(video);
- player->play();
- \endcode
-
- \bold {Note}: Only a single display output can be attached to a media
- object at one time.
-
- \sa QMediaObject, QMediaPlayer, QVideoWidget
-*/
-
-/*!
- Constructs a graphics item that displays video.
-
- The \a parent is passed to QGraphicsItem.
-*/
-QGraphicsVideoItem::QGraphicsVideoItem(QGraphicsItem *parent)
- : QGraphicsObject(parent)
- , d_ptr(new QGraphicsVideoItemPrivate)
-{
- d_ptr->q_ptr = this;
- d_ptr->surface = new QEglImageTextureSurface(this);
-
- qRegisterMetaType<QVideoSurfaceFormat>();
-
- connect(d_ptr->surface, SIGNAL(frameChanged()), this, SLOT(_q_present()));
- connect(d_ptr->surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection);
-}
-
-/*!
- Destroys a video graphics item.
-*/
-QGraphicsVideoItem::~QGraphicsVideoItem()
-{
- if (d_ptr->rendererControl) {
- d_ptr->rendererControl->setSurface(0);
- d_ptr->service->releaseControl(d_ptr->rendererControl);
- }
-
- delete d_ptr->surface;
- delete d_ptr;
-}
-
-/*!
- \property QGraphicsVideoItem::mediaObject
- \brief the media object which provides the video displayed by a graphics
- item.
-*/
-
-QMediaObject *QGraphicsVideoItem::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \internal
-*/
-bool QGraphicsVideoItem::setMediaObject(QMediaObject *object)
-{
- Q_D(QGraphicsVideoItem);
-
- if (object == d->mediaObject)
- return true;
-
- d->clearService();
-
- d->mediaObject = object;
-
- if (d->mediaObject) {
- d->service = d->mediaObject->service();
-
- if (d->service) {
- QMediaControl *control = d->service->requestControl(QVideoRendererControl_iid);
- if (control) {
- d->rendererControl = qobject_cast<QVideoRendererControl *>(control);
-
- if (d->rendererControl) {
- connect(d->rendererControl, SIGNAL(nativeSizeChanged()),
- this, SLOT(_q_updateNativeSize()), Qt::QueuedConnection);
- d->_q_updateNativeSize();
- //don't set the surface untill the item is painted
- //at least once and the surface is configured
- if (!d->updatePaintDevice)
- d->rendererControl->setSurface(d->surface);
- else
- update(boundingRect());
-
- connect(d->service, SIGNAL(destroyed()), this, SLOT(_q_serviceDestroyed()));
-
- return true;
- }
- if (control)
- d->service->releaseControl(control);
- }
- }
- }
-
- d->mediaObject = 0;
- return false;
-}
-
-/*!
- \property QGraphicsVideoItem::aspectRatioMode
- \brief how a video is scaled to fit the graphics item's size.
-*/
-
-Qt::AspectRatioMode QGraphicsVideoItem::aspectRatioMode() const
-{
- return d_func()->aspectRatioMode;
-}
-
-void QGraphicsVideoItem::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- Q_D(QGraphicsVideoItem);
-
- d->aspectRatioMode = mode;
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::offset
- \brief the video item's offset.
-
- QGraphicsVideoItem will draw video using the offset for its top left
- corner.
-*/
-
-QPointF QGraphicsVideoItem::offset() const
-{
- return d_func()->rect.topLeft();
-}
-
-void QGraphicsVideoItem::setOffset(const QPointF &offset)
-{
- Q_D(QGraphicsVideoItem);
-
- d->rect.moveTo(offset);
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::size
- \brief the video item's size.
-
- QGraphicsVideoItem will draw video scaled to fit size according to its
- fillMode.
-*/
-
-QSizeF QGraphicsVideoItem::size() const
-{
- return d_func()->rect.size();
-}
-
-void QGraphicsVideoItem::setSize(const QSizeF &size)
-{
- Q_D(QGraphicsVideoItem);
-
- d->rect.setSize(size.isValid() ? size : QSizeF(0, 0));
- d->updateRects();
-}
-
-/*!
- \property QGraphicsVideoItem::nativeSize
- \brief the native size of the video.
-*/
-
-QSizeF QGraphicsVideoItem::nativeSize() const
-{
- return d_func()->nativeSize;
-}
-
-/*!
- \fn QGraphicsVideoItem::nativeSizeChanged(const QSizeF &size)
-
- Signals that the native \a size of the video has changed.
-*/
-
-/*!
- \reimp
-*/
-QRectF QGraphicsVideoItem::boundingRect() const
-{
- return d_func()->boundingRect;
-}
-
-/*!
- \reimp
-*/
-void QGraphicsVideoItem::paint(
- QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_D(QGraphicsVideoItem);
-
- Q_UNUSED(option);
- Q_UNUSED(widget);
-
- if (d->surface && d->rendererControl && d->updatePaintDevice) {
- d->updatePaintDevice = false;
-
- if (widget)
- d->rendererControl->setProperty("winId", qulonglong(widget->winId()));
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- if (widget)
- connect(widget, SIGNAL(destroyed()), d->surface, SLOT(viewportDestroyed()));
-
- d->surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext()));
-#endif
- if (d->rendererControl->surface() != d->surface)
- d->rendererControl->setSurface(d->surface);
- }
-
-
- //overlay doesn't work reliably
-
- //check if the item is obscured:
-#ifdef ENABLE_OVERLAY
- if (!isObscured()) {
- bool obscured = false;
-
- if (scene()) {
- foreach (QGraphicsItem *item,
- scene()->items(mapToScene(boundingRect()), Qt::IntersectsItemBoundingRect) ) {
- if (item->flags() & QGraphicsItem::ItemHasNoContents)
- continue;
-
- if (item == this)
- break;
-
- if (collidesWithItem(item)) {
- obscured = true;
- break;
- }
- }
- }
-
- d->rendererControl->setProperty("overlayEnabled", !obscured);
- }
-
- if (d->rendererControl->property("overlayEnabled").toBool()) {
- QTransform transform = painter->combinedTransform();
- QRect overlayRect = transform.mapRect(d->boundingRect).toRect();
-
- d->rendererControl->setProperty("overlayGeometry", overlayRect);
- QMetaObject::invokeMethod(d->rendererControl, "repaintOverlay");
-
- painter->fillRect(d->boundingRect,
- d->rendererControl->property("colorKey").value<QColor>());
- } else
-#endif //ENABLE_OVERLAY
- {
- if (d->surface && d->surface->isActive()) {
- d->surface->paint(painter, d->boundingRect, d->sourceRect);
- d->surface->setReady(true);
- }
- }
-}
-
-/*!
- \reimp
-
- \internal
-*/
-QVariant QGraphicsVideoItem::itemChange(GraphicsItemChange change, const QVariant &value)
-{
- return QGraphicsItem::itemChange(change, value);
-}
-
-/*!
- \internal
-*/
-void QGraphicsVideoItem::timerEvent(QTimerEvent *event)
-{
- QGraphicsObject::timerEvent(event);
-}
-
-#include "moc_qgraphicsvideoitem.cpp"
-QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qpaintervideosurface.cpp b/src/multimediawidgets/qpaintervideosurface.cpp
deleted file mode 100644
index 8c31dd5..0000000
--- a/src/multimediawidgets/qpaintervideosurface.cpp
+++ /dev/null
@@ -1,1728 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpaintervideosurface_p.h"
-#include "qpaintervideosurface_mac_p.h"
-
-#include <qmath.h>
-
-#include <qpainter.h>
-#include <qvariant.h>
-#include <qvideosurfaceformat.h>
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-#include <qglshaderprogram.h>
-#ifndef GL_CLAMP_TO_EDGE
-#define GL_CLAMP_TO_EDGE 0x812F
-#endif
-#endif
-
-#include <QtDebug>
-QT_BEGIN_NAMESPACE
-
-QVideoSurfacePainter::~QVideoSurfacePainter()
-{
-}
-
-class QVideoSurfaceGenericPainter : public QVideoSurfacePainter
-{
-public:
- QVideoSurfaceGenericPainter();
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const;
-
- bool isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const;
-
- QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format);
- void stop();
-
- QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame);
-
- QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source);
-
- void updateColors(int brightness, int contrast, int hue, int saturation);
-
-private:
- QList<QVideoFrame::PixelFormat> m_imagePixelFormats;
- QVideoFrame m_frame;
- QSize m_imageSize;
- QImage::Format m_imageFormat;
- QVideoSurfaceFormat::Direction m_scanLineDirection;
-};
-
-QVideoSurfaceGenericPainter::QVideoSurfaceGenericPainter()
- : m_imageFormat(QImage::Format_Invalid)
- , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom)
-{
- m_imagePixelFormats
- << QVideoFrame::Format_RGB32
-#ifndef QT_OPENGL_ES // The raster formats should be a subset of the GL formats.
- << QVideoFrame::Format_RGB24
-#endif
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_RGB565;
-}
-
-QList<QVideoFrame::PixelFormat> QVideoSurfaceGenericPainter::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- switch (handleType) {
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::NoHandle:
- return m_imagePixelFormats;
- default:
- ;
- }
- return QList<QVideoFrame::PixelFormat>();
-}
-
-bool QVideoSurfaceGenericPainter::isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const
-{
- switch (format.handleType()) {
- case QAbstractVideoBuffer::QPixmapHandle:
- return true;
- case QAbstractVideoBuffer::NoHandle:
- return m_imagePixelFormats.contains(format.pixelFormat())
- && !format.frameSize().isEmpty();
- default:
- ;
- }
- return false;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::start(const QVideoSurfaceFormat &format)
-{
- m_frame = QVideoFrame();
- m_imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
- m_imageSize = format.frameSize();
- m_scanLineDirection = format.scanLineDirection();
-
- const QAbstractVideoBuffer::HandleType t = format.handleType();
- if (t == QAbstractVideoBuffer::NoHandle) {
- if (m_imageFormat != QImage::Format_Invalid
-#ifdef QT_OPENGL_ES
- && format.pixelFormat() != QVideoFrame::Format_RGB24
-#endif
- && !m_imageSize.isEmpty()) {
- return QAbstractVideoSurface::NoError;
- }
- } else if (t == QAbstractVideoBuffer::QPixmapHandle) {
- return QAbstractVideoSurface::NoError;
- }
- return QAbstractVideoSurface::UnsupportedFormatError;
-}
-
-void QVideoSurfaceGenericPainter::stop()
-{
- m_frame = QVideoFrame();
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::setCurrentFrame(const QVideoFrame &frame)
-{
- m_frame = frame;
-
- return QAbstractVideoSurface::NoError;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGenericPainter::paint(
- const QRectF &target, QPainter *painter, const QRectF &source)
-{
- if (!m_frame.isValid()) {
- painter->fillRect(target, Qt::black);
- return QAbstractVideoSurface::NoError;
- }
-
- if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source);
- } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
- QImage image(
- m_frame.bits(),
- m_imageSize.width(),
- m_imageSize.height(),
- m_frame.bytesPerLine(),
- m_imageFormat);
-
- if (m_scanLineDirection == QVideoSurfaceFormat::BottomToTop) {
- const QTransform oldTransform = painter->transform();
-
- painter->scale(1, -1);
- painter->translate(0, -target.bottom());
- painter->drawImage(
- QRectF(target.x(), 0, target.width(), target.height()), image, source);
- painter->setTransform(oldTransform);
- } else {
- painter->drawImage(target, image, source);
- }
-
- m_frame.unmap();
- } else if (m_frame.isValid()) {
- return QAbstractVideoSurface::IncorrectFormatError;
- } else {
- painter->fillRect(target, Qt::black);
- }
- return QAbstractVideoSurface::NoError;
-}
-
-void QVideoSurfaceGenericPainter::updateColors(int, int, int, int)
-{
-}
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-
-#ifndef Q_WS_MAC
-# ifndef APIENTRYP
-# ifdef APIENTRY
-# define APIENTRYP APIENTRY *
-# else
-# define APIENTRY
-# define APIENTRYP *
-# endif
-# endif
-#else
-# define APIENTRY
-# define APIENTRYP *
-#endif
-
-#ifndef GL_TEXTURE0
-# define GL_TEXTURE0 0x84C0
-# define GL_TEXTURE1 0x84C1
-# define GL_TEXTURE2 0x84C2
-#endif
-#ifndef GL_PROGRAM_ERROR_STRING_ARB
-# define GL_PROGRAM_ERROR_STRING_ARB 0x8874
-#endif
-
-#ifndef GL_UNSIGNED_SHORT_5_6_5
-# define GL_UNSIGNED_SHORT_5_6_5 33635
-#endif
-
-class QVideoSurfaceGLPainter : public QVideoSurfacePainter
-{
-public:
- QVideoSurfaceGLPainter(QGLContext *context);
- ~QVideoSurfaceGLPainter();
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const;
-
- bool isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const;
-
- QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame);
-
- QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source);
-
- void updateColors(int brightness, int contrast, int hue, int saturation);
- void viewportDestroyed();
-
-protected:
- void initRgbTextureInfo(GLenum internalFormat, GLuint format, GLenum type, const QSize &size);
- void initYuv420PTextureInfo(const QSize &size);
- void initYv12TextureInfo(const QSize &size);
-
-#ifndef QT_OPENGL_ES
- typedef void (APIENTRY *_glActiveTexture) (GLenum);
- _glActiveTexture glActiveTexture;
-#endif
-
- QList<QVideoFrame::PixelFormat> m_imagePixelFormats;
- QList<QVideoFrame::PixelFormat> m_glPixelFormats;
- QMatrix4x4 m_colorMatrix;
- QVideoFrame m_frame;
-
- QGLContext *m_context;
- QAbstractVideoBuffer::HandleType m_handleType;
- QVideoSurfaceFormat::Direction m_scanLineDirection;
- QVideoSurfaceFormat::YCbCrColorSpace m_colorSpace;
- GLenum m_textureFormat;
- GLuint m_textureInternalFormat;
- GLenum m_textureType;
- int m_textureCount;
- GLuint m_textureIds[3];
- int m_textureWidths[3];
- int m_textureHeights[3];
- int m_textureOffsets[3];
- bool m_yuv;
-};
-
-QVideoSurfaceGLPainter::QVideoSurfaceGLPainter(QGLContext *context)
- : m_context(context)
- , m_handleType(QAbstractVideoBuffer::NoHandle)
- , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom)
- , m_colorSpace(QVideoSurfaceFormat::YCbCr_BT601)
- , m_textureFormat(0)
- , m_textureInternalFormat(0)
- , m_textureType(0)
- , m_textureCount(0)
- , m_yuv(false)
-{
-#ifndef QT_OPENGL_ES
- glActiveTexture = (_glActiveTexture)m_context->getProcAddress(QLatin1String("glActiveTexture"));
-#endif
-}
-
-QVideoSurfaceGLPainter::~QVideoSurfaceGLPainter()
-{
-}
-
-void QVideoSurfaceGLPainter::viewportDestroyed()
-{
- m_context = 0;
-}
-
-QList<QVideoFrame::PixelFormat> QVideoSurfaceGLPainter::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- switch (handleType) {
- case QAbstractVideoBuffer::NoHandle:
- return m_imagePixelFormats;
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::GLTextureHandle:
- return m_glPixelFormats;
- default:
- ;
- }
- return QList<QVideoFrame::PixelFormat>();
-}
-
-bool QVideoSurfaceGLPainter::isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const
-{
- if (format.frameSize().isEmpty()) {
- return false;
- } else {
- switch (format.handleType()) {
- case QAbstractVideoBuffer::NoHandle:
- return m_imagePixelFormats.contains(format.pixelFormat());
- case QAbstractVideoBuffer::QPixmapHandle:
- case QAbstractVideoBuffer::GLTextureHandle:
- return m_glPixelFormats.contains(format.pixelFormat());
- default:
- ;
- }
- }
- return false;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGLPainter::setCurrentFrame(const QVideoFrame &frame)
-{
- m_frame = frame;
-
- if (m_handleType == QAbstractVideoBuffer::GLTextureHandle) {
- m_textureIds[0] = frame.handle().toInt();
- } else if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
- m_context->makeCurrent();
-
- for (int i = 0; i < m_textureCount; ++i) {
- glBindTexture(GL_TEXTURE_2D, m_textureIds[i]);
- glTexImage2D(
- GL_TEXTURE_2D,
- 0,
- m_textureInternalFormat,
- m_textureWidths[i],
- m_textureHeights[i],
- 0,
- m_textureFormat,
- m_textureType,
- m_frame.bits() + m_textureOffsets[i]);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- }
- m_frame.unmap();
- } else if (m_handleType != QAbstractVideoBuffer::QPixmapHandle && m_frame.isValid()) {
- return QAbstractVideoSurface::IncorrectFormatError;
- }
-
- return QAbstractVideoSurface::NoError;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGLPainter::paint(
- const QRectF &target, QPainter *painter, const QRectF &source)
-{
- if (!m_frame.isValid()) {
- painter->fillRect(target, Qt::black);
- return QAbstractVideoSurface::NoError;
- }
-
- if (m_frame.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- painter->drawPixmap(target, m_frame.handle().value<QPixmap>(), source);
- } else if (m_frame.isValid()) {
- return QAbstractVideoSurface::IncorrectFormatError;
- } else {
- painter->fillRect(target, Qt::black);
- }
- return QAbstractVideoSurface::NoError;
-}
-
-void QVideoSurfaceGLPainter::updateColors(int brightness, int contrast, int hue, int saturation)
-{
- const qreal b = brightness / 200.0;
- const qreal c = contrast / 100.0 + 1.0;
- const qreal h = hue / 100.0;
- const qreal s = saturation / 100.0 + 1.0;
-
- const qreal cosH = qCos(M_PI * h);
- const qreal sinH = qSin(M_PI * h);
-
- const qreal h11 = 0.787 * cosH - 0.213 * sinH + 0.213;
- const qreal h21 = -0.213 * cosH + 0.143 * sinH + 0.213;
- const qreal h31 = -0.213 * cosH - 0.787 * sinH + 0.213;
-
- const qreal h12 = -0.715 * cosH - 0.715 * sinH + 0.715;
- const qreal h22 = 0.285 * cosH + 0.140 * sinH + 0.715;
- const qreal h32 = -0.715 * cosH + 0.715 * sinH + 0.715;
-
- const qreal h13 = -0.072 * cosH + 0.928 * sinH + 0.072;
- const qreal h23 = -0.072 * cosH - 0.283 * sinH + 0.072;
- const qreal h33 = 0.928 * cosH + 0.072 * sinH + 0.072;
-
- const qreal sr = (1.0 - s) * 0.3086;
- const qreal sg = (1.0 - s) * 0.6094;
- const qreal sb = (1.0 - s) * 0.0820;
-
- const qreal sr_s = sr + s;
- const qreal sg_s = sg + s;
- const qreal sb_s = sr + s;
-
- const float m4 = (s + sr + sg + sb) * (0.5 - 0.5 * c + b);
-
- m_colorMatrix(0, 0) = c * (sr_s * h11 + sg * h21 + sb * h31);
- m_colorMatrix(0, 1) = c * (sr_s * h12 + sg * h22 + sb * h32);
- m_colorMatrix(0, 2) = c * (sr_s * h13 + sg * h23 + sb * h33);
- m_colorMatrix(0, 3) = m4;
-
- m_colorMatrix(1, 0) = c * (sr * h11 + sg_s * h21 + sb * h31);
- m_colorMatrix(1, 1) = c * (sr * h12 + sg_s * h22 + sb * h32);
- m_colorMatrix(1, 2) = c * (sr * h13 + sg_s * h23 + sb * h33);
- m_colorMatrix(1, 3) = m4;
-
- m_colorMatrix(2, 0) = c * (sr * h11 + sg * h21 + sb_s * h31);
- m_colorMatrix(2, 1) = c * (sr * h12 + sg * h22 + sb_s * h32);
- m_colorMatrix(2, 2) = c * (sr * h13 + sg * h23 + sb_s * h33);
- m_colorMatrix(2, 3) = m4;
-
- m_colorMatrix(3, 0) = 0.0;
- m_colorMatrix(3, 1) = 0.0;
- m_colorMatrix(3, 2) = 0.0;
- m_colorMatrix(3, 3) = 1.0;
-
- if (m_yuv) {
- QMatrix4x4 colorSpaceMatrix;
-
- switch (m_colorSpace) {
- case QVideoSurfaceFormat::YCbCr_JPEG:
- colorSpaceMatrix = QMatrix4x4(
- 1.0, 0.000, 1.402, -0.701,
- 1.0, -0.344, -0.714, 0.529,
- 1.0, 1.772, 0.000, -0.886,
- 0.0, 0.000, 0.000, 1.0000);
- break;
- case QVideoSurfaceFormat::YCbCr_BT709:
- case QVideoSurfaceFormat::YCbCr_xvYCC709:
- colorSpaceMatrix = QMatrix4x4(
- 1.164, 0.000, 1.793, -0.5727,
- 1.164, -0.534, -0.213, 0.3007,
- 1.164, 2.115, 0.000, -1.1302,
- 0.0, 0.000, 0.000, 1.0000);
- break;
- default: //BT 601:
- colorSpaceMatrix = QMatrix4x4(
- 1.164, 0.000, 1.596, -0.8708,
- 1.164, -0.392, -0.813, 0.5296,
- 1.164, 2.017, 0.000, -1.081,
- 0.0, 0.000, 0.000, 1.0000);
- }
-
- m_colorMatrix = m_colorMatrix * colorSpaceMatrix;
- }
-}
-
-void QVideoSurfaceGLPainter::initRgbTextureInfo(
- GLenum internalFormat, GLuint format, GLenum type, const QSize &size)
-{
- m_yuv = false;
- m_textureInternalFormat = internalFormat;
- m_textureFormat = format;
- m_textureType = type;
- m_textureCount = 1;
- m_textureWidths[0] = size.width();
- m_textureHeights[0] = size.height();
- m_textureOffsets[0] = 0;
-}
-
-void QVideoSurfaceGLPainter::initYuv420PTextureInfo(const QSize &size)
-{
- int bytesPerLine = (size.width() + 3) & ~3;
- int bytesPerLine2 = (size.width() / 2 + 3) & ~3;
-
- m_yuv = true;
- m_textureInternalFormat = GL_LUMINANCE;
- m_textureFormat = GL_LUMINANCE;
- m_textureType = GL_UNSIGNED_BYTE;
- m_textureCount = 3;
- m_textureWidths[0] = bytesPerLine;
- m_textureHeights[0] = size.height();
- m_textureOffsets[0] = 0;
- m_textureWidths[1] = bytesPerLine2;
- m_textureHeights[1] = size.height() / 2;
- m_textureOffsets[1] = bytesPerLine * size.height();
- m_textureWidths[2] = bytesPerLine2;
- m_textureHeights[2] = size.height() / 2;
- m_textureOffsets[2] = bytesPerLine * size.height() + bytesPerLine2 * size.height()/2;
-}
-
-void QVideoSurfaceGLPainter::initYv12TextureInfo(const QSize &size)
-{
- int bytesPerLine = (size.width() + 3) & ~3;
- int bytesPerLine2 = (size.width() / 2 + 3) & ~3;
-
- m_yuv = true;
- m_textureInternalFormat = GL_LUMINANCE;
- m_textureFormat = GL_LUMINANCE;
- m_textureType = GL_UNSIGNED_BYTE;
- m_textureCount = 3;
- m_textureWidths[0] = bytesPerLine;
- m_textureHeights[0] = size.height();
- m_textureOffsets[0] = 0;
- m_textureWidths[1] = bytesPerLine2;
- m_textureHeights[1] = size.height() / 2;
- m_textureOffsets[1] = bytesPerLine * size.height() + bytesPerLine2 * size.height()/2;
- m_textureWidths[2] = bytesPerLine2;
- m_textureHeights[2] = size.height() / 2;
- m_textureOffsets[2] = bytesPerLine * size.height();
-}
-
-#ifndef QT_OPENGL_ES
-
-# ifndef GL_FRAGMENT_PROGRAM_ARB
-# define GL_FRAGMENT_PROGRAM_ARB 0x8804
-# define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
-# endif
-
-// Paints an RGB32 frame
-static const char *qt_arbfp_xrgbShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP xrgb;\n"
- "TEX xrgb.xyz, fragment.texcoord[0], texture[0], 2D;\n"
- "MOV xrgb.w, matrix[3].w;\n"
- "DP4 result.color.x, xrgb.zyxw, matrix[0];\n"
- "DP4 result.color.y, xrgb.zyxw, matrix[1];\n"
- "DP4 result.color.z, xrgb.zyxw, matrix[2];\n"
- "END";
-
-// Paints an ARGB frame.
-static const char *qt_arbfp_argbShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP argb;\n"
- "TEX argb, fragment.texcoord[0], texture[0], 2D;\n"
- "MOV argb.w, matrix[3].w;\n"
- "DP4 result.color.x, argb.zyxw, matrix[0];\n"
- "DP4 result.color.y, argb.zyxw, matrix[1];\n"
- "DP4 result.color.z, argb.zyxw, matrix[2];\n"
- "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n"
- "END";
-
-// Paints an RGB(A) frame.
-static const char *qt_arbfp_rgbShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP rgb;\n"
- "TEX rgb, fragment.texcoord[0], texture[0], 2D;\n"
- "MOV rgb.w, matrix[3].w;\n"
- "DP4 result.color.x, rgb, matrix[0];\n"
- "DP4 result.color.y, rgb, matrix[1];\n"
- "DP4 result.color.z, rgb, matrix[2];\n"
- "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n"
- "END";
-
-// Paints a YUV420P or YV12 frame.
-static const char *qt_arbfp_yuvPlanarShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP yuv;\n"
- "TEX yuv.x, fragment.texcoord[0], texture[0], 2D;\n"
- "TEX yuv.y, fragment.texcoord[0], texture[1], 2D;\n"
- "TEX yuv.z, fragment.texcoord[0], texture[2], 2D;\n"
- "MOV yuv.w, matrix[3].w;\n"
- "DP4 result.color.x, yuv, matrix[0];\n"
- "DP4 result.color.y, yuv, matrix[1];\n"
- "DP4 result.color.z, yuv, matrix[2];\n"
- "END";
-
-// Paints a YUV444 frame.
-static const char *qt_arbfp_xyuvShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP ayuv;\n"
- "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n"
- "MOV ayuv.x, matrix[3].w;\n"
- "DP4 result.color.x, ayuv.yzwx, matrix[0];\n"
- "DP4 result.color.y, ayuv.yzwx, matrix[1];\n"
- "DP4 result.color.z, ayuv.yzwx, matrix[2];\n"
- "END";
-
-// Paints a AYUV444 frame.
-static const char *qt_arbfp_ayuvShaderProgram =
- "!!ARBfp1.0\n"
- "PARAM matrix[4] = { program.local[0..2],"
- "{ 0.0, 0.0, 0.0, 1.0 } };\n"
- "TEMP ayuv;\n"
- "TEX ayuv, fragment.texcoord[0], texture[0], 2D;\n"
- "MOV ayuv.x, matrix[3].w;\n"
- "DP4 result.color.x, ayuv.yzwx, matrix[0];\n"
- "DP4 result.color.y, ayuv.yzwx, matrix[1];\n"
- "DP4 result.color.z, ayuv.yzwx, matrix[2];\n"
- "TEX result.color.w, fragment.texcoord[0], texture, 2D;\n"
- "END";
-
-class QVideoSurfaceArbFpPainter : public QVideoSurfaceGLPainter
-{
-public:
- QVideoSurfaceArbFpPainter(QGLContext *context);
-
- QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format);
- void stop();
-
- QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source);
-
-private:
- typedef void (APIENTRY *_glProgramStringARB) (GLenum, GLenum, GLsizei, const GLvoid *);
- typedef void (APIENTRY *_glBindProgramARB) (GLenum, GLuint);
- typedef void (APIENTRY *_glDeleteProgramsARB) (GLsizei, const GLuint *);
- typedef void (APIENTRY *_glGenProgramsARB) (GLsizei, GLuint *);
- typedef void (APIENTRY *_glProgramLocalParameter4fARB) (
- GLenum, GLuint, GLfloat, GLfloat, GLfloat, GLfloat);
- typedef void (APIENTRY *_glActiveTexture) (GLenum);
-
- _glProgramStringARB glProgramStringARB;
- _glBindProgramARB glBindProgramARB;
- _glDeleteProgramsARB glDeleteProgramsARB;
- _glGenProgramsARB glGenProgramsARB;
- _glProgramLocalParameter4fARB glProgramLocalParameter4fARB;
-
- GLuint m_programId;
- QSize m_frameSize;
-};
-
-QVideoSurfaceArbFpPainter::QVideoSurfaceArbFpPainter(QGLContext *context)
- : QVideoSurfaceGLPainter(context)
- , m_programId(0)
-{
- glProgramStringARB = (_glProgramStringARB) m_context->getProcAddress(
- QLatin1String("glProgramStringARB"));
- glBindProgramARB = (_glBindProgramARB) m_context->getProcAddress(
- QLatin1String("glBindProgramARB"));
- glDeleteProgramsARB = (_glDeleteProgramsARB) m_context->getProcAddress(
- QLatin1String("glDeleteProgramsARB"));
- glGenProgramsARB = (_glGenProgramsARB) m_context->getProcAddress(
- QLatin1String("glGenProgramsARB"));
- glProgramLocalParameter4fARB = (_glProgramLocalParameter4fARB) m_context->getProcAddress(
- QLatin1String("glProgramLocalParameter4fARB"));
-
- m_imagePixelFormats
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_BGR32
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_RGB24
- << QVideoFrame::Format_BGR24
- << QVideoFrame::Format_RGB565
- << QVideoFrame::Format_AYUV444
- << QVideoFrame::Format_YUV444
- << QVideoFrame::Format_YV12
- << QVideoFrame::Format_YUV420P;
- m_glPixelFormats
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::start(const QVideoSurfaceFormat &format)
-{
- Q_ASSERT(m_textureCount == 0);
-
- QAbstractVideoSurface::Error error = QAbstractVideoSurface::NoError;
-
- m_context->makeCurrent();
-
- const char *program = 0;
-
- if (format.handleType() == QAbstractVideoBuffer::NoHandle) {
- switch (format.pixelFormat()) {
- case QVideoFrame::Format_RGB32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_xrgbShaderProgram;
- break;
- case QVideoFrame::Format_BGR32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_rgbShaderProgram;
- break;
- case QVideoFrame::Format_ARGB32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_argbShaderProgram;
- break;
- case QVideoFrame::Format_RGB24:
- initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_rgbShaderProgram;
- break;
- case QVideoFrame::Format_BGR24:
- initRgbTextureInfo(GL_RGB8, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_xrgbShaderProgram;
- break;
- case QVideoFrame::Format_RGB565:
- initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize());
- program = qt_arbfp_rgbShaderProgram;
- break;
- case QVideoFrame::Format_YUV444:
- initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_xyuvShaderProgram;
- m_yuv = true;
- break;
- case QVideoFrame::Format_AYUV444:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- program = qt_arbfp_ayuvShaderProgram;
- m_yuv = true;
- break;
- case QVideoFrame::Format_YV12:
- initYv12TextureInfo(format.frameSize());
- program = qt_arbfp_yuvPlanarShaderProgram;
- break;
- case QVideoFrame::Format_YUV420P:
- initYuv420PTextureInfo(format.frameSize());
- program = qt_arbfp_yuvPlanarShaderProgram;
- break;
- default:
- break;
- }
- } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
- switch (format.pixelFormat()) {
- case QVideoFrame::Format_RGB32:
- case QVideoFrame::Format_ARGB32:
- m_yuv = false;
- m_textureCount = 1;
- program = qt_arbfp_rgbShaderProgram;
- break;
- default:
- break;
- }
- } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- m_handleType = QAbstractVideoBuffer::QPixmapHandle;
- return QAbstractVideoSurface::NoError;
- }
-
- if (!program) {
- error = QAbstractVideoSurface::UnsupportedFormatError;
- } else {
- glGenProgramsARB(1, &m_programId);
-
- GLenum glError = glGetError();
- if (glError != GL_NO_ERROR) {
- qWarning("QPainterVideoSurface: ARBfb Shader allocation error %x", int(glError));
- m_textureCount = 0;
- m_programId = 0;
-
- error = QAbstractVideoSurface::ResourceError;
- } else {
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_programId);
- glProgramStringARB(
- GL_FRAGMENT_PROGRAM_ARB,
- GL_PROGRAM_FORMAT_ASCII_ARB,
- qstrlen(program),
- reinterpret_cast<const GLvoid *>(program));
-
- if ((glError = glGetError()) != GL_NO_ERROR) {
- const GLubyte* errorString = glGetString(GL_PROGRAM_ERROR_STRING_ARB);
-
- qWarning("QPainterVideoSurface: ARBfp Shader compile error %x, %s",
- int(glError),
- reinterpret_cast<const char *>(errorString));
- glDeleteProgramsARB(1, &m_programId);
-
- m_textureCount = 0;
- m_programId = 0;
-
- error = QAbstractVideoSurface::ResourceError;
- } else {
- m_handleType = format.handleType();
- m_scanLineDirection = format.scanLineDirection();
- m_frameSize = format.frameSize();
- m_colorSpace = format.yCbCrColorSpace();
-
- if (m_handleType == QAbstractVideoBuffer::NoHandle)
- glGenTextures(m_textureCount, m_textureIds);
- }
- }
- }
-
- return error;
-}
-
-void QVideoSurfaceArbFpPainter::stop()
-{
- if (m_context) {
- m_context->makeCurrent();
-
- if (m_handleType != QAbstractVideoBuffer::GLTextureHandle)
- glDeleteTextures(m_textureCount, m_textureIds);
- glDeleteProgramsARB(1, &m_programId);
- }
-
- m_textureCount = 0;
- m_programId = 0;
- m_handleType = QAbstractVideoBuffer::NoHandle;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceArbFpPainter::paint(
- const QRectF &target, QPainter *painter, const QRectF &source)
-{
- if (!m_frame.isValid()) {
- painter->fillRect(target, Qt::black);
- return QAbstractVideoSurface::NoError;
- }
-
- const QAbstractVideoBuffer::HandleType h = m_frame.handleType();
- if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) {
- bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
- bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
-
- painter->beginNativePainting();
-
- if (stencilTestEnabled)
- glEnable(GL_STENCIL_TEST);
- if (scissorTestEnabled)
- glEnable(GL_SCISSOR_TEST);
-
- const float txLeft = source.left() / m_frameSize.width();
- const float txRight = source.right() / m_frameSize.width();
- const float txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.top() / m_frameSize.height()
- : source.bottom() / m_frameSize.height();
- const float txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.bottom() / m_frameSize.height()
- : source.top() / m_frameSize.height();
-
- const float tx_array[] =
- {
- txLeft , txBottom,
- txRight, txBottom,
- txLeft , txTop,
- txRight, txTop
- };
-
- const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.top()
- : target.bottom() + 1;
- const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.bottom() + 1
- : target.top();
-
- const GLfloat v_array[] =
- {
- GLfloat(target.left()) , GLfloat(vBottom),
- GLfloat(target.right() + 1), GLfloat(vBottom),
- GLfloat(target.left()) , GLfloat(vTop),
- GLfloat(target.right() + 1), GLfloat(vTop)
- };
-
- glEnable(GL_FRAGMENT_PROGRAM_ARB);
- glBindProgramARB(GL_FRAGMENT_PROGRAM_ARB, m_programId);
-
- glProgramLocalParameter4fARB(
- GL_FRAGMENT_PROGRAM_ARB,
- 0,
- m_colorMatrix(0, 0),
- m_colorMatrix(0, 1),
- m_colorMatrix(0, 2),
- m_colorMatrix(0, 3));
- glProgramLocalParameter4fARB(
- GL_FRAGMENT_PROGRAM_ARB,
- 1,
- m_colorMatrix(1, 0),
- m_colorMatrix(1, 1),
- m_colorMatrix(1, 2),
- m_colorMatrix(1, 3));
- glProgramLocalParameter4fARB(
- GL_FRAGMENT_PROGRAM_ARB,
- 2,
- m_colorMatrix(2, 0),
- m_colorMatrix(2, 1),
- m_colorMatrix(2, 2),
- m_colorMatrix(2, 3));
-
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[0]);
-
- if (m_textureCount == 3) {
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[1]);
- glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[2]);
- glActiveTexture(GL_TEXTURE0);
- }
-
- glVertexPointer(2, GL_FLOAT, 0, v_array);
- glTexCoordPointer(2, GL_FLOAT, 0, tx_array);
-
- glEnableClientState(GL_VERTEX_ARRAY);
- glEnableClientState(GL_TEXTURE_COORD_ARRAY);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- glDisableClientState(GL_TEXTURE_COORD_ARRAY);
- glDisableClientState(GL_VERTEX_ARRAY);
- glDisable(GL_FRAGMENT_PROGRAM_ARB);
-
- painter->endNativePainting();
-
- return QAbstractVideoSurface::NoError;
- }
-
- return QVideoSurfaceGLPainter::paint(target, painter, source);
-}
-
-#endif
-
-static const char *qt_glsl_vertexShaderProgram =
- "attribute highp vec4 vertexCoordArray;\n"
- "attribute highp vec2 textureCoordArray;\n"
- "uniform highp mat4 positionMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " gl_Position = positionMatrix * vertexCoordArray;\n"
- " textureCoord = textureCoordArray;\n"
- "}\n";
-
-// Paints an RGB32 frame
-static const char *qt_glsl_xrgbShaderProgram =
- "uniform sampler2D texRgb;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).bgr, 1.0);\n"
- " gl_FragColor = colorMatrix * color;\n"
- "}\n";
-
-// Paints an ARGB frame.
-static const char *qt_glsl_argbShaderProgram =
- "uniform sampler2D texRgb;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).bgr, 1.0);\n"
- " color = colorMatrix * color;\n"
- " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).a);\n"
- "}\n";
-
-// Paints an RGB(A) frame.
-static const char *qt_glsl_rgbShaderProgram =
- "uniform sampler2D texRgb;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).rgb, 1.0);\n"
- " color = colorMatrix * color;\n"
- " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).a);\n"
- "}\n";
-
-// Paints a YUV420P or YV12 frame.
-static const char *qt_glsl_yuvPlanarShaderProgram =
- "uniform sampler2D texY;\n"
- "uniform sampler2D texU;\n"
- "uniform sampler2D texV;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(\n"
- " texture2D(texY, textureCoord.st).r,\n"
- " texture2D(texU, textureCoord.st).r,\n"
- " texture2D(texV, textureCoord.st).r,\n"
- " 1.0);\n"
- " gl_FragColor = colorMatrix * color;\n"
- "}\n";
-
-// Paints a YUV444 frame.
-static const char *qt_glsl_xyuvShaderProgram =
- "uniform sampler2D texRgb;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n"
- " gl_FragColor = colorMatrix * color;\n"
- "}\n";
-
-// Paints a AYUV444 frame.
-static const char *qt_glsl_ayuvShaderProgram =
- "uniform sampler2D texRgb;\n"
- "uniform mediump mat4 colorMatrix;\n"
- "varying highp vec2 textureCoord;\n"
- "void main(void)\n"
- "{\n"
- " highp vec4 color = vec4(texture2D(texRgb, textureCoord.st).gba, 1.0);\n"
- " color = colorMatrix * color;\n"
- " gl_FragColor = vec4(color.rgb, texture2D(texRgb, textureCoord.st).r);\n"
- "}\n";
-
-class QVideoSurfaceGlslPainter : public QVideoSurfaceGLPainter
-{
-public:
- QVideoSurfaceGlslPainter(QGLContext *context);
-
- QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format);
- void stop();
-
- QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source);
-
-private:
- QGLShaderProgram m_program;
- QSize m_frameSize;
-};
-
-QVideoSurfaceGlslPainter::QVideoSurfaceGlslPainter(QGLContext *context)
- : QVideoSurfaceGLPainter(context)
- , m_program(context)
-{
- m_imagePixelFormats
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_BGR32
- << QVideoFrame::Format_ARGB32
-#ifndef QT_OPENGL_ES
- << QVideoFrame::Format_RGB24
- << QVideoFrame::Format_BGR24
-#endif
- << QVideoFrame::Format_RGB565
- << QVideoFrame::Format_YUV444
- << QVideoFrame::Format_AYUV444
- << QVideoFrame::Format_YV12
- << QVideoFrame::Format_YUV420P;
- m_glPixelFormats
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::start(const QVideoSurfaceFormat &format)
-{
- Q_ASSERT(m_textureCount == 0);
-
- QAbstractVideoSurface::Error error = QAbstractVideoSurface::NoError;
-
- m_context->makeCurrent();
-
- const char *fragmentProgram = 0;
-
- if (format.handleType() == QAbstractVideoBuffer::NoHandle) {
- switch (format.pixelFormat()) {
- case QVideoFrame::Format_RGB32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_xrgbShaderProgram;
- break;
- case QVideoFrame::Format_BGR32:
- initRgbTextureInfo(GL_RGB, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_rgbShaderProgram;
- break;
- case QVideoFrame::Format_ARGB32:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_argbShaderProgram;
- break;
-#ifndef QT_OPENGL_ES
- case QVideoFrame::Format_RGB24:
- initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_rgbShaderProgram;
- break;
- case QVideoFrame::Format_BGR24:
- initRgbTextureInfo(GL_RGB8, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_argbShaderProgram;
- break;
-#endif
- case QVideoFrame::Format_RGB565:
- initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, format.frameSize());
- fragmentProgram = qt_glsl_rgbShaderProgram;
- break;
- case QVideoFrame::Format_YUV444:
- initRgbTextureInfo(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_xyuvShaderProgram;
- m_yuv = true;
- break;
- case QVideoFrame::Format_AYUV444:
- initRgbTextureInfo(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE, format.frameSize());
- fragmentProgram = qt_glsl_ayuvShaderProgram;
- m_yuv = true;
- break;
- case QVideoFrame::Format_YV12:
- initYv12TextureInfo(format.frameSize());
- fragmentProgram = qt_glsl_yuvPlanarShaderProgram;
- break;
- case QVideoFrame::Format_YUV420P:
- initYuv420PTextureInfo(format.frameSize());
- fragmentProgram = qt_glsl_yuvPlanarShaderProgram;
- break;
- default:
- break;
- }
- } else if (format.handleType() == QAbstractVideoBuffer::GLTextureHandle) {
- switch (format.pixelFormat()) {
- case QVideoFrame::Format_RGB32:
- case QVideoFrame::Format_ARGB32:
- m_yuv = false;
- m_textureCount = 1;
- fragmentProgram = qt_glsl_rgbShaderProgram;
- break;
- default:
- break;
- }
- } else if (format.handleType() == QAbstractVideoBuffer::QPixmapHandle) {
- m_handleType = QAbstractVideoBuffer::QPixmapHandle;
- return QAbstractVideoSurface::NoError;
- }
-
- if (!fragmentProgram) {
- error = QAbstractVideoSurface::UnsupportedFormatError;
- } else if (!m_program.addShaderFromSourceCode(QGLShader::Vertex, qt_glsl_vertexShaderProgram)) {
- qWarning("QPainterVideoSurface: Vertex shader compile error %s",
- qPrintable(m_program.log()));
- error = QAbstractVideoSurface::ResourceError;
- } else if (!m_program.addShaderFromSourceCode(QGLShader::Fragment, fragmentProgram)) {
- qWarning("QPainterVideoSurface: Shader compile error %s", qPrintable(m_program.log()));
- error = QAbstractVideoSurface::ResourceError;
- m_program.removeAllShaders();
- } else if(!m_program.link()) {
- qWarning("QPainterVideoSurface: Shader link error %s", qPrintable(m_program.log()));
- m_program.removeAllShaders();
- error = QAbstractVideoSurface::ResourceError;
- } else {
- m_handleType = format.handleType();
- m_scanLineDirection = format.scanLineDirection();
- m_frameSize = format.frameSize();
- m_colorSpace = format.yCbCrColorSpace();
-
- if (m_handleType == QAbstractVideoBuffer::NoHandle)
- glGenTextures(m_textureCount, m_textureIds);
- }
-
- return error;
-}
-
-void QVideoSurfaceGlslPainter::stop()
-{
- if (m_context) {
- m_context->makeCurrent();
-
- if (m_handleType != QAbstractVideoBuffer::GLTextureHandle)
- glDeleteTextures(m_textureCount, m_textureIds);
- }
-
- m_program.removeAllShaders();
-
- m_textureCount = 0;
- m_handleType = QAbstractVideoBuffer::NoHandle;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceGlslPainter::paint(
- const QRectF &target, QPainter *painter, const QRectF &source)
-{
- if (!m_frame.isValid()) {
- painter->fillRect(target, Qt::black);
- return QAbstractVideoSurface::NoError;
- }
-
- const QAbstractVideoBuffer::HandleType h = m_frame.handleType();
- if (h == QAbstractVideoBuffer::NoHandle || h == QAbstractVideoBuffer::GLTextureHandle) {
- bool stencilTestEnabled = glIsEnabled(GL_STENCIL_TEST);
- bool scissorTestEnabled = glIsEnabled(GL_SCISSOR_TEST);
-
- painter->beginNativePainting();
-
- if (stencilTestEnabled)
- glEnable(GL_STENCIL_TEST);
- if (scissorTestEnabled)
- glEnable(GL_SCISSOR_TEST);
-
- const int width = QGLContext::currentContext()->device()->width();
- const int height = QGLContext::currentContext()->device()->height();
-
- const QTransform transform = painter->deviceTransform();
-
- const GLfloat wfactor = 2.0 / width;
- const GLfloat hfactor = -2.0 / height;
-
- const GLfloat positionMatrix[4][4] =
- {
- {
- /*(0,0)*/ GLfloat(wfactor * transform.m11() - transform.m13()),
- /*(0,1)*/ GLfloat(hfactor * transform.m12() + transform.m13()),
- /*(0,2)*/ 0.0,
- /*(0,3)*/ GLfloat(transform.m13())
- }, {
- /*(1,0)*/ GLfloat(wfactor * transform.m21() - transform.m23()),
- /*(1,1)*/ GLfloat(hfactor * transform.m22() + transform.m23()),
- /*(1,2)*/ 0.0,
- /*(1,3)*/ GLfloat(transform.m23())
- }, {
- /*(2,0)*/ 0.0,
- /*(2,1)*/ 0.0,
- /*(2,2)*/ -1.0,
- /*(2,3)*/ 0.0
- }, {
- /*(3,0)*/ GLfloat(wfactor * transform.dx() - transform.m33()),
- /*(3,1)*/ GLfloat(hfactor * transform.dy() + transform.m33()),
- /*(3,2)*/ 0.0,
- /*(3,3)*/ GLfloat(transform.m33())
- }
- };
-
- const GLfloat vTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.top()
- : target.bottom() + 1;
- const GLfloat vBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? target.bottom() + 1
- : target.top();
-
-
- const GLfloat vertexCoordArray[] =
- {
- GLfloat(target.left()) , GLfloat(vBottom),
- GLfloat(target.right() + 1), GLfloat(vBottom),
- GLfloat(target.left()) , GLfloat(vTop),
- GLfloat(target.right() + 1), GLfloat(vTop)
- };
-
- const GLfloat txLeft = source.left() / m_frameSize.width();
- const GLfloat txRight = source.right() / m_frameSize.width();
- const GLfloat txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.top() / m_frameSize.height()
- : source.bottom() / m_frameSize.height();
- const GLfloat txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.bottom() / m_frameSize.height()
- : source.top() / m_frameSize.height();
-
- const GLfloat textureCoordArray[] =
- {
- txLeft , txBottom,
- txRight, txBottom,
- txLeft , txTop,
- txRight, txTop
- };
-
- m_program.bind();
-
- m_program.enableAttributeArray("vertexCoordArray");
- m_program.enableAttributeArray("textureCoordArray");
- m_program.setAttributeArray("vertexCoordArray", vertexCoordArray, 2);
- m_program.setAttributeArray("textureCoordArray", textureCoordArray, 2);
- m_program.setUniformValue("positionMatrix", positionMatrix);
-
- if (m_textureCount == 3) {
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[0]);
- glActiveTexture(GL_TEXTURE1);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[1]);
- glActiveTexture(GL_TEXTURE2);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[2]);
- glActiveTexture(GL_TEXTURE0);
-
- m_program.setUniformValue("texY", 0);
- m_program.setUniformValue("texU", 1);
- m_program.setUniformValue("texV", 2);
- } else {
- glActiveTexture(GL_TEXTURE0);
- glBindTexture(GL_TEXTURE_2D, m_textureIds[0]);
-
- m_program.setUniformValue("texRgb", 0);
- }
- m_program.setUniformValue("colorMatrix", m_colorMatrix);
-
- glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
-
- m_program.release();
-
- painter->endNativePainting();
-
- return QAbstractVideoSurface::NoError;
- }
-
- return QVideoSurfaceGLPainter::paint(target, painter, source);
-}
-
-#endif
-
-/*!
- \class QPainterVideoSurface
- \since 1.0
- \internal
-*/
-
-/*!
-*/
-QPainterVideoSurface::QPainterVideoSurface(QObject *parent)
- : QAbstractVideoSurface(parent)
- , m_painter(0)
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- , m_glContext(0)
- , m_shaderTypes(NoShaders)
- , m_shaderType(NoShaders)
-#endif
- , m_brightness(0)
- , m_contrast(0)
- , m_hue(0)
- , m_saturation(0)
- , m_pixelFormat(QVideoFrame::Format_Invalid)
- , m_colorsDirty(true)
- , m_ready(false)
-{
-}
-
-/*!
-*/
-QPainterVideoSurface::~QPainterVideoSurface()
-{
- if (isActive())
- m_painter->stop();
-
- delete m_painter;
-}
-
-/*!
- \since 1.0
-*/
-QList<QVideoFrame::PixelFormat> QPainterVideoSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- if (!m_painter)
- const_cast<QPainterVideoSurface *>(this)->createPainter();
-
- return m_painter->supportedPixelFormats(handleType);
-}
-
-/*!
- \since 1.0
-*/
-bool QPainterVideoSurface::isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const
-{
- if (!m_painter)
- const_cast<QPainterVideoSurface *>(this)->createPainter();
-
- return m_painter->isFormatSupported(format, similar);
-}
-
-/*!
- \since 1.0
-*/
-bool QPainterVideoSurface::start(const QVideoSurfaceFormat &format)
-{
- if (isActive())
- m_painter->stop();
-
- if (!m_painter)
- createPainter();
-
- if (format.frameSize().isEmpty()) {
- setError(UnsupportedFormatError);
- } else {
- QAbstractVideoSurface::Error error = m_painter->start(format);
-
- if (error != QAbstractVideoSurface::NoError) {
- setError(error);
- } else {
- m_pixelFormat = format.pixelFormat();
- m_frameSize = format.frameSize();
- m_sourceRect = format.viewport();
- m_colorsDirty = true;
- m_ready = true;
-
- return QAbstractVideoSurface::start(format);
- }
- }
-
- QAbstractVideoSurface::stop();
-
- return false;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::stop()
-{
- if (isActive()) {
- m_painter->stop();
- m_ready = false;
-
- QAbstractVideoSurface::stop();
- }
-}
-
-/*!
- \since 1.0
-*/
-bool QPainterVideoSurface::present(const QVideoFrame &frame)
-{
- if (!m_ready) {
- if (!isActive())
- setError(StoppedError);
- } else if (frame.isValid()
- && (frame.pixelFormat() != m_pixelFormat || frame.size() != m_frameSize)) {
- setError(IncorrectFormatError);
-
- stop();
- } else {
- QAbstractVideoSurface::Error error = m_painter->setCurrentFrame(frame);
-
- if (error != QAbstractVideoSurface::NoError) {
- setError(error);
-
- stop();
- } else {
- m_ready = false;
-
- emit frameChanged();
-
- return true;
- }
- }
- return false;
-}
-
-/*!
- \since 1.0
-*/
-int QPainterVideoSurface::brightness() const
-{
- return m_brightness;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setBrightness(int brightness)
-{
- m_brightness = brightness;
-
- m_colorsDirty = true;
-}
-
-/*!
- \since 1.0
-*/
-int QPainterVideoSurface::contrast() const
-{
- return m_contrast;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setContrast(int contrast)
-{
- m_contrast = contrast;
-
- m_colorsDirty = true;
-}
-
-/*!
- \since 1.0
-*/
-int QPainterVideoSurface::hue() const
-{
- return m_hue;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setHue(int hue)
-{
- m_hue = hue;
-
- m_colorsDirty = true;
-}
-
-/*!
- \since 1.0
-*/
-int QPainterVideoSurface::saturation() const
-{
- return m_saturation;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setSaturation(int saturation)
-{
- m_saturation = saturation;
-
- m_colorsDirty = true;
-}
-
-/*!
- \since 1.0
-*/
-bool QPainterVideoSurface::isReady() const
-{
- return m_ready;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setReady(bool ready)
-{
- m_ready = ready;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::paint(QPainter *painter, const QRectF &target, const QRectF &source)
-{
- if (!isActive()) {
- painter->fillRect(target, QBrush(Qt::black));
- } else {
- if (m_colorsDirty) {
- m_painter->updateColors(m_brightness, m_contrast, m_hue, m_saturation);
- m_colorsDirty = false;
- }
-
- const QRectF sourceRect(
- m_sourceRect.x() + m_sourceRect.width() * source.x(),
- m_sourceRect.y() + m_sourceRect.height() * source.y(),
- m_sourceRect.width() * source.width(),
- m_sourceRect.height() * source.height());
-
- QAbstractVideoSurface::Error error = m_painter->paint(target, painter, sourceRect);
-
- if (error != QAbstractVideoSurface::NoError) {
- setError(error);
-
- stop();
- }
- }
-}
-
-/*!
- \fn QPainterVideoSurface::frameChanged()
- \since 1.0
-*/
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-
-/*!
-*/
-const QGLContext *QPainterVideoSurface::glContext() const
-{
- return m_glContext;
-}
-
-/*!
-*/
-void QPainterVideoSurface::setGLContext(QGLContext *context)
-{
- if (m_glContext == context)
- return;
-
- m_glContext = context;
-
- m_shaderTypes = NoShaders;
-
- if (m_glContext) {
- m_glContext->makeCurrent();
-
- const QByteArray extensions(reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS)));
-#ifndef QT_OPENGL_ES
-
- if (extensions.contains("ARB_fragment_program"))
- m_shaderTypes |= FragmentProgramShader;
-#endif
- if (QGLShaderProgram::hasOpenGLShaderPrograms(m_glContext)
-#ifndef QT_OPENGL_ES_2
- && extensions.contains("ARB_shader_objects")
-#endif
- )
- m_shaderTypes |= GlslShader;
- }
-
- ShaderType type = (m_shaderType & m_shaderTypes)
- ? m_shaderType
- : NoShaders;
-
- if (type != m_shaderType || type != NoShaders) {
- m_shaderType = type;
-
- if (isActive()) {
- m_painter->stop();
- delete m_painter;
- m_painter = 0;
- m_ready = false;
-
- setError(ResourceError);
- QAbstractVideoSurface::stop();
- }
- emit supportedFormatsChanged();
- }
-}
-
-/*!
- \enum QPainterVideoSurface::ShaderType
-
- \value NoShaders
- \value FragmentProgramShader
- \value HlslShader
-*/
-
-/*!
- \typedef QPainterVideoSurface::ShaderTypes
-*/
-
-/*!
- \since 1.0
-*/
-QPainterVideoSurface::ShaderTypes QPainterVideoSurface::supportedShaderTypes() const
-{
- return m_shaderTypes;
-}
-
-/*!
- \since 1.0
-*/
-QPainterVideoSurface::ShaderType QPainterVideoSurface::shaderType() const
-{
- return m_shaderType;
-}
-
-/*!
- \since 1.0
-*/
-void QPainterVideoSurface::setShaderType(ShaderType type)
-{
- if (!(type & m_shaderTypes))
- type = NoShaders;
-
- if (type != m_shaderType) {
- m_shaderType = type;
-
- if (isActive()) {
- m_painter->stop();
- delete m_painter;
- m_painter = 0;
- m_ready = false;
-
- setError(ResourceError);
- QAbstractVideoSurface::stop();
- } else {
- delete m_painter;
- m_painter = 0;
- }
- emit supportedFormatsChanged();
- }
-}
-
-#endif
-
-void QPainterVideoSurface::viewportDestroyed()
-{
- if (m_painter) {
- m_painter->viewportDestroyed();
-
- setError(ResourceError);
- stop();
- delete m_painter;
- m_painter = 0;
- }
-}
-
-void QPainterVideoSurface::createPainter()
-{
- Q_ASSERT(!m_painter);
-
-#ifdef Q_WS_MAC
- if (m_glContext)
- m_glContext->makeCurrent();
-
- m_painter = new QVideoSurfaceCoreGraphicsPainter(m_glContext != 0);
- return;
-#endif
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- switch (m_shaderType) {
-#ifndef QT_OPENGL_ES
- case FragmentProgramShader:
- Q_ASSERT(m_glContext);
- m_glContext->makeCurrent();
- m_painter = new QVideoSurfaceArbFpPainter(m_glContext);
- break;
-#endif
- case GlslShader:
- Q_ASSERT(m_glContext);
- m_glContext->makeCurrent();
- m_painter = new QVideoSurfaceGlslPainter(m_glContext);
- break;
- default:
- m_painter = new QVideoSurfaceGenericPainter;
- break;
- }
-#else
- m_painter = new QVideoSurfaceGenericPainter;
-#endif
-}
-
-#include "moc_qpaintervideosurface_p.cpp"
-QT_END_NAMESPACE
-
-
diff --git a/src/multimediawidgets/qpaintervideosurface_mac.mm b/src/multimediawidgets/qpaintervideosurface_mac.mm
deleted file mode 100644
index 02eabfe..0000000
--- a/src/multimediawidgets/qpaintervideosurface_mac.mm
+++ /dev/null
@@ -1,285 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <AppKit/AppKit.h>
-#include <QuartzCore/CIContext.h>
-#include <CGLCurrent.h>
-#include <OpenGL/gl.h>
-
-#include "qpaintervideosurface_mac_p.h"
-
-#include <QtCore/qdatetime.h>
-
-#include <qmath.h>
-
-#include <qpainter.h>
-#include <qvariant.h>
-#include <qvideosurfaceformat.h>
-
-#include <QtDebug>
-
-QT_BEGIN_NAMESPACE
-
-extern CGContextRef qt_mac_cg_context(const QPaintDevice *pdev); //qpaintdevice_mac.cpp
-
-QVideoSurfaceCoreGraphicsPainter::QVideoSurfaceCoreGraphicsPainter(bool glSupported)
- : ciContext(0)
- , m_imageFormat(QImage::Format_Invalid)
- , m_scanLineDirection(QVideoSurfaceFormat::TopToBottom)
-{
- //qDebug() << "QVideoSurfaceCoreGraphicsPainter, GL supported:" << glSupported;
- ciContext = 0;
- m_imagePixelFormats
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_ARGB32
- << QVideoFrame::Format_ARGB32_Premultiplied
- << QVideoFrame::Format_RGB24
- << QVideoFrame::Format_RGB565
- << QVideoFrame::Format_RGB555
- << QVideoFrame::Format_ARGB8565_Premultiplied;
-
- m_supportedHandles
- << QAbstractVideoBuffer::NoHandle
- << QAbstractVideoBuffer::CoreImageHandle;
-
- if (glSupported)
- m_supportedHandles << QAbstractVideoBuffer::GLTextureHandle;
-}
-
-QVideoSurfaceCoreGraphicsPainter::~QVideoSurfaceCoreGraphicsPainter()
-{
- [(CIContext*)ciContext release];
-}
-
-QList<QVideoFrame::PixelFormat> QVideoSurfaceCoreGraphicsPainter::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- return m_supportedHandles.contains(handleType)
- ? m_imagePixelFormats
- : QList<QVideoFrame::PixelFormat>();
-}
-
-bool QVideoSurfaceCoreGraphicsPainter::isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *) const
-{
- return m_supportedHandles.contains(format.handleType())
- && m_imagePixelFormats.contains(format.pixelFormat())
- && !format.frameSize().isEmpty();
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::start(const QVideoSurfaceFormat &format)
-{
- m_frame = QVideoFrame();
- m_imageFormat = QVideoFrame::imageFormatFromPixelFormat(format.pixelFormat());
- m_imageSize = format.frameSize();
- m_scanLineDirection = format.scanLineDirection();
-
- return m_supportedHandles.contains(format.handleType())
- && m_imageFormat != QImage::Format_Invalid
- && !m_imageSize.isEmpty()
- ? QAbstractVideoSurface::NoError
- : QAbstractVideoSurface::UnsupportedFormatError;
-}
-
-void QVideoSurfaceCoreGraphicsPainter::stop()
-{
- m_frame = QVideoFrame();
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::setCurrentFrame(const QVideoFrame &frame)
-{
- m_frame = frame;
-
- return QAbstractVideoSurface::NoError;
-}
-
-QAbstractVideoSurface::Error QVideoSurfaceCoreGraphicsPainter::paint(
- const QRectF &target, QPainter *painter, const QRectF &source)
-{
- if (m_frame.handleType() == QAbstractVideoBuffer::CoreImageHandle) {
- if (painter->paintEngine()->type() == QPaintEngine::CoreGraphics ) {
-
- CIImage *img = (CIImage*)(m_frame.handle().value<void*>());
-
- if (img) {
- CGContextRef cgContext = qt_mac_cg_context(painter->device());
-
- if (cgContext) {
- painter->beginNativePainting();
-
- CGRect sRect = CGRectMake(source.x(), source.y(), source.width(), source.height());
- CGRect dRect = CGRectMake(target.x(), target.y(), target.width(), target.height());
-
- NSBitmapImageRep *bitmap = [[NSBitmapImageRep alloc] initWithCIImage:img];
-
- if (m_scanLineDirection == QVideoSurfaceFormat::TopToBottom) {
- CGContextSaveGState( cgContext );
- CGContextTranslateCTM(cgContext, 0, dRect.origin.y + CGRectGetMaxY(dRect));
- CGContextScaleCTM(cgContext, 1, -1);
-
- CGContextDrawImage(cgContext, dRect, [bitmap CGImage]);
-
- CGContextRestoreGState(cgContext);
- } else {
- CGContextDrawImage(cgContext, dRect, [bitmap CGImage]);
- }
-
- [bitmap release];
-
- painter->endNativePainting();
-
- return QAbstractVideoSurface::NoError;
- }
- }
- } else if (painter->paintEngine()->type() == QPaintEngine::OpenGL2 ||
- painter->paintEngine()->type() == QPaintEngine::OpenGL) {
- CIImage *img = (CIImage*)(m_frame.handle().value<void*>());
-
- if (img) {
- CGLContextObj cglContext = CGLGetCurrentContext();
-
- if (cglContext) {
-
- if (!ciContext) {
- CGLContextObj cglContext = CGLGetCurrentContext();
- NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat];
- CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]);
-
- ciContext = [CIContext contextWithCGLContext:cglContext
- pixelFormat:cglPixelFormat
- options:nil];
-
- [(CIContext*)ciContext retain];
- }
-
- CGRect sRect = CGRectMake(source.x(), source.y(), source.width(), source.height());
- CGRect dRect = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom ?
- CGRectMake(target.x(), target.y()+target.height(), target.width(), -target.height()) :
- CGRectMake(target.x(), target.y(), target.width(), target.height());
-
-
- painter->beginNativePainting();
-
- [(CIContext*)ciContext drawImage:img inRect:dRect fromRect:sRect];
-
- painter->endNativePainting();
-
- return QAbstractVideoSurface::NoError;
- }
- }
- }
- }
-
- if (m_frame.handleType() == QAbstractVideoBuffer::GLTextureHandle &&
- (painter->paintEngine()->type() == QPaintEngine::OpenGL2 ||
- painter->paintEngine()->type() == QPaintEngine::OpenGL)) {
-
- painter->beginNativePainting();
- GLuint texture = m_frame.handle().toUInt();
-
- glDisable(GL_CULL_FACE);
- glEnable(GL_TEXTURE_2D);
-
- glBindTexture(GL_TEXTURE_2D, texture);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-
- const float txLeft = source.left() / m_frame.width();
- const float txRight = source.right() / m_frame.width();
- const float txTop = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.top() / m_frame.height()
- : source.bottom() / m_frame.height();
- const float txBottom = m_scanLineDirection == QVideoSurfaceFormat::TopToBottom
- ? source.bottom() / m_frame.height()
- : source.top() / m_frame.height();
-
- glBegin(GL_QUADS);
- QRectF rect = target;
- glTexCoord2f(txLeft, txBottom);
- glVertex2f(rect.topLeft().x(), rect.topLeft().y());
- glTexCoord2f(txRight, txBottom);
- glVertex2f(rect.topRight().x() + 1, rect.topRight().y());
- glTexCoord2f(txRight, txTop);
- glVertex2f(rect.bottomRight().x() + 1, rect.bottomRight().y() + 1);
- glTexCoord2f(txLeft, txTop);
- glVertex2f(rect.bottomLeft().x(), rect.bottomLeft().y() + 1);
- glEnd();
- painter->endNativePainting();
-
- return QAbstractVideoSurface::NoError;
- }
-
- //fallback case, software rendering
- if (m_frame.map(QAbstractVideoBuffer::ReadOnly)) {
- QImage image(
- m_frame.bits(),
- m_imageSize.width(),
- m_imageSize.height(),
- m_frame.bytesPerLine(),
- m_imageFormat);
-
- if (m_scanLineDirection == QVideoSurfaceFormat::BottomToTop) {
- const QTransform oldTransform = painter->transform();
-
- painter->scale(1, -1);
- painter->translate(0, -target.bottom());
- painter->drawImage(
- QRectF(target.x(), 0, target.width(), target.height()), image, source);
- painter->setTransform(oldTransform);
- } else {
- painter->drawImage(target, image, source);
- }
-
- m_frame.unmap();
- } else if (m_frame.isValid()) {
- return QAbstractVideoSurface::IncorrectFormatError;
- } else {
- painter->fillRect(target, Qt::black);
- }
-
- return QAbstractVideoSurface::NoError;
-}
-
-void QVideoSurfaceCoreGraphicsPainter::updateColors(int, int, int, int)
-{
-}
-
-QT_END_NAMESPACE
diff --git a/src/multimediawidgets/qpaintervideosurface_mac_p.h b/src/multimediawidgets/qpaintervideosurface_mac_p.h
deleted file mode 100644
index d650d9a..0000000
--- a/src/multimediawidgets/qpaintervideosurface_mac_p.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPAINTERVIDEOSURFACE_MAC_P_H
-#define QPAINTERVIDEOSURFACE_MAC_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qpaintervideosurface_p.h"
-#include <qvideosurfaceformat.h>
-#include <qvideoframe.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QVideoSurfaceCoreGraphicsPainter : public QVideoSurfacePainter
-{
-public:
- QVideoSurfaceCoreGraphicsPainter(bool glSupported);
- ~QVideoSurfaceCoreGraphicsPainter();
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const;
-
- bool isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const;
-
- QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format);
- void stop();
-
- QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame);
-
- QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source);
-
- void updateColors(int brightness, int contrast, int hue, int saturation);
-
-private:
- void* ciContext;
- QList<QVideoFrame::PixelFormat> m_imagePixelFormats;
- QVideoFrame m_frame;
- QSize m_imageSize;
- QImage::Format m_imageFormat;
- QVector<QAbstractVideoBuffer::HandleType> m_supportedHandles;
- QVideoSurfaceFormat::Direction m_scanLineDirection;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/multimediawidgets/qpaintervideosurface_p.h b/src/multimediawidgets/qpaintervideosurface_p.h
deleted file mode 100644
index a8b535b..0000000
--- a/src/multimediawidgets/qpaintervideosurface_p.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPAINTERVIDEOSURFACE_P_H
-#define QPAINTERVIDEOSURFACE_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediawidgetdefs.h>
-#include <QtCore/qsize.h>
-#include <QtGui/qimage.h>
-#include <QtGui/qmatrix4x4.h>
-#include <QtGui/qpaintengine.h>
-#include <qabstractvideosurface.h>
-#include <qvideoframe.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-class QGLContext;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-QT_BEGIN_NAMESPACE
-
-class QVideoSurfacePainter
-{
-public:
- virtual ~QVideoSurfacePainter();
-
- virtual QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const = 0;
-
- virtual bool isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar) const = 0;
-
- virtual QAbstractVideoSurface::Error start(const QVideoSurfaceFormat &format) = 0;
- virtual void stop() = 0;
-
- virtual QAbstractVideoSurface::Error setCurrentFrame(const QVideoFrame &frame) = 0;
-
- virtual QAbstractVideoSurface::Error paint(
- const QRectF &target, QPainter *painter, const QRectF &source) = 0;
-
- virtual void updateColors(int brightness, int contrast, int hue, int saturation) = 0;
- virtual void viewportDestroyed() {}
-};
-
-
-class Q_AUTOTEST_EXPORT QPainterVideoSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
-public:
- explicit QPainterVideoSurface(QObject *parent = 0);
- ~QPainterVideoSurface();
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- bool isFormatSupported(
- const QVideoSurfaceFormat &format, QVideoSurfaceFormat *similar = 0) const;
-
- bool start(const QVideoSurfaceFormat &format);
- void stop();
-
- bool present(const QVideoFrame &frame);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- bool isReady() const;
- void setReady(bool ready);
-
- void paint(QPainter *painter, const QRectF &target, const QRectF &source = QRectF(0, 0, 1, 1));
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- const QGLContext *glContext() const;
- void setGLContext(QGLContext *context);
-
- enum ShaderType
- {
- NoShaders = 0x00,
- FragmentProgramShader = 0x01,
- GlslShader = 0x02
- };
-
- Q_DECLARE_FLAGS(ShaderTypes, ShaderType)
-
- ShaderTypes supportedShaderTypes() const;
-
- ShaderType shaderType() const;
- void setShaderType(ShaderType type);
-#endif
-
-public Q_SLOTS:
- void viewportDestroyed();
-
-Q_SIGNALS:
- void frameChanged();
-
-private:
- void createPainter();
-
- QVideoSurfacePainter *m_painter;
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- QGLContext *m_glContext;
- ShaderTypes m_shaderTypes;
- ShaderType m_shaderType;
-#endif
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
-
- QVideoFrame::PixelFormat m_pixelFormat;
- QSize m_frameSize;
- QRect m_sourceRect;
- bool m_colorsDirty;
- bool m_ready;
-};
-
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QPainterVideoSurface::ShaderTypes)
-#endif
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qtmultimediawidgetdefs.h b/src/multimediawidgets/qtmultimediawidgetdefs.h
deleted file mode 100644
index 0816d47..0000000
--- a/src/multimediawidgets/qtmultimediawidgetdefs.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QTMULTIMEDIAWIDGETS_P_H
-#define QTMULTIMEDIAWIDGETS_P_H
-
-#include <QtCore/qglobal.h>
-
-QT_BEGIN_HEADER
-
-#if defined(Q_OS_WIN)
-# if defined(QT_NODLL)
-# undef QT_MAKEDLL
-# undef QT_DLL
-# elif defined(QT_MAKEDLL)
-# if defined(QT_DLL)
-# undef QT_DLL
-# endif
-# if defined(QT_BUILD_MULTIMEDIAWIDGETS_LIB)
-# define Q_MULTIMEDIAWIDGETS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_MULTIMEDIAWIDGETS_EXPORT Q_DECL_IMPORT
-# endif
-# elif defined(QT_DLL) /* use a Qt DLL library */
-# define Q_MULTIMEDIAWIDGETS_EXPORT Q_DECL_IMPORT
-# endif
-#endif
-
-#if !defined(Q_MULTIMEDIAWIDGETS_EXPORT)
-# if defined(QT_SHARED)
-# define Q_MULTIMEDIAWIDGETS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_MULTIMEDIAWIDGETS_EXPORT
-# endif
-#endif
-
-QT_END_HEADER
-
-#endif // QMULTIMEDIAWIDGETS_P_H
-
diff --git a/src/multimediawidgets/qvideowidget.cpp b/src/multimediawidgets/qvideowidget.cpp
deleted file mode 100644
index 919ed1f..0000000
--- a/src/multimediawidgets/qvideowidget.cpp
+++ /dev/null
@@ -1,1043 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideowidget_p.h"
-#include "qpaintervideosurface_p.h"
-
-#include <qmediaobject.h>
-#include <qmediaservice.h>
-#include <qvideowindowcontrol.h>
-#include <qvideowidgetcontrol.h>
-
-#include <qvideorenderercontrol.h>
-#include <qvideosurfaceformat.h>
-#include <qpainter.h>
-
-#include <qapplication.h>
-#include <qevent.h>
-#include <qdialog.h>
-#include <qboxlayout.h>
-#include <qnamespace.h>
-
-using namespace Qt;
-
-QT_BEGIN_NAMESPACE
-
-QVideoWidgetControlBackend::QVideoWidgetControlBackend(
- QMediaService *service, QVideoWidgetControl *control, QWidget *widget)
- : m_service(service)
- , m_widgetControl(control)
-{
- connect(control, SIGNAL(brightnessChanged(int)), widget, SLOT(_q_brightnessChanged(int)));
- connect(control, SIGNAL(contrastChanged(int)), widget, SLOT(_q_contrastChanged(int)));
- connect(control, SIGNAL(hueChanged(int)), widget, SLOT(_q_hueChanged(int)));
- connect(control, SIGNAL(saturationChanged(int)), widget, SLOT(_q_saturationChanged(int)));
- connect(control, SIGNAL(fullScreenChanged(bool)), widget, SLOT(_q_fullScreenChanged(bool)));
-
- QBoxLayout *layout = new QVBoxLayout;
- layout->setMargin(0);
- layout->setSpacing(0);
-
- layout->addWidget(control->videoWidget());
-
- widget->setLayout(layout);
-}
-
-void QVideoWidgetControlBackend::releaseControl()
-{
- m_service->releaseControl(m_widgetControl);
-}
-
-void QVideoWidgetControlBackend::setBrightness(int brightness)
-{
- m_widgetControl->setBrightness(brightness);
-}
-
-void QVideoWidgetControlBackend::setContrast(int contrast)
-{
- m_widgetControl->setContrast(contrast);
-}
-
-void QVideoWidgetControlBackend::setHue(int hue)
-{
- m_widgetControl->setHue(hue);
-}
-
-void QVideoWidgetControlBackend::setSaturation(int saturation)
-{
- m_widgetControl->setSaturation(saturation);
-}
-
-void QVideoWidgetControlBackend::setFullScreen(bool fullScreen)
-{
- m_widgetControl->setFullScreen(fullScreen);
-}
-
-
-Qt::AspectRatioMode QVideoWidgetControlBackend::aspectRatioMode() const
-{
- return m_widgetControl->aspectRatioMode();
-}
-
-void QVideoWidgetControlBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_widgetControl->setAspectRatioMode(mode);
-}
-
-QRendererVideoWidgetBackend::QRendererVideoWidgetBackend(
- QMediaService *service, QVideoRendererControl *control, QWidget *widget)
- : m_service(service)
- , m_rendererControl(control)
- , m_widget(widget)
- , m_surface(new QPainterVideoSurface)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_updatePaintDevice(true)
-{
- connect(this, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int)));
- connect(this, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int)));
- connect(this, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int)));
- connect(this, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int)));
- connect(m_surface, SIGNAL(frameChanged()), this, SLOT(frameChanged()));
- connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SLOT(formatChanged(QVideoSurfaceFormat)));
-
- m_rendererControl->setSurface(m_surface);
-}
-
-QRendererVideoWidgetBackend::~QRendererVideoWidgetBackend()
-{
- delete m_surface;
-}
-
-void QRendererVideoWidgetBackend::releaseControl()
-{
- m_service->releaseControl(m_rendererControl);
-}
-
-void QRendererVideoWidgetBackend::clearSurface()
-{
- m_rendererControl->setSurface(0);
-}
-
-void QRendererVideoWidgetBackend::setBrightness(int brightness)
-{
- m_surface->setBrightness(brightness);
-
- emit brightnessChanged(brightness);
-}
-
-void QRendererVideoWidgetBackend::setContrast(int contrast)
-{
- m_surface->setContrast(contrast);
-
- emit contrastChanged(contrast);
-}
-
-void QRendererVideoWidgetBackend::setHue(int hue)
-{
- m_surface->setHue(hue);
-
- emit hueChanged(hue);
-}
-
-void QRendererVideoWidgetBackend::setSaturation(int saturation)
-{
- m_surface->setSaturation(saturation);
-
- emit saturationChanged(saturation);
-}
-
-Qt::AspectRatioMode QRendererVideoWidgetBackend::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QRendererVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
-
- m_widget->updateGeometry();
-}
-
-void QRendererVideoWidgetBackend::setFullScreen(bool)
-{
-}
-
-QSize QRendererVideoWidgetBackend::sizeHint() const
-{
- return m_surface->surfaceFormat().sizeHint();
-}
-
-void QRendererVideoWidgetBackend::showEvent()
-{
-}
-
-void QRendererVideoWidgetBackend::hideEvent(QHideEvent *)
-{
-#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- m_updatePaintDevice = true;
- m_surface->setGLContext(0);
-#endif
-}
-
-void QRendererVideoWidgetBackend::resizeEvent(QResizeEvent *)
-{
- updateRects();
-}
-
-void QRendererVideoWidgetBackend::moveEvent(QMoveEvent *)
-{
-}
-
-void QRendererVideoWidgetBackend::paintEvent(QPaintEvent *event)
-{
- QPainter painter(m_widget);
-
- if (m_widget->testAttribute(Qt::WA_OpaquePaintEvent)) {
- QRegion borderRegion = event->region();
- borderRegion = borderRegion.subtracted(m_boundingRect);
-
- QBrush brush = m_widget->palette().window();
-
- QVector<QRect> rects = borderRegion.rects();
- for (QVector<QRect>::iterator it = rects.begin(), end = rects.end(); it != end; ++it) {
- painter.fillRect(*it, brush);
- }
- }
-
- if (m_surface->isActive() && m_boundingRect.intersects(event->rect())) {
- m_surface->paint(&painter, m_boundingRect, m_sourceRect);
-
- m_surface->setReady(true);
- } else {
- #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_1_CL) && !defined(QT_OPENGL_ES_1)
- if (m_updatePaintDevice && (painter.paintEngine()->type() == QPaintEngine::OpenGL
- || painter.paintEngine()->type() == QPaintEngine::OpenGL2)) {
- m_updatePaintDevice = false;
-
- m_surface->setGLContext(const_cast<QGLContext *>(QGLContext::currentContext()));
- if (m_surface->supportedShaderTypes() & QPainterVideoSurface::GlslShader) {
- m_surface->setShaderType(QPainterVideoSurface::GlslShader);
- } else {
- m_surface->setShaderType(QPainterVideoSurface::FragmentProgramShader);
- }
- }
-#endif
- }
-
-}
-
-void QRendererVideoWidgetBackend::formatChanged(const QVideoSurfaceFormat &format)
-{
- m_nativeSize = format.sizeHint();
-
- updateRects();
-
- m_widget->updateGeometry();
- m_widget->update();
-}
-
-void QRendererVideoWidgetBackend::frameChanged()
-{
- m_widget->update(m_boundingRect);
-}
-
-void QRendererVideoWidgetBackend::updateRects()
-{
- QRect rect = m_widget->rect();
-
- if (m_nativeSize.isEmpty()) {
- m_boundingRect = QRect();
- } else if (m_aspectRatioMode == Qt::IgnoreAspectRatio) {
- m_boundingRect = rect;
- m_sourceRect = QRectF(0, 0, 1, 1);
- } else if (m_aspectRatioMode == Qt::KeepAspectRatio) {
- QSize size = m_nativeSize;
- size.scale(rect.size(), Qt::KeepAspectRatio);
-
- m_boundingRect = QRect(0, 0, size.width(), size.height());
- m_boundingRect.moveCenter(rect.center());
-
- m_sourceRect = QRectF(0, 0, 1, 1);
- } else if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
- m_boundingRect = rect;
-
- QSizeF size = rect.size();
- size.scale(m_nativeSize, Qt::KeepAspectRatio);
-
- m_sourceRect = QRectF(
- 0, 0, size.width() / m_nativeSize.width(), size.height() / m_nativeSize.height());
- m_sourceRect.moveCenter(QPointF(0.5, 0.5));
- }
-}
-
-QWindowVideoWidgetBackend::QWindowVideoWidgetBackend(
- QMediaService *service, QVideoWindowControl *control, QWidget *widget)
- : m_service(service)
- , m_windowControl(control)
- , m_widget(widget)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
-{
- connect(control, SIGNAL(brightnessChanged(int)), m_widget, SLOT(_q_brightnessChanged(int)));
- connect(control, SIGNAL(contrastChanged(int)), m_widget, SLOT(_q_contrastChanged(int)));
- connect(control, SIGNAL(hueChanged(int)), m_widget, SLOT(_q_hueChanged(int)));
- connect(control, SIGNAL(saturationChanged(int)), m_widget, SLOT(_q_saturationChanged(int)));
- connect(control, SIGNAL(fullScreenChanged(bool)), m_widget, SLOT(_q_fullScreenChanged(bool)));
- connect(control, SIGNAL(nativeSizeChanged()), m_widget, SLOT(_q_dimensionsChanged()));
-
- control->setWinId(widget->winId());
-}
-
-QWindowVideoWidgetBackend::~QWindowVideoWidgetBackend()
-{
-}
-
-void QWindowVideoWidgetBackend::releaseControl()
-{
- m_service->releaseControl(m_windowControl);
-}
-
-void QWindowVideoWidgetBackend::setBrightness(int brightness)
-{
- m_windowControl->setBrightness(brightness);
-}
-
-void QWindowVideoWidgetBackend::setContrast(int contrast)
-{
- m_windowControl->setContrast(contrast);
-}
-
-void QWindowVideoWidgetBackend::setHue(int hue)
-{
- m_windowControl->setHue(hue);
-}
-
-void QWindowVideoWidgetBackend::setSaturation(int saturation)
-{
- m_windowControl->setSaturation(saturation);
-}
-
-void QWindowVideoWidgetBackend::setFullScreen(bool fullScreen)
-{
- m_windowControl->setFullScreen(fullScreen);
-}
-
-Qt::AspectRatioMode QWindowVideoWidgetBackend::aspectRatioMode() const
-{
- return m_windowControl->aspectRatioMode();
-}
-
-void QWindowVideoWidgetBackend::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_windowControl->setAspectRatioMode(mode);
-}
-
-QSize QWindowVideoWidgetBackend::sizeHint() const
-{
- return m_windowControl->nativeSize();
-}
-
-void QWindowVideoWidgetBackend::showEvent()
-{
- m_windowControl->setWinId(m_widget->winId());
-
- m_windowControl->setDisplayRect(m_widget->rect());
-
-#if defined(Q_WS_WIN)
- m_widget->setUpdatesEnabled(false);
-#endif
-}
-
-void QWindowVideoWidgetBackend::hideEvent(QHideEvent *)
-{
-#if defined(Q_WS_WIN)
- m_widget->setUpdatesEnabled(true);
-#endif
-}
-
-void QWindowVideoWidgetBackend::moveEvent(QMoveEvent *)
-{
- m_windowControl->setDisplayRect(m_widget->rect());
-}
-
-void QWindowVideoWidgetBackend::resizeEvent(QResizeEvent *)
-{
- m_windowControl->setDisplayRect(m_widget->rect());
-}
-
-void QWindowVideoWidgetBackend::paintEvent(QPaintEvent *event)
-{
- if (m_widget->testAttribute(Qt::WA_OpaquePaintEvent)) {
- QPainter painter(m_widget);
-
- painter.fillRect(event->rect(), m_widget->palette().window());
- }
-
- m_windowControl->repaint();
-
- event->accept();
-}
-
-#if defined(Q_WS_WIN)
-bool QWindowVideoWidgetBackend::winEvent(MSG *message, long *)
-{
- if (message->message == WM_PAINT)
- m_windowControl->repaint();
-
- return false;
-}
-#endif
-
-void QVideoWidgetPrivate::setCurrentControl(QVideoWidgetControlInterface *control)
-{
- if (currentControl != control) {
- currentControl = control;
-
- currentControl->setBrightness(brightness);
- currentControl->setContrast(contrast);
- currentControl->setHue(hue);
- currentControl->setSaturation(saturation);
- currentControl->setAspectRatioMode(aspectRatioMode);
- }
-}
-
-void QVideoWidgetPrivate::clearService()
-{
- if (service) {
- QObject::disconnect(service, SIGNAL(destroyed()), q_func(), SLOT(_q_serviceDestroyed()));
-
- if (widgetBackend) {
- QLayout *layout = q_func()->layout();
-
- for (QLayoutItem *item = layout->takeAt(0); item; item = layout->takeAt(0)) {
- item->widget()->setParent(0);
- delete item;
- }
- delete layout;
-
- widgetBackend->releaseControl();
-
- delete widgetBackend;
- widgetBackend = 0;
- } else if (rendererBackend) {
- rendererBackend->clearSurface();
- rendererBackend->releaseControl();
-
- delete rendererBackend;
- rendererBackend = 0;
- } else {
- windowBackend->releaseControl();
-
- delete windowBackend;
- windowBackend = 0;
- }
-
- currentBackend = 0;
- currentControl = 0;
- service = 0;
- }
-}
-
-bool QVideoWidgetPrivate::createWidgetBackend()
-{
- if (QMediaControl *control = service->requestControl(QVideoWidgetControl_iid)) {
- if (QVideoWidgetControl *widgetControl = qobject_cast<QVideoWidgetControl *>(control)) {
- widgetBackend = new QVideoWidgetControlBackend(service, widgetControl, q_func());
-
- setCurrentControl(widgetBackend);
-
- return true;
- }
- service->releaseControl(control);
- }
- return false;
-}
-
-bool QVideoWidgetPrivate::createWindowBackend()
-{
- if (QMediaControl *control = service->requestControl(QVideoWindowControl_iid)) {
- if (QVideoWindowControl *windowControl = qobject_cast<QVideoWindowControl *>(control)) {
- windowBackend = new QWindowVideoWidgetBackend(service, windowControl, q_func());
- currentBackend = windowBackend;
-
- setCurrentControl(windowBackend);
-
- return true;
- }
- service->releaseControl(control);
- }
- return false;
-}
-
-bool QVideoWidgetPrivate::createRendererBackend()
-{
- if (QMediaControl *control = service->requestControl(QVideoRendererControl_iid)) {
- if (QVideoRendererControl *rendererControl = qobject_cast<QVideoRendererControl *>(control)) {
- rendererBackend = new QRendererVideoWidgetBackend(service, rendererControl, q_func());
- currentBackend = rendererBackend;
-
- setCurrentControl(rendererBackend);
-
- return true;
- }
- service->releaseControl(control);
- }
- return false;
-}
-
-void QVideoWidgetPrivate::_q_serviceDestroyed()
-{
- if (widgetBackend)
- delete q_func()->layout();
-
- delete widgetBackend;
- delete windowBackend;
- delete rendererBackend;
-
- widgetBackend = 0;
- windowBackend = 0;
- rendererBackend = 0;
- currentControl = 0;
- currentBackend = 0;
- service = 0;
-}
-
-void QVideoWidgetPrivate::_q_brightnessChanged(int b)
-{
- if (b != brightness)
- emit q_func()->brightnessChanged(brightness = b);
-}
-
-void QVideoWidgetPrivate::_q_contrastChanged(int c)
-{
- if (c != contrast)
- emit q_func()->contrastChanged(contrast = c);
-}
-
-void QVideoWidgetPrivate::_q_hueChanged(int h)
-{
- if (h != hue)
- emit q_func()->hueChanged(hue = h);
-}
-
-void QVideoWidgetPrivate::_q_saturationChanged(int s)
-{
- if (s != saturation)
- emit q_func()->saturationChanged(saturation = s);
-}
-
-
-void QVideoWidgetPrivate::_q_fullScreenChanged(bool fullScreen)
-{
- if (!fullScreen && q_func()->isFullScreen())
- q_func()->showNormal();
-}
-
-void QVideoWidgetPrivate::_q_dimensionsChanged()
-{
- q_func()->updateGeometry();
- q_func()->update();
-}
-
-/*!
- \class QVideoWidget
-
-
- \brief The QVideoWidget class provides a widget which presents video
- produced by a media object.
- \ingroup multimedia
- \inmodule QtMultimedia
- \since 1.0
-
- \inmodule QtMultimedia
-
- Attaching a QVideoWidget to a QMediaObject allows it to display the
- video or image output of that media object. A QVideoWidget is attached
- to media object by passing a pointer to the QMediaObject in its
- constructor, and detached by destroying the QVideoWidget.
-
- \snippet doc/src/snippets/multimedia-snippets/video.cpp Video widget
-
- \bold {Note}: Only a single display output can be attached to a media
- object at one time.
-
- \sa QMediaObject, QMediaPlayer, QGraphicsVideoItem
-*/
-
-/*!
- Constructs a new video widget.
-
- The \a parent is passed to QWidget.
-*/
-QVideoWidget::QVideoWidget(QWidget *parent)
- : QWidget(parent, 0)
- , d_ptr(new QVideoWidgetPrivate)
-{
- d_ptr->q_ptr = this;
-}
-
-/*!
- \internal
-*/
-QVideoWidget::QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent)
- : QWidget(parent, 0)
- , d_ptr(&dd)
-{
- d_ptr->q_ptr = this;
-
- QPalette palette = QWidget::palette();
- palette.setColor(QPalette::Background, Qt::black);
- setPalette(palette);
-}
-
-/*!
- Destroys a video widget.
-*/
-QVideoWidget::~QVideoWidget()
-{
- d_ptr->clearService();
-
- delete d_ptr;
-}
-
-/*!
- \property QVideoWidget::mediaObject
- \brief the media object which provides the video displayed by a widget.
- \since 1.0
-*/
-
-QMediaObject *QVideoWidget::mediaObject() const
-{
- return d_func()->mediaObject;
-}
-
-/*!
- \internal
- \since 1.0
-*/
-bool QVideoWidget::setMediaObject(QMediaObject *object)
-{
- Q_D(QVideoWidget);
-
- if (object == d->mediaObject)
- return true;
-
- d->clearService();
-
- d->mediaObject = object;
-
- if (d->mediaObject)
- d->service = d->mediaObject->service();
-
- if (d->service) {
- if (d->createWidgetBackend()) {
- // Nothing to do here.
- } else if ((!window() || !window()->testAttribute(Qt::WA_DontShowOnScreen))
- && d->createWindowBackend()) {
- if (isVisible())
- d->windowBackend->showEvent();
- } else if (d->createRendererBackend()) {
- if (isVisible())
- d->rendererBackend->showEvent();
- } else {
- d->service = 0;
- d->mediaObject = 0;
-
- return false;
- }
-
- connect(d->service, SIGNAL(destroyed()), SLOT(_q_serviceDestroyed()));
- } else {
- d->mediaObject = 0;
-
- return false;
- }
-
- return true;
-}
-
-/*!
- \property QVideoWidget::aspectRatioMode
- \brief how video is scaled with respect to its aspect ratio.
- \since 1.0
-*/
-
-Qt::AspectRatioMode QVideoWidget::aspectRatioMode() const
-{
- return d_func()->aspectRatioMode;
-}
-
-void QVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- Q_D(QVideoWidget);
-
- if (d->currentControl) {
- d->currentControl->setAspectRatioMode(mode);
- d->aspectRatioMode = d->currentControl->aspectRatioMode();
- } else {
- d->aspectRatioMode = mode;
- }
-}
-
-/*!
- \property QVideoWidget::fullScreen
- \brief whether video display is confined to a window or is fullScreen.
- \since 1.0
-*/
-
-void QVideoWidget::setFullScreen(bool fullScreen)
-{
- Q_D(QVideoWidget);
-
- if (fullScreen) {
- Qt::WindowFlags flags = windowFlags();
-
- d->nonFullScreenFlags = flags & (Qt::Window | Qt::SubWindow);
- flags |= Qt::Window;
- flags &= ~Qt::SubWindow;
- setWindowFlags(flags);
-
- showFullScreen();
- } else {
- showNormal();
- }
-}
-
-/*!
- \fn QVideoWidget::fullScreenChanged(bool fullScreen)
-
- Signals that the \a fullScreen mode of a video widget has changed.
-
- \since 1.0
- \sa fullScreen
-*/
-
-/*!
- \property QVideoWidget::brightness
- \brief an adjustment to the brightness of displayed video.
-
- Valid brightness values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-int QVideoWidget::brightness() const
-{
- return d_func()->brightness;
-}
-
-void QVideoWidget::setBrightness(int brightness)
-{
- Q_D(QVideoWidget);
-
- int boundedBrightness = qBound(-100, brightness, 100);
-
- if (d->currentControl)
- d->currentControl->setBrightness(boundedBrightness);
- else if (d->brightness != boundedBrightness)
- emit brightnessChanged(d->brightness = boundedBrightness);
-}
-
-/*!
- \fn QVideoWidget::brightnessChanged(int brightness)
-
- Signals that a video widgets's \a brightness adjustment has changed.
-
- \since 1.0
- \sa brightness
-*/
-
-/*!
- \property QVideoWidget::contrast
- \brief an adjustment to the contrast of displayed video.
-
- Valid contrast values range between -100 and 100, the default is 0.
-
- \since 1.0
-*/
-
-int QVideoWidget::contrast() const
-{
- return d_func()->contrast;
-}
-
-void QVideoWidget::setContrast(int contrast)
-{
- Q_D(QVideoWidget);
-
- int boundedContrast = qBound(-100, contrast, 100);
-
- if (d->currentControl)
- d->currentControl->setContrast(boundedContrast);
- else if (d->contrast != boundedContrast)
- emit contrastChanged(d->contrast = boundedContrast);
-}
-
-/*!
- \fn QVideoWidget::contrastChanged(int contrast)
-
- Signals that a video widgets's \a contrast adjustment has changed.
-
- \since 1.0
- \sa contrast
-*/
-
-/*!
- \property QVideoWidget::hue
- \brief an adjustment to the hue of displayed video.
-
- Valid hue values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-int QVideoWidget::hue() const
-{
- return d_func()->hue;
-}
-
-void QVideoWidget::setHue(int hue)
-{
- Q_D(QVideoWidget);
-
- int boundedHue = qBound(-100, hue, 100);
-
- if (d->currentControl)
- d->currentControl->setHue(boundedHue);
- else if (d->hue != boundedHue)
- emit hueChanged(d->hue = boundedHue);
-}
-
-/*!
- \fn QVideoWidget::hueChanged(int hue)
-
- Signals that a video widgets's \a hue has changed.
-
- \since 1.0
- \sa hue
-*/
-
-/*!
- \property QVideoWidget::saturation
- \brief an adjustment to the saturation of displayed video.
-
- Valid saturation values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-int QVideoWidget::saturation() const
-{
- return d_func()->saturation;
-}
-
-void QVideoWidget::setSaturation(int saturation)
-{
- Q_D(QVideoWidget);
-
- int boundedSaturation = qBound(-100, saturation, 100);
-
- if (d->currentControl)
- d->currentControl->setSaturation(boundedSaturation);
- else if (d->saturation != boundedSaturation)
- emit saturationChanged(d->saturation = boundedSaturation);
-
-}
-
-/*!
- \fn QVideoWidget::saturationChanged(int saturation)
-
- Signals that a video widgets's \a saturation has changed.
-
- \since 1.0
- \sa saturation
-*/
-
-/*!
- Returns the size hint for the current back end,
- if there is one, or else the size hint from QWidget.
- \since 1.0
- */
-QSize QVideoWidget::sizeHint() const
-{
- Q_D(const QVideoWidget);
-
- if (d->currentBackend)
- return d->currentBackend->sizeHint();
- else
- return QWidget::sizeHint();
-
-
-}
-
-/*!
- Current event \a event.
- Returns the value of the baseclass QWidget::event(QEvent *event) function.
- \since 1.0
-*/
-bool QVideoWidget::event(QEvent *event)
-{
- Q_D(QVideoWidget);
-
- if (event->type() == QEvent::WindowStateChange) {
- Qt::WindowFlags flags = windowFlags();
-
- if (windowState() & Qt::WindowFullScreen) {
- if (d->currentControl)
- d->currentControl->setFullScreen(true);
-
- if (!d->wasFullScreen)
- emit fullScreenChanged(d->wasFullScreen = true);
- } else {
- if (d->currentControl)
- d->currentControl->setFullScreen(false);
-
- if (d->wasFullScreen) {
- flags &= ~(Qt::Window | Qt::SubWindow); //clear the flags...
- flags |= d->nonFullScreenFlags; //then we reset the flags (window and subwindow)
- setWindowFlags(flags);
-
- emit fullScreenChanged(d->wasFullScreen = false);
- }
- }
- }
- return QWidget::event(event);
-}
-
-/*!
- Handles the show \a event.
- \since 1.0
- */
-void QVideoWidget::showEvent(QShowEvent *event)
-{
- Q_D(QVideoWidget);
-
- QWidget::showEvent(event);
-
- // The window backend won't work for re-directed windows so use the renderer backend instead.
- if (d->windowBackend && window()->testAttribute(Qt::WA_DontShowOnScreen)) {
- d->windowBackend->releaseControl();
-
- delete d->windowBackend;
- d->windowBackend = 0;
-
- d->createRendererBackend();
- }
-
- if (d->currentBackend)
- d->currentBackend->showEvent();
-}
-
-/*!
-
- Handles the hide \a event.
- \since 1.0
-*/
-void QVideoWidget::hideEvent(QHideEvent *event)
-{
- Q_D(QVideoWidget);
-
- if (d->currentBackend)
- d->currentBackend->hideEvent(event);
-
- QWidget::hideEvent(event);
-}
-
-/*!
- Handles the resize \a event.
- \since 1.0
- */
-void QVideoWidget::resizeEvent(QResizeEvent *event)
-{
- Q_D(QVideoWidget);
-
- QWidget::resizeEvent(event);
-
- if (d->currentBackend)
- d->currentBackend->resizeEvent(event);
-}
-
-/*!
- Handles the move \a event.
- \since 1.0
- */
-void QVideoWidget::moveEvent(QMoveEvent *event)
-{
- Q_D(QVideoWidget);
-
- if (d->currentBackend)
- d->currentBackend->moveEvent(event);
-}
-
-/*!
- Handles the paint \a event.
- \since 1.0
- */
-void QVideoWidget::paintEvent(QPaintEvent *event)
-{
- Q_D(QVideoWidget);
-
- if (d->currentBackend) {
- d->currentBackend->paintEvent(event);
- } else if (testAttribute(Qt::WA_OpaquePaintEvent)) {
- QPainter painter(this);
-
- painter.fillRect(event->rect(), palette().window());
- }
-}
-
-
-#if defined(Q_WS_WIN)
-/*!
- \reimp
- \internal
- \since 1.1
-*/
-bool QVideoWidget::winEvent(MSG *message, long *result)
-{
- return d_func()->windowBackend && d_func()->windowBackend->winEvent(message, result)
- ? true
- : QWidget::winEvent(message, result);
-}
-#endif
-
-
-#include "moc_qvideowidget.cpp"
-#include "moc_qvideowidget_p.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimediawidgets/qvideowidget.h b/src/multimediawidgets/qvideowidget.h
deleted file mode 100644
index b9d2cfe..0000000
--- a/src/multimediawidgets/qvideowidget.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOWIDGET_H
-#define QVIDEOWIDGET_H
-
-#include <QtWidgets/qwidget.h>
-
-#include <qtmultimediawidgetdefs.h>
-#include <qmediabindableinterface.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaObject;
-
-class QVideoWidgetPrivate;
-class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidget : public QWidget, public QMediaBindableInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaBindableInterface)
- Q_PROPERTY(QMediaObject* mediaObject READ mediaObject WRITE setMediaObject)
- Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen NOTIFY fullScreenChanged)
- Q_PROPERTY(Qt::AspectRatioMode aspectRatioMode READ aspectRatioMode WRITE setAspectRatioMode)
- Q_PROPERTY(int brightness READ brightness WRITE setBrightness NOTIFY brightnessChanged)
- Q_PROPERTY(int contrast READ contrast WRITE setContrast NOTIFY contrastChanged)
- Q_PROPERTY(int hue READ hue WRITE setHue NOTIFY hueChanged)
- Q_PROPERTY(int saturation READ saturation WRITE setSaturation NOTIFY saturationChanged)
-
-public:
- QVideoWidget(QWidget *parent = 0);
- ~QVideoWidget();
-
- QMediaObject *mediaObject() const;
-
-#ifdef Q_QDOC
- bool isFullScreen() const;
-#endif
-
- Qt::AspectRatioMode aspectRatioMode() const;
-
- int brightness() const;
- int contrast() const;
- int hue() const;
- int saturation() const;
-
- QSize sizeHint() const;
-
-public Q_SLOTS:
- void setFullScreen(bool fullScreen);
- void setAspectRatioMode(Qt::AspectRatioMode mode);
- void setBrightness(int brightness);
- void setContrast(int contrast);
- void setHue(int hue);
- void setSaturation(int saturation);
-
-Q_SIGNALS:
- void fullScreenChanged(bool fullScreen);
- void brightnessChanged(int brightness);
- void contrastChanged(int contrast);
- void hueChanged(int hue);
- void saturationChanged(int saturation);
-
-protected:
- bool event(QEvent *event);
- void showEvent(QShowEvent *event);
- void hideEvent(QHideEvent *event);
- void resizeEvent(QResizeEvent *event);
- void moveEvent(QMoveEvent *event);
- void paintEvent(QPaintEvent *event);
-
- bool setMediaObject(QMediaObject *object);
-
-#if defined(Q_WS_WIN)
- bool winEvent(MSG *message, long *result);
-#endif
-
- QVideoWidget(QVideoWidgetPrivate &dd, QWidget *parent);
- QVideoWidgetPrivate *d_ptr;
-
-private:
- Q_DECLARE_PRIVATE(QVideoWidget)
- Q_PRIVATE_SLOT(d_func(), void _q_serviceDestroyed())
- Q_PRIVATE_SLOT(d_func(), void _q_brightnessChanged(int))
- Q_PRIVATE_SLOT(d_func(), void _q_contrastChanged(int))
- Q_PRIVATE_SLOT(d_func(), void _q_hueChanged(int))
- Q_PRIVATE_SLOT(d_func(), void _q_saturationChanged(int))
- Q_PRIVATE_SLOT(d_func(), void _q_fullScreenChanged(bool))
- Q_PRIVATE_SLOT(d_func(), void _q_dimensionsChanged())
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qvideowidget_p.h b/src/multimediawidgets/qvideowidget_p.h
deleted file mode 100644
index df1d86d..0000000
--- a/src/multimediawidgets/qvideowidget_p.h
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOWIDGET_P_H
-#define QVIDEOWIDGET_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <qtmultimediawidgetdefs.h>
-#include "qvideowidget.h"
-
-#ifndef QT_NO_OPENGL
-#include <QGLWidget>
-#endif
-
-#include "qpaintervideosurface_p.h"
-
-#include <QtCore/qpointer.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QMediaService;
-
-class QVideoWidgetControlInterface
-{
-public:
- virtual ~QVideoWidgetControlInterface() {}
-
- virtual void setBrightness(int brightness) = 0;
- virtual void setContrast(int contrast) = 0;
- virtual void setHue(int hue) = 0;
- virtual void setSaturation(int saturation) = 0;
-
- virtual void setFullScreen(bool fullScreen) = 0;
-
- virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
-};
-
-class QVideoWidgetBackend : public QObject, public QVideoWidgetControlInterface
-{
- Q_OBJECT
-public:
- virtual QSize sizeHint() const = 0;
-
- virtual void showEvent() = 0;
- virtual void hideEvent(QHideEvent *event) = 0;
- virtual void resizeEvent(QResizeEvent *event) = 0;
- virtual void moveEvent(QMoveEvent *event) = 0;
- virtual void paintEvent(QPaintEvent *event) = 0;
-};
-
-class QVideoWidgetControl;
-
-class QVideoWidgetControlBackend : public QObject, public QVideoWidgetControlInterface
-{
- Q_OBJECT
-public:
- QVideoWidgetControlBackend(QMediaService *service, QVideoWidgetControl *control, QWidget *widget);
-
- void releaseControl();
-
- void setBrightness(int brightness);
- void setContrast(int contrast);
- void setHue(int hue);
- void setSaturation(int saturation);
-
- void setFullScreen(bool fullScreen);
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
-private:
- QMediaService *m_service;
- QVideoWidgetControl *m_widgetControl;
-};
-
-
-class QVideoRendererControl;
-
-class QRendererVideoWidgetBackend : public QVideoWidgetBackend
-{
- Q_OBJECT
-public:
- QRendererVideoWidgetBackend(QMediaService *service, QVideoRendererControl *control, QWidget *widget);
- ~QRendererVideoWidgetBackend();
-
- void releaseControl();
- void clearSurface();
-
- void setBrightness(int brightness);
- void setContrast(int contrast);
- void setHue(int hue);
- void setSaturation(int saturation);
-
- void setFullScreen(bool fullScreen);
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- QSize sizeHint() const;
-
- void showEvent();
- void hideEvent(QHideEvent *event);
- void resizeEvent(QResizeEvent *event);
- void moveEvent(QMoveEvent *event);
- void paintEvent(QPaintEvent *event);
-
-Q_SIGNALS:
- void fullScreenChanged(bool fullScreen);
- void brightnessChanged(int brightness);
- void contrastChanged(int contrast);
- void hueChanged(int hue);
- void saturationChanged(int saturation);
-
-private Q_SLOTS:
- void formatChanged(const QVideoSurfaceFormat &format);
- void frameChanged();
-
-private:
- void updateRects();
-
- QMediaService *m_service;
- QVideoRendererControl *m_rendererControl;
- QWidget *m_widget;
- QPainterVideoSurface *m_surface;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_boundingRect;
- QRectF m_sourceRect;
- QSize m_nativeSize;
- bool m_updatePaintDevice;
-};
-
-class QVideoWindowControl;
-
-class QWindowVideoWidgetBackend : public QVideoWidgetBackend
-{
- Q_OBJECT
-public:
- QWindowVideoWidgetBackend(QMediaService *service, QVideoWindowControl *control, QWidget *widget);
- ~QWindowVideoWidgetBackend();
-
- void releaseControl();
-
- void setBrightness(int brightness);
- void setContrast(int contrast);
- void setHue(int hue);
- void setSaturation(int saturation);
-
- void setFullScreen(bool fullScreen);
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- QSize sizeHint() const;
-
- void showEvent();
- void hideEvent(QHideEvent *event);
- void resizeEvent(QResizeEvent *event);
- void moveEvent(QMoveEvent *event);
- void paintEvent(QPaintEvent *event);
-
-#if defined(Q_WS_WIN)
- bool winEvent(MSG *message, long *result);
-#endif
-
-private:
- QMediaService *m_service;
- QVideoWindowControl *m_windowControl;
- QWidget *m_widget;
- Qt::AspectRatioMode m_aspectRatioMode;
- QSize m_pixelAspectRatio;
-};
-
-class QMediaService;
-class QVideoOutputControl;
-
-class QVideoWidgetPrivate
-{
- Q_DECLARE_PUBLIC(QVideoWidget)
-public:
- QVideoWidgetPrivate()
- : q_ptr(0)
- , mediaObject(0)
- , service(0)
- , widgetBackend(0)
- , windowBackend(0)
- , rendererBackend(0)
- , currentControl(0)
- , currentBackend(0)
- , brightness(0)
- , contrast(0)
- , hue(0)
- , saturation(0)
- , aspectRatioMode(Qt::KeepAspectRatio)
- , nonFullScreenFlags(0)
- , wasFullScreen(false)
- {
- }
-
- QVideoWidget *q_ptr;
- QPointer<QMediaObject> mediaObject;
- QMediaService *service;
- QVideoWidgetControlBackend *widgetBackend;
- QWindowVideoWidgetBackend *windowBackend;
- QRendererVideoWidgetBackend *rendererBackend;
- QVideoWidgetControlInterface *currentControl;
- QVideoWidgetBackend *currentBackend;
- int brightness;
- int contrast;
- int hue;
- int saturation;
- Qt::AspectRatioMode aspectRatioMode;
- Qt::WindowFlags nonFullScreenFlags;
- bool wasFullScreen;
-
- bool createWidgetBackend();
- bool createWindowBackend();
- bool createRendererBackend();
-
- void setCurrentControl(QVideoWidgetControlInterface *control);
- void clearService();
-
- void _q_serviceDestroyed();
- void _q_brightnessChanged(int brightness);
- void _q_contrastChanged(int contrast);
- void _q_hueChanged(int hue);
- void _q_saturationChanged(int saturation);
- void _q_fullScreenChanged(bool fullScreen);
- void _q_dimensionsChanged();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qvideowidgetcontrol.cpp b/src/multimediawidgets/qvideowidgetcontrol.cpp
deleted file mode 100644
index e153030..0000000
--- a/src/multimediawidgets/qvideowidgetcontrol.cpp
+++ /dev/null
@@ -1,245 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideowidgetcontrol.h"
-#include "private/qmediacontrol_p.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVideoWidgetControl
-
-
- \brief The QVideoWidgetControl class provides a media control which
- implements a video widget.
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \since 1.0
-
- The videoWidget() property of QVideoWidgetControl provides a pointer to a
- video widget implemented by the control's media service. This widget is
- owned by the media service and so care should be taken not to delete it.
-
- \snippet doc/src/snippets/multimedia-snippets/video.cpp Video widget control
-
- QVideoWidgetControl is one of number of possible video output controls.
-
- The interface name of QVideoWidgetControl is \c com.nokia.Qt.QVideoWidgetControl/1.0 as
- defined in QVideoWidgetControl_iid.
-
- \sa QMediaService::requestControl(), QVideoWidget
-*/
-
-/*!
- \macro QVideoWidgetControl_iid
-
- \c com.nokia.Qt.QVideoWidgetControl/1.0
-
- Defines the interface name of the QVideoWidgetControl class.
-
- \relates QVideoWidgetControl
-*/
-
-/*!
- Constructs a new video widget control with the given \a parent.
-*/
-QVideoWidgetControl::QVideoWidgetControl(QObject *parent)
- :QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a video widget control.
-*/
-QVideoWidgetControl::~QVideoWidgetControl()
-{
-}
-
-/*!
- \fn QVideoWidgetControl::isFullScreen() const
-
- Returns true if the video is shown using the complete screen.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::setFullScreen(bool fullScreen)
-
- Sets whether a video widget is in \a fullScreen mode.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::fullScreenChanged(bool fullScreen)
-
- Signals that the \a fullScreen state of a video widget has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::aspectRatioMode() const
-
- Returns how video is scaled to fit the widget with respect to its aspect ratio.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-
- Sets the aspect ratio \a mode which determines how video is scaled to the fit the widget with
- respect to its aspect ratio.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::brightness() const
-
- Returns the brightness adjustment applied to a video.
-
- Valid brightness values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::setBrightness(int brightness)
-
- Sets a \a brightness adjustment for a video.
-
- Valid brightness values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::brightnessChanged(int brightness)
-
- Signals that a video widget's \a brightness adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::contrast() const
-
- Returns the contrast adjustment applied to a video.
-
- Valid contrast values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::setContrast(int contrast)
-
- Sets the contrast adjustment for a video widget to \a contrast.
-
- Valid contrast values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-
-/*!
- \fn QVideoWidgetControl::contrastChanged(int contrast)
-
- Signals that a video widget's \a contrast adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::hue() const
-
- Returns the hue adjustment applied to a video widget.
-
- Value hue values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::setHue(int hue)
-
- Sets a \a hue adjustment for a video widget.
-
- Valid hue values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-
-/*!
- \fn QVideoWidgetControl::hueChanged(int hue)
-
- Signals that a video widget's \a hue adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::saturation() const
-
- Returns the saturation adjustment applied to a video widget.
-
- Value saturation values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-
-/*!
- \fn QVideoWidgetControl::setSaturation(int saturation)
-
- Sets a \a saturation adjustment for a video widget.
-
- Valid saturation values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::saturationChanged(int saturation)
-
- Signals that a video widget's \a saturation adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWidgetControl::videoWidget()
-
- Returns the QWidget.
- \since 1.0
-*/
-
-#include "moc_qvideowidgetcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimediawidgets/qvideowidgetcontrol.h b/src/multimediawidgets/qvideowidgetcontrol.h
deleted file mode 100644
index 41a02dd..0000000
--- a/src/multimediawidgets/qvideowidgetcontrol.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOWIDGETCONTROL_H
-#define QVIDEOWIDGETCONTROL_H
-
-#include "qvideowidget.h"
-#include "qmediacontrol.h"
-
-#include <QtWidgets/qwidget.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class QVideoWidgetControlPrivate;
-
-class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWidgetControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- virtual ~QVideoWidgetControl();
-
- virtual QWidget *videoWidget() = 0;
-
- virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
-
- virtual bool isFullScreen() const = 0;
- virtual void setFullScreen(bool fullScreen) = 0;
-
- virtual int brightness() const = 0;
- virtual void setBrightness(int brightness) = 0;
-
- virtual int contrast() const = 0;
- virtual void setContrast(int contrast) = 0;
-
- virtual int hue() const = 0;
- virtual void setHue(int hue) = 0;
-
- virtual int saturation() const = 0;
- virtual void setSaturation(int saturation) = 0;
-
-Q_SIGNALS:
- void fullScreenChanged(bool fullScreen);
- void brightnessChanged(int brightness);
- void contrastChanged(int contrast);
- void hueChanged(int hue);
- void saturationChanged(int saturation);
-
-protected:
- QVideoWidgetControl(QObject *parent = 0);
-};
-
-#define QVideoWidgetControl_iid "com.nokia.Qt.QVideoWidgetControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QVideoWidgetControl, QVideoWidgetControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/multimediawidgets/qvideowindowcontrol.cpp b/src/multimediawidgets/qvideowindowcontrol.cpp
deleted file mode 100644
index d963919..0000000
--- a/src/multimediawidgets/qvideowindowcontrol.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qvideowindowcontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \class QVideoWindowControl
-
- \inmodule QtMultimedia
- \ingroup multimedia-serv
- \brief The QVideoWindowControl class provides a media control for rendering video to a window.
- \since 1.0
-
-
- The winId() property QVideoWindowControl allows a platform specific window
- ID to be set as the video render target of a QMediaService. The
- displayRect() property is used to set the region of the window the video
- should be rendered to, and the aspectRatioMode() property indicates how the
- video should be scaled to fit the displayRect().
-
- \snippet doc/src/snippets/multimedia-snippets/video.cpp Video window control
-
- QVideoWindowControl is one of a number of possible video output controls.
-
- The interface name of QVideoWindowControl is \c com.nokia.Qt.QVideoWindowControl/1.0 as
- defined in QVideoWindowControl_iid.
-
- \sa QMediaService::requestControl(), QVideoWidget
-*/
-
-/*!
- \macro QVideoWindowControl_iid
-
- \c com.nokia.Qt.QVideoWindowControl/1.0
-
- Defines the interface name of the QVideoWindowControl class.
-
- \relates QVideoWindowControl
-*/
-
-/*!
- Constructs a new video window control with the given \a parent.
-*/
-QVideoWindowControl::QVideoWindowControl(QObject *parent)
- : QMediaControl(parent)
-{
-}
-
-/*!
- Destroys a video window control.
-*/
-QVideoWindowControl::~QVideoWindowControl()
-{
-}
-
-/*!
- \fn QVideoWindowControl::winId() const
-
- Returns the ID of the window a video overlay end point renders to.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setWinId(WId id)
-
- Sets the \a id of the window a video overlay end point renders to.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::displayRect() const
- Returns the sub-rect of a window where video is displayed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setDisplayRect(const QRect &rect)
- Sets the sub-\a rect of a window where video is displayed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::isFullScreen() const
-
- Identifies if a video overlay is a fullScreen overlay.
-
- Returns true if the video overlay is fullScreen, and false otherwise.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setFullScreen(bool fullScreen)
-
- Sets whether a video overlay is a \a fullScreen overlay.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::fullScreenChanged(bool fullScreen)
-
- Signals that the \a fullScreen state of a video overlay has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::repaint()
-
- Repaints the last frame.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::nativeSize() const
-
- Returns a suggested size for the video display based on the resolution and aspect ratio of the
- video.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::nativeSizeChanged()
-
- Signals that the native dimensions of the video have changed.
- \since 1.0
-*/
-
-
-/*!
- \fn QVideoWindowControl::aspectRatioMode() const
-
- Returns how video is scaled to fit the display region with respect to its aspect ratio.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-
- Sets the aspect ratio \a mode which determines how video is scaled to the fit the display region
- with respect to its aspect ratio.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::brightness() const
-
- Returns the brightness adjustment applied to a video overlay.
-
- Valid brightness values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setBrightness(int brightness)
-
- Sets a \a brightness adjustment for a video overlay.
-
- Valid brightness values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::brightnessChanged(int brightness)
-
- Signals that a video overlay's \a brightness adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::contrast() const
-
- Returns the contrast adjustment applied to a video overlay.
-
- Valid contrast values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setContrast(int contrast)
-
- Sets the \a contrast adjustment for a video overlay.
-
- Valid contrast values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::contrastChanged(int contrast)
-
- Signals that a video overlay's \a contrast adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::hue() const
-
- Returns the hue adjustment applied to a video overlay.
-
- Value hue values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setHue(int hue)
-
- Sets a \a hue adjustment for a video overlay.
-
- Valid hue values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::hueChanged(int hue)
-
- Signals that a video overlay's \a hue adjustment has changed.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::saturation() const
-
- Returns the saturation adjustment applied to a video overlay.
-
- Value saturation values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::setSaturation(int saturation)
- Sets a \a saturation adjustment for a video overlay.
-
- Valid saturation values range between -100 and 100, the default is 0.
- \since 1.0
-*/
-
-/*!
- \fn QVideoWindowControl::saturationChanged(int saturation)
-
- Signals that a video overlay's \a saturation adjustment has changed.
- \since 1.0
-*/
-
-#include "moc_qvideowindowcontrol.cpp"
-QT_END_NAMESPACE
-
diff --git a/src/multimediawidgets/qvideowindowcontrol.h b/src/multimediawidgets/qvideowindowcontrol.h
deleted file mode 100644
index f8e1c63..0000000
--- a/src/multimediawidgets/qvideowindowcontrol.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QVIDEOWINDOWCONTROL_H
-#define QVIDEOWINDOWCONTROL_H
-
-#include "qmediacontrol.h"
-#include "qvideowidget.h"
-
-#include <QtWidgets/qwidget.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-QT_MODULE(Multimedia)
-
-
-class Q_MULTIMEDIAWIDGETS_EXPORT QVideoWindowControl : public QMediaControl
-{
- Q_OBJECT
-
-public:
- ~QVideoWindowControl();
-
- virtual WId winId() const = 0;
- virtual void setWinId(WId id) = 0;
-
- virtual QRect displayRect() const = 0;
- virtual void setDisplayRect(const QRect &rect) = 0;
-
- virtual bool isFullScreen() const = 0;
- virtual void setFullScreen(bool fullScreen) = 0;
-
- virtual void repaint() = 0;
-
- virtual QSize nativeSize() const = 0;
-
- virtual Qt::AspectRatioMode aspectRatioMode() const = 0;
- virtual void setAspectRatioMode(Qt::AspectRatioMode mode) = 0;
-
- virtual int brightness() const = 0;
- virtual void setBrightness(int brightness) = 0;
-
- virtual int contrast() const = 0;
- virtual void setContrast(int contrast) = 0;
-
- virtual int hue() const = 0;
- virtual void setHue(int hue) = 0;
-
- virtual int saturation() const = 0;
- virtual void setSaturation(int saturation) = 0;
-
-Q_SIGNALS:
- void fullScreenChanged(bool fullScreen);
- void brightnessChanged(int brightness);
- void contrastChanged(int contrast);
- void hueChanged(int hue);
- void saturationChanged(int saturation);
- void nativeSizeChanged();
-
-protected:
- QVideoWindowControl(QObject *parent = 0);
-};
-
-#define QVideoWindowControl_iid "com.nokia.Qt.QVideoWindowControl/1.0"
-Q_MEDIA_DECLARE_CONTROL(QVideoWindowControl, QVideoWindowControl_iid)
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/plugins/audiocapture/audiocapture.pro b/src/plugins/audiocapture/audiocapture.pro
deleted file mode 100644
index 8b30b2a..0000000
--- a/src/plugins/audiocapture/audiocapture.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-load(qt_module)
-
-TARGET = qtmedia_audioengine
-QT += multimedia-private
-PLUGIN_TYPE=mediaservice
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-# Input
-HEADERS += audioencodercontrol.h \
- audiocontainercontrol.h \
- audiomediarecordercontrol.h \
- audioendpointselector.h \
- audiocaptureservice.h \
- audiocaptureserviceplugin.h \
- audiocapturesession.h
-
-SOURCES += audioencodercontrol.cpp \
- audiocontainercontrol.cpp \
- audiomediarecordercontrol.cpp \
- audioendpointselector.cpp \
- audiocaptureservice.cpp \
- audiocaptureserviceplugin.cpp \
- audiocapturesession.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/audiocapture/audiocaptureservice.cpp b/src/plugins/audiocapture/audiocaptureservice.cpp
deleted file mode 100644
index 6dff4c5..0000000
--- a/src/plugins/audiocapture/audiocaptureservice.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audiocaptureservice.h"
-#include "audiocapturesession.h"
-#include "audioendpointselector.h"
-#include "audioencodercontrol.h"
-#include "audiocontainercontrol.h"
-#include "audiomediarecordercontrol.h"
-
-AudioCaptureService::AudioCaptureService(QObject *parent):
- QMediaService(parent)
-{
- m_session = new AudioCaptureSession(this);
- m_encoderControl = new AudioEncoderControl(m_session);
- m_containerControl = new AudioContainerControl(m_session);
- m_mediaControl = new AudioMediaRecorderControl(m_session);
- m_endpointSelector = new AudioEndpointSelector(m_session);
-}
-
-AudioCaptureService::~AudioCaptureService()
-{
- delete m_encoderControl;
- delete m_containerControl;
- delete m_endpointSelector;
- delete m_mediaControl;
- delete m_session;
-}
-
-QMediaControl *AudioCaptureService::requestControl(const char *name)
-{
- if (qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return m_mediaControl;
-
- if (qstrcmp(name,QAudioEncoderControl_iid) == 0)
- return m_encoderControl;
-
- if (qstrcmp(name,QAudioEndpointSelector_iid) == 0)
- return m_endpointSelector;
-
- if (qstrcmp(name,QMediaContainerControl_iid) == 0)
- return m_containerControl;
-
- return 0;
-}
-
-void AudioCaptureService::releaseControl(QMediaControl *control)
-{
- Q_UNUSED(control)
-}
-
-
diff --git a/src/plugins/audiocapture/audiocaptureservice.h b/src/plugins/audiocapture/audiocaptureservice.h
deleted file mode 100644
index 26a39d4..0000000
--- a/src/plugins/audiocapture/audiocaptureservice.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOCAPTURESERVICE_H
-#define AUDIOCAPTURESERVICE_H
-
-#include <QtCore/qobject.h>
-
-#include "qmediaservice.h"
-
-class AudioCaptureSession;
-class AudioEncoderControl;
-class AudioContainerControl;
-class AudioMediaRecorderControl;
-class AudioEndpointSelector;
-
-QT_USE_NAMESPACE
-
-class AudioCaptureService : public QMediaService
-{
- Q_OBJECT
-public:
- AudioCaptureService(QObject *parent = 0);
- ~AudioCaptureService();
-
- QMediaControl *requestControl(const char *interface);
- void releaseControl(QMediaControl *control);
-private:
- AudioCaptureSession *m_session;
- AudioEncoderControl *m_encoderControl;
- AudioContainerControl *m_containerControl;
- AudioEndpointSelector *m_endpointSelector;
- AudioMediaRecorderControl *m_mediaControl;
-};
-
-#endif
diff --git a/src/plugins/audiocapture/audiocaptureserviceplugin.cpp b/src/plugins/audiocapture/audiocaptureserviceplugin.cpp
deleted file mode 100644
index cfa2ab9..0000000
--- a/src/plugins/audiocapture/audiocaptureserviceplugin.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-
-#include "audiocaptureserviceplugin.h"
-#include "audiocaptureservice.h"
-
-#include "qmediaserviceprovider.h"
-
-
-QStringList AudioCaptureServicePlugin::keys() const
-{
- return QStringList() << QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE);
-}
-
-QMediaService* AudioCaptureServicePlugin::create(QString const& key)
-{
- if (key == QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE))
- return new AudioCaptureService;
-
- return 0;
-}
-
-void AudioCaptureServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_audioengine, AudioCaptureServicePlugin);
-
diff --git a/src/plugins/audiocapture/audiocaptureserviceplugin.h b/src/plugins/audiocapture/audiocaptureserviceplugin.h
deleted file mode 100644
index 16b4643..0000000
--- a/src/plugins/audiocapture/audiocaptureserviceplugin.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef AUDIOCAPTURESERVICEPLUGIN_H
-#define AUDIOCAPTURESERVICEPLUGIN_H
-
-#include "qmediaserviceproviderplugin.h"
-
-QT_USE_NAMESPACE
-
-class AudioCaptureServicePlugin : public QMediaServiceProviderPlugin
-{
- Q_OBJECT
-
-public:
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-};
-
-#endif // AUDIOCAPTURESERVICEPLUGIN_H
diff --git a/src/plugins/audiocapture/audiocapturesession.cpp b/src/plugins/audiocapture/audiocapturesession.cpp
deleted file mode 100644
index 82d330f..0000000
--- a/src/plugins/audiocapture/audiocapturesession.cpp
+++ /dev/null
@@ -1,358 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qdir.h>
-#include <qaudiodeviceinfo.h>
-
-#include "qmediarecorder.h"
-
-#include "audiocapturesession.h"
-
-AudioCaptureSession::AudioCaptureSession(QObject *parent):
- QObject(parent)
-{
- m_deviceInfo = new QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice());
- m_audioInput = 0;
- m_position = 0;
- m_state = QMediaRecorder::StoppedState;
-
- m_format.setFrequency(8000);
- m_format.setChannels(1);
- m_format.setSampleSize(8);
- m_format.setSampleType(QAudioFormat::UnSignedInt);
- m_format.setCodec("audio/pcm");
- wavFile = true;
-}
-
-AudioCaptureSession::~AudioCaptureSession()
-{
- stop();
-
- if(m_audioInput)
- delete m_audioInput;
-}
-
-QAudioDeviceInfo* AudioCaptureSession::deviceInfo() const
-{
- return m_deviceInfo;
-}
-
-QAudioFormat AudioCaptureSession::format() const
-{
- return m_format;
-}
-
-bool AudioCaptureSession::isFormatSupported(const QAudioFormat &format) const
-{
- if(m_deviceInfo) {
- if(format.codec().contains(QLatin1String("audio/x-wav"))) {
- QAudioFormat fmt = format;
- fmt.setCodec("audio/pcm");
- return m_deviceInfo->isFormatSupported(fmt);
- } else
- return m_deviceInfo->isFormatSupported(format);
- }
- return false;
-}
-
-bool AudioCaptureSession::setFormat(const QAudioFormat &format)
-{
- if(m_deviceInfo) {
-
- QAudioFormat fmt = format;
-
- if(m_deviceInfo->isFormatSupported(fmt)) {
- m_format = fmt;
- if(m_audioInput) delete m_audioInput;
- m_audioInput = 0;
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for(int i=0;i<devices.size();i++) {
- if(qstrcmp(m_deviceInfo->deviceName().toLocal8Bit().constData(),
- devices.at(i).deviceName().toLocal8Bit().constData()) == 0) {
- m_audioInput = new QAudioInput(devices.at(i),m_format);
- connect(m_audioInput,SIGNAL(stateChanged(QAudio::State)),this,SLOT(stateChanged(QAudio::State)));
- connect(m_audioInput,SIGNAL(notify()),this,SLOT(notify()));
- break;
- }
- }
- } else {
- m_format = m_deviceInfo->preferredFormat();
- qWarning()<<"failed to setFormat using preferred...";
- }
- }
- return false;
-}
-
-QStringList AudioCaptureSession::supportedContainers() const
-{
- QStringList list;
- if(m_deviceInfo) {
- if (m_deviceInfo->supportedCodecs().size() > 0) {
- list << "audio/x-wav";
- list << "audio/pcm";
- }
- }
- return list;
-}
-
-QString AudioCaptureSession::containerDescription(const QString &formatMimeType) const
-{
- if(m_deviceInfo) {
- if (formatMimeType.contains(QLatin1String("audio/pcm")))
- return tr("RAW file format");
- if (formatMimeType.contains(QLatin1String("audio/x-wav")))
- return tr("WAV file format");
- }
- return QString();
-}
-
-void AudioCaptureSession::setContainerMimeType(const QString &formatMimeType)
-{
- if (!formatMimeType.contains(QLatin1String("audio/x-wav")) &&
- !formatMimeType.contains(QLatin1String("audio/pcm")) &&
- !formatMimeType.isEmpty())
- return;
-
- if(m_deviceInfo) {
- if (!m_deviceInfo->supportedCodecs().contains(QLatin1String("audio/pcm")))
- return;
-
- if (formatMimeType.isEmpty() || formatMimeType.contains(QLatin1String("audio/x-wav"))) {
- wavFile = true;
- m_format.setCodec("audio/pcm");
- } else {
- wavFile = false;
- m_format.setCodec(formatMimeType);
- }
- }
-}
-
-QString AudioCaptureSession::containerMimeType() const
-{
- if(wavFile)
- return QString("audio/x-wav");
-
- return QString("audio/pcm");
-}
-
-QUrl AudioCaptureSession::outputLocation() const
-{
- return m_actualSink;
-}
-
-bool AudioCaptureSession::setOutputLocation(const QUrl& sink)
-{
- m_sink = m_actualSink = sink;
- return true;
-}
-
-qint64 AudioCaptureSession::position() const
-{
- return m_position;
-}
-
-int AudioCaptureSession::state() const
-{
- return int(m_state);
-}
-
-QDir AudioCaptureSession::defaultDir() const
-{
- QStringList dirCandidates;
-
-#if defined(Q_WS_MAEMO_6)
- dirCandidates << QLatin1String("/home/user/MyDocs");
-#endif
-
- dirCandidates << QDir::home().filePath("Documents");
- dirCandidates << QDir::home().filePath("My Documents");
- dirCandidates << QDir::homePath();
- dirCandidates << QDir::currentPath();
- dirCandidates << QDir::tempPath();
-
- foreach (const QString &path, dirCandidates) {
- QDir dir(path);
- if (dir.exists() && QFileInfo(path).isWritable())
- return dir;
- }
-
- return QDir();
-}
-
-QString AudioCaptureSession::generateFileName(const QDir &dir, const QString &ext) const
-{
-
- int lastClip = 0;
- foreach(QString fileName, dir.entryList(QStringList() << QString("clip_*.%1").arg(ext))) {
- int imgNumber = fileName.mid(5, fileName.size()-6-ext.length()).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("clip_%1.%2").arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0')).arg(ext);
-
- return dir.absoluteFilePath(name);
-}
-
-void AudioCaptureSession::record()
-{
- if(!m_audioInput) {
- setFormat(m_format);
- }
-
- m_actualSink = m_sink;
-
- if (m_actualSink.isEmpty()) {
- QString ext = wavFile ? QLatin1String("wav") : QLatin1String("raw");
- m_actualSink = generateFileName(defaultDir(), ext);
- }
-
- if(m_actualSink.toLocalFile().length() > 0)
- file.setFileName(m_actualSink.toLocalFile());
- else
- file.setFileName(m_actualSink.toString());
-
- if(m_audioInput) {
- if(m_state == QMediaRecorder::StoppedState) {
- if(file.open(QIODevice::WriteOnly)) {
- memset(&header,0,sizeof(CombinedHeader));
- memcpy(header.riff.descriptor.id,"RIFF",4);
- header.riff.descriptor.size = 0xFFFFFFFF; // This should be updated on stop(), filesize-8
- memcpy(header.riff.type,"WAVE",4);
- memcpy(header.wave.descriptor.id,"fmt ",4);
- header.wave.descriptor.size = 16;
- header.wave.audioFormat = 1; // for PCM data
- header.wave.numChannels = m_format.channels();
- header.wave.sampleRate = m_format.frequency();
- header.wave.byteRate = m_format.frequency()*m_format.channels()*m_format.sampleSize()/8;
- header.wave.blockAlign = m_format.channels()*m_format.sampleSize()/8;
- header.wave.bitsPerSample = m_format.sampleSize();
- memcpy(header.data.descriptor.id,"data",4);
- header.data.descriptor.size = 0xFFFFFFFF; // This should be updated on stop(),samples*channels*sampleSize/8
- if (wavFile)
- file.write((char*)&header,sizeof(CombinedHeader));
-
- m_audioInput->start(qobject_cast<QIODevice*>(&file));
- } else {
- emit error(1,QString("can't open source, failed"));
- m_state = QMediaRecorder::StoppedState;
- emit stateChanged(m_state);
- }
- }
- }
-
- m_state = QMediaRecorder::RecordingState;
-}
-
-void AudioCaptureSession::pause()
-{
- if(m_audioInput)
- m_audioInput->stop();
-
- m_state = QMediaRecorder::PausedState;
-}
-
-void AudioCaptureSession::stop()
-{
- if(m_audioInput) {
- m_audioInput->stop();
- file.close();
- if (wavFile) {
- qint32 fileSize = file.size()-8;
- file.open(QIODevice::ReadWrite | QIODevice::Unbuffered);
- file.read((char*)&header,sizeof(CombinedHeader));
- header.riff.descriptor.size = fileSize; // filesize-8
- header.data.descriptor.size = fileSize-44; // samples*channels*sampleSize/8
- file.seek(0);
- file.write((char*)&header,sizeof(CombinedHeader));
- file.close();
- }
- m_position = 0;
- }
- m_state = QMediaRecorder::StoppedState;
-}
-
-void AudioCaptureSession::stateChanged(QAudio::State state)
-{
- switch(state) {
- case QAudio::ActiveState:
- emit stateChanged(QMediaRecorder::RecordingState);
- break;
- default:
- if(!((m_state == QMediaRecorder::PausedState)||(m_state == QMediaRecorder::StoppedState)))
- m_state = QMediaRecorder::StoppedState;
-
- emit stateChanged(m_state);
- break;
- }
-}
-
-void AudioCaptureSession::notify()
-{
- m_position += m_audioInput->notifyInterval();
- emit positionChanged(m_position);
-}
-
-void AudioCaptureSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
- if(m_deviceInfo)
- delete m_deviceInfo;
-
- m_deviceInfo = 0;
-
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for(int i = 0; i < devices.size(); i++) {
- if(qstrcmp(m_captureDevice.toLocal8Bit().constData(),
- devices.at(i).deviceName().toLocal8Bit().constData())==0){
- m_deviceInfo = new QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice());
- return;
- }
- }
- m_deviceInfo = new QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice());
-}
-
-
-
diff --git a/src/plugins/audiocapture/audiocapturesession.h b/src/plugins/audiocapture/audiocapturesession.h
deleted file mode 100644
index 8b0636f..0000000
--- a/src/plugins/audiocapture/audiocapturesession.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOCAPTURESESSION_H
-#define AUDIOCAPTURESESSION_H
-
-#include <QFile>
-#include <QUrl>
-#include <QDir>
-
-#include "audioencodercontrol.h"
-#include "audioendpointselector.h"
-#include "audiomediarecordercontrol.h"
-
-#include <qaudioformat.h>
-#include <qaudioinput.h>
-#include <qaudiodeviceinfo.h>
-
-QT_USE_NAMESPACE
-
-class AudioCaptureSession : public QObject
-{
- Q_OBJECT
-
-public:
- AudioCaptureSession(QObject *parent = 0);
- ~AudioCaptureSession();
-
- QAudioFormat format() const;
- QAudioDeviceInfo* deviceInfo() const;
- bool isFormatSupported(const QAudioFormat &format) const;
- bool setFormat(const QAudioFormat &format);
- QStringList supportedContainers() const;
- QString containerMimeType() const;
- void setContainerMimeType(const QString &formatMimeType);
- QString containerDescription(const QString &formatMimeType) const;
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl& sink);
- qint64 position() const;
- int state() const;
- void record();
- void pause();
- void stop();
-
-public slots:
- void setCaptureDevice(const QString &deviceName);
-
-signals:
- void stateChanged(QMediaRecorder::State state);
- void positionChanged(qint64 position);
- void error(int error, const QString &errorString);
-
-private slots:
- void stateChanged(QAudio::State state);
- void notify();
-
-private:
- QDir defaultDir() const;
- QString generateFileName(const QDir &dir, const QString &ext) const;
-
- QFile file;
- QString m_captureDevice;
- QUrl m_sink;
- QUrl m_actualSink;
- QMediaRecorder::State m_state;
- QAudioInput *m_audioInput;
- QAudioDeviceInfo *m_deviceInfo;
- QAudioFormat m_format;
- qint64 m_position;
- bool wavFile;
-
- // WAV header stuff
-
- struct chunk
- {
- char id[4];
- quint32 size;
- };
-
- struct RIFFHeader
- {
- chunk descriptor;
- char type[4];
- };
-
- struct WAVEHeader
- {
- chunk descriptor;
- quint16 audioFormat; // PCM = 1
- quint16 numChannels;
- quint32 sampleRate;
- quint32 byteRate;
- quint16 blockAlign;
- quint16 bitsPerSample;
- };
-
- struct DATAHeader
- {
- chunk descriptor;
-// quint8 data[];
- };
-
- struct CombinedHeader
- {
- RIFFHeader riff;
- WAVEHeader wave;
- DATAHeader data;
- };
-
- CombinedHeader header;
-};
-
-#endif
diff --git a/src/plugins/audiocapture/audiocontainercontrol.cpp b/src/plugins/audiocapture/audiocontainercontrol.cpp
deleted file mode 100644
index b5c84d2..0000000
--- a/src/plugins/audiocapture/audiocontainercontrol.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audiocontainercontrol.h"
-#include "audiocapturesession.h"
-
-AudioContainerControl::AudioContainerControl(QObject *parent)
- :QMediaContainerControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
-}
-
-AudioContainerControl::~AudioContainerControl()
-{
-}
-
-QStringList AudioContainerControl::supportedContainers() const
-{
- return m_session->supportedContainers();
-}
-
-QString AudioContainerControl::containerMimeType() const
-{
- return m_session->containerMimeType();
-}
-
-void AudioContainerControl::setContainerMimeType(const QString &formatMimeType)
-{
- m_session->setContainerMimeType(formatMimeType);
-}
-
-QString AudioContainerControl::containerDescription(const QString &formatMimeType) const
-{
- return m_session->containerDescription(formatMimeType);
-}
-
diff --git a/src/plugins/audiocapture/audiocontainercontrol.h b/src/plugins/audiocapture/audiocontainercontrol.h
deleted file mode 100644
index 793e7f8..0000000
--- a/src/plugins/audiocapture/audiocontainercontrol.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOCONTAINERCONTROL_H
-#define AUDIOCONTAINERCONTROL_H
-
-#include "qmediacontainercontrol.h"
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-class AudioCaptureSession;
-
-QT_USE_NAMESPACE
-
-class AudioContainerControl : public QMediaContainerControl
-{
- Q_OBJECT
-public:
- AudioContainerControl(QObject *parent);
- virtual ~AudioContainerControl();
-
- QStringList supportedContainers() const;
- QString containerMimeType() const;
- void setContainerMimeType(const QString &formatMimeType);
- QString containerDescription(const QString &formatMimeType) const;
-
-private:
- AudioCaptureSession* m_session;
-};
-
-#endif
diff --git a/src/plugins/audiocapture/audioencodercontrol.cpp b/src/plugins/audiocapture/audioencodercontrol.cpp
deleted file mode 100644
index ce2ab42..0000000
--- a/src/plugins/audiocapture/audioencodercontrol.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audioencodercontrol.h"
-#include "audiocapturesession.h"
-
-#include <qaudioformat.h>
-
-#include <QtCore/qdebug.h>
-
-AudioEncoderControl::AudioEncoderControl(QObject *parent)
- :QAudioEncoderControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
-
- QT_PREPEND_NAMESPACE(QAudioFormat) fmt;
- fmt.setSampleSize(8);
- fmt.setChannels(1);
- fmt.setFrequency(8000);
- fmt.setSampleType(QT_PREPEND_NAMESPACE(QAudioFormat)::SignedInt);
- fmt.setCodec("audio/pcm");
- fmt.setByteOrder(QAudioFormat::LittleEndian);
- m_session->setFormat(fmt);
-
- m_settings.setEncodingMode(QtMultimedia::ConstantQualityEncoding);
- m_settings.setCodec("audio/pcm");
- m_settings.setBitRate(8000);
- m_settings.setChannelCount(1);
- m_settings.setSampleRate(8000);
- m_settings.setQuality(QtMultimedia::LowQuality);
-}
-
-AudioEncoderControl::~AudioEncoderControl()
-{
-}
-
-QStringList AudioEncoderControl::supportedAudioCodecs() const
-{
- QStringList list;
- if (m_session->supportedContainers().size() > 0)
- list.append("audio/pcm");
-
- return list;
-}
-
-QString AudioEncoderControl::codecDescription(const QString &codecName) const
-{
- if (codecName.contains(QLatin1String("audio/pcm")))
- return tr("PCM audio data");
-
- return QString();
-}
-
-QStringList AudioEncoderControl::supportedEncodingOptions(const QString &codec) const
-{
- Q_UNUSED(codec)
-
- QStringList list;
- return list;
-}
-
-QVariant AudioEncoderControl::encodingOption(const QString &codec, const QString &name) const
-{
- Q_UNUSED(codec)
- Q_UNUSED(name)
-
- return QVariant();
-}
-
-void AudioEncoderControl::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- Q_UNUSED(value)
- Q_UNUSED(codec)
- Q_UNUSED(name)
-}
-
-QList<int> AudioEncoderControl::supportedSampleRates(const QAudioEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return m_session->deviceInfo()->supportedFrequencies();
-}
-
-QAudioEncoderSettings AudioEncoderControl::audioSettings() const
-{
- return m_settings;
-}
-
-void AudioEncoderControl::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- QAudioFormat fmt = m_session->format();
-
- if (settings.encodingMode() == QtMultimedia::ConstantQualityEncoding) {
- if (settings.quality() == QtMultimedia::LowQuality) {
- fmt.setSampleSize(8);
- fmt.setChannels(1);
- fmt.setFrequency(8000);
- fmt.setSampleType(QAudioFormat::UnSignedInt);
-
- } else if (settings.quality() == QtMultimedia::NormalQuality) {
- fmt.setSampleSize(16);
- fmt.setChannels(1);
- fmt.setFrequency(22050);
- fmt.setSampleType(QAudioFormat::SignedInt);
-
- } else {
- fmt.setSampleSize(16);
- fmt.setChannels(1);
- fmt.setFrequency(44100);
- fmt.setSampleType(QAudioFormat::SignedInt);
- }
-
- } else {
- fmt.setChannels(settings.channelCount());
- fmt.setFrequency(settings.sampleRate());
- if (settings.sampleRate() == 8000 && settings.bitRate() == 8000) {
- fmt.setSampleType(QAudioFormat::UnSignedInt);
- fmt.setSampleSize(8);
- } else {
- fmt.setSampleSize(16);
- fmt.setSampleType(QAudioFormat::SignedInt);
- }
- }
- fmt.setCodec("audio/pcm");
-
- m_session->setFormat(fmt);
- m_settings = settings;
-}
diff --git a/src/plugins/audiocapture/audioencodercontrol.h b/src/plugins/audiocapture/audioencodercontrol.h
deleted file mode 100644
index 25e86e7..0000000
--- a/src/plugins/audiocapture/audioencodercontrol.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOENCODERCONTROL_H
-#define AUDIOENCODERCONTROL_H
-
-#include "qaudioencodercontrol.h"
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <qaudioformat.h>
-
-class AudioCaptureSession;
-
-QT_USE_NAMESPACE
-
-class AudioEncoderControl : public QAudioEncoderControl
-{
- Q_OBJECT
-public:
- AudioEncoderControl(QObject *parent);
- virtual ~AudioEncoderControl();
-
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
- QList<int> supportedSampleRates(const QAudioEncoderSettings &, bool *continuous = 0) const;
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
-private:
- AudioCaptureSession* m_session;
- QAudioEncoderSettings m_settings;
-};
-
-#endif
diff --git a/src/plugins/audiocapture/audioendpointselector.cpp b/src/plugins/audiocapture/audioendpointselector.cpp
deleted file mode 100644
index 9a20981..0000000
--- a/src/plugins/audiocapture/audioendpointselector.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audiocapturesession.h"
-#include "audioendpointselector.h"
-
-#include <qaudiodeviceinfo.h>
-
-
-AudioEndpointSelector::AudioEndpointSelector(QObject *parent)
- :QAudioEndpointSelector(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
-
- update();
-
- m_audioInput = defaultEndpoint();
-}
-
-AudioEndpointSelector::~AudioEndpointSelector()
-{
-}
-
-QList<QString> AudioEndpointSelector::availableEndpoints() const
-{
- return m_names;
-}
-
-QString AudioEndpointSelector::endpointDescription(const QString& name) const
-{
- QString desc;
-
- for(int i = 0; i < m_names.count(); i++) {
- if (m_names.at(i).compare(name) == 0) {
- desc = m_names.at(i);
- break;
- }
- }
- return desc;
-}
-
-QString AudioEndpointSelector::defaultEndpoint() const
-{
- return QAudioDeviceInfo(QAudioDeviceInfo::defaultInputDevice()).deviceName();
-}
-
-QString AudioEndpointSelector::activeEndpoint() const
-{
- return m_audioInput;
-}
-
-void AudioEndpointSelector::setActiveEndpoint(const QString& name)
-{
- if (m_audioInput.compare(name) != 0) {
- m_audioInput = name;
- m_session->setCaptureDevice(name);
- emit activeEndpointChanged(name);
- }
-}
-
-void AudioEndpointSelector::update()
-{
- m_names.clear();
- m_descriptions.clear();
-
- QList<QAudioDeviceInfo> devices;
- devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
- for(int i = 0; i < devices.size(); ++i) {
- m_names.append(devices.at(i).deviceName());
- m_descriptions.append(devices.at(i).deviceName());
- }
-}
diff --git a/src/plugins/audiocapture/audioendpointselector.h b/src/plugins/audiocapture/audioendpointselector.h
deleted file mode 100644
index b4dbe2a..0000000
--- a/src/plugins/audiocapture/audioendpointselector.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOENDPOINTSELECTOR_H
-#define AUDIOENDPOINTSELECTOR_H
-
-#include <QStringList>
-
-#include "qaudioendpointselector.h"
-
-class AudioCaptureSession;
-
-QT_USE_NAMESPACE
-
-class AudioEndpointSelector : public QAudioEndpointSelector
-{
-Q_OBJECT
-public:
- AudioEndpointSelector(QObject *parent);
- virtual ~AudioEndpointSelector();
-
- QList<QString> availableEndpoints() const;
- QString endpointDescription(const QString& name) const;
- QString defaultEndpoint() const;
- QString activeEndpoint() const;
-
-public Q_SLOTS:
- void setActiveEndpoint(const QString& name);
-
-private:
- void update();
-
- QString m_audioInput;
- QList<QString> m_names;
- QList<QString> m_descriptions;
- AudioCaptureSession* m_session;
-};
-
-#endif // AUDIOENDPOINTSELECTOR_H
diff --git a/src/plugins/audiocapture/audiomediarecordercontrol.cpp b/src/plugins/audiocapture/audiomediarecordercontrol.cpp
deleted file mode 100644
index 4778610..0000000
--- a/src/plugins/audiocapture/audiomediarecordercontrol.cpp
+++ /dev/null
@@ -1,102 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "audiocapturesession.h"
-#include "audiomediarecordercontrol.h"
-
-#include <QtCore/qdebug.h>
-
-AudioMediaRecorderControl::AudioMediaRecorderControl(QObject *parent)
- :QMediaRecorderControl(parent)
-{
- m_session = qobject_cast<AudioCaptureSession*>(parent);
- connect(m_session,SIGNAL(positionChanged(qint64)),this,SIGNAL(durationChanged(qint64)));
- connect(m_session,SIGNAL(stateChanged(QMediaRecorder::State)),this,SIGNAL(stateChanged(QMediaRecorder::State)));
- connect(m_session,SIGNAL(error(int,QString)),this,SIGNAL(error(int,QString)));
-}
-
-AudioMediaRecorderControl::~AudioMediaRecorderControl()
-{
-}
-
-QUrl AudioMediaRecorderControl::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool AudioMediaRecorderControl::setOutputLocation(const QUrl& sink)
-{
- return m_session->setOutputLocation(sink);
-}
-
-QMediaRecorder::State AudioMediaRecorderControl::state() const
-{
- return (QMediaRecorder::State)m_session->state();
-}
-
-qint64 AudioMediaRecorderControl::duration() const
-{
- return m_session->position();
-}
-
-void AudioMediaRecorderControl::record()
-{
- m_session->record();
-}
-
-void AudioMediaRecorderControl::pause()
-{
- m_session->stop();
-}
-
-void AudioMediaRecorderControl::stop()
-{
- m_session->stop();
-}
-
-bool AudioMediaRecorderControl::isMuted() const
-{
- return false;
-}
-
-void AudioMediaRecorderControl::setMuted(bool)
-{
-}
diff --git a/src/plugins/audiocapture/audiomediarecordercontrol.h b/src/plugins/audiocapture/audiomediarecordercontrol.h
deleted file mode 100644
index 603aaf2..0000000
--- a/src/plugins/audiocapture/audiomediarecordercontrol.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef AUDIOMEDIARECORDERCONTROL_H
-#define AUDIOMEDIARECORDERCONTROL_H
-
-#include <QtCore/qobject.h>
-
-#include "qmediarecorder.h"
-#include "qmediarecordercontrol.h"
-
-class AudioCaptureSession;
-
-QT_USE_NAMESPACE
-
-class AudioMediaRecorderControl : public QMediaRecorderControl
-{
- Q_OBJECT
-public:
- AudioMediaRecorderControl(QObject *parent = 0);
- ~AudioMediaRecorderControl();
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
-
- QMediaRecorder::State state() const;
-
- qint64 duration() const;
-
- bool isMuted() const;
-
- void applySettings() {}
-
-public slots:
- void record();
- void pause();
- void stop();
- void setMuted(bool);
-
-private:
- AudioCaptureSession* m_session;
-};
-
-#endif
diff --git a/src/plugins/directshow/camera/camera.pri b/src/plugins/directshow/camera/camera.pri
deleted file mode 100644
index 42f5999..0000000
--- a/src/plugins/directshow/camera/camera.pri
+++ /dev/null
@@ -1,31 +0,0 @@
-INCLUDEPATH += $$PWD
-
-DEFINES += QMEDIA_DIRECTSHOW_CAMERA
-
-win32-g++: DEFINES += QT_NO_WMSDK
-
-win32: DEFINES += _CRT_SECURE_NO_WARNINGS
-
-HEADERS += \
- $$PWD/dscameraservice.h \
- $$PWD/dscameracontrol.h \
- $$PWD/dsvideorenderer.h \
- $$PWD/dsvideodevicecontrol.h \
- $$PWD/dsimagecapturecontrol.h \
- $$PWD/dscamerasession.h \
- $$PWD/dsvideowidgetcontrol.h \
- $$PWD/dscameraservice.h \
- $$PWD/directshowglobal.h
-
-
-SOURCES += \
- $$PWD/dscameraservice.cpp \
- $$PWD/dscameracontrol.cpp \
- $$PWD/dsvideorenderer.cpp \
- $$PWD/dsvideodevicecontrol.cpp \
- $$PWD/dsimagecapturecontrol.cpp \
- $$PWD/dscamerasession.cpp \
- $$PWD/dsvideowidgetcontrol.cpp
-
-INCLUDEPATH += $(DXSDK_DIR)/include
-LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32
diff --git a/src/plugins/directshow/camera/directshowglobal.h b/src/plugins/directshow/camera/directshowglobal.h
deleted file mode 100644
index c595aba..0000000
--- a/src/plugins/directshow/camera/directshowglobal.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWGLOBAL_H
-#define DIRECTSHOWGLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-#include <dshow.h>
-
-DEFINE_GUID(MEDIASUBTYPE_I420,
- 0x30323449,0x0000,0x0010,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71);
-
-extern const GUID MEDIASUBTYPE_RGB24;
-extern const GUID MEDIASUBTYPE_RGB32;
-extern const GUID MEDIASUBTYPE_YUY2;
-extern const GUID MEDIASUBTYPE_MJPG;
-extern const GUID MEDIASUBTYPE_RGB555;
-extern const GUID MEDIASUBTYPE_YVU9;
-extern const GUID MEDIASUBTYPE_UYVY;
-extern const GUID PIN_CATEGORY_CAPTURE;
-extern const GUID PIN_CATEGORY_PREVIEW;
-
-extern const IID IID_IPropertyBag;
-extern const IID IID_ISampleGrabber;
-extern const IID IID_ICaptureGraphBuilder2;
-extern const IID IID_IAMStreamConfig;
-
-
-extern const CLSID CLSID_CVidCapClassManager;
-extern const CLSID CLSID_VideoInputDeviceCategory;
-extern const CLSID CLSID_SampleGrabber;
-extern const CLSID CLSID_CaptureGraphBuilder2;
-
-#define SAFE_RELEASE(x) { if(x) x->Release(); x = NULL; }
-
-typedef struct IFileSinkFilter *LPFILESINKFILTER;
-typedef struct IAMCopyCaptureFileProgress *LPAMCOPYCAPTUREFILEPROGRESS;
-
-#ifndef __ICaptureGraphBuilder2_INTERFACE_DEFINED__
-#define __ICaptureGraphBuilder2_INTERFACE_DEFINED__
-struct ICaptureGraphBuilder2 : public IUnknown
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE SetFiltergraph(
- /* [in] */ IGraphBuilder *pfg) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFiltergraph(
- /* [out] */ IGraphBuilder **ppfg) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetOutputFileName(
- /* [in] */ const GUID *pType,
- /* [in] */ LPCOLESTR lpstrFile,
- /* [out] */ IBaseFilter **ppf,
- /* [out] */ IFileSinkFilter **ppSink) = 0;
-
- virtual /* [local] */ HRESULT STDMETHODCALLTYPE FindInterface(
- /* [in] */ const GUID *pCategory,
- /* [in] */ const GUID *pType,
- /* [in] */ IBaseFilter *pf,
- /* [in] */ REFIID riid,
- /* [out] */ void **ppint) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE RenderStream(
- /* [in] */ const GUID *pCategory,
- /* [in] */ const GUID *pType,
- /* [in] */ IUnknown *pSource,
- /* [in] */ IBaseFilter *pfCompressor,
- /* [in] */ IBaseFilter *pfRenderer) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE ControlStream(
- /* [in] */ const GUID *pCategory,
- /* [in] */ const GUID *pType,
- /* [in] */ IBaseFilter *pFilter,
- /* [in] */ REFERENCE_TIME *pstart,
- /* [in] */ REFERENCE_TIME *pstop,
- /* [in] */ WORD wStartCookie,
- /* [in] */ WORD wStopCookie) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE AllocCapFile(
- /* [in] */ LPCOLESTR lpstr,
- /* [in] */ DWORDLONG dwlSize) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE CopyCaptureFile(
- /* [in] */ LPOLESTR lpwstrOld,
- /* [in] */ LPOLESTR lpwstrNew,
- /* [in] */ int fAllowEscAbort,
- /* [in] */ IAMCopyCaptureFileProgress *pCallback) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE FindPin(
- /* [in] */ IUnknown *pSource,
- /* [in] */ PIN_DIRECTION pindir,
- /* [in] */ const GUID *pCategory,
- /* [in] */ const GUID *pType,
- /* [in] */ BOOL fUnconnected,
- /* [in] */ int num,
- /* [out] */ IPin **ppPin) = 0;
-
-};
-#endif
-
-#ifndef __IAMStreamConfig_INTERFACE_DEFINED__
-#define __IAMStreamConfig_INTERFACE_DEFINED__
-struct IAMStreamConfig : public IUnknown
-{
-public:
- virtual HRESULT STDMETHODCALLTYPE SetFormat(
- /* [in] */ AM_MEDIA_TYPE *pmt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFormat(
- /* [out] */ AM_MEDIA_TYPE **ppmt) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetNumberOfCapabilities(
- /* [out] */ int *piCount,
- /* [out] */ int *piSize) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetStreamCaps(
- /* [in] */ int iIndex,
- /* [out] */ AM_MEDIA_TYPE **ppmt,
- /* [out] */ BYTE *pSCC) = 0;
-
-};
-#endif
-
-#ifndef __IErrorLog_INTERFACE_DEFINED__
-#define __IErrorLog_INTERFACE_DEFINED__
-struct IErrorLog : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE AddError(
- /* [in] */ LPCOLESTR pszPropName,
- /* [in] */ EXCEPINFO *pExcepInfo) = 0;
-
- };
-#endif
-
-#ifndef __IPropertyBag_INTERFACE_DEFINED__
-#define __IPropertyBag_INTERFACE_DEFINED__
-struct IPropertyBag : public IUnknown
-{
-public:
- virtual /* [local] */ HRESULT STDMETHODCALLTYPE Read(
- /* [in] */ LPCOLESTR pszPropName,
- /* [out][in] */ VARIANT *pVar,
- /* [in] */ IErrorLog *pErrorLog) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE Write(
- /* [in] */ LPCOLESTR pszPropName,
- /* [in] */ VARIANT *pVar) = 0;
-
-};
-#endif
-
-typedef struct IMediaSample *LPMEDIASAMPLE;
-
-EXTERN_C const IID IID_ISampleGrabberCB;
-
-#ifndef __ISampleGrabberCB_INTERFACE_DEFINED__
-#define __ISampleGrabberCB_INTERFACE_DEFINED__
-
-#undef INTERFACE
-#define INTERFACE ISampleGrabberCB
-DECLARE_INTERFACE_(ISampleGrabberCB, IUnknown)
-{
-// STDMETHOD(QueryInterface) (THIS_ const GUID *, void **) PURE;
- STDMETHOD(QueryInterface) (THIS_ REFIID riid, void **) PURE;
- STDMETHOD_(ULONG, AddRef) (THIS) PURE;
- STDMETHOD_(ULONG, Release) (THIS) PURE;
- STDMETHOD_(HRESULT, SampleCB) (THIS_ double, LPMEDIASAMPLE) PURE;
- STDMETHOD_(HRESULT, BufferCB) (THIS_ double, BYTE *, long) PURE;
-};
-#undef INTERFACE
-
-#endif
-
-
-#ifndef __ISampleGrabber_INTERFACE_DEFINED__
-#define __ISampleGrabber_INTERFACE_DEFINED__
-
-#define INTERFACE ISampleGrabber
-DECLARE_INTERFACE_(ISampleGrabber,IUnknown)
-{
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD(SetOneShot)(THIS_ BOOL) PURE;
- STDMETHOD(SetMediaType)(THIS_ const AM_MEDIA_TYPE*) PURE;
- STDMETHOD(GetConnectedMediaType)(THIS_ AM_MEDIA_TYPE*) PURE;
- STDMETHOD(SetBufferSamples)(THIS_ BOOL) PURE;
- STDMETHOD(GetCurrentBuffer)(THIS_ long*,long*) PURE;
- STDMETHOD(GetCurrentSample)(THIS_ IMediaSample**) PURE;
- STDMETHOD(SetCallback)(THIS_ ISampleGrabberCB *,long) PURE;
-};
-#undef INTERFACE
-#endif
-
-
-#endif
diff --git a/src/plugins/directshow/camera/dscameracontrol.cpp b/src/plugins/directshow/camera/dscameracontrol.cpp
deleted file mode 100644
index 4379b79..0000000
--- a/src/plugins/directshow/camera/dscameracontrol.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-
-#include "dscameracontrol.h"
-#include "dscameraservice.h"
-#include "dscamerasession.h"
-
-QT_BEGIN_NAMESPACE
-
-DSCameraControl::DSCameraControl(QObject *parent)
- :QCameraControl(parent), m_captureMode(QCamera::CaptureStillImage)
-{
- m_session = qobject_cast<DSCameraSession*>(parent);
- connect(m_session, SIGNAL(stateChanged(QCamera::State)),this, SIGNAL(stateChanged(QCamera::State)));
-}
-
-DSCameraControl::~DSCameraControl()
-{
-}
-
-void DSCameraControl::setState(QCamera::State state)
-{
- switch (state) {
- case QCamera::ActiveState:
- start();
- break;
- case QCamera::UnloadedState: /* fall through */
- case QCamera::LoadedState:
- stop();
- break;
- }
-}
-
-bool DSCameraControl::isCaptureModeSupported(QCamera::CaptureMode mode) const
-{
- bool bCaptureSupported = false;
- switch (mode) {
- case QCamera::CaptureStillImage:
- bCaptureSupported = true;
- break;
- case QCamera::CaptureVideo:
- bCaptureSupported = false;
- break;
- }
- return bCaptureSupported;
-}
-
-void DSCameraControl::start()
-{
- m_session->record();
-}
-
-void DSCameraControl::stop()
-{
- m_session->stop();
-}
-
-QCamera::State DSCameraControl::state() const
-{
- return (QCamera::State)m_session->state();
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/directshow/camera/dscameracontrol.h b/src/plugins/directshow/camera/dscameracontrol.h
deleted file mode 100644
index ee9e594..0000000
--- a/src/plugins/directshow/camera/dscameracontrol.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSCAMERACONTROL_H
-#define DSCAMERACONTROL_H
-
-#include <QtCore/qobject.h>
-#include <qcameracontrol.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class DSCameraService;
-class DSCameraSession;
-
-
-class DSCameraControl : public QCameraControl
-{
- Q_OBJECT
-public:
- DSCameraControl(QObject *parent = 0);
- ~DSCameraControl();
-
- void start();
- void stop();
- QCamera::State state() const;
-
- QCamera::CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureMode mode)
- {
- if (m_captureMode != mode) {
- m_captureMode = mode;
- emit captureModeChanged(mode);
- }
- }
-
- void setState(QCamera::State state);
-
- QCamera::Status status() const { return QCamera::UnavailableStatus; }
- bool isCaptureModeSupported(QCamera::CaptureMode mode) const;
- bool canChangeProperty(PropertyChangeType /* changeType */, QCamera::Status /* status */) const {return false; }
-
-private:
- DSCameraSession *m_session;
- DSCameraService *m_service;
- QCamera::CaptureMode m_captureMode;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
-
-
diff --git a/src/plugins/directshow/camera/dscameraservice.cpp b/src/plugins/directshow/camera/dscameraservice.cpp
deleted file mode 100644
index 3b42a18..0000000
--- a/src/plugins/directshow/camera/dscameraservice.cpp
+++ /dev/null
@@ -1,114 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/qwidget.h>
-#include <QVideoWidgetControl.h>
-
-
-#include "dscameraservice.h"
-#include "dscameracontrol.h"
-#include "dscamerasession.h"
-#include "dsvideorenderer.h"
-#include "dsvideodevicecontrol.h"
-#include "dsimagecapturecontrol.h"
-#include "dsvideowidgetcontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-DSCameraService::DSCameraService(QObject *parent):
- QMediaService(parent)
-{
- m_session = new DSCameraSession(this);
-
- m_control = new DSCameraControl(m_session);
-
- m_videoDevice = new DSVideoDeviceControl(m_session);
-
- m_videoRenderer = new DSVideoRendererControl(m_session, this);
-
- m_imageCapture = new DSImageCaptureControl(m_session);
-
- m_viewFinderWidget = new DSVideoWidgetControl(m_session);
-
- m_device = QByteArray("default");
-}
-
-DSCameraService::~DSCameraService()
-{
- delete m_control;
- delete m_videoDevice;
- delete m_videoRenderer;
- delete m_imageCapture;
- delete m_viewFinderWidget;
- delete m_session;
-}
-
-QMediaControl* DSCameraService::requestControl(const char *name)
-{
- if(qstrcmp(name,QCameraControl_iid) == 0)
- return m_control;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return m_imageCapture;
-
- if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
- if (m_viewFinderWidget) {
- return m_viewFinderWidget;
- }
- }
-
- if(qstrcmp(name,QVideoRendererControl_iid) == 0)
- return m_videoRenderer;
-
- if(qstrcmp(name,QVideoDeviceControl_iid) == 0)
- return m_videoDevice;
-
- return 0;
-}
-
-void DSCameraService::releaseControl(QMediaControl *control)
-{
- // Implemented as a singleton, so we do nothing.
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/directshow/camera/dscameraservice.h b/src/plugins/directshow/camera/dscameraservice.h
deleted file mode 100644
index 2423801..0000000
--- a/src/plugins/directshow/camera/dscameraservice.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSCAMERASERVICE_H
-#define DSCAMERASERVICE_H
-
-#include <QtCore/qobject.h>
-
-#include <qmediaservice.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class DSCameraControl;
-class DSCameraSession;
-class DSVideoOutputControl;
-class DSVideoDeviceControl;
-class DSVideoRendererControl;
-class DSImageCaptureControl;
-class DSVideoWidgetControl;
-
-
-class DSCameraService : public QMediaService
-{
- Q_OBJECT
-
-public:
- DSCameraService(QObject *parent = 0);
- ~DSCameraService();
-
- virtual QMediaControl* requestControl(const char *name);
- virtual void releaseControl(QMediaControl *control);
-
-private:
- DSCameraControl *m_control;
- DSCameraSession *m_session;
- DSVideoOutputControl *m_videoOutput;
- DSVideoWidgetControl *m_viewFinderWidget;
- DSVideoDeviceControl *m_videoDevice;
- DSVideoRendererControl *m_videoRenderer;
- DSImageCaptureControl *m_imageCapture;
- QByteArray m_device;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/plugins/directshow/camera/dscamerasession.cpp b/src/plugins/directshow/camera/dscamerasession.cpp
deleted file mode 100644
index 073bc60..0000000
--- a/src/plugins/directshow/camera/dscamerasession.cpp
+++ /dev/null
@@ -1,1160 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-#include <QWidget>
-#include <QFile>
-#include <QtMultimedia/qabstractvideobuffer.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include "dscamerasession.h"
-#include "dsvideorenderer.h"
-#include "directshowglobal.h"
-
-QT_BEGIN_NAMESPACE
-
-// If frames come in quicker than we display them, we allow the queue to build
-// up to this number before we start dropping them.
-const int LIMIT_FRAME = 5;
-
-namespace {
-// DirectShow helper implementation
-void _FreeMediaType(AM_MEDIA_TYPE& mt)
-{
- if (mt.cbFormat != 0) {
- CoTaskMemFree((PVOID)mt.pbFormat);
- mt.cbFormat = 0;
- mt.pbFormat = NULL;
- }
- if (mt.pUnk != NULL) {
- // pUnk should not be used.
- mt.pUnk->Release();
- mt.pUnk = NULL;
- }
-}
-
-} // end namespace
-
-class SampleGrabberCallbackPrivate : public ISampleGrabberCB
-{
-public:
- STDMETHODIMP_(ULONG) AddRef() { return 1; }
- STDMETHODIMP_(ULONG) Release() { return 2; }
-
- STDMETHODIMP QueryInterface(REFIID riid, void **ppvObject)
- {
- if (NULL == ppvObject)
- return E_POINTER;
- if (riid == IID_IUnknown /*__uuidof(IUnknown) */ ) {
- *ppvObject = static_cast<IUnknown*>(this);
- return S_OK;
- }
- if (riid == IID_ISampleGrabberCB /*__uuidof(ISampleGrabberCB)*/ ) {
- *ppvObject = static_cast<ISampleGrabberCB*>(this);
- return S_OK;
- }
- return E_NOTIMPL;
- }
-
- STDMETHODIMP SampleCB(double Time, IMediaSample *pSample)
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP BufferCB(double Time, BYTE *pBuffer, long BufferLen)
- {
- if (!cs || active) {
- return S_OK;
- }
-
- if ((cs->StillMediaType.majortype != MEDIATYPE_Video) ||
- (cs->StillMediaType.formattype != FORMAT_VideoInfo) ||
- (cs->StillMediaType.cbFormat < sizeof(VIDEOINFOHEADER))) {
- return VFW_E_INVALIDMEDIATYPE;
- }
-
- active = true;
-
- if(toggle == true) {
- toggle = false;
- }
- else {
- toggle = true;
- }
-
- if(toggle) {
- active = false;
- return S_OK;
- }
-
- bool check = false;
- cs->mutex.lock();
-
- if (cs->frames.size() > LIMIT_FRAME) {
- check = true;
- }
-
- if (check) {
- cs->mutex.unlock();
- // Frames building up. We're going to drop some here
- Sleep(100);
- active = false;
- return S_OK;
- }
- cs->mutex.unlock();
-
- unsigned char* vidData = new unsigned char[BufferLen];
- memcpy(vidData, pBuffer, BufferLen);
-
- cs->mutex.lock();
-
- video_buffer* buf = new video_buffer;
- buf->buffer = vidData;
- buf->length = BufferLen;
- buf->time = (qint64)Time;
-
- cs->frames.append(buf);
-
- cs->mutex.unlock();
-
- QMetaObject::invokeMethod(cs, "captureFrame", Qt::QueuedConnection);
-
- active = false;
-
- return S_OK;
- }
-
- DSCameraSession* cs;
- bool active;
- bool toggle;
-};
-
-
-DSCameraSession::DSCameraSession(QObject *parent)
- : QObject(parent)
- ,m_currentImageId(0)
-{
- pBuild = NULL;
- pGraph = NULL;
- pCap = NULL;
- pSG_Filter = NULL;
- pSG = NULL;
-
- opened = false;
- available = false;
- resolutions.clear();
- m_state = QCamera::UnloadedState;
- m_device = "default";
-
- StillCapCB = new SampleGrabberCallbackPrivate;
- StillCapCB->cs = this;
- StillCapCB->active = false;
- StillCapCB->toggle = false;
-
- m_output = 0;
- m_surface = 0;
- m_windowSize = QSize(320,240);
- pixelF = QVideoFrame::Format_RGB24;
- actualFormat = QVideoSurfaceFormat(m_windowSize,pixelF);
-
- graph = false;
- active = false;
-
- ::CoInitialize(NULL);
-}
-
-DSCameraSession::~DSCameraSession()
-{
- if (opened) {
- closeStream();
- }
-
- CoUninitialize();
-
- SAFE_RELEASE(pCap);
- SAFE_RELEASE(pSG_Filter);
- SAFE_RELEASE(pGraph);
- SAFE_RELEASE(pBuild);
-
- if (StillCapCB) {
- delete StillCapCB;
- }
-}
-
-int DSCameraSession::captureImage(const QString &fileName)
-{
- emit readyForCaptureChanged(false);
-
- // We're going to do this in one big synchronous call
- m_currentImageId++;
- if (fileName.isEmpty()) {
- m_snapshot = "img.jpg";
- } else {
- m_snapshot = fileName;
- }
-
- if (!active) {
- startStream();
- }
-
- return m_currentImageId;
-}
-
-void DSCameraSession::setSurface(QAbstractVideoSurface* surface)
-{
- m_surface = surface;
-}
-
-bool DSCameraSession::deviceReady()
-{
- return available;
-}
-
-bool DSCameraSession::pictureInProgress()
-{
- return m_snapshot.isEmpty();
-}
-
-int DSCameraSession::framerate() const
-{
- return -1;
-}
-
-void DSCameraSession::setFrameRate(int rate)
-{
- Q_UNUSED(rate)
-}
-
-int DSCameraSession::brightness() const
-{
- return -1;
-}
-
-void DSCameraSession::setBrightness(int b)
-{
- Q_UNUSED(b)
-}
-
-int DSCameraSession::contrast() const
-{
- return -1;
-}
-
-void DSCameraSession::setContrast(int c)
-{
- Q_UNUSED(c)
-}
-
-int DSCameraSession::saturation() const
-{
- return -1;
-}
-
-void DSCameraSession::setSaturation(int s)
-{
- Q_UNUSED(s)
-}
-
-int DSCameraSession::hue() const
-{
- return -1;
-}
-
-void DSCameraSession::setHue(int h)
-{
- Q_UNUSED(h)
-}
-
-int DSCameraSession::sharpness() const
-{
- return -1;
-}
-
-void DSCameraSession::setSharpness(int s)
-{
- Q_UNUSED(s)
-}
-
-int DSCameraSession::zoom() const
-{
- return -1;
-}
-
-void DSCameraSession::setZoom(int z)
-{
- Q_UNUSED(z)
-}
-
-bool DSCameraSession::backlightCompensation() const
-{
- return false;
-}
-
-void DSCameraSession::setBacklightCompensation(bool b)
-{
- Q_UNUSED(b)
-}
-
-int DSCameraSession::whitelevel() const
-{
- return -1;
-}
-
-void DSCameraSession::setWhitelevel(int w)
-{
- Q_UNUSED(w)
-}
-
-int DSCameraSession::rotation() const
-{
- return 0;
-}
-
-void DSCameraSession::setRotation(int r)
-{
- Q_UNUSED(r)
-}
-
-bool DSCameraSession::flash() const
-{
- return false;
-}
-
-void DSCameraSession::setFlash(bool f)
-{
- Q_UNUSED(f)
-}
-
-bool DSCameraSession::autofocus() const
-{
- return false;
-}
-
-void DSCameraSession::setAutofocus(bool f)
-{
- Q_UNUSED(f)
-}
-
-QSize DSCameraSession::frameSize() const
-{
- return m_windowSize;
-}
-
-void DSCameraSession::setFrameSize(const QSize& s)
-{
- if (supportedResolutions(pixelF).contains(s))
- m_windowSize = s;
- else
- qWarning() << "frame size if not supported for current pixel format, no change";
-}
-
-void DSCameraSession::setDevice(const QString &device)
-{
- if(opened)
- stopStream();
-
- if(graph) {
- SAFE_RELEASE(pCap);
- SAFE_RELEASE(pSG_Filter);
- SAFE_RELEASE(pGraph);
- SAFE_RELEASE(pBuild);
- }
-
- available = false;
- m_state = QCamera::LoadedState;
-
- CoInitialize(NULL);
-
- ICreateDevEnum* pDevEnum = NULL;
- IEnumMoniker* pEnum = NULL;
-
- // Create the System device enumerator
- HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
- CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
- reinterpret_cast<void**>(&pDevEnum));
- if(SUCCEEDED(hr)) {
- // Create the enumerator for the video capture category
- hr = pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnum, 0);
- if (S_OK == hr) {
- pEnum->Reset();
- // go through and find all video capture devices
- IMoniker* pMoniker = NULL;
- while(pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag;
- hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
- (void**)(&pPropBag));
- if(FAILED(hr)) {
- pMoniker->Release();
- continue; // skip this one
- }
- // Find the description
- WCHAR str[120];
- VARIANT varName;
- varName.vt = VT_BSTR;
- hr = pPropBag->Read(L"Description", &varName, 0);
- if(FAILED(hr))
- hr = pPropBag->Read(L"FriendlyName", &varName, 0);
- if(SUCCEEDED(hr)) {
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString temp(QString::fromUtf16((unsigned short*)str));
- if(temp.contains(device)) {
- available = true;
- }
- }
- pPropBag->Release();
- pMoniker->Release();
- }
- pEnum->Release();
- }
- pDevEnum->Release();
- }
- CoUninitialize();
-
- if(available) {
- m_device = QByteArray(device.toLocal8Bit().constData());
- graph = createFilterGraph();
- if(!graph)
- available = false;
- }
-}
-
-QList<QVideoFrame::PixelFormat> DSCameraSession::supportedPixelFormats()
-{
- return types;
-}
-
-QVideoFrame::PixelFormat DSCameraSession::pixelFormat() const
-{
- return pixelF;
-}
-
-void DSCameraSession::setPixelFormat(QVideoFrame::PixelFormat fmt)
-{
- pixelF = fmt;
-}
-
-QList<QSize> DSCameraSession::supportedResolutions(QVideoFrame::PixelFormat format)
-{
- if (!resolutions.contains(format))
- return QList<QSize>();
- return resolutions.value(format);
-}
-
-bool DSCameraSession::setOutputLocation(const QUrl &sink)
-{
- m_sink = sink;
-
- return true;
-}
-
-QUrl DSCameraSession::outputLocation() const
-{
- return m_sink;
-}
-
-qint64 DSCameraSession::position() const
-{
- return timeStamp.elapsed();
-}
-
-int DSCameraSession::state() const
-{
- return int(m_state);
-}
-
-void DSCameraSession::record()
-{
- if(opened) {
- return;
- }
-
- if(m_surface) {
- bool match = false;
-
- if (!m_surface->isFormatSupported(actualFormat)) {
- QList<QVideoFrame::PixelFormat> fmts;
- foreach(QVideoFrame::PixelFormat f, types) {
- if (fmts.contains(f)) {
- match = true;
- pixelF = f;
- actualFormat = QVideoSurfaceFormat(m_windowSize,pixelF);
- break;
- }
- }
- }
- if (!m_surface->isFormatSupported(actualFormat) && !match) {
- // fallback
- if (types.contains(QVideoFrame::Format_RGB24)) {
- // get RGB24 from camera and convert to RGB32 for surface!
- pixelF = QVideoFrame::Format_RGB32;
- actualFormat = QVideoSurfaceFormat(m_windowSize,pixelF);
- }
- }
-
- if (m_surface->isFormatSupported(actualFormat)) {
- m_surface->start(actualFormat);
- m_state = QCamera::ActiveState;
- emit stateChanged(QCamera::ActiveState);
- } else {
- qWarning() << "surface doesn't support camera format, cant start";
- m_state = QCamera::LoadedState;
- emit stateChanged(QCamera::LoadedState);
- return;
- }
- } else {
- qWarning() << "no video surface, cant start";
- m_state = QCamera::LoadedState;
- emit stateChanged(QCamera::LoadedState);
- return;
- }
-
- opened = startStream();
-
- if (!opened) {
- qWarning() << "Stream did not open";
- m_state = QCamera::LoadedState;
- emit stateChanged(QCamera::LoadedState);
- }
-}
-
-void DSCameraSession::pause()
-{
- suspendStream();
-}
-
-void DSCameraSession::stop()
-{
- if(!opened) {
- return;
- }
-
- stopStream();
- opened = false;
- m_state = QCamera::LoadedState;
- emit stateChanged(QCamera::LoadedState);
-}
-
-void DSCameraSession::captureFrame()
-{
- if(m_surface && frames.count() > 0) {
-
- QImage image;
-
- if(pixelF == QVideoFrame::Format_RGB24) {
-
- mutex.lock();
-
- image = QImage(frames.at(0)->buffer,m_windowSize.width(),m_windowSize.height(),
- QImage::Format_RGB888).rgbSwapped().mirrored(true);
-
- QVideoFrame frame(image);
- frame.setStartTime(frames.at(0)->time);
-
- mutex.unlock();
-
- m_surface->present(frame);
-
- } else if (pixelF == QVideoFrame::Format_RGB32) {
-
- mutex.lock();
-
- image = QImage(frames.at(0)->buffer,m_windowSize.width(),m_windowSize.height(),
- QImage::Format_RGB888).rgbSwapped().mirrored(true);
-
- QVideoFrame frame(image.convertToFormat(QImage::Format_RGB32));
- frame.setStartTime(frames.at(0)->time);
-
- mutex.unlock();
-
- m_surface->present(frame);
-
- } else {
- qWarning() << "TODO:captureFrame() format =" << pixelF;
- }
-
- if (m_snapshot.length() > 0) {
- emit imageCaptured(m_currentImageId, image);
- image.save(m_snapshot,"JPG");
- emit imageSaved(m_currentImageId, m_snapshot);
- m_snapshot.clear();
- emit readyForCaptureChanged(true);
- }
-
- mutex.lock();
- if (frames.isEmpty()) {
- qWarning() << "Frames over-run";
- }
-
- video_buffer* buf = frames.takeFirst();
- delete buf->buffer;
- delete buf;
- mutex.unlock();
- }
-}
-
-HRESULT DSCameraSession::getPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin)
-{
- *ppPin = 0;
- IEnumPins *pEnum = 0;
- IPin *pPin = 0;
-
- HRESULT hr = pFilter->EnumPins(&pEnum);
- if(FAILED(hr)) {
- return hr;
- }
-
- pEnum->Reset();
- while(pEnum->Next(1, &pPin, NULL) == S_OK) {
- PIN_DIRECTION ThisPinDir;
- pPin->QueryDirection(&ThisPinDir);
- if(ThisPinDir == PinDir) {
- pEnum->Release();
- *ppPin = pPin;
- return S_OK;
- }
- pEnum->Release();
- }
- pEnum->Release();
- return E_FAIL;
-}
-
-bool DSCameraSession::createFilterGraph()
-{
- HRESULT hr;
- IMoniker* pMoniker = NULL;
- ICreateDevEnum* pDevEnum = NULL;
- IEnumMoniker* pEnum = NULL;
-
- CoInitialize(NULL);
-
- // Create the filter graph
- hr = CoCreateInstance(CLSID_FilterGraph,NULL,CLSCTX_INPROC,
- IID_IGraphBuilder, (void**)&pGraph);
- if (FAILED(hr)) {
- qWarning()<<"failed to create filter graph";
- return false;
- }
-
- // Create the capture graph builder
- hr = CoCreateInstance(CLSID_CaptureGraphBuilder2, NULL, CLSCTX_INPROC,
- IID_ICaptureGraphBuilder2, (void**)&pBuild);
- if (FAILED(hr)) {
- qWarning()<<"failed to create graph builder";
- return false;
- }
-
- // Attach the filter graph to the capture graph
- hr = pBuild->SetFiltergraph(pGraph);
- if (FAILED(hr)) {
- qWarning()<<"failed to connect capture graph and filter graph";
- return false;
- }
-
- // Find the Capture device
- hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
- CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
- reinterpret_cast<void**>(&pDevEnum));
- if (SUCCEEDED(hr)) {
- // Create an enumerator for the video capture category
- hr = pDevEnum->CreateClassEnumerator(CLSID_VideoInputDeviceCategory, &pEnum, 0);
- pDevEnum->Release();
- if (S_OK == hr) {
- pEnum->Reset();
- //go through and find all video capture devices
- while (pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag;
- hr = pMoniker->BindToStorage(0, 0,
- IID_IPropertyBag, (void**)(&pPropBag));
- if(FAILED(hr)) {
- pMoniker->Release();
- continue; // skip this one
- }
- // Find the description
- WCHAR str[120];
- VARIANT varName;
- varName.vt = VT_BSTR;
- hr = pPropBag->Read(L"FriendlyName", &varName, 0);
- if (SUCCEEDED(hr)) {
- // check if it is the selected device
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString output = QString::fromUtf16((unsigned short*)str);
- if (m_device.contains(output.toLocal8Bit().constData())) {
- hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pCap);
- if (SUCCEEDED(hr)) {
- pPropBag->Release();
- pMoniker->Release();
- break;
- }
- }
- }
- pPropBag->Release();
- pMoniker->Release();
- }
- if (NULL == pCap)
- {
- if (m_device.contains("default"))
- {
- pEnum->Reset();
- // still have to loop to discard bind to storage failure case
- while (pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag = 0;
-
- hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag, (void**)(&pPropBag));
- if (FAILED(hr)) {
- pMoniker->Release();
- continue; // Don't panic yet
- }
-
- // No need to get the description, just grab it
-
- hr = pMoniker->BindToObject(0, 0, IID_IBaseFilter, (void**)&pCap);
- pPropBag->Release();
- pMoniker->Release();
- if (SUCCEEDED(hr)) {
- break; // done, stop looping through
- }
- else
- {
- qWarning() << "Object bind failed";
- }
- }
- }
- }
- pEnum->Release();
- }
- }
-
- // Sample grabber filter
- hr = CoCreateInstance(CLSID_SampleGrabber, NULL,CLSCTX_INPROC,
- IID_IBaseFilter, (void**)&pSG_Filter);
- if (FAILED(hr)) {
- qWarning() << "failed to create sample grabber";
- return false;
- }
-
- pSG_Filter->QueryInterface(IID_ISampleGrabber, (void**)&pSG);
- if (FAILED(hr)) {
- qWarning() << "failed to get sample grabber";
- return false;
- }
- pSG->SetOneShot(FALSE);
- pSG->SetBufferSamples(TRUE);
- pSG->SetCallback(StillCapCB, 1);
-
- CoUninitialize();
-
- return true;
-}
-
-void DSCameraSession::updateProperties()
-{
- HRESULT hr;
- AM_MEDIA_TYPE *pmt = NULL;
- VIDEOINFOHEADER *pvi = NULL;
- VIDEO_STREAM_CONFIG_CAPS scc;
- IAMStreamConfig* pConfig = 0;
-
- hr = pBuild->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,pCap,
- IID_IAMStreamConfig, (void**)&pConfig);
- if (FAILED(hr)) {
- qWarning()<<"failed to get config on capture device";
- return;
- }
-
- int iCount;
- int iSize;
- hr = pConfig->GetNumberOfCapabilities(&iCount, &iSize);
- if (FAILED(hr)) {
- qWarning()<<"failed to get capabilities";
- return;
- }
-
- QList<QSize> sizes;
- QVideoFrame::PixelFormat f = QVideoFrame::Format_Invalid;
-
- types.clear();
- resolutions.clear();
-
- for (int iIndex = 0; iIndex < iCount; iIndex++) {
- hr = pConfig->GetStreamCaps(iIndex, &pmt, reinterpret_cast<BYTE*>(&scc));
- if (hr == S_OK) {
- pvi = (VIDEOINFOHEADER*)pmt->pbFormat;
- if ((pmt->majortype == MEDIATYPE_Video) &&
- (pmt->formattype == FORMAT_VideoInfo)) {
- // Add types
- if (pmt->subtype == MEDIASUBTYPE_RGB24) {
- if (!types.contains(QVideoFrame::Format_RGB24)) {
- types.append(QVideoFrame::Format_RGB24);
- f = QVideoFrame::Format_RGB24;
- }
- } else if (pmt->subtype == MEDIASUBTYPE_RGB32) {
- if (!types.contains(QVideoFrame::Format_RGB32)) {
- types.append(QVideoFrame::Format_RGB32);
- f = QVideoFrame::Format_RGB32;
- }
- } else if (pmt->subtype == MEDIASUBTYPE_YUY2) {
- if (!types.contains(QVideoFrame::Format_YUYV)) {
- types.append(QVideoFrame::Format_YUYV);
- f = QVideoFrame::Format_YUYV;
- }
- } else if (pmt->subtype == MEDIASUBTYPE_MJPG) {
- } else if (pmt->subtype == MEDIASUBTYPE_I420) {
- if (!types.contains(QVideoFrame::Format_YUV420P)) {
- types.append(QVideoFrame::Format_YUV420P);
- f = QVideoFrame::Format_YUV420P;
- }
- } else if (pmt->subtype == MEDIASUBTYPE_RGB555) {
- if (!types.contains(QVideoFrame::Format_RGB555)) {
- types.append(QVideoFrame::Format_RGB555);
- f = QVideoFrame::Format_RGB555;
- }
- } else if (pmt->subtype == MEDIASUBTYPE_YVU9) {
- } else if (pmt->subtype == MEDIASUBTYPE_UYVY) {
- if (!types.contains(QVideoFrame::Format_UYVY)) {
- types.append(QVideoFrame::Format_UYVY);
- f = QVideoFrame::Format_UYVY;
- }
- } else {
- qWarning() << "UNKNOWN FORMAT: " << pmt->subtype.Data1;
- }
- // Add resolutions
- QSize res(pvi->bmiHeader.biWidth, pvi->bmiHeader.biHeight);
- if (!resolutions.contains(f)) {
- sizes.clear();
- resolutions.insert(f,sizes);
- }
- resolutions[f].append(res);
- }
- }
- }
- pConfig->Release();
-}
-
-bool DSCameraSession::setProperties()
-{
- CoInitialize(NULL);
-
- HRESULT hr;
- AM_MEDIA_TYPE am_media_type;
- AM_MEDIA_TYPE *pmt = NULL;
- VIDEOINFOHEADER *pvi = NULL;
- VIDEO_STREAM_CONFIG_CAPS scc;
-
- IAMStreamConfig* pConfig = 0;
- hr = pBuild->FindInterface(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video, pCap,
- IID_IAMStreamConfig, (void**)&pConfig);
- if(FAILED(hr)) {
- qWarning()<<"failed to get config on capture device";
- return false;
- }
-
- int iCount;
- int iSize;
- hr = pConfig->GetNumberOfCapabilities(&iCount, &iSize);
- if(FAILED(hr)) {
- qWarning()<<"failed to get capabilities";
- return false;
- }
-
- bool setFormatOK = false;
- for (int iIndex = 0; iIndex < iCount; iIndex++) {
- hr = pConfig->GetStreamCaps(iIndex, &pmt, reinterpret_cast<BYTE*>(&scc));
- if (hr == S_OK) {
- pvi = (VIDEOINFOHEADER*)pmt->pbFormat;
-
- if ((pmt->majortype == MEDIATYPE_Video) &&
- (pmt->formattype == FORMAT_VideoInfo)) {
- if ((actualFormat.frameWidth() == pvi->bmiHeader.biWidth) &&
- (actualFormat.frameHeight() == pvi->bmiHeader.biHeight)) {
- hr = pConfig->SetFormat(pmt);
- _FreeMediaType(*pmt);
- if(FAILED(hr)) {
- qWarning()<<"failed to set format:" << hr;
- qWarning()<<"but going to continue";
- continue; // We going to continue
- } else {
- setFormatOK = true;
- break;
- }
- }
- }
- }
- }
- pConfig->Release();
-
- if (!setFormatOK) {
- qWarning() << "unable to set any format for camera";
- return false;
- }
-
- // Set Sample Grabber config to match capture
- ZeroMemory(&am_media_type, sizeof(am_media_type));
- am_media_type.majortype = MEDIATYPE_Video;
-
- if (actualFormat.pixelFormat() == QVideoFrame::Format_RGB32)
- am_media_type.subtype = MEDIASUBTYPE_RGB24;
- else if (actualFormat.pixelFormat() == QVideoFrame::Format_RGB24)
- am_media_type.subtype = MEDIASUBTYPE_RGB24;
- else if (actualFormat.pixelFormat() == QVideoFrame::Format_YUYV)
- am_media_type.subtype = MEDIASUBTYPE_YUY2;
- else if (actualFormat.pixelFormat() == QVideoFrame::Format_YUV420P)
- am_media_type.subtype = MEDIASUBTYPE_I420;
- else if (actualFormat.pixelFormat() == QVideoFrame::Format_RGB555)
- am_media_type.subtype = MEDIASUBTYPE_RGB555;
- else if (actualFormat.pixelFormat() == QVideoFrame::Format_UYVY)
- am_media_type.subtype = MEDIASUBTYPE_UYVY;
- else {
- qWarning()<<"unknown format? for SG";
- return false;
- }
-
- am_media_type.formattype = FORMAT_VideoInfo;
- hr = pSG->SetMediaType(&am_media_type);
- if (FAILED(hr)) {
- qWarning()<<"failed to set video format on grabber";
- return false;
- }
-
- pSG->GetConnectedMediaType(&StillMediaType);
-
- CoUninitialize();
-
- return true;
-}
-
-bool DSCameraSession::openStream()
-{
- //Opens the stream for reading and allocates any necessary resources needed
- //Return true if success, false otherwise
-
- if (opened) {
- return true;
- }
-
- if (!graph) {
- graph = createFilterGraph();
- if(!graph) {
- qWarning()<<"failed to create filter graph in openStream";
- return false;
- }
- }
-
- CoInitialize(NULL);
-
- HRESULT hr;
-
- hr = pGraph->AddFilter(pCap, L"Capture Filter");
- if (FAILED(hr)) {
- qWarning()<<"failed to create capture filter";
- return false;
- }
-
- hr = pGraph->AddFilter(pSG_Filter, L"Sample Grabber");
- if (FAILED(hr)) {
- qWarning()<<"failed to add sample grabber";
- return false;
- }
-
- hr = pBuild->RenderStream(&PIN_CATEGORY_CAPTURE, &MEDIATYPE_Video,
- pCap, NULL, pSG_Filter);
- if (FAILED(hr)) {
- qWarning() << "failed to renderstream" << hr;
- return false;
- }
- pSG->GetConnectedMediaType(&StillMediaType);
- pSG_Filter->Release();
-
- CoUninitialize();
-
- return true;
-}
-
-void DSCameraSession::closeStream()
-{
- // Closes the stream and internally frees any resources used
- HRESULT hr;
- IMediaControl* pControl = 0;
-
- hr = pGraph->QueryInterface(IID_IMediaControl,(void**)&pControl);
- if (FAILED(hr)) {
- qWarning()<<"failed to get stream control";
- return;
- }
-
- hr = pControl->StopWhenReady();
- if (FAILED(hr)) {
- qWarning()<<"failed to stop";
- pControl->Release();
- return;
- }
-
- pControl->Release();
-
- opened = false;
- IPin *pPin = 0;
-
- if (pCap)
- {
- hr = getPin(pCap, PINDIR_OUTPUT, &pPin);
- if(FAILED(hr)) {
- qWarning()<<"failed to disconnect capture filter";
- return;
- }
- }
-
- pGraph->Disconnect(pPin);
- if (FAILED(hr)) {
- qWarning()<<"failed to disconnect grabber filter";
- return;
- }
-
- hr = getPin(pSG_Filter,PINDIR_INPUT,&pPin);
- pGraph->Disconnect(pPin);
- pGraph->RemoveFilter(pSG_Filter);
- pGraph->RemoveFilter(pCap);
-
- SAFE_RELEASE(pCap);
- SAFE_RELEASE(pSG_Filter);
- SAFE_RELEASE(pGraph);
- SAFE_RELEASE(pBuild);
-
- graph = false;
-}
-
-bool DSCameraSession::startStream()
-{
- // Starts the stream, by emitting either QVideoPackets
- // or QvideoFrames, depending on Format chosen
- if (!graph)
- graph = createFilterGraph();
-
- if (!setProperties()) {
- qWarning() << "Couldn't set properties (retrying)";
- closeStream();
- if (!openStream()) {
- qWarning() << "Retry to open strean failed";
- return false;
- }
- }
-
- if (!opened) {
- opened = openStream();
- if (!opened) {
- qWarning() << "failed to openStream()";
- return false;
- }
- }
-
- HRESULT hr;
- IMediaControl* pControl = 0;
-
- hr = pGraph->QueryInterface(IID_IMediaControl, (void**)&pControl);
- if (FAILED(hr)) {
- qWarning() << "failed to get stream control";
- return false;
- }
-
- hr = pControl->Run();
- pControl->Release();
-
- if (FAILED(hr)) {
- qWarning() << "failed to start";
- return false;
- }
- active = true;
- return true;
-}
-
-void DSCameraSession::stopStream()
-{
- // Stops the stream from emitting packets
- HRESULT hr;
-
- IMediaControl* pControl = 0;
- hr = pGraph->QueryInterface(IID_IMediaControl, (void**)&pControl);
- if (FAILED(hr)) {
- qWarning() << "failed to get stream control";
- return;
- }
-
- hr = pControl->Stop();
- pControl->Release();
- if (FAILED(hr)) {
- qWarning() << "failed to stop";
- return;
- }
- active = false;
-
- if (opened) {
- closeStream();
- }
-}
-
-void DSCameraSession::suspendStream()
-{
- // Pauses the stream
- HRESULT hr;
-
- IMediaControl* pControl = 0;
- hr = pGraph->QueryInterface(IID_IMediaControl, (void**)&pControl);
- if (FAILED(hr)) {
- qWarning() << "failed to get stream control";
- return;
- }
-
- hr = pControl->Pause();
- pControl->Release();
- if (FAILED(hr)) {
- qWarning() << "failed to pause";
- return;
- }
-
- active = false;
-}
-
-void DSCameraSession::resumeStream()
-{
- // Resumes a paused stream
- startStream();
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/directshow/camera/dscamerasession.h b/src/plugins/directshow/camera/dscamerasession.h
deleted file mode 100644
index 3ac4622..0000000
--- a/src/plugins/directshow/camera/dscamerasession.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSCAMERASESSION_H
-#define DSCAMERASESSION_H
-
-#include <QtCore/qobject.h>
-#include <QTime>
-#include <QUrl>
-#include <QMutex>
-
-#include <qcamera.h>
-#include <QtMultimedia/qvideoframe.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include <tchar.h>
-#include <dshow.h>
-#include <objbase.h>
-#include <initguid.h>
-#pragma comment(lib, "strmiids.lib")
-#pragma comment(lib, "ole32.lib")
-#include <windows.h>
-
-#pragma include_alias("dxtrans.h","qedit.h")
-#define __IDxtCompositor_INTERFACE_DEFINED__
-#define __IDxtAlphaSetter_INTERFACE_DEFINED__
-#define __IDxtJpeg_INTERFACE_DEFINED__
-#define __IDxtKey_INTERFACE_DEFINED__
-#include <qedit.h>
-
-struct ICaptureGraphBuilder2;
-struct ISampleGrabber;
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class DSVideoRenderer;
-class SampleGrabberCallbackPrivate;
-
-
-struct video_buffer {
- unsigned char* buffer;
- int length;
- qint64 time;
-};
-
-typedef QMap<unsigned int, QList<QSize> > FormatResolutionMap;
-
-class DSCameraSession : public QObject
-{
- Q_OBJECT
-public:
- DSCameraSession(QObject *parent = 0);
- ~DSCameraSession();
-
- bool deviceReady();
- bool pictureInProgress();
-
- // camera controls
-
- int framerate() const;
- void setFrameRate(int rate);
- int brightness() const;
- void setBrightness(int b);
- int contrast() const;
- void setContrast(int c);
- int saturation() const;
- void setSaturation(int s);
- int hue() const;
- void setHue(int h);
- int sharpness() const;
- void setSharpness(int s);
- int zoom() const;
- void setZoom(int z);
- bool backlightCompensation() const;
- void setBacklightCompensation(bool);
- int whitelevel() const;
- void setWhitelevel(int w);
- int rotation() const;
- void setRotation(int r);
- bool flash() const;
- void setFlash(bool f);
- bool autofocus() const;
- void setAutofocus(bool f);
-
- QSize frameSize() const;
- void setFrameSize(const QSize& s);
- void setDevice(const QString &device);
- QList<QVideoFrame::PixelFormat> supportedPixelFormats();
- QVideoFrame::PixelFormat pixelFormat() const;
- void setPixelFormat(QVideoFrame::PixelFormat fmt);
- QList<QSize> supportedResolutions(QVideoFrame::PixelFormat format);
-
- // media control
-
- bool setOutputLocation(const QUrl &sink);
- QUrl outputLocation() const;
- qint64 position() const;
- int state() const;
- void record();
- void pause();
- void stop();
-
- void setSurface(QAbstractVideoSurface* surface);
-
- int captureImage(const QString &fileName);
-
- AM_MEDIA_TYPE StillMediaType;
- QList<video_buffer*> frames;
- SampleGrabberCallbackPrivate* StillCapCB;
-
- QMutex mutex;
-
-Q_SIGNALS:
- void stateChanged(QCamera::State);
- void imageCaptured(int id, const QImage &preview);
- void imageSaved(int id, const QString &fileName);
- void readyForCaptureChanged(bool);
-
-private Q_SLOTS:
- void captureFrame();
-
-private:
- QVideoSurfaceFormat actualFormat;
- QList<QVideoFrame::PixelFormat> types;
-
- QTime timeStamp;
- bool graph;
- bool active;
- bool opened;
- bool available;
- QCamera::State m_state;
- QByteArray m_device;
- QUrl m_sink;
- DSVideoRenderer* m_output;
- QAbstractVideoSurface* m_surface;
- QVideoFrame::PixelFormat pixelF;
- QSize m_windowSize;
- FormatResolutionMap resolutions;
-
- ICaptureGraphBuilder2* pBuild;
- IGraphBuilder* pGraph;
- IBaseFilter* pCap;
- IBaseFilter* pSG_Filter;
- ISampleGrabber *pSG;
-
-
- QString m_snapshot;
- int m_currentImageId;
-protected:
- HRESULT getPin(IBaseFilter *pFilter, PIN_DIRECTION PinDir, IPin **ppPin);
- bool createFilterGraph();
- void updateProperties();
- bool setProperties();
- bool openStream();
- void closeStream();
- bool startStream();
- void stopStream();
- void suspendStream();
- void resumeStream();
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-
-#endif
diff --git a/src/plugins/directshow/camera/dsimagecapturecontrol.cpp b/src/plugins/directshow/camera/dsimagecapturecontrol.cpp
deleted file mode 100644
index 7ee6ffd..0000000
--- a/src/plugins/directshow/camera/dsimagecapturecontrol.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/QDebug>
-
-#include "dsimagecapturecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-DSImageCaptureControl::DSImageCaptureControl(DSCameraSession *session)
- :QCameraImageCaptureControl(session), m_session(session), m_ready(false)
-{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateState()));
- connect(m_session, SIGNAL(imageCaptured(const int, QImage)),
- this, SIGNAL(imageCaptured(const int, QImage)));
- connect(m_session, SIGNAL(imageSaved(const int, const QString &)),
- this, SIGNAL(imageSaved(const int, const QString &)));
- connect(m_session, SIGNAL(readyForCaptureChanged(bool)),
- this, SIGNAL(readyForCaptureChanged(bool)));
-}
-
-DSImageCaptureControl::~DSImageCaptureControl()
-{
-}
-
-bool DSImageCaptureControl::isReadyForCapture() const
-{
- return m_ready;
-}
-
-int DSImageCaptureControl::capture(const QString &fileName)
-{
- return m_session->captureImage(fileName);
-}
-
-void DSImageCaptureControl::updateState()
-{
- bool ready = (m_session->state() == QCamera::ActiveState) &&
- !m_session->pictureInProgress();
- if(m_ready != ready)
- emit readyForCaptureChanged(m_ready = ready);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/directshow/camera/dsimagecapturecontrol.h b/src/plugins/directshow/camera/dsimagecapturecontrol.h
deleted file mode 100644
index baf649a..0000000
--- a/src/plugins/directshow/camera/dsimagecapturecontrol.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSIMAGECAPTURECONTROL_H
-#define DSIMAGECAPTURECONTROL_H
-
-#include <qcameraimagecapturecontrol.h>
-#include "dscamerasession.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class DSImageCaptureControl : public QCameraImageCaptureControl
-{
- Q_OBJECT
-public:
- DSImageCaptureControl(DSCameraSession *session);
- virtual ~DSImageCaptureControl();
-
- bool isReadyForCapture() const;
- int capture(const QString &fileName);
-
- virtual QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- virtual void setDriveMode(QCameraImageCapture::DriveMode mode) { }
-
- virtual void cancelCapture() {}
-
-private slots:
- void updateState();
-
-
-private:
- DSCameraSession *m_session;
- bool m_ready;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // DSCAPTURECONTROL_H
diff --git a/src/plugins/directshow/camera/dsvideodevicecontrol.cpp b/src/plugins/directshow/camera/dsvideodevicecontrol.cpp
deleted file mode 100644
index 11da5d3..0000000
--- a/src/plugins/directshow/camera/dsvideodevicecontrol.cpp
+++ /dev/null
@@ -1,168 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-#include <QFile>
-#include <QtWidgets/QIcon>
-
-#include "dsvideodevicecontrol.h"
-#include "dscamerasession.h"
-
-#include <tchar.h>
-#include <dshow.h>
-#include <objbase.h>
-#include <initguid.h>
-#include <Ocidl.h>
-#include <string.h>
-
-extern const CLSID CLSID_VideoInputDeviceCategory;
-
-QT_BEGIN_NAMESPACE
-
-DSVideoDeviceControl::DSVideoDeviceControl(QObject *parent)
- : QVideoDeviceControl(parent)
-{
- m_session = qobject_cast<DSCameraSession*>(parent);
-
- devices.clear();
- descriptions.clear();
-
- CoInitialize(NULL);
- ICreateDevEnum* pDevEnum = NULL;
- IEnumMoniker* pEnum = NULL;
- // Create the System device enumerator
- HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
- CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
- reinterpret_cast<void**>(&pDevEnum));
- if(SUCCEEDED(hr)) {
- // Create the enumerator for the video capture category
- hr = pDevEnum->CreateClassEnumerator(
- CLSID_VideoInputDeviceCategory, &pEnum, 0);
- if (S_OK == hr) {
- pEnum->Reset();
- // go through and find all video capture devices
- IMoniker* pMoniker = NULL;
- while(pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag;
- hr = pMoniker->BindToStorage(0, 0, IID_IPropertyBag,
- (void**)(&pPropBag));
- if(FAILED(hr)) {
- pMoniker->Release();
- continue; // skip this one
- }
- // Find the description
- WCHAR str[120];
- VARIANT varName;
- varName.vt = VT_BSTR;
- hr = pPropBag->Read(L"FriendlyName", &varName, 0);
- if(SUCCEEDED(hr)) {
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString temp(QString::fromUtf16((unsigned short*)str));
- devices.append(QString("ds:%1").arg(temp).toLocal8Bit().constData());
- hr = pPropBag->Read(L"Description", &varName, 0);
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString temp2(QString::fromUtf16((unsigned short*)str));
- descriptions.append(temp2.toLocal8Bit().constData());
- }
- pPropBag->Release();
- pMoniker->Release();
- }
- pEnum->Release();
- }
- pDevEnum->Release();
- }
- CoUninitialize();
-
- selected = 0;
-}
-
-int DSVideoDeviceControl::deviceCount() const
-{
- return devices.count();
-}
-
-QString DSVideoDeviceControl::deviceName(int index) const
-{
- if(index >= 0 && index <= devices.count())
- return devices.at(index);
-
- return QString();
-}
-
-QString DSVideoDeviceControl::deviceDescription(int index) const
-{
- if(index >= 0 && index <= descriptions.count())
- return descriptions.at(index);
-
- return QString();
-}
-
-QIcon DSVideoDeviceControl::deviceIcon(int index) const
-{
- Q_UNUSED(index)
-
- return QIcon();
-}
-
-int DSVideoDeviceControl::defaultDevice() const
-{
- return 0;
-}
-
-int DSVideoDeviceControl::selectedDevice() const
-{
- return selected;
-}
-
-void DSVideoDeviceControl::setSelectedDevice(int index)
-{
- if(index >= 0 && index <= devices.count()) {
- if (m_session) {
- QString device = devices.at(index);
- if (device.startsWith("ds:"))
- device.remove(0,3);
- m_session->setDevice(device);
- }
- selected = index;
- }
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/directshow/camera/dsvideodevicecontrol.h b/src/plugins/directshow/camera/dsvideodevicecontrol.h
deleted file mode 100644
index 0711479..0000000
--- a/src/plugins/directshow/camera/dsvideodevicecontrol.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSVIDEODEVICECONTROL_H
-#define DSVIDEODEVICECONTROL_H
-
-#include <qvideodevicecontrol.h>
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-class DSCameraSession;
-
-//QTM_USE_NAMESPACE
-
-class DSVideoDeviceControl : public QVideoDeviceControl
-{
- Q_OBJECT
-public:
- DSVideoDeviceControl(QObject *parent = 0);
-
- int deviceCount() const;
- QString deviceName(int index) const;
- QString deviceDescription(int index) const;
- QIcon deviceIcon(int index) const;
- int defaultDevice() const;
- int selectedDevice() const;
-
-public Q_SLOTS:
- void setSelectedDevice(int index);
-
-private:
- DSCameraSession* m_session;
-
- QList<QString> devices;
- QList<QString> descriptions;
-
- int selected;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif
diff --git a/src/plugins/directshow/camera/dsvideorenderer.cpp b/src/plugins/directshow/camera/dsvideorenderer.cpp
deleted file mode 100644
index f0a80e2..0000000
--- a/src/plugins/directshow/camera/dsvideorenderer.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-
-#include "dsvideorenderer.h"
-
-QT_BEGIN_NAMESPACE
-
-DSVideoRendererControl::DSVideoRendererControl(DSCameraSession* session, QObject *parent)
- :QVideoRendererControl(parent),
- m_surface(0),
- m_session(session)
-{
-}
-
-DSVideoRendererControl::~DSVideoRendererControl()
-{
-}
-
-QAbstractVideoSurface* DSVideoRendererControl::surface() const
-{
- return m_surface;
-}
-
-void DSVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-{
- m_surface = surface;
- if(m_session)
- m_session->setSurface(m_surface);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/plugins/directshow/camera/dsvideorenderer.h b/src/plugins/directshow/camera/dsvideorenderer.h
deleted file mode 100644
index f8e7642..0000000
--- a/src/plugins/directshow/camera/dsvideorenderer.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSVIDEORENDERER_H
-#define DSVIDEORENDERER_H
-
-#include <qvideorenderercontrol.h>
-#include "dscamerasession.h"
-
-class CameraFormatConverter;
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
-class DSVideoRendererControl : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- DSVideoRendererControl(DSCameraSession* session, QObject *parent = 0);
- ~DSVideoRendererControl();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void setSession(DSCameraSession* session);
-
-private:
- QAbstractVideoSurface* m_surface;
- DSCameraSession* m_session;
- CameraFormatConverter* converter;
-};
-
-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
deleted file mode 100644
index 676b2d5..0000000
--- a/src/plugins/directshow/camera/dsvideowidgetcontrol.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qtimer.h>
-
-#include "DSVideoWidgetControl.h"
-#include "dscamerasession.h"
-
-QT_BEGIN_NAMESPACE
-
-DSVideoWidgetSurface::DSVideoWidgetSurface(QLabel *pWidget, QObject *parent)
-{
- widget = pWidget;
- myPixmap = 0;
-}
-
-QList<QVideoFrame::PixelFormat> DSVideoWidgetSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- if (handleType == QAbstractVideoBuffer::NoHandle) {
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_RGB32
- << QVideoFrame::Format_RGB24;
- } else {
- return QList<QVideoFrame::PixelFormat>();
- }
-}
-
-
-bool DSVideoWidgetSurface::present(const QVideoFrame &frame)
-{
- QVideoFrame myFrame = frame;
- myFrame.map(QAbstractVideoBuffer::ReadOnly);
- QImage image(
- frame.bits(),
- frame.width(),
- frame.height(),
- frame.bytesPerLine(),
- imageFormat);
- if (image.isNull())
- {
- // Try to adapt
- QImage image2(
- frame.bits(),
- frame.width(),
- frame.height(),
- frame.bytesPerLine(),
- QImage::Format_RGB888);
- image = image2;
- }
- myFrame.unmap();
- delete myPixmap;
- myPixmap = new QPixmap(QPixmap::fromImage(image).scaled(widget->size()));
- widget->setPixmap(*myPixmap);
- widget->repaint();
- return true;
-}
-
-void DSVideoWidgetSurface::setImageFormat(QImage::Format fmt)
-{
- imageFormat = fmt;
-}
-
-void DSVideoWidgetSurface::updateVideoRect()
-{
-}
-
-void DSVideoWidgetSurface::paint(QPainter *painter)
-{
-}
-
-
-DSVideoWidgetControl::DSVideoWidgetControl(DSCameraSession* session, QObject *parent) :
- m_session(session), QVideoWidgetControl(parent),
- m_widget(new QLabel()),
- m_fullScreen(false)
-{
- m_widget->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
- m_widget->setAlignment(Qt::AlignCenter);
- m_widget->setAttribute(Qt::WA_NoSystemBackground, true);
-
- surface = new DSVideoWidgetSurface(m_widget);
-
- QPalette palette;
- palette.setColor(QPalette::Background, Qt::black);
- m_widget->setPalette(palette);
- m_widget->setAutoFillBackground( true );
-
- // Request QEvents
- m_widget->installEventFilter(this);
- m_windowId = m_widget->effectiveWinId();
-
- surface->setImageFormat(QImage::Format_RGB888);
- session->setSurface(surface);
-}
-
-DSVideoWidgetControl::~DSVideoWidgetControl()
-{
- delete m_widget;
-}
-
-bool DSVideoWidgetControl::eventFilter(QObject *object, QEvent *e)
-{
- if (object == m_widget) {
- switch (e->type()) {
- case QEvent::ParentChange:
- case QEvent::WinIdChange:
- case QEvent::Show:
- m_windowId = m_widget->effectiveWinId();
- emit widgetUpdated();
- break;
- case QEvent::Resize:
- emit widgetResized(m_widget->size());
- break;
- case QEvent::PolishRequest:
- m_widget->ensurePolished();
- break;
-
- default:
- // Do nothing
- break;
- }
- }
- return false;
-}
-
-QWidget *DSVideoWidgetControl::videoWidget()
-{
- return m_widget;
-}
-
-Qt::AspectRatioMode DSVideoWidgetControl::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void DSVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode ratio)
-{
- if (m_aspectRatioMode==ratio) {
- return;
- }
- m_aspectRatioMode = ratio;
-
- if (m_aspectRatioMode == Qt::KeepAspectRatio)
- m_widget->setScaledContents(false);
- else {
- m_widget->setScaledContents(true);
- }
-}
-
-bool DSVideoWidgetControl::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void DSVideoWidgetControl::setFullScreen(bool fullScreen)
-{
- if (m_widget && !fullScreen && m_fullScreen) {
- m_widget->showNormal();
- m_fullScreen = false;
- } else if (m_widget && fullScreen) {
- m_widget->showFullScreen();
- m_fullScreen = true;
- }
-
- emit fullScreenChanged(fullScreen);
-}
-
-int DSVideoWidgetControl::brightness() const
-{
- return 0;
-}
-
-void DSVideoWidgetControl::setBrightness(int brightness)
-{
- Q_UNUSED(brightness);
-}
-
-int DSVideoWidgetControl::contrast() const
-{
- return 0;
-}
-
-void DSVideoWidgetControl::setContrast(int contrast)
-{
- Q_UNUSED(contrast);
-}
-
-int DSVideoWidgetControl::hue() const
-{
- return 0;
-}
-
-void DSVideoWidgetControl::setHue(int hue)
-{
- Q_UNUSED(hue);
-}
-
-int DSVideoWidgetControl::saturation() const
-{
- return 0;
-}
-
-void DSVideoWidgetControl::setSaturation(int saturation)
-{
- Q_UNUSED(saturation);
-}
-
-QT_END_NAMESPACE
-
-// End of file
diff --git a/src/plugins/directshow/camera/dsvideowidgetcontrol.h b/src/plugins/directshow/camera/dsvideowidgetcontrol.h
deleted file mode 100644
index 62eb502..0000000
--- a/src/plugins/directshow/camera/dsvideowidgetcontrol.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSVIDEOWIDGETCONTROL_H
-#define DSVIDEOWIDGETCONTROL_H
-
-#include <QtCore/qobject.h>
-#include <QtWidgets>
-#include <QtMultimedia/qvideoframe.h>
-#include <QtMultimedia/qabstractvideosurface.h>
-#include <QtMultimedia/qvideosurfaceformat.h>
-
-#include <qvideowidgetcontrol.h>
-#include "DsCameraControl.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-class DSVideoWidgetSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
- public:
- DSVideoWidgetSurface(QLabel *pWidget, QObject *parent = 0);
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- bool present(const QVideoFrame &frame);
-
- QRect videoRect() const { return targetRect; }
- void updateVideoRect();
-
- void paint(QPainter *painter);
- void setImageFormat(QImage::Format fmt);
-
- private:
- QLabel *widget;
- QImage::Format imageFormat;
- QRect targetRect;
- QSize imageSize;
- QRect sourceRect;
- QPixmap* myPixmap;
- };
-
-class DSVideoWidgetControl : public QVideoWidgetControl
-{
- Q_OBJECT
-
- DSVideoWidgetSurface* surface;
-public: // Constructor & Destructor
-
- DSVideoWidgetControl(DSCameraSession* session, QObject *parent = 0);
- virtual ~DSVideoWidgetControl();
-
-public: // QVideoWidgetControl
-
- QWidget *videoWidget();
-
- // Aspect Ratio
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode ratio);
-
- // Full Screen
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- // Brightness
- int brightness() const;
- void setBrightness(int brightness);
-
- // Contrast
- int contrast() const;
- void setContrast(int contrast);
-
- // Hue
- int hue() const;
- void setHue(int hue);
-
- // Saturation
- int saturation() const;
- void setSaturation(int saturation);
-
-public: // Internal
-
- bool eventFilter(QObject *object, QEvent *event);
-
-/*
-Q_SIGNALS: // QVideoWidgetControl
-
- void fullScreenChanged(bool fullScreen);
- void brightnessChanged(int brightness);
- void contrastChanged(int contrast);
- void hueChanged(int hue);
- void saturationChanged(int saturation);
-*/
-
-Q_SIGNALS: // Internal Signals
-
- void widgetResized(QSize size);
- void widgetUpdated();
-
-private: // Data
-
- DSCameraSession* m_session;
- QLabel *m_widget;
- WId m_windowId;
- Qt::AspectRatioMode m_aspectRatioMode;
- bool m_fullScreen;
-};
-
-QT_END_NAMESPACE
-
-QT_END_HEADER
-
-#endif // DSVideoWidgetControl_H
diff --git a/src/plugins/directshow/directshow.pro b/src/plugins/directshow/directshow.pro
deleted file mode 100644
index 80d588f..0000000
--- a/src/plugins/directshow/directshow.pro
+++ /dev/null
@@ -1,23 +0,0 @@
-TEMPLATE = lib
-
-CONFIG += plugin
-TARGET = $$qtLibraryTarget(dsengine)
-
-PLUGIN_TYPE=mediaservice
-
-include (../../../common.pri)
-
-QT += multimedia
-
-DEPENDPATH += .
-
-HEADERS += dsserviceplugin.h
-SOURCES += dsserviceplugin.cpp
-
-!contains(config_test_wmsdk, yes): DEFINES += QT_NO_WMSDK
-
-contains(config_test_wmf, no): include (player/player.pri)
-include (camera/camera.pri)
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/directshow/dsserviceplugin.cpp b/src/plugins/directshow/dsserviceplugin.cpp
deleted file mode 100644
index adfb025..0000000
--- a/src/plugins/directshow/dsserviceplugin.cpp
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/QFile>
-
-#include "dsserviceplugin.h"
-
-
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
-#include <dshow.h>
-#include "dscameraservice.h"
-#endif
-
-#ifdef QMEDIA_DIRECTSHOW_PLAYER
-#include "directshowplayerservice.h"
-#endif
-
-#include <qmediaserviceprovider.h>
-
-
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
-
-extern const CLSID CLSID_VideoInputDeviceCategory;
-
-
-#ifndef _STRSAFE_H_INCLUDED_
-#include <tchar.h>
-#endif
-#include <dshow.h>
-#include <objbase.h>
-#include <initguid.h>
-#pragma comment(lib, "strmiids.lib")
-#pragma comment(lib, "ole32.lib")
-#include <windows.h>
-#include <ocidl.h>
-#endif
-
-QT_USE_NAMESPACE
-
-QStringList DSServicePlugin::keys() const
-{
- return QStringList()
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
- << QLatin1String(Q_MEDIASERVICE_CAMERA)
-#endif
-#ifdef QMEDIA_DIRECTSHOW_PLAYER
- << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
-#endif
- ;
-}
-
-QMediaService* DSServicePlugin::create(QString const& key)
-{
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
- return new DSCameraService;
-#endif
-#ifdef QMEDIA_DIRECTSHOW_PLAYER
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new DirectShowPlayerService;
-#endif
-
- qDebug() << "unsupported key:" << key;
- return 0;
-}
-
-void DSServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features DSServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_MEDIAPLAYER)
- return QMediaServiceProviderHint::StreamPlayback | QMediaServiceProviderHint::VideoSurface;
- else
- return QMediaServiceProviderHint::Features();
-}
-
-QList<QByteArray> DSServicePlugin::devices(const QByteArray &service) const
-{
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
- if (service == Q_MEDIASERVICE_CAMERA) {
- if (m_cameraDevices.isEmpty())
- updateDevices();
-
- return m_cameraDevices;
- }
-#endif
-
- return QList<QByteArray>();
-}
-
-QString DSServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
-{
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
- if (service == Q_MEDIASERVICE_CAMERA) {
- if (m_cameraDevices.isEmpty())
- updateDevices();
-
- for (int i=0; i<m_cameraDevices.count(); i++)
- if (m_cameraDevices[i] == device)
- return m_cameraDescriptions[i];
- }
-#endif
- return QString();
-}
-
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
-
-void DSServicePlugin::updateDevices() const
-{
- m_cameraDevices.clear();
- m_cameraDescriptions.clear();
- BOOL bFound = TRUE;
- CoInitialize(NULL);
- ICreateDevEnum* pDevEnum = NULL;
- IEnumMoniker* pEnum = NULL;
- // Create the System device enumerator
- HRESULT hr = CoCreateInstance(CLSID_SystemDeviceEnum, NULL,
- CLSCTX_INPROC_SERVER, IID_ICreateDevEnum,
- reinterpret_cast<void**>(&pDevEnum));
- if(SUCCEEDED(hr)) {
- // Create the enumerator for the video capture category
- hr = pDevEnum->CreateClassEnumerator(
- CLSID_VideoInputDeviceCategory, &pEnum, 0);
- if (S_OK == hr) {
- pEnum->Reset();
- // go through and find all video capture devices
- IMoniker* pMoniker = NULL;
- while(pEnum->Next(1, &pMoniker, NULL) == S_OK) {
- IPropertyBag *pPropBag;
- hr = pMoniker->BindToStorage(0,0,IID_IPropertyBag,
- (void**)(&pPropBag));
- if(FAILED(hr)) {
- pMoniker->Release();
- continue; // skip this one
- }
- bFound = TRUE;
- // Find the description
- WCHAR str[120];
- VARIANT varName;
- varName.vt = VT_BSTR;
- hr = pPropBag->Read(L"FriendlyName", &varName, 0);
- if(SUCCEEDED(hr)) {
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString temp(QString::fromUtf16((unsigned short*)str));
- m_cameraDevices.append(QString("ds:%1").arg(temp).toLocal8Bit().constData());
- hr = pPropBag->Read(L"Description", &varName, 0);
- wcsncpy(str, varName.bstrVal, sizeof(str)/sizeof(str[0]));
- QString temp2(QString::fromUtf16((unsigned short*)str));
- m_cameraDescriptions.append(temp2);
- } else {
- qWarning() << "No friendly name";
- }
- pPropBag->Release();
- pMoniker->Release();
- }
- pEnum->Release();
- }
- pDevEnum->Release();
- }
- CoUninitialize();
- if (!bFound) {
- qWarning() << "No camera devices found";
- }
-}
-#endif
-
-Q_EXPORT_PLUGIN2(qtmedia_dsengine, DSServicePlugin);
-
diff --git a/src/plugins/directshow/dsserviceplugin.h b/src/plugins/directshow/dsserviceplugin.h
deleted file mode 100644
index 6baa5d0..0000000
--- a/src/plugins/directshow/dsserviceplugin.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DSSERVICEPLUGIN_H
-#define DSSERVICEPLUGIN_H
-
-#include "qmediaserviceproviderplugin.h"
-
-QT_USE_NAMESPACE
-
-class DSServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedDevicesInterface
- , public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
-
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
-
-private:
-#ifdef QMEDIA_DIRECTSHOW_CAMERA
- void updateDevices() const;
-
- mutable QList<QByteArray> m_cameraDevices;
- mutable QStringList m_cameraDescriptions;
-#endif
-};
-
-#endif // DSSERVICEPLUGIN_H
diff --git a/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp b/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp
deleted file mode 100644
index 92272ff..0000000
--- a/src/plugins/directshow/player/directshowaudioendpointcontrol.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowaudioendpointcontrol.h"
-
-#include "directshowglobal.h"
-#include "directshowplayerservice.h"
-
-DirectShowAudioEndpointControl::DirectShowAudioEndpointControl(
- DirectShowPlayerService *service, QObject *parent)
- : QAudioEndpointSelector(parent)
- , m_service(service)
- , m_bindContext(0)
- , m_deviceEnumerator(0)
-{
- if (CreateBindCtx(0, &m_bindContext) == S_OK) {
- m_deviceEnumerator = com_new<ICreateDevEnum>(CLSID_SystemDeviceEnum, IID_ICreateDevEnum);
-
- updateEndpoints();
-
- setActiveEndpoint(m_defaultEndpoint);
- }
-}
-
-DirectShowAudioEndpointControl::~DirectShowAudioEndpointControl()
-{
- foreach (IMoniker *moniker, m_devices)
- moniker->Release();
-
- if (m_bindContext)
- m_bindContext->Release();
-
- if (m_deviceEnumerator)
- m_deviceEnumerator->Release();
-}
-
-QList<QString> DirectShowAudioEndpointControl::availableEndpoints() const
-{
- return m_devices.keys();
-}
-
-QString DirectShowAudioEndpointControl::endpointDescription(const QString &name) const
-{
-#ifdef __IPropertyBag_INTERFACE_DEFINED__
- QString description;
-
- if (IMoniker *moniker = m_devices.value(name, 0)) {
- IPropertyBag *propertyBag = 0;
- if (SUCCEEDED(moniker->BindToStorage(
- 0, 0, IID_IPropertyBag, reinterpret_cast<void **>(&propertyBag)))) {
- VARIANT name;
- VariantInit(&name);
- if (SUCCEEDED(propertyBag->Read(L"FriendlyName", &name, 0)))
- description = QString::fromWCharArray(name.bstrVal);
- VariantClear(&name);
- propertyBag->Release();
- }
- }
-
- return description;
-#else
- return name.section(QLatin1Char('\\'), -1);
-#endif
-}
-
-QString DirectShowAudioEndpointControl::defaultEndpoint() const
-{
- return m_defaultEndpoint;
-}
-
-QString DirectShowAudioEndpointControl::activeEndpoint() const
-{
- return m_activeEndpoint;
-}
-
-void DirectShowAudioEndpointControl::setActiveEndpoint(const QString &name)
-{
- if (m_activeEndpoint == name)
- return;
-
- if (IMoniker *moniker = m_devices.value(name, 0)) {
- IBaseFilter *filter = 0;
-
- if (moniker->BindToObject(
- m_bindContext,
- 0,
- IID_IBaseFilter,
- reinterpret_cast<void **>(&filter)) == S_OK) {
- m_service->setAudioOutput(filter);
-
- filter->Release();
- }
- }
-}
-
-void DirectShowAudioEndpointControl::updateEndpoints()
-{
- IMalloc *oleMalloc = 0;
- if (m_deviceEnumerator && CoGetMalloc(1, &oleMalloc) == S_OK) {
- IEnumMoniker *monikers = 0;
-
- if (m_deviceEnumerator->CreateClassEnumerator(
- CLSID_AudioRendererCategory, &monikers, 0) == S_OK) {
- for (IMoniker *moniker = 0; monikers->Next(1, &moniker, 0) == S_OK; moniker->Release()) {
- OLECHAR *string = 0;
- if (moniker->GetDisplayName(m_bindContext, 0, &string) == S_OK) {
- QString deviceId = QString::fromWCharArray(string);
- oleMalloc->Free(string);
-
- moniker->AddRef();
- m_devices.insert(deviceId, moniker);
-
- if (m_defaultEndpoint.isEmpty()
- || deviceId.endsWith(QLatin1String("Default DirectSound Device"))) {
- m_defaultEndpoint = deviceId;
- }
- }
- }
- monikers->Release();
- }
- oleMalloc->Release();
- }
-}
diff --git a/src/plugins/directshow/player/directshowaudioendpointcontrol.h b/src/plugins/directshow/player/directshowaudioendpointcontrol.h
deleted file mode 100644
index f98f488..0000000
--- a/src/plugins/directshow/player/directshowaudioendpointcontrol.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWAUDIOENDPOINTCONTROL_H
-#define DIRECTSHOWAUDIOENDPOINTCONTROL_H
-
-#include "qaudioendpointselector.h"
-
-#include <dshow.h>
-
-class DirectShowPlayerService;
-
-QT_USE_NAMESPACE
-
-class DirectShowAudioEndpointControl : public QAudioEndpointSelector
-{
- Q_OBJECT
-public:
- DirectShowAudioEndpointControl(DirectShowPlayerService *service, QObject *parent = 0);
- ~DirectShowAudioEndpointControl();
-
- QList<QString> availableEndpoints() const;
-
- QString endpointDescription(const QString &name) const;
-
- QString defaultEndpoint() const;
- QString activeEndpoint() const;
-
- void setActiveEndpoint(const QString& name);
-
-private:
- void updateEndpoints();
-
- DirectShowPlayerService *m_service;
- IBindCtx *m_bindContext;
- ICreateDevEnum *m_deviceEnumerator;
-
- QMap<QString, IMoniker *> m_devices;
- QString m_defaultEndpoint;
- QString m_activeEndpoint;
-};
-
-#endif
-
diff --git a/src/plugins/directshow/player/directshoweventloop.cpp b/src/plugins/directshow/player/directshoweventloop.cpp
deleted file mode 100644
index 69efb9f..0000000
--- a/src/plugins/directshow/player/directshoweventloop.cpp
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <directshoweventloop.h>
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qcoreevent.h>
-
-class DirectShowPostedEvent
-{
-public:
- DirectShowPostedEvent(QObject *receiver, QEvent *event)
- : receiver(receiver)
- , event(event)
- , next(0)
- {
- }
-
- ~DirectShowPostedEvent()
- {
- delete event;
- }
-
- QObject *receiver;
- QEvent *event;
- DirectShowPostedEvent *next;
-};
-
-DirectShowEventLoop::DirectShowEventLoop(QObject *parent)
- : QObject(parent)
- , m_postsHead(0)
- , m_postsTail(0)
- , m_eventHandle(::CreateEvent(0, 0, 0, 0))
- , m_waitHandle(::CreateEvent(0, 0, 0, 0))
-{
-}
-
-DirectShowEventLoop::~DirectShowEventLoop()
-{
- ::CloseHandle(m_eventHandle);
- ::CloseHandle(m_waitHandle);
-
- for (DirectShowPostedEvent *post = m_postsHead; post; post = m_postsHead) {
- m_postsHead = m_postsHead->next;
-
- delete post;
- }
-}
-
-void DirectShowEventLoop::wait(QMutex *mutex)
-{
- ::ResetEvent(m_waitHandle);
-
- mutex->unlock();
-
- HANDLE handles[] = { m_eventHandle, m_waitHandle };
- while (::WaitForMultipleObjects(2, handles, false, INFINITE) == WAIT_OBJECT_0)
- processEvents();
-
- mutex->lock();
-}
-
-void DirectShowEventLoop::wake()
-{
- ::SetEvent(m_waitHandle);
-}
-
-void DirectShowEventLoop::postEvent(QObject *receiver, QEvent *event)
-{
- QMutexLocker locker(&m_mutex);
-
- DirectShowPostedEvent *post = new DirectShowPostedEvent(receiver, event);
-
- if (m_postsTail)
- m_postsTail->next = post;
- else
- m_postsHead = post;
-
- m_postsTail = post;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- ::SetEvent(m_eventHandle);
-}
-
-void DirectShowEventLoop::customEvent(QEvent *event)
-{
- if (event->type() == QEvent::User) {
- processEvents();
- } else {
- QObject::customEvent(event);
- }
-}
-
-void DirectShowEventLoop::processEvents()
-{
- QMutexLocker locker(&m_mutex);
-
- ::ResetEvent(m_eventHandle);
-
- while(m_postsHead) {
- DirectShowPostedEvent *post = m_postsHead;
- m_postsHead = m_postsHead->next;
-
- if (!m_postsHead)
- m_postsTail = 0;
-
- locker.unlock();
- QCoreApplication::sendEvent(post->receiver, post->event);
- delete post;
- locker.relock();
- }
-}
diff --git a/src/plugins/directshow/player/directshoweventloop.h b/src/plugins/directshow/player/directshoweventloop.h
deleted file mode 100644
index cea4c5f..0000000
--- a/src/plugins/directshow/player/directshoweventloop.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWEVENTLOOP_H
-#define DIRECTSHOWEVENTLOOP_H
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qwaitcondition.h>
-
-#include <windows.h>
-
-class DirectShowPostedEvent;
-
-class DirectShowEventLoop : public QObject
-{
- Q_OBJECT
-public:
- DirectShowEventLoop(QObject *parent = 0);
- ~DirectShowEventLoop();
-
- void wait(QMutex *mutex);
- void wake();
-
- void postEvent(QObject *object, QEvent *event);
-
-protected:
- void customEvent(QEvent *event);
-
-private:
- void processEvents();
-
- DirectShowPostedEvent *m_postsHead;
- DirectShowPostedEvent *m_postsTail;
- HANDLE m_eventHandle;
- HANDLE m_waitHandle;
- QMutex m_mutex;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowglobal.h b/src/plugins/directshow/player/directshowglobal.h
deleted file mode 100644
index f209805..0000000
--- a/src/plugins/directshow/player/directshowglobal.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWGLOBAL_H
-#define DIRECTSHOWGLOBAL_H
-
-#include <QtCore/qglobal.h>
-
-#include <dshow.h>
-
-template <typename T> T *com_cast(IUnknown *unknown, const IID &iid)
-{
- T *iface = 0;
- return unknown && unknown->QueryInterface(iid, reinterpret_cast<void **>(&iface)) == S_OK
- ? iface
- : 0;
-}
-
-template <typename T> T *com_new(const IID &clsid, const IID &iid)
-{
- T *object = 0;
- return CoCreateInstance(
- clsid,
- NULL,
- CLSCTX_INPROC_SERVER,
- iid,
- reinterpret_cast<void **>(&object)) == S_OK
- ? object
- : 0;
-}
-
-#ifndef __IFilterGraph2_INTERFACE_DEFINED__
-#define __IFilterGraph2_INTERFACE_DEFINED__
-#define INTERFACE IFilterGraph2
-DECLARE_INTERFACE_(IFilterGraph2 ,IGraphBuilder)
-{
- STDMETHOD(AddSourceFilterForMoniker)(THIS_ IMoniker *, IBindCtx *, LPCWSTR,IBaseFilter **) PURE;
- STDMETHOD(ReconnectEx)(THIS_ IPin *, const AM_MEDIA_TYPE *) PURE;
- STDMETHOD(RenderEx)(IPin *, DWORD, DWORD *) PURE;
-};
-#undef INTERFACE
-#endif
-
-#ifndef __IAMFilterMiscFlags_INTERFACE_DEFINED__
-#define __IAMFilterMiscFlags_INTERFACE_DEFINED__
-#define INTERFACE IAMFilterMiscFlags
-DECLARE_INTERFACE_(IAMFilterMiscFlags ,IUnknown)
-{
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD_(ULONG,GetMiscFlags)(THIS) PURE;
-};
-#undef INTERFACE
-#endif
-
-#ifndef __IFileSourceFilter_INTERFACE_DEFINED__
-#define __IFileSourceFilter_INTERFACE_DEFINED__
-#define INTERFACE IFileSourceFilter
-DECLARE_INTERFACE_(IFileSourceFilter ,IUnknown)
-{
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD(Load)(THIS_ LPCOLESTR, const AM_MEDIA_TYPE *) PURE;
- STDMETHOD(GetCurFile)(THIS_ LPOLESTR *ppszFileName, AM_MEDIA_TYPE *) PURE;
-};
-#undef INTERFACE
-#endif
-
-#ifndef __IAMOpenProgress_INTERFACE_DEFINED__
-#define __IAMOpenProgress_INTERFACE_DEFINED__
-#define INTERFACE IAMOpenProgress
-DECLARE_INTERFACE_(IAMOpenProgress ,IUnknown)
-{
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD(QueryProgress)(THIS_ LONGLONG *, LONGLONG *) PURE;
- STDMETHOD(AbortOperation)(THIS) PURE;
-};
-#undef INTERFACE
-#endif
-
-#ifndef __IFilterChain_INTERFACE_DEFINED__
-#define __IFilterChain_INTERFACE_DEFINED__
-#define INTERFACE IFilterChain
-DECLARE_INTERFACE_(IFilterChain ,IUnknown)
-{
- STDMETHOD(QueryInterface)(THIS_ REFIID,PVOID*) PURE;
- STDMETHOD_(ULONG,AddRef)(THIS) PURE;
- STDMETHOD_(ULONG,Release)(THIS) PURE;
- STDMETHOD(StartChain)(IBaseFilter *, IBaseFilter *) PURE;
- STDMETHOD(PauseChain)(IBaseFilter *, IBaseFilter *) PURE;
- STDMETHOD(StopChain)(IBaseFilter *, IBaseFilter *) PURE;
- STDMETHOD(RemoveChain)(IBaseFilter *, IBaseFilter *) PURE;
-};
-#undef INTERFACE
-#endif
-
-#endif
diff --git a/src/plugins/directshow/player/directshowioreader.cpp b/src/plugins/directshow/player/directshowioreader.cpp
deleted file mode 100644
index 71208f7..0000000
--- a/src/plugins/directshow/player/directshowioreader.cpp
+++ /dev/null
@@ -1,496 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowioreader.h"
-
-#include "directshoweventloop.h"
-#include "directshowglobal.h"
-#include "directshowiosource.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qthread.h>
-
-class DirectShowSampleRequest
-{
-public:
- DirectShowSampleRequest(
- IMediaSample *sample, DWORD_PTR userData, LONGLONG position, LONG length, BYTE *buffer)
- : next(0)
- , sample(sample)
- , userData(userData)
- , position(position)
- , length(length)
- , buffer(buffer)
- , result(S_FALSE)
- {
- }
-
- DirectShowSampleRequest *remove() { DirectShowSampleRequest *n = next; delete this; return n; }
-
- DirectShowSampleRequest *next;
- IMediaSample *sample;
- DWORD_PTR userData;
- LONGLONG position;
- LONG length;
- BYTE *buffer;
- HRESULT result;
-};
-
-DirectShowIOReader::DirectShowIOReader(
- QIODevice *device, DirectShowIOSource *source, DirectShowEventLoop *loop)
- : m_source(source)
- , m_device(device)
- , m_loop(loop)
- , m_pendingHead(0)
- , m_pendingTail(0)
- , m_readyHead(0)
- , m_readyTail(0)
- , m_synchronousPosition(0)
- , m_synchronousLength(0)
- , m_synchronousBytesRead(0)
- , m_synchronousBuffer(0)
- , m_synchronousResult(S_OK)
- , m_totalLength(0)
- , m_availableLength(0)
- , m_flushing(false)
-{
- moveToThread(device->thread());
-
- connect(device, SIGNAL(readyRead()), this, SLOT(readyRead()));
-}
-
-DirectShowIOReader::~DirectShowIOReader()
-{
- flushRequests();
-}
-
-HRESULT DirectShowIOReader::QueryInterface(REFIID riid, void **ppvObject)
-{
- return m_source->QueryInterface(riid, ppvObject);
-}
-
-ULONG DirectShowIOReader::AddRef()
-{
- return m_source->AddRef();
-}
-
-ULONG DirectShowIOReader::Release()
-{
- return m_source->Release();
-}
-
-// IAsyncReader
-HRESULT DirectShowIOReader::RequestAllocator(
- IMemAllocator *pPreferred, ALLOCATOR_PROPERTIES *pProps, IMemAllocator **ppActual)
-{
- if (!ppActual || !pProps) {
- return E_POINTER;
- } else {
- ALLOCATOR_PROPERTIES actualProperties;
-
- if (pProps->cbAlign == 0)
- pProps->cbAlign = 1;
-
- if (pPreferred && pPreferred->SetProperties(pProps, &actualProperties) == S_OK) {
- pPreferred->AddRef();
-
- *ppActual = pPreferred;
-
- m_source->setAllocator(*ppActual);
-
- return S_OK;
- } else {
- *ppActual = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator);
-
- if (*ppActual) {
- if ((*ppActual)->SetProperties(pProps, &actualProperties) != S_OK) {
- (*ppActual)->Release();
- } else {
- m_source->setAllocator(*ppActual);
-
- return S_OK;
- }
- }
- }
- ppActual = 0;
-
- return E_FAIL;
- }
-}
-
-HRESULT DirectShowIOReader::Request(IMediaSample *pSample, DWORD_PTR dwUser)
-{
- QMutexLocker locker(&m_mutex);
-
- if (!pSample) {
- return E_POINTER;
- } else if (m_flushing) {
- return VFW_E_WRONG_STATE;
- } else {
- REFERENCE_TIME startTime = 0;
- REFERENCE_TIME endTime = 0;
- BYTE *buffer;
-
- if (pSample->GetTime(&startTime, &endTime) != S_OK
- || pSample->GetPointer(&buffer) != S_OK) {
- return VFW_E_SAMPLE_TIME_NOT_SET;
- } else {
- LONGLONG position = startTime / 10000000;
- LONG length = (endTime - startTime) / 10000000;
-
- DirectShowSampleRequest *request = new DirectShowSampleRequest(
- pSample, dwUser, position, length, buffer);
-
- if (m_pendingTail) {
- m_pendingTail->next = request;
- } else {
- m_pendingHead = request;
-
- m_loop->postEvent(this, new QEvent(QEvent::User));
- }
- m_pendingTail = request;
-
- return S_OK;
- }
- }
-}
-
-HRESULT DirectShowIOReader::WaitForNext(
- DWORD dwTimeout, IMediaSample **ppSample, DWORD_PTR *pdwUser)
-{
- if (!ppSample || !pdwUser)
- return E_POINTER;
-
- QMutexLocker locker(&m_mutex);
-
- do {
- if (m_readyHead) {
- DirectShowSampleRequest *request = m_readyHead;
-
- *ppSample = request->sample;
- *pdwUser = request->userData;
-
- HRESULT hr = request->result;
-
- m_readyHead = request->next;
-
- if (!m_readyHead)
- m_readyTail = 0;
-
- delete request;
-
- return hr;
- } else if (m_flushing) {
- *ppSample = 0;
- *pdwUser = 0;
-
- return VFW_E_WRONG_STATE;
- }
- } while (m_wait.wait(&m_mutex, dwTimeout));
-
- *ppSample = 0;
- *pdwUser = 0;
-
- return VFW_E_TIMEOUT;
-}
-
-HRESULT DirectShowIOReader::SyncReadAligned(IMediaSample *pSample)
-{
- if (!pSample) {
- return E_POINTER;
- } else {
- REFERENCE_TIME startTime = 0;
- REFERENCE_TIME endTime = 0;
- BYTE *buffer;
-
- if (pSample->GetTime(&startTime, &endTime) != S_OK
- || pSample->GetPointer(&buffer) != S_OK) {
- return VFW_E_SAMPLE_TIME_NOT_SET;
- } else {
- LONGLONG position = startTime / 10000000;
- LONG length = (endTime - startTime) / 10000000;
-
- QMutexLocker locker(&m_mutex);
-
- if (thread() == QThread::currentThread()) {
- qint64 bytesRead = 0;
-
- HRESULT hr = blockingRead(position, length, buffer, &bytesRead);
-
- if (SUCCEEDED(hr))
- pSample->SetActualDataLength(bytesRead);
-
- return hr;
- } else {
- m_synchronousPosition = position;
- m_synchronousLength = length;
- m_synchronousBuffer = buffer;
-
- m_loop->postEvent(this, new QEvent(QEvent::User));
-
- m_wait.wait(&m_mutex);
-
- m_synchronousBuffer = 0;
-
- if (SUCCEEDED(m_synchronousResult))
- pSample->SetActualDataLength(m_synchronousBytesRead);
-
- return m_synchronousResult;
- }
- }
- }
-}
-
-HRESULT DirectShowIOReader::SyncRead(LONGLONG llPosition, LONG lLength, BYTE *pBuffer)
-{
- if (!pBuffer) {
- return E_POINTER;
- } else {
- if (thread() == QThread::currentThread()) {
- qint64 bytesRead;
-
- return blockingRead(llPosition, lLength, pBuffer, &bytesRead);
- } else {
- QMutexLocker locker(&m_mutex);
-
- m_synchronousPosition = llPosition;
- m_synchronousLength = lLength;
- m_synchronousBuffer = pBuffer;
-
- m_loop->postEvent(this, new QEvent(QEvent::User));
-
- m_wait.wait(&m_mutex);
-
- m_synchronousBuffer = 0;
-
- return m_synchronousResult;
- }
- }
-}
-
-HRESULT DirectShowIOReader::Length(LONGLONG *pTotal, LONGLONG *pAvailable)
-{
- if (!pTotal || !pAvailable) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- *pTotal = m_totalLength;
- *pAvailable = m_availableLength;
-
- return S_OK;
- }
-}
-
-
-HRESULT DirectShowIOReader::BeginFlush()
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_flushing)
- return S_FALSE;
-
- m_flushing = true;
-
- flushRequests();
-
- m_wait.wakeAll();
-
- return S_OK;
-}
-
-HRESULT DirectShowIOReader::EndFlush()
-{
- QMutexLocker locker(&m_mutex);
-
- if (!m_flushing)
- return S_FALSE;
-
- m_flushing = false;
-
- return S_OK;
-}
-
-void DirectShowIOReader::customEvent(QEvent *event)
-{
- if (event->type() == QEvent::User) {
- readyRead();
- } else {
- QObject::customEvent(event);
- }
-}
-
-void DirectShowIOReader::readyRead()
-{
- QMutexLocker locker(&m_mutex);
-
- m_availableLength = m_device->bytesAvailable() + m_device->pos();
- m_totalLength = m_device->size();
-
- if (m_synchronousBuffer) {
- if (nonBlockingRead(
- m_synchronousPosition,
- m_synchronousLength,
- m_synchronousBuffer,
- &m_synchronousBytesRead,
- &m_synchronousResult)) {
- m_wait.wakeAll();
- }
- } else {
- qint64 bytesRead = 0;
-
- while (m_pendingHead && nonBlockingRead(
- m_pendingHead->position,
- m_pendingHead->length,
- m_pendingHead->buffer,
- &bytesRead,
- &m_pendingHead->result)) {
- m_pendingHead->sample->SetActualDataLength(bytesRead);
-
- if (m_readyTail)
- m_readyTail->next = m_pendingHead;
- m_readyTail = m_pendingHead;
-
- m_pendingHead = m_pendingHead->next;
-
- m_readyTail->next = 0;
-
- if (!m_pendingHead)
- m_pendingTail = 0;
-
- if (!m_readyHead)
- m_readyHead = m_readyTail;
-
- m_wait.wakeAll();
- }
- }
-}
-
-HRESULT DirectShowIOReader::blockingRead(
- LONGLONG position, LONG length, BYTE *buffer, qint64 *bytesRead)
-{
- *bytesRead = 0;
-
- if (qint64(position) > m_device->size())
- return S_FALSE;
-
- const qint64 maxSize = qMin<qint64>(m_device->size(), position + length);
-
- while (m_device->bytesAvailable() + m_device->pos() < maxSize) {
- if (!m_device->waitForReadyRead(-1))
- return S_FALSE;
- }
-
- if (m_device->pos() != position && !m_device->seek(position))
- return S_FALSE;
-
- const qint64 maxBytes = qMin<qint64>(length, m_device->bytesAvailable());
-
- *bytesRead = m_device->read(reinterpret_cast<char *>(buffer), maxBytes);
-
- if (*bytesRead != length) {
- qMemSet(buffer + *bytesRead, 0, length - *bytesRead);
-
- return S_FALSE;
- } else {
- return S_OK;
- }
-}
-
-bool DirectShowIOReader::nonBlockingRead(
- LONGLONG position, LONG length, BYTE *buffer, qint64 *bytesRead, HRESULT *result)
-{
- const qint64 maxSize = qMin<qint64>(m_device->size(), position + length);
-
- if (position > m_device->size()) {
- *bytesRead = 0;
- *result = S_FALSE;
-
- return true;
- } else if (m_device->bytesAvailable() + m_device->pos() >= maxSize) {
- if (m_device->pos() != position && !m_device->seek(position)) {
- *bytesRead = 0;
- *result = S_FALSE;
-
- return true;
- } else {
- const qint64 maxBytes = qMin<qint64>(length, m_device->bytesAvailable());
-
- *bytesRead = m_device->read(reinterpret_cast<char *>(buffer), maxBytes);
-
- if (*bytesRead != length) {
- qMemSet(buffer + *bytesRead, 0, length - *bytesRead);
-
- *result = S_FALSE;
- } else {
- *result = S_OK;
- }
-
- return true;
- }
- } else {
- return false;
- }
-}
-
-void DirectShowIOReader::flushRequests()
-{
- while (m_pendingHead) {
- m_pendingHead->result = VFW_E_WRONG_STATE;
-
- if (m_readyTail)
- m_readyTail->next = m_pendingHead;
-
- m_readyTail = m_pendingHead;
-
- m_pendingHead = m_pendingHead->next;
-
- m_readyTail->next = 0;
-
- if (!m_pendingHead)
- m_pendingTail = 0;
-
- if (!m_readyHead)
- m_readyHead = m_readyTail;
- }
-}
diff --git a/src/plugins/directshow/player/directshowioreader.h b/src/plugins/directshow/player/directshowioreader.h
deleted file mode 100644
index 6056baf..0000000
--- a/src/plugins/directshow/player/directshowioreader.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWIOREADER_H
-#define DIRECTSHOWIOREADER_H
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qwaitcondition.h>
-
-#include <dshow.h>
-
-QT_BEGIN_NAMESPACE
-class QIODevice;
-QT_END_NAMESPACE
-
-class DirectShowEventLoop;
-class DirectShowIOSource;
-class DirectShowSampleRequest;
-
-class DirectShowIOReader : public QObject, public IAsyncReader
-{
- Q_OBJECT
-public:
- DirectShowIOReader(QIODevice *device, DirectShowIOSource *source, DirectShowEventLoop *loop);
- ~DirectShowIOReader();
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IAsyncReader
- HRESULT STDMETHODCALLTYPE RequestAllocator(
- IMemAllocator *pPreferred, ALLOCATOR_PROPERTIES *pProps, IMemAllocator **ppActual);
-
- HRESULT STDMETHODCALLTYPE Request(IMediaSample *pSample, DWORD_PTR dwUser);
-
- HRESULT STDMETHODCALLTYPE WaitForNext(
- DWORD dwTimeout, IMediaSample **ppSample, DWORD_PTR *pdwUser);
-
- HRESULT STDMETHODCALLTYPE SyncReadAligned(IMediaSample *pSample);
-
- HRESULT STDMETHODCALLTYPE SyncRead(LONGLONG llPosition, LONG lLength, BYTE *pBuffer);
-
- HRESULT STDMETHODCALLTYPE Length(LONGLONG *pTotal, LONGLONG *pAvailable);
-
- HRESULT STDMETHODCALLTYPE BeginFlush();
- HRESULT STDMETHODCALLTYPE EndFlush();
-
-protected:
- void customEvent(QEvent *event);
-
-private Q_SLOTS:
- void readyRead();
-
-private:
- HRESULT blockingRead(LONGLONG position, LONG length, BYTE *buffer, qint64 *bytesRead);
- bool nonBlockingRead(
- LONGLONG position, LONG length, BYTE *buffer, qint64 *bytesRead, HRESULT *result);
- void flushRequests();
-
- DirectShowIOSource *m_source;
- QIODevice *m_device;
- DirectShowEventLoop *m_loop;
- DirectShowSampleRequest *m_pendingHead;
- DirectShowSampleRequest *m_pendingTail;
- DirectShowSampleRequest *m_readyHead;
- DirectShowSampleRequest *m_readyTail;
- LONGLONG m_synchronousPosition;
- LONG m_synchronousLength;
- qint64 m_synchronousBytesRead;
- BYTE *m_synchronousBuffer;
- HRESULT m_synchronousResult;
- LONGLONG m_totalLength;
- LONGLONG m_availableLength;
- bool m_flushing;
- QMutex m_mutex;
- QWaitCondition m_wait;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowiosource.cpp b/src/plugins/directshow/player/directshowiosource.cpp
deleted file mode 100644
index 8445a03..0000000
--- a/src/plugins/directshow/player/directshowiosource.cpp
+++ /dev/null
@@ -1,639 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowiosource.h"
-
-#include "directshowglobal.h"
-#include "directshowmediatype.h"
-#include "directshowpinenum.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qurl.h>
-
-static const GUID directshow_subtypes[] =
-{
- MEDIASUBTYPE_Avi,
- MEDIASUBTYPE_WAVE,
- MEDIASUBTYPE_NULL
-};
-
-DirectShowIOSource::DirectShowIOSource(DirectShowEventLoop *loop)
- : m_ref(1)
- , m_state(State_Stopped)
- , m_reader(0)
- , m_loop(loop)
- , m_graph(0)
- , m_clock(0)
- , m_allocator(0)
- , m_peerPin(0)
- , m_pinId(QLatin1String("Data"))
-{
- QVector<AM_MEDIA_TYPE> mediaTypes;
-
- AM_MEDIA_TYPE type =
- {
- MEDIATYPE_Stream, // majortype
- MEDIASUBTYPE_NULL, // subtype
- TRUE, // bFixedSizeSamples
- FALSE, // bTemporalCompression
- 1, // lSampleSize
- GUID_NULL, // formattype
- 0, // pUnk
- 0, // cbFormat
- 0, // pbFormat
- };
-
- static const int count = sizeof(directshow_subtypes) / sizeof(GUID);
-
- for (int i = 0; i < count; ++i) {
- type.subtype = directshow_subtypes[i];
- mediaTypes.append(type);
- }
-
- setMediaTypes(mediaTypes);
-}
-
-DirectShowIOSource::~DirectShowIOSource()
-{
- Q_ASSERT(m_ref == 0);
-
- delete m_reader;
-}
-
-void DirectShowIOSource::setDevice(QIODevice *device)
-{
- Q_ASSERT(!m_reader);
-
- m_reader = new DirectShowIOReader(device, this, m_loop);
-}
-
-void DirectShowIOSource::setAllocator(IMemAllocator *allocator)
-{
- if (m_allocator)
- m_allocator->Release();
-
- m_allocator = allocator;
-
- if (m_allocator)
- m_allocator->AddRef();
-}
-
-// IUnknown
-HRESULT DirectShowIOSource::QueryInterface(REFIID riid, void **ppvObject)
-{
- // 2dd74950-a890-11d1-abe8-00a0c905f375
- static const GUID iid_IAmFilterMiscFlags = {
- 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75}};
-
- if (!ppvObject) {
- return E_POINTER;
- } else if (riid == IID_IUnknown
- || riid == IID_IPersist
- || riid == IID_IMediaFilter
- || riid == IID_IBaseFilter) {
- *ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == iid_IAmFilterMiscFlags) {
- *ppvObject = static_cast<IAMFilterMiscFlags *>(this);
- } else if (riid == IID_IPin) {
- *ppvObject = static_cast<IPin *>(this);
- } else if (riid == IID_IAsyncReader) {
- *ppvObject = static_cast<IAsyncReader *>(m_reader);
- } else {
- *ppvObject = 0;
-
- return E_NOINTERFACE;
- }
-
- AddRef();
-
- return S_OK;
-}
-
-ULONG DirectShowIOSource::AddRef()
-{
- return InterlockedIncrement(&m_ref);
-}
-
-ULONG DirectShowIOSource::Release()
-{
- ULONG ref = InterlockedDecrement(&m_ref);
-
- if (ref == 0) {
- delete this;
- }
-
- return ref;
-}
-
-// IPersist
-HRESULT DirectShowIOSource::GetClassID(CLSID *pClassID)
-{
- *pClassID = CLSID_NULL;
-
- return S_OK;
-}
-
-// IMediaFilter
-HRESULT DirectShowIOSource::Run(REFERENCE_TIME tStart)
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = State_Running;
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::Pause()
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = State_Paused;
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::Stop()
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = State_Stopped;
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
-{
- Q_UNUSED(dwMilliSecsTimeout);
-
- if (!pState) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- *pState = m_state;
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::SetSyncSource(IReferenceClock *pClock)
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_clock)
- m_clock->Release();
-
- m_clock = pClock;
-
- if (m_clock)
- m_clock->AddRef();
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::GetSyncSource(IReferenceClock **ppClock)
-{
- if (!ppClock) {
- return E_POINTER;
- } else {
- if (!m_clock) {
- *ppClock = 0;
-
- return S_FALSE;
- } else {
- m_clock->AddRef();
-
- *ppClock = m_clock;
-
- return S_OK;
- }
- }
-}
-
-// IBaseFilter
-HRESULT DirectShowIOSource::EnumPins(IEnumPins **ppEnum)
-{
- if (!ppEnum) {
- return E_POINTER;
- } else {
- *ppEnum = new DirectShowPinEnum(QList<IPin *>() << this);
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::FindPin(LPCWSTR Id, IPin **ppPin)
-{
- if (!ppPin || !Id) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
- if (QString::fromWCharArray(Id) == m_pinId) {
- AddRef();
-
- *ppPin = this;
-
- return S_OK;
- } else {
- *ppPin = 0;
-
- return VFW_E_NOT_FOUND;
- }
- }
-}
-
-HRESULT DirectShowIOSource::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
-{
- QMutexLocker locker(&m_mutex);
-
- m_graph = pGraph;
- m_filterName = QString::fromWCharArray(pName);
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::QueryFilterInfo(FILTER_INFO *pInfo)
-{
- if (!pInfo) {
- return E_POINTER;
- } else {
- QString name = m_filterName;
-
- if (name.length() >= MAX_FILTER_NAME)
- name.truncate(MAX_FILTER_NAME - 1);
-
- int length = name.toWCharArray(pInfo->achName);
- pInfo->achName[length] = '\0';
-
- if (m_graph)
- m_graph->AddRef();
-
- pInfo->pGraph = m_graph;
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::QueryVendorInfo(LPWSTR *pVendorInfo)
-{
- Q_UNUSED(pVendorInfo);
-
- return E_NOTIMPL;
-}
-
-// IAMFilterMiscFlags
-ULONG DirectShowIOSource::GetMiscFlags()
-{
- return AM_FILTER_MISC_FLAGS_IS_SOURCE;
-}
-
-// IPin
-HRESULT DirectShowIOSource::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
-{
- QMutexLocker locker(&m_mutex);
- if (!pReceivePin) {
- return E_POINTER;
- } else if (m_state != State_Stopped) {
- return VFW_E_NOT_STOPPED;
- } else if (m_peerPin) {
- return VFW_E_ALREADY_CONNECTED;
- } else {
- HRESULT hr = VFW_E_TYPE_NOT_ACCEPTED;
-
- m_peerPin = pReceivePin;
- m_peerPin->AddRef();
-
- if (!pmt) {
- IEnumMediaTypes *mediaTypes = 0;
- if (pReceivePin->EnumMediaTypes(&mediaTypes) == S_OK) {
- for (AM_MEDIA_TYPE *type = 0;
- mediaTypes->Next(1, &type, 0) == S_OK;
- DirectShowMediaType::deleteType(type)) {
- switch (tryConnect(pReceivePin, type)) {
- case S_OK:
- DirectShowMediaType::freeData(type);
- mediaTypes->Release();
- return S_OK;
- case VFW_E_NO_TRANSPORT:
- hr = VFW_E_NO_TRANSPORT;
- break;
- default:
- break;
- }
- }
- mediaTypes->Release();
- }
- AM_MEDIA_TYPE type =
- {
- MEDIATYPE_Stream, // majortype
- MEDIASUBTYPE_NULL, // subtype
- TRUE, // bFixedSizeSamples
- FALSE, // bTemporalCompression
- 1, // lSampleSize
- GUID_NULL, // formattype
- 0, // pUnk
- 0, // cbFormat
- 0, // pbFormat
- };
-
- static const int count = sizeof(directshow_subtypes) / sizeof(GUID);
-
- for (int i = 0; i < count; ++i) {
- type.subtype = directshow_subtypes[i];
-
- switch (tryConnect(pReceivePin, &type)) {
- case S_OK:
- return S_OK;
- case VFW_E_NO_TRANSPORT:
- hr = VFW_E_NO_TRANSPORT;
- break;
- default:
- break;
- }
- }
- } else if (pmt->majortype == MEDIATYPE_Stream && (hr = tryConnect(pReceivePin, pmt))) {
- return S_OK;
- }
-
- m_peerPin->Release();
- m_peerPin = 0;
-
- m_mediaType.clear();
-
- return hr;
- }
-}
-
-HRESULT DirectShowIOSource::tryConnect(IPin *pin, const AM_MEDIA_TYPE *type)
-{
- m_mediaType = *type;
-
- HRESULT hr = pin->ReceiveConnection(this, type);
-
- if (!SUCCEEDED(hr)) {
- if (m_allocator) {
- m_allocator->Release();
- m_allocator = 0;
- }
- } else if (!m_allocator) {
- hr = VFW_E_NO_TRANSPORT;
-
- if (IMemInputPin *memPin = com_cast<IMemInputPin>(pin, IID_IMemInputPin)) {
- if ((m_allocator = com_new<IMemAllocator>(CLSID_MemoryAllocator, IID_IMemAllocator))) {
- ALLOCATOR_PROPERTIES properties;
- if (memPin->GetAllocatorRequirements(&properties) == S_OK
- || m_allocator->GetProperties(&properties) == S_OK) {
- if (properties.cbAlign == 0)
- properties.cbAlign = 1;
-
- ALLOCATOR_PROPERTIES actualProperties;
- if (SUCCEEDED(hr = m_allocator->SetProperties(&properties, &actualProperties)))
- hr = memPin->NotifyAllocator(m_allocator, TRUE);
- }
- if (!SUCCEEDED(hr)) {
- m_allocator->Release();
- m_allocator = 0;
- }
- }
- memPin->Release();
- }
- if (!SUCCEEDED(hr))
- pin->Disconnect();
- }
- return hr;
-}
-
-HRESULT DirectShowIOSource::ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt)
-{
- Q_UNUSED(pConnector);
- Q_UNUSED(pmt);
- // Output pin.
- return E_NOTIMPL;
-}
-
-HRESULT DirectShowIOSource::Disconnect()
-{
- if (!m_peerPin) {
- return S_FALSE;
- } else if (m_state != State_Stopped) {
- return VFW_E_NOT_STOPPED;
- } else {
- HRESULT hr = m_peerPin->Disconnect();
-
- if (!SUCCEEDED(hr))
- return hr;
-
- if (m_allocator) {
- m_allocator->Release();
- m_allocator = 0;
- }
-
- m_peerPin->Release();
- m_peerPin = 0;
-
- m_mediaType.clear();
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::ConnectedTo(IPin **ppPin)
-{
- if (!ppPin) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin) {
- *ppPin = 0;
-
- return VFW_E_NOT_CONNECTED;
- } else {
- m_peerPin->AddRef();
-
- *ppPin = m_peerPin;
-
- return S_OK;
- }
- }
-}
-
-HRESULT DirectShowIOSource::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
-{
- if (!pmt) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin) {
- pmt = 0;
-
- return VFW_E_NOT_CONNECTED;
- } else {
- DirectShowMediaType::copy(pmt, m_mediaType);
-
- return S_OK;
- }
- }
-}
-
-HRESULT DirectShowIOSource::QueryPinInfo(PIN_INFO *pInfo)
-{
- if (!pInfo) {
- return E_POINTER;
- } else {
- AddRef();
-
- pInfo->pFilter = this;
- pInfo->dir = PINDIR_OUTPUT;
-
- const int bytes = qMin(MAX_FILTER_NAME, (m_pinId.length() + 1) * 2);
-
- qMemCopy(pInfo->achName, m_pinId.utf16(), bytes);
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::QueryId(LPWSTR *Id)
-{
- if (!Id) {
- return E_POINTER;
- } else {
- const int bytes = (m_pinId.length() + 1) * 2;
-
- *Id = static_cast<LPWSTR>(::CoTaskMemAlloc(bytes));
-
- qMemCopy(*Id, m_pinId.utf16(), bytes);
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::QueryAccept(const AM_MEDIA_TYPE *pmt)
-{
- if (!pmt) {
- return E_POINTER;
- } else if (pmt->majortype == MEDIATYPE_Stream) {
- return S_OK;
- } else {
- return S_FALSE;
- }
-}
-
-HRESULT DirectShowIOSource::EnumMediaTypes(IEnumMediaTypes **ppEnum)
-{
- if (!ppEnum) {
- return E_POINTER;
- } else {
- *ppEnum = createMediaTypeEnum();
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowIOSource::QueryInternalConnections(IPin **apPin, ULONG *nPin)
-{
- Q_UNUSED(apPin);
- Q_UNUSED(nPin);
-
- return E_NOTIMPL;
-}
-
-HRESULT DirectShowIOSource::EndOfStream()
-{
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::BeginFlush()
-{
- return m_reader->BeginFlush();
-}
-
-HRESULT DirectShowIOSource::EndFlush()
-{
- return m_reader->EndFlush();
-}
-
-HRESULT DirectShowIOSource::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
-{
- Q_UNUSED(tStart);
- Q_UNUSED(tStop);
- Q_UNUSED(dRate);
-
- return S_OK;
-}
-
-HRESULT DirectShowIOSource::QueryDirection(PIN_DIRECTION *pPinDir)
-{
- if (!pPinDir) {
- return E_POINTER;
- } else {
- *pPinDir = PINDIR_OUTPUT;
-
- return S_OK;
- }
-}
-
-DirectShowRcSource::DirectShowRcSource(DirectShowEventLoop *loop)
- : DirectShowIOSource(loop)
-{
-}
-
-bool DirectShowRcSource::open(const QUrl &url)
-{
- m_file.moveToThread(QCoreApplication::instance()->thread());
-
- m_file.setFileName(QLatin1Char(':') + url.path());
-
- qDebug("qrc file %s", qPrintable(m_file.fileName()));
-
- if (m_file.open(QIODevice::ReadOnly)) {
- qDebug("Size %d", m_file.size());
- qDebug("Sequential %d", int(m_file.isSequential()));
-
- setDevice(&m_file);
-
- return true;
- } else {
- return false;
- }
-}
diff --git a/src/plugins/directshow/player/directshowiosource.h b/src/plugins/directshow/player/directshowiosource.h
deleted file mode 100644
index 137a4f1..0000000
--- a/src/plugins/directshow/player/directshowiosource.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWIOSOURCE_H
-#define DIRECTSHOWIOSOURCE_H
-
-#include "directshowglobal.h"
-#include "directshowioreader.h"
-#include "directshowmediatype.h"
-#include "directshowmediatypelist.h"
-
-#include <QtCore/qfile.h>
-
-class DirectShowIOSource
- : public DirectShowMediaTypeList
- , public IBaseFilter
- , public IAMFilterMiscFlags
- , public IPin
-{
-public:
- DirectShowIOSource(DirectShowEventLoop *loop);
- ~DirectShowIOSource();
-
- void setDevice(QIODevice *device);
- void setAllocator(IMemAllocator *allocator);
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IPersist
- HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
-
- // IMediaFilter
- HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart);
- HRESULT STDMETHODCALLTYPE Pause();
- HRESULT STDMETHODCALLTYPE Stop();
-
- HRESULT STDMETHODCALLTYPE GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState);
-
- HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock);
- HRESULT STDMETHODCALLTYPE GetSyncSource(IReferenceClock **ppClock);
-
- // IBaseFilter
- HRESULT STDMETHODCALLTYPE EnumPins(IEnumPins **ppEnum);
- HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, IPin **ppPin);
-
- HRESULT STDMETHODCALLTYPE JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
-
- HRESULT STDMETHODCALLTYPE QueryFilterInfo(FILTER_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryVendorInfo(LPWSTR *pVendorInfo);
-
- // IAMFilterMiscFlags
- ULONG STDMETHODCALLTYPE GetMiscFlags();
-
- // IPin
- HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE Disconnect();
- HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **ppPin);
-
- HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt);
-
- HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id);
-
- HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt);
-
- HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum);
-
- HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin);
-
- HRESULT STDMETHODCALLTYPE EndOfStream();
-
- HRESULT STDMETHODCALLTYPE BeginFlush();
- HRESULT STDMETHODCALLTYPE EndFlush();
-
- HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
-
- HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir);
-
-private:
- HRESULT tryConnect(IPin *pin, const AM_MEDIA_TYPE *type);
-
- volatile LONG m_ref;
- FILTER_STATE m_state;
- DirectShowIOReader *m_reader;
- DirectShowEventLoop *m_loop;
- IFilterGraph *m_graph;
- IReferenceClock *m_clock;
- IMemAllocator *m_allocator;
- IPin *m_peerPin;
- DirectShowMediaType m_mediaType;
- QString m_filterName;
- const QString m_pinId;
- QMutex m_mutex;
-};
-
-class DirectShowRcSource : public DirectShowIOSource
-{
-public:
- DirectShowRcSource(DirectShowEventLoop *loop);
-
- bool open(const QUrl &url);
-
-private:
- QFile m_file;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowmediatype.cpp b/src/plugins/directshow/player/directshowmediatype.cpp
deleted file mode 100644
index ab901c5..0000000
--- a/src/plugins/directshow/player/directshowmediatype.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowmediatype.h"
-
-namespace
-{
- struct TypeLookup
- {
- QVideoFrame::PixelFormat pixelFormat;
- GUID mediaType;
- };
-
- static const TypeLookup qt_typeLookup[] =
- {
- { QVideoFrame::Format_RGB32, /*MEDIASUBTYPE_RGB32*/ {0xe436eb7e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
- { QVideoFrame::Format_BGR24, /*MEDIASUBTYPE_RGB24*/ {0xe436eb7d, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
- { QVideoFrame::Format_RGB565, /*MEDIASUBTYPE_RGB565*/ {0xe436eb7b, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
- { QVideoFrame::Format_RGB555, /*MEDIASUBTYPE_RGB555*/ {0xe436eb7c, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}} },
- { QVideoFrame::Format_AYUV444, /*MEDIASUBTYPE_AYUV*/ {0x56555941, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_YUYV, /*MEDIASUBTYPE_YUY2*/ {0x32595559, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_UYVY, /*MEDIASUBTYPE_UYVY*/ {0x59565955, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_IMC1, /*MEDIASUBTYPE_IMC1*/ {0x31434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_IMC2, /*MEDIASUBTYPE_IMC2*/ {0x32434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_IMC3, /*MEDIASUBTYPE_IMC3*/ {0x33434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_IMC4, /*MEDIASUBTYPE_IMC4*/ {0x34434D49, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_YV12, /*MEDIASUBTYPE_YV12*/ {0x32315659, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_NV12, /*MEDIASUBTYPE_NV12*/ {0x3231564E, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} },
- { QVideoFrame::Format_YUV420P, /*MEDIASUBTYPE_IYUV*/ {0x56555949, 0x0000, 0x0010, {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}} }
- };
-}
-
-void DirectShowMediaType::copy(AM_MEDIA_TYPE *target, const AM_MEDIA_TYPE &source)
-{
- *target = source;
-
- if (source.cbFormat > 0) {
- target->pbFormat = reinterpret_cast<PBYTE>(CoTaskMemAlloc(source.cbFormat));
- memcpy(target->pbFormat, source.pbFormat, source.cbFormat);
- }
- if (target->pUnk)
- target->pUnk->AddRef();
-}
-
-void DirectShowMediaType::deleteType(AM_MEDIA_TYPE *type)
-{
- freeData(type);
-
- CoTaskMemFree(type);
-}
-
-void DirectShowMediaType::freeData(AM_MEDIA_TYPE *type)
-{
- if (type->cbFormat > 0)
- CoTaskMemFree(type->pbFormat);
-
- if (type->pUnk)
- type->pUnk->Release();
-}
-
-
-GUID DirectShowMediaType::convertPixelFormat(QVideoFrame::PixelFormat format)
-{
- // MEDIASUBTYPE_None;
- static const GUID none = {
- 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
-
- const int count = sizeof(qt_typeLookup) / sizeof(TypeLookup);
-
- for (int i = 0; i < count; ++i)
- if (qt_typeLookup[i].pixelFormat == format)
- return qt_typeLookup[i].mediaType;
- return none;
-}
-
-QVideoSurfaceFormat DirectShowMediaType::formatFromType(const AM_MEDIA_TYPE &type)
-{
- const int count = sizeof(qt_typeLookup) / sizeof(TypeLookup);
-
- for (int i = 0; i < count; ++i) {
- if (IsEqualGUID(qt_typeLookup[i].mediaType, type.subtype) && type.cbFormat > 0) {
- if (IsEqualGUID(type.formattype, FORMAT_VideoInfo)) {
- VIDEOINFOHEADER *header = reinterpret_cast<VIDEOINFOHEADER *>(type.pbFormat);
-
- QVideoSurfaceFormat format(
- QSize(header->bmiHeader.biWidth, qAbs(header->bmiHeader.biHeight)),
- qt_typeLookup[i].pixelFormat);
-
- if (header->AvgTimePerFrame > 0)
- format.setFrameRate(10000 /header->AvgTimePerFrame);
-
- format.setScanLineDirection(header->bmiHeader.biHeight < 0
- ? QVideoSurfaceFormat::TopToBottom
- : QVideoSurfaceFormat::BottomToTop);
-
- return format;
- } else if (IsEqualGUID(type.formattype, FORMAT_VideoInfo2)) {
- VIDEOINFOHEADER2 *header = reinterpret_cast<VIDEOINFOHEADER2 *>(type.pbFormat);
-
- QVideoSurfaceFormat format(
- QSize(header->bmiHeader.biWidth, qAbs(header->bmiHeader.biHeight)),
- qt_typeLookup[i].pixelFormat);
-
- if (header->AvgTimePerFrame > 0)
- format.setFrameRate(10000 / header->AvgTimePerFrame);
-
- format.setScanLineDirection(header->bmiHeader.biHeight < 0
- ? QVideoSurfaceFormat::TopToBottom
- : QVideoSurfaceFormat::BottomToTop);
-
- return format;
- }
- }
- }
- return QVideoSurfaceFormat();
-}
-
-#define PAD_TO_DWORD(x) (((x) + 3) & ~3)
-int DirectShowMediaType::bytesPerLine(const QVideoSurfaceFormat &format)
-{
- switch (format.pixelFormat()) {
- // 32 bpp packed formats.
- case QVideoFrame::Format_RGB32:
- case QVideoFrame::Format_AYUV444:
- return format.frameWidth() * 4;
- // 24 bpp packed formats.
- case QVideoFrame::Format_RGB24:
- return PAD_TO_DWORD(format.frameWidth() * 3);
- // 16 bpp packed formats.
- case QVideoFrame::Format_RGB565:
- case QVideoFrame::Format_RGB555:
- case QVideoFrame::Format_YUYV:
- case QVideoFrame::Format_UYVY:
- return PAD_TO_DWORD(format.frameWidth() * 2);
- // Planar formats.
- case QVideoFrame::Format_IMC1:
- case QVideoFrame::Format_IMC2:
- case QVideoFrame::Format_IMC3:
- case QVideoFrame::Format_IMC4:
- case QVideoFrame::Format_YV12:
- case QVideoFrame::Format_NV12:
- case QVideoFrame::Format_YUV420P:
- return PAD_TO_DWORD(format.frameWidth());
- default:
- return 0;
- }
-}
diff --git a/src/plugins/directshow/player/directshowmediatype.h b/src/plugins/directshow/player/directshowmediatype.h
deleted file mode 100644
index 66f3028..0000000
--- a/src/plugins/directshow/player/directshowmediatype.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWMEDIATYPE_H
-#define DIRECTSHOWMEDIATYPE_H
-
-#include <qvideosurfaceformat.h>
-
-#include <dshow.h>
-#include <dvdmedia.h>
-
-class DirectShowMediaType : public AM_MEDIA_TYPE
-{
-public:
- DirectShowMediaType() { memset(this, 0, sizeof(DirectShowMediaType)); }
- DirectShowMediaType(const AM_MEDIA_TYPE &type) { copy(this, type); }
- DirectShowMediaType(const DirectShowMediaType &other) { copy(this, other); }
- DirectShowMediaType &operator =(const AM_MEDIA_TYPE &type) {
- freeData(this); copy(this, type); return *this; }
- DirectShowMediaType &operator =(const DirectShowMediaType &other) {
- freeData(this); copy(this, other); return *this; }
- ~DirectShowMediaType() { freeData(this); }
-
- void clear() { freeData(this); memset(this, 0, sizeof(DirectShowMediaType)); }
-
- static void copy(AM_MEDIA_TYPE *target, const AM_MEDIA_TYPE &source);
- static void freeData(AM_MEDIA_TYPE *type);
- static void deleteType(AM_MEDIA_TYPE *type);
-
- static GUID convertPixelFormat(QVideoFrame::PixelFormat format);
- static QVideoSurfaceFormat formatFromType(const AM_MEDIA_TYPE &type);
-
- static int bytesPerLine(const QVideoSurfaceFormat &format);
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowmediatypelist.cpp b/src/plugins/directshow/player/directshowmediatypelist.cpp
deleted file mode 100644
index 06a7523..0000000
--- a/src/plugins/directshow/player/directshowmediatypelist.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowmediatypelist.h"
-
-#include "directshowmediatype.h"
-#include "videosurfacefilter.h"
-
-
-class DirectShowMediaTypeEnum : public IEnumMediaTypes
-{
-public:
- DirectShowMediaTypeEnum(DirectShowMediaTypeList *list, int token, int index = 0);
- ~DirectShowMediaTypeEnum();
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IEnumMediaTypes
- HRESULT STDMETHODCALLTYPE Next(
- ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched);
- HRESULT STDMETHODCALLTYPE Skip(ULONG cMediaTypes);
- HRESULT STDMETHODCALLTYPE Reset();
-
- HRESULT STDMETHODCALLTYPE Clone(IEnumMediaTypes **ppEnum);
-
-private:
- LONG m_ref;
- DirectShowMediaTypeList *m_list;
- int m_mediaTypeToken;
- int m_index;
-};
-
-
-DirectShowMediaTypeEnum::DirectShowMediaTypeEnum(
- DirectShowMediaTypeList *list, int token, int index)
- : m_ref(1)
- , m_list(list)
- , m_mediaTypeToken(token)
- , m_index(index)
-{
- m_list->AddRef();
-}
-
-DirectShowMediaTypeEnum::~DirectShowMediaTypeEnum()
-{
- m_list->Release();
-}
-
-HRESULT DirectShowMediaTypeEnum::QueryInterface(REFIID riid, void **ppvObject)
-{
- if (!ppvObject) {
- return E_POINTER;
- } else if (riid == IID_IUnknown
- || riid == IID_IEnumMediaTypes) {
- *ppvObject = static_cast<IEnumMediaTypes *>(this);
- } else {
- *ppvObject = 0;
-
- return E_NOINTERFACE;
- }
-
- AddRef();
-
- return S_OK;
-}
-
-ULONG DirectShowMediaTypeEnum::AddRef()
-{
- return InterlockedIncrement(&m_ref);
-}
-
-ULONG DirectShowMediaTypeEnum::Release()
-{
- ULONG ref = InterlockedDecrement(&m_ref);
-
- if (ref == 0) {
- delete this;
- }
-
- return ref;
-}
-
-HRESULT DirectShowMediaTypeEnum::Next(
- ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched)
-{
- return m_list->nextMediaType(m_mediaTypeToken, &m_index, cMediaTypes, ppMediaTypes, pcFetched);
-}
-
-HRESULT DirectShowMediaTypeEnum::Skip(ULONG cMediaTypes)
-{
- return m_list->skipMediaType(m_mediaTypeToken, &m_index, cMediaTypes);
-}
-
-HRESULT DirectShowMediaTypeEnum::Reset()
-{
- m_mediaTypeToken = m_list->currentMediaTypeToken();
- m_index = 0;
-
- return S_OK;
-}
-
-HRESULT DirectShowMediaTypeEnum::Clone(IEnumMediaTypes **ppEnum)
-{
- return m_list->cloneMediaType(m_mediaTypeToken, m_index, ppEnum);
-}
-
-
-DirectShowMediaTypeList::DirectShowMediaTypeList()
- : m_mediaTypeToken(0)
-{
-}
-
-IEnumMediaTypes *DirectShowMediaTypeList::createMediaTypeEnum()
-{
- return new DirectShowMediaTypeEnum(this, m_mediaTypeToken, 0);
-}
-
-
-void DirectShowMediaTypeList::setMediaTypes(const QVector<AM_MEDIA_TYPE> &types)
-{
- ++m_mediaTypeToken;
-
- m_mediaTypes = types;
-}
-
-
-int DirectShowMediaTypeList::currentMediaTypeToken()
-{
- return m_mediaTypeToken;
-}
-
-HRESULT DirectShowMediaTypeList::nextMediaType(
- int token, int *index, ULONG count, AM_MEDIA_TYPE **types, ULONG *fetchedCount)
-{
- if (!types || (count != 1 && !fetchedCount)) {
- return E_POINTER;
- } else if (m_mediaTypeToken != token) {
- return VFW_E_ENUM_OUT_OF_SYNC;
- } else {
- int boundedCount = qBound<int>(0, count, m_mediaTypes.count() - *index);
-
- for (int i = 0; i < boundedCount; ++i, ++(*index)) {
- types[i] = reinterpret_cast<AM_MEDIA_TYPE *>(CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE)));
-
- if (types[i]) {
- DirectShowMediaType::copy(types[i], m_mediaTypes.at(*index));
- } else {
- for (--i; i >= 0; --i)
- CoTaskMemFree(types[i]);
-
- if (fetchedCount)
- *fetchedCount = 0;
-
- return E_OUTOFMEMORY;
- }
- }
- if (fetchedCount)
- *fetchedCount = boundedCount;
-
- return boundedCount == count ? S_OK : S_FALSE;
- }
-}
-
-HRESULT DirectShowMediaTypeList::skipMediaType(int token, int *index, ULONG count)
-{
- if (m_mediaTypeToken != token) {
- return VFW_E_ENUM_OUT_OF_SYNC;
- } else {
- *index = qMin<int>(*index + count, m_mediaTypes.size());
-
- return *index < m_mediaTypes.size() ? S_OK : S_FALSE;
- }
-}
-
-HRESULT DirectShowMediaTypeList::cloneMediaType(int token, int index, IEnumMediaTypes **enumeration)
-{
- if (m_mediaTypeToken != token) {
- return VFW_E_ENUM_OUT_OF_SYNC;
- } else {
- *enumeration = new DirectShowMediaTypeEnum(this, token, index);
-
- return S_OK;
- }
-}
-
diff --git a/src/plugins/directshow/player/directshowmediatypelist.h b/src/plugins/directshow/player/directshowmediatypelist.h
deleted file mode 100644
index 62632da..0000000
--- a/src/plugins/directshow/player/directshowmediatypelist.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWMEDIATYPELIST_H
-#define DIRECTSHOWMEDIATYPELIST_H
-
-#include <QtCore/qvector.h>
-
-#include <dshow.h>
-
-class DirectShowMediaTypeList : public IUnknown
-{
-public:
- DirectShowMediaTypeList();
-
- IEnumMediaTypes *createMediaTypeEnum();
-
- void setMediaTypes(const QVector<AM_MEDIA_TYPE> &types);
-
- virtual int currentMediaTypeToken();
- virtual HRESULT nextMediaType(
- int token, int *index, ULONG count, AM_MEDIA_TYPE **types, ULONG *fetchedCount);
- virtual HRESULT skipMediaType(int token, int *index, ULONG count);
- virtual HRESULT cloneMediaType(int token, int index, IEnumMediaTypes **enumeration);
-
-private:
- int m_mediaTypeToken;
- QVector<AM_MEDIA_TYPE> m_mediaTypes;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.cpp b/src/plugins/directshow/player/directshowmetadatacontrol.cpp
deleted file mode 100644
index 3bf2a32..0000000
--- a/src/plugins/directshow/player/directshowmetadatacontrol.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <dshow.h>
-#include <initguid.h>
-#include <qnetwork.h>
-
-#include "directshowmetadatacontrol.h"
-
-#include "directshowplayerservice.h"
-
-#include <QtCore/qcoreapplication.h>
-
-#ifndef QT_NO_WMSDK
-namespace
-{
- struct QWMMetaDataKeyLookup
- {
- QtMultimedia::MetaData key;
- const wchar_t *token;
- };
-}
-
-static const QWMMetaDataKeyLookup qt_wmMetaDataKeys[] =
-{
- { QtMultimedia::Title, L"Title" },
- { QtMultimedia::SubTitle, L"WM/SubTitle" },
- { QtMultimedia::Author, L"Author" },
- { QtMultimedia::Comment, L"Comment" },
- { QtMultimedia::Description, L"Description" },
- { QtMultimedia::Category, L"WM/Category" },
- { QtMultimedia::Genre, L"WM/Genre" },
- //{ QtMultimedia::Date, 0 },
- { QtMultimedia::Year, L"WM/Year" },
- { QtMultimedia::UserRating, L"UserRating" },
- //{ QtMultimedia::MetaDatawords, 0 },
- { QtMultimedia::Language, L"Language" },
- { QtMultimedia::Publisher, L"WM/Publisher" },
- { QtMultimedia::Copyright, L"Copyright" },
- { QtMultimedia::ParentalRating, L"ParentalRating" },
- { QtMultimedia::RatingOrganisation, L"RatingOrganisation" },
-
- // Media
- { QtMultimedia::Size, L"FileSize" },
- { QtMultimedia::MediaType, L"MediaType" },
- { QtMultimedia::Duration, L"Duration" },
-
- // Audio
- { QtMultimedia::AudioBitRate, L"AudioBitRate" },
- { QtMultimedia::AudioCodec, L"AudioCodec" },
- { QtMultimedia::ChannelCount, L"ChannelCount" },
- { QtMultimedia::SampleRate, L"Frequency" },
-
- // Music
- { QtMultimedia::AlbumTitle, L"WM/AlbumTitle" },
- { QtMultimedia::AlbumArtist, L"WM/AlbumArtist" },
- { QtMultimedia::ContributingArtist, L"Author" },
- { QtMultimedia::Composer, L"WM/Composer" },
- { QtMultimedia::Conductor, L"WM/Conductor" },
- { QtMultimedia::Lyrics, L"WM/Lyrics" },
- { QtMultimedia::Mood, L"WM/Mood" },
- { QtMultimedia::TrackNumber, L"WM/TrackNumber" },
- //{ QtMultimedia::TrackCount, 0 },
- //{ QtMultimedia::CoverArtUriSmall, 0 },
- //{ QtMultimedia::CoverArtUriLarge, 0 },
-
- // Image/Video
- //{ QtMultimedia::Resolution, 0 },
- //{ QtMultimedia::PixelAspectRatio, 0 },
-
- // Video
- //{ QtMultimedia::FrameRate, 0 },
- { QtMultimedia::VideoBitRate, L"VideoBitRate" },
- { QtMultimedia::VideoCodec, L"VideoCodec" },
-
- //{ QtMultimedia::PosterUri, 0 },
-
- // Movie
- { QtMultimedia::ChapterNumber, L"ChapterNumber" },
- { QtMultimedia::Director, L"WM/Director" },
- { QtMultimedia::LeadPerformer, L"LeadPerformer" },
- { QtMultimedia::Writer, L"WM/Writer" },
-
- // Photos
- { QtMultimedia::CameraManufacturer, L"CameraManufacturer" },
- { QtMultimedia::CameraModel, L"CameraModel" },
- { QtMultimedia::Event, L"Event" },
- { QtMultimedia::Subject, L"Subject" }
-};
-
-static QVariant getValue(IWMHeaderInfo *header, const wchar_t *key)
-{
- WORD streamNumber = 0;
- WMT_ATTR_DATATYPE type = WMT_TYPE_DWORD;
- WORD size = 0;
-
- if (header->GetAttributeByName(&streamNumber, key, &type, 0, &size) == S_OK) {
- switch (type) {
- case WMT_TYPE_DWORD:
- if (size == sizeof(DWORD)) {
- DWORD word;
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(&word),
- &size) == S_OK) {
- return int(word);
- }
- }
- break;
- case WMT_TYPE_STRING:
- {
- QString string;
- string.resize(size / 2 - 1);
-
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(const_cast<ushort *>(string.utf16())),
- &size) == S_OK) {
- return string;
- }
- }
- break;
- case WMT_TYPE_BINARY:
- {
- QByteArray bytes;
- bytes.resize(size);
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(bytes.data()),
- &size) == S_OK) {
- return bytes;
- }
- }
- break;
- case WMT_TYPE_BOOL:
- if (size == sizeof(DWORD)) {
- DWORD word;
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(&word),
- &size) == S_OK) {
- return bool(word);
- }
- }
- break;
- case WMT_TYPE_QWORD:
- if (size == sizeof(QWORD)) {
- QWORD word;
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(&word),
- &size) == S_OK) {
- return qint64(word);
- }
- }
- break;
- case WMT_TYPE_WORD:
- if (size == sizeof(WORD)){
- WORD word;
- if (header->GetAttributeByName(
- &streamNumber,
- key,
- &type,
- reinterpret_cast<BYTE *>(&word),
- &size) == S_OK) {
- return short(word);
- }
- }
- break;
- case WMT_TYPE_GUID:
- if (size == 16) {
- }
- break;
- default:
- break;
- }
- }
- return QVariant();
-}
-#endif
-
-DirectShowMetaDataControl::DirectShowMetaDataControl(QObject *parent)
- : QMetaDataReaderControl(parent)
- , m_content(0)
-#ifndef QT_NO_WMSDK
- , m_headerInfo(0)
-#endif
-{
-}
-
-DirectShowMetaDataControl::~DirectShowMetaDataControl()
-{
-}
-
-bool DirectShowMetaDataControl::isMetaDataAvailable() const
-{
-#ifndef QT_NO_WMSDK
- return m_content || m_headerInfo;
-#else
- return m_content;
-#endif
-}
-
-QVariant DirectShowMetaDataControl::metaData(QtMultimedia::MetaData key) const
-{
- QVariant value;
-
-#ifndef QT_NO_WMSDK
- if (m_headerInfo) {
- static const int count = sizeof(qt_wmMetaDataKeys) / sizeof(QWMMetaDataKeyLookup);
- for (int i = 0; i < count; ++i) {
- if (qt_wmMetaDataKeys[i].key == key) {
- value = getValue(m_headerInfo, qt_wmMetaDataKeys[i].token);
- break;
- }
- }
- } else if (m_content) {
-#else
- if (m_content) {
-#endif
- BSTR string = 0;
-
- switch (key) {
- case QtMultimedia::Author:
- m_content->get_AuthorName(&string);
- break;
- case QtMultimedia::Title:
- m_content->get_Title(&string);
- break;
- case QtMultimedia::ParentalRating:
- m_content->get_Rating(&string);
- break;
- case QtMultimedia::Description:
- m_content->get_Description(&string);
- break;
- case QtMultimedia::Copyright:
- m_content->get_Copyright(&string);
- break;
- default:
- break;
- }
-
- if (string) {
- value = QString::fromUtf16(reinterpret_cast<ushort *>(string), ::SysStringLen(string));
-
- ::SysFreeString(string);
- }
- }
- return value;
-}
-
-QList<QtMultimedia::MetaData> DirectShowMetaDataControl::availableMetaData() const
-{
- return QList<QtMultimedia::MetaData>();
-}
-
-QVariant DirectShowMetaDataControl::extendedMetaData(const QString &) const
-{
- return QVariant();
-}
-
-QStringList DirectShowMetaDataControl::availableExtendedMetaData() const
-{
- return QStringList();
-}
-
-void DirectShowMetaDataControl::updateGraph(IFilterGraph2 *graph, IBaseFilter *source)
-{
- if (m_content)
- m_content->Release();
-
- if (!graph || graph->QueryInterface(
- IID_IAMMediaContent, reinterpret_cast<void **>(&m_content)) != S_OK) {
- m_content = 0;
- }
-
-#ifdef QT_NO_WMSDK
- Q_UNUSED(source);
-#else
- if (m_headerInfo)
- m_headerInfo->Release();
-
- m_headerInfo = com_cast<IWMHeaderInfo>(source, IID_IWMHeaderInfo);
-#endif
- // DirectShowMediaPlayerService holds a lock at this point so defer emitting signals to a later
- // time.
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(MetaDataChanged)));
-}
-
-void DirectShowMetaDataControl::customEvent(QEvent *event)
-{
- if (event->type() == QEvent::Type(MetaDataChanged)) {
- event->accept();
-
- emit metaDataChanged();
-#ifndef QT_NO_WMSDK
- emit metaDataAvailableChanged(m_content || m_headerInfo);
-#else
- emit metaDataAvailableChanged(m_content);
-#endif
- } else {
- QMetaDataReaderControl::customEvent(event);
- }
-}
diff --git a/src/plugins/directshow/player/directshowmetadatacontrol.h b/src/plugins/directshow/player/directshowmetadatacontrol.h
deleted file mode 100644
index f5c65f1..0000000
--- a/src/plugins/directshow/player/directshowmetadatacontrol.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWMETADATACONTROL_H
-#define DIRECTSHOWMETADATACONTROL_H
-
-#include <qmetadatareadercontrol.h>
-
-#include "directshowglobal.h"
-
-#include <qnetwork.h>
-
-#ifndef QT_NO_WMSDK
-#include <wmsdk.h>
-#endif
-
-#include <QtCore/qcoreevent.h>
-
-class DirectShowPlayerService;
-
-QT_USE_NAMESPACE
-
-class DirectShowMetaDataControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- DirectShowMetaDataControl(QObject *parent = 0);
- ~DirectShowMetaDataControl();
-
- bool isMetaDataAvailable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const;
- QStringList availableExtendedMetaData() const;
-
- void updateGraph(IFilterGraph2 *graph, IBaseFilter *source);
-
-protected:
- void customEvent(QEvent *event);
-
-private:
- enum Event
- {
- MetaDataChanged = QEvent::User
- };
-
- IAMMediaContent *m_content;
-#ifndef QT_NO_WMSDK
- IWMHeaderInfo *m_headerInfo;
-#endif
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowpinenum.cpp b/src/plugins/directshow/player/directshowpinenum.cpp
deleted file mode 100644
index f88f791..0000000
--- a/src/plugins/directshow/player/directshowpinenum.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowpinenum.h"
-
-
-DirectShowPinEnum::DirectShowPinEnum(const QList<IPin *> &pins)
- : m_ref(1)
- , m_pins(pins)
- , m_index(0)
-{
- foreach (IPin *pin, m_pins)
- pin->AddRef();
-}
-
-DirectShowPinEnum::~DirectShowPinEnum()
-{
- foreach (IPin *pin, m_pins)
- pin->Release();
-}
-
-HRESULT DirectShowPinEnum::QueryInterface(REFIID riid, void **ppvObject)
-{
- if (riid == IID_IUnknown
- || riid == IID_IEnumPins) {
- AddRef();
-
- *ppvObject = static_cast<IEnumPins *>(this);
-
- return S_OK;
- } else {
- *ppvObject = 0;
-
- return E_NOINTERFACE;
- }
-}
-
-ULONG DirectShowPinEnum::AddRef()
-{
- return InterlockedIncrement(&m_ref);
-}
-
-ULONG DirectShowPinEnum::Release()
-{
- ULONG ref = InterlockedDecrement(&m_ref);
-
- if (ref == 0) {
- delete this;
- }
-
- return ref;
-}
-
-HRESULT DirectShowPinEnum::Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched)
-{
- if (ppPins && (pcFetched || cPins == 1)) {
- ULONG count = qBound<ULONG>(0, cPins, m_pins.count() - m_index);
-
- for (ULONG i = 0; i < count; ++i, ++m_index) {
- ppPins[i] = m_pins.at(m_index);
- ppPins[i]->AddRef();
- }
-
- if (pcFetched)
- *pcFetched = count;
-
- return count == cPins ? S_OK : S_FALSE;
- } else {
- return E_POINTER;
- }
-}
-
-HRESULT DirectShowPinEnum::Skip(ULONG cPins)
-{
- m_index = qMin(int(m_index + cPins), m_pins.count());
-
- return m_index < m_pins.count() ? S_OK : S_FALSE;
-}
-
-HRESULT DirectShowPinEnum::Reset()
-{
- m_index = 0;
-
- return S_OK;
-}
-
-HRESULT DirectShowPinEnum::Clone(IEnumPins **ppEnum)
-{
- if (ppEnum) {
- *ppEnum = new DirectShowPinEnum(m_pins);
-
- return S_OK;
- } else {
- return E_POINTER;
- }
-}
diff --git a/src/plugins/directshow/player/directshowpinenum.h b/src/plugins/directshow/player/directshowpinenum.h
deleted file mode 100644
index e1cbb10..0000000
--- a/src/plugins/directshow/player/directshowpinenum.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWPINENUM_H
-#define DIRECTSHOWPINENUM_H
-
-#include <QtCore/qlist.h>
-
-#include <dshow.h>
-
-class DirectShowPinEnum : public IEnumPins
-{
-public:
- DirectShowPinEnum(const QList<IPin *> &pins);
- ~DirectShowPinEnum();
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IEnumPins
- HRESULT STDMETHODCALLTYPE Next(ULONG cPins, IPin **ppPins, ULONG *pcFetched);
- HRESULT STDMETHODCALLTYPE Skip(ULONG cPins);
- HRESULT STDMETHODCALLTYPE Reset();
- HRESULT STDMETHODCALLTYPE Clone(IEnumPins **ppEnum);
-
-private:
- LONG m_ref;
- QList<IPin *> m_pins;
- int m_index;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowplayercontrol.cpp b/src/plugins/directshow/player/directshowplayercontrol.cpp
deleted file mode 100644
index 4037dd0..0000000
--- a/src/plugins/directshow/player/directshowplayercontrol.cpp
+++ /dev/null
@@ -1,405 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowplayercontrol.h"
-
-#include "directshowplayerservice.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qmath.h>
-
-static int volumeToDecibels(int volume)
-{
- if (volume == 0) {
- return -10000;
- } else if (volume == 100) {
- return 0;
-#ifdef QT_USE_MATH_H_FLOATS
- } else if (sizeof(qreal) == sizeof(float)) {
- return qRound(::log10f(float(volume) / 100) * 5000);
-#endif
- } else {
- return qRound(::log10(qreal(volume) / 100) * 5000);
- }
-}
-
-static int decibelsToVolume(int dB)
-{
- if (dB == -10000) {
- return 0;
- } else if (dB == 0) {
- return 100;
- } else {
- return qRound(100 * qPow(10, qreal(dB) / 5000));
- }
-}
-
-DirectShowPlayerControl::DirectShowPlayerControl(DirectShowPlayerService *service, QObject *parent)
- : QMediaPlayerControl(parent)
- , m_service(service)
- , m_audio(0)
- , m_updateProperties(0)
- , m_state(QMediaPlayer::StoppedState)
- , m_status(QMediaPlayer::NoMedia)
- , m_error(QMediaPlayer::NoError)
- , m_streamTypes(0)
- , m_muteVolume(-1)
- , m_position(0)
- , m_duration(0)
- , m_playbackRate(0)
- , m_seekable(false)
-{
-}
-
-DirectShowPlayerControl::~DirectShowPlayerControl()
-{
- if (m_audio)
- m_audio->Release();
-}
-
-QMediaPlayer::State DirectShowPlayerControl::state() const
-{
- return m_state;
-}
-
-QMediaPlayer::MediaStatus DirectShowPlayerControl::mediaStatus() const
-{
- return m_status;
-}
-
-qint64 DirectShowPlayerControl::duration() const
-{
- return m_duration;
-}
-
-qint64 DirectShowPlayerControl::position() const
-{
- return const_cast<qint64 &>(m_position) = m_service->position();
-}
-
-void DirectShowPlayerControl::setPosition(qint64 position)
-{
- m_service->seek(position);
-}
-
-int DirectShowPlayerControl::volume() const
-{
- if (m_muteVolume >= 0) {
- return m_muteVolume;
- } else if (m_audio) {
- long dB = 0;
-
- m_audio->get_Volume(&dB);
-
- return decibelsToVolume(dB);
- } else {
- return 0;
- }
-}
-
-void DirectShowPlayerControl::setVolume(int volume)
-{
- int boundedVolume = qBound(0, volume, 100);
-
- if (m_muteVolume >= 0) {
- m_muteVolume = boundedVolume;
-
- emit volumeChanged(m_muteVolume);
- } else if (m_audio) {
- m_audio->put_Volume(volumeToDecibels(volume));
-
- emit volumeChanged(boundedVolume);
- }
-}
-
-bool DirectShowPlayerControl::isMuted() const
-{
- return m_muteVolume >= 0;
-}
-
-void DirectShowPlayerControl::setMuted(bool muted)
-{
- if (muted && m_muteVolume < 0) {
- if (m_audio) {
- long dB = 0;
-
- m_audio->get_Volume(&dB);
-
- m_muteVolume = decibelsToVolume(dB);
-
- m_audio->put_Volume(-10000);
- } else {
- m_muteVolume = 0;
- }
-
- emit mutedChanged(muted);
- } else if (!muted && m_muteVolume >= 0) {
- if (m_audio) {
- m_audio->put_Volume(volumeToDecibels(m_muteVolume));
- }
- m_muteVolume = -1;
-
- emit mutedChanged(muted);
- }
-}
-
-int DirectShowPlayerControl::bufferStatus() const
-{
- return m_service->bufferStatus();
-}
-
-bool DirectShowPlayerControl::isAudioAvailable() const
-{
- return m_streamTypes & DirectShowPlayerService::AudioStream;
-}
-
-bool DirectShowPlayerControl::isVideoAvailable() const
-{
- return m_streamTypes & DirectShowPlayerService::VideoStream;
-}
-
-bool DirectShowPlayerControl::isSeekable() const
-{
- return m_seekable;
-}
-
-QMediaTimeRange DirectShowPlayerControl::availablePlaybackRanges() const
-{
- return m_service->availablePlaybackRanges();
-}
-
-qreal DirectShowPlayerControl::playbackRate() const
-{
- return m_playbackRate;
-}
-
-void DirectShowPlayerControl::setPlaybackRate(qreal rate)
-{
- if (m_playbackRate != rate) {
- m_service->setRate(rate);
-
- emit playbackRateChanged(m_playbackRate = rate);
- }
-}
-
-QMediaContent DirectShowPlayerControl::media() const
-{
- return m_media;
-}
-
-const QIODevice *DirectShowPlayerControl::mediaStream() const
-{
- return m_stream;
-}
-
-void DirectShowPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream)
-{
- m_media = media;
- m_stream = stream;
-
- m_updateProperties &= PlaybackRateProperty;
-
- m_service->load(media, stream);
-
- emit mediaChanged(m_media);
- emitPropertyChanges();
-}
-
-void DirectShowPlayerControl::play()
-{
- if (m_status == QMediaPlayer::NoMedia)
- return;
- if (m_status == QMediaPlayer::InvalidMedia) {
- setMedia(m_media, m_stream);
- if (m_error != QMediaPlayer::NoError)
- return;
- }
- m_service->play();
- emit stateChanged(m_state = QMediaPlayer::PlayingState);
-}
-
-void DirectShowPlayerControl::pause()
-{
- if (m_status == QMediaPlayer::NoMedia)
- return;
- if (m_status == QMediaPlayer::InvalidMedia) {
- setMedia(m_media, m_stream);
- if (m_error != QMediaPlayer::NoError)
- return;
- }
- m_service->pause();
- emit stateChanged(m_state = QMediaPlayer::PausedState);
-}
-
-void DirectShowPlayerControl::stop()
-{
- m_service->stop();
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
-}
-
-void DirectShowPlayerControl::customEvent(QEvent *event)
-{
- if (event->type() == QEvent::Type(PropertiesChanged)) {
- emitPropertyChanges();
-
- event->accept();
- } else {
- QMediaPlayerControl::customEvent(event);
- }
-}
-
-void DirectShowPlayerControl::emitPropertyChanges()
-{
- int properties = m_updateProperties;
- m_updateProperties = 0;
-
- if ((properties & ErrorProperty) && m_error != QMediaPlayer::NoError)
- emit error(m_error, m_errorString);
-
- if (properties & PlaybackRateProperty)
- emit playbackRateChanged(m_playbackRate);
-
- if (properties & StreamTypesProperty) {
- emit audioAvailableChanged(m_streamTypes & DirectShowPlayerService::AudioStream);
- emit videoAvailableChanged(m_streamTypes & DirectShowPlayerService::VideoStream);
- }
-
- if (properties & PositionProperty)
- emit positionChanged(m_position);
-
- if (properties & DurationProperty)
- emit durationChanged(m_duration);
-
- if (properties & SeekableProperty)
- emit seekableChanged(m_seekable);
-
- if (properties & StatusProperty)
- emit mediaStatusChanged(m_status);
-
- if (properties & StateProperty)
- emit stateChanged(m_state);
-}
-
-void DirectShowPlayerControl::scheduleUpdate(int properties)
-{
- if (m_updateProperties == 0)
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(PropertiesChanged)));
-
- m_updateProperties |= properties;
-}
-
-void DirectShowPlayerControl::updateState(QMediaPlayer::State state)
-{
- if (m_state != state) {
- m_state = state;
-
- scheduleUpdate(StateProperty);
- }
-}
-
-void DirectShowPlayerControl::updateStatus(QMediaPlayer::MediaStatus status)
-{
- if (m_status != status) {
- m_status = status;
-
- scheduleUpdate(StatusProperty);
- }
-}
-
-void DirectShowPlayerControl::updateMediaInfo(qint64 duration, int streamTypes, bool seekable)
-{
- int properties = 0;
-
- if (m_duration != duration) {
- m_duration = duration;
-
- properties |= DurationProperty;
- }
- if (m_streamTypes != streamTypes) {
- m_streamTypes = streamTypes;
-
- properties |= StreamTypesProperty;
- }
-
- if (m_seekable != seekable) {
- m_seekable = seekable;
-
- properties |= SeekableProperty;
- }
-
- if (properties != 0)
- scheduleUpdate(properties);
-}
-
-void DirectShowPlayerControl::updatePlaybackRate(qreal rate)
-{
- if (m_playbackRate != rate) {
- m_playbackRate = rate;
-
- scheduleUpdate(PlaybackRateProperty);
- }
-}
-
-void DirectShowPlayerControl::updateAudioOutput(IBaseFilter *filter)
-{
- if (m_audio)
- m_audio->Release();
-
- m_audio = com_cast<IBasicAudio>(filter, IID_IBasicAudio);
-}
-
-void DirectShowPlayerControl::updateError(QMediaPlayer::Error error, const QString &errorString)
-{
- m_error = error;
- m_errorString = errorString;
-
- if (m_error != QMediaPlayer::NoError)
- scheduleUpdate(ErrorProperty);
-}
-
-void DirectShowPlayerControl::updatePosition(qint64 position)
-{
- if (m_position != position) {
- m_position = position;
-
- scheduleUpdate(PositionProperty);
- }
-}
diff --git a/src/plugins/directshow/player/directshowplayercontrol.h b/src/plugins/directshow/player/directshowplayercontrol.h
deleted file mode 100644
index eee0867..0000000
--- a/src/plugins/directshow/player/directshowplayercontrol.h
+++ /dev/null
@@ -1,146 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWPLAYERCONTROL_H
-#define DIRECTSHOWPLAYERCONTROL_H
-
-#include "qmediacontent.h"
-#include "qmediaplayercontrol.h"
-
-#include <QtCore/qcoreevent.h>
-
-#include "directshowplayerservice.h"
-
-QT_USE_NAMESPACE
-
-class DirectShowPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- DirectShowPlayerControl(DirectShowPlayerService *service, QObject *parent = 0);
- ~DirectShowPlayerControl();
-
- QMediaPlayer::State state() const;
-
- QMediaPlayer::MediaStatus mediaStatus() const;
-
- qint64 duration() const;
-
- qint64 position() const;
- void setPosition(qint64 position);
-
- int volume() const;
- void setVolume(int volume);
-
- bool isMuted() const;
- void setMuted(bool muted);
-
- int bufferStatus() const;
-
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
-
- bool isSeekable() const;
-
- QMediaTimeRange availablePlaybackRanges() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent &media, QIODevice *stream);
-
- void play();
- void pause();
- void stop();
-
- void updateState(QMediaPlayer::State state);
- void updateStatus(QMediaPlayer::MediaStatus status);
- void updateMediaInfo(qint64 duration, int streamTypes, bool seekable);
- void updatePlaybackRate(qreal rate);
- void updateAudioOutput(IBaseFilter *filter);
- void updateError(QMediaPlayer::Error error, const QString &errorString);
- void updatePosition(qint64 position);
-
-protected:
- void customEvent(QEvent *event);
-
-private:
- enum Properties
- {
- StateProperty = 0x01,
- StatusProperty = 0x02,
- StreamTypesProperty = 0x04,
- DurationProperty = 0x08,
- PlaybackRateProperty = 0x10,
- SeekableProperty = 0x20,
- ErrorProperty = 0x40,
- PositionProperty = 0x80
- };
-
- enum Event
- {
- PropertiesChanged = QEvent::User
- };
-
- void scheduleUpdate(int properties);
- void emitPropertyChanges();
-
- DirectShowPlayerService *m_service;
- IBasicAudio *m_audio;
- QIODevice *m_stream;
- int m_updateProperties;
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_status;
- QMediaPlayer::Error m_error;
- int m_streamTypes;
- int m_muteVolume;
- qint64 m_position;
- qint64 m_duration;
- qreal m_playbackRate;
- bool m_seekable;
- QMediaContent m_media;
- QString m_errorString;
-
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowplayerservice.cpp b/src/plugins/directshow/player/directshowplayerservice.cpp
deleted file mode 100644
index 2ba142c..0000000
--- a/src/plugins/directshow/player/directshowplayerservice.cpp
+++ /dev/null
@@ -1,1408 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowplayerservice.h"
-
-#include "directshowaudioendpointcontrol.h"
-#include "directshowiosource.h"
-#include "directshowmetadatacontrol.h"
-#include "directshowplayercontrol.h"
-#include "directshowvideorenderercontrol.h"
-#ifndef Q_WS_SIMULATOR
-#include "vmr9videowindowcontrol.h"
-#endif
-
-#include "qmediacontent.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qvarlengtharray.h>
-
-Q_GLOBAL_STATIC(DirectShowEventLoop, qt_directShowEventLoop)
-
-
-// QMediaPlayer uses millisecond time units, direct show uses 100 nanosecond units.
-static const int qt_directShowTimeScale = 10000;
-
-class DirectShowPlayerServiceThread : public QThread
-{
-public:
- DirectShowPlayerServiceThread(DirectShowPlayerService *service)
- : m_service(service)
- {
- }
-
-protected:
- void run() { m_service->run(); }
-
-private:
- DirectShowPlayerService *m_service;
-};
-
-DirectShowPlayerService::DirectShowPlayerService(QObject *parent)
- : QMediaService(parent)
- , m_playerControl(0)
- , m_metaDataControl(0)
- , m_videoRendererControl(0)
-#ifndef Q_WS_SIMULATOR
- , m_videoWindowControl(0)
-#endif
- , m_audioEndpointControl(0)
- , m_taskThread(0)
- , m_loop(qt_directShowEventLoop())
- , m_pendingTasks(0)
- , m_executingTask(0)
- , m_executedTasks(0)
- , m_taskHandle(::CreateEvent(0, 0, 0, 0))
- , m_eventHandle(0)
- , m_graphStatus(NoMedia)
- , m_stream(0)
- , m_graph(0)
- , m_source(0)
- , m_audioOutput(0)
- , m_videoOutput(0)
- , m_rate(1.0)
- , m_position(0)
- , m_duration(0)
- , m_buffering(false)
- , m_seekable(false)
- , m_atEnd(false)
-{
- CoInitialize(NULL);
- m_playerControl = new DirectShowPlayerControl(this);
- m_metaDataControl = new DirectShowMetaDataControl(this);
- m_audioEndpointControl = new DirectShowAudioEndpointControl(this);
-
- m_taskThread = new DirectShowPlayerServiceThread(this);
- m_taskThread->start();
-}
-
-DirectShowPlayerService::~DirectShowPlayerService()
-{
- {
- QMutexLocker locker(&m_mutex);
-
- releaseGraph();
-
- m_pendingTasks = Shutdown;
- ::SetEvent(m_taskHandle);
- }
-
- m_taskThread->wait();
- delete m_taskThread;
-
- if (m_audioOutput) {
- m_audioOutput->Release();
- m_audioOutput = 0;
- }
-
- if (m_videoOutput) {
- m_videoOutput->Release();
- m_videoOutput = 0;
- }
-
- delete m_playerControl;
- delete m_audioEndpointControl;
- delete m_metaDataControl;
- delete m_videoRendererControl;
-#ifndef Q_WS_SIMULATOR
- delete m_videoWindowControl;
-#endif
-
- ::CloseHandle(m_taskHandle);
- CoUninitialize();
-}
-
-QMediaControl *DirectShowPlayerService::requestControl(const char *name)
-{
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0) {
- return m_playerControl;
- } else if (qstrcmp(name, QAudioEndpointSelector_iid) == 0) {
- return m_audioEndpointControl;
- } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
- return m_metaDataControl;
- } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
-#ifndef Q_WS_SIMULATOR
- if (!m_videoRendererControl && !m_videoWindowControl) {
-#else
- if (!m_videoRendererControl) {
-#endif
- m_videoRendererControl = new DirectShowVideoRendererControl(m_loop);
-
- connect(m_videoRendererControl, SIGNAL(filterChanged()),
- this, SLOT(videoOutputChanged()));
-
- return m_videoRendererControl;
- }
-#ifndef Q_WS_SIMULATOR
- } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- if (!m_videoRendererControl && !m_videoWindowControl) {
- m_videoWindowControl = new Vmr9VideoWindowControl;
-
- setVideoOutput(m_videoWindowControl->filter());
-
- return m_videoWindowControl;
- }
-#endif
- }
- return 0;
-}
-
-void DirectShowPlayerService::releaseControl(QMediaControl *control)
-{
- if (!control) {
- qWarning("QMediaService::releaseControl():"
- " Attempted release of null control");
- } else if (control == m_videoRendererControl) {
- setVideoOutput(0);
-
- delete m_videoRendererControl;
-
- m_videoRendererControl = 0;
-#ifndef Q_WS_SIMULATOR
- } else if (control == m_videoWindowControl) {
- setVideoOutput(0);
-
- delete m_videoWindowControl;
-
- m_videoWindowControl = 0;
-#endif
- }
-}
-
-void DirectShowPlayerService::load(const QMediaContent &media, QIODevice *stream)
-{
- QMutexLocker locker(&m_mutex);
-
- m_pendingTasks = 0;
-
- if (m_graph)
- releaseGraph();
-
- m_resources = media.resources();
- m_stream = stream;
- m_error = QMediaPlayer::NoError;
- m_errorString = QString();
- m_position = 0;
- m_duration = 0;
- m_streamTypes = 0;
- m_executedTasks = 0;
- m_buffering = false;
- m_seekable = false;
- m_atEnd = false;
- m_metaDataControl->updateGraph(0, 0);
-
- if (m_resources.isEmpty() && !stream) {
- m_pendingTasks = 0;
- m_graphStatus = NoMedia;
-
- m_url.clear();
- } else if (stream && (!stream->isReadable() || stream->isSequential())) {
- m_pendingTasks = 0;
- m_graphStatus = InvalidMedia;
- m_error = QMediaPlayer::ResourceError;
- } else {
- // {36b73882-c2c8-11cf-8b46-00805f6cef60}
- static const GUID iid_IFilterGraph2 = {
- 0x36b73882, 0xc2c8, 0x11cf, {0x8b, 0x46, 0x00, 0x80, 0x5f, 0x6c, 0xef, 0x60} };
- m_graphStatus = Loading;
-
- m_graph = com_new<IFilterGraph2>(CLSID_FilterGraph, iid_IFilterGraph2);
-
- if (stream)
- m_pendingTasks = SetStreamSource;
- else
- m_pendingTasks = SetUrlSource;
-
- ::SetEvent(m_taskHandle);
- }
-
- m_playerControl->updateError(m_error, m_errorString);
- m_playerControl->updateMediaInfo(m_duration, m_streamTypes, m_seekable);
- m_playerControl->updateState(QMediaPlayer::StoppedState);
- m_playerControl->updatePosition(m_position);
- updateStatus();
-}
-
-void DirectShowPlayerService::doSetUrlSource(QMutexLocker *locker)
-{
- IBaseFilter *source = 0;
-
- QMediaResource resource = m_resources.takeFirst();
- QUrl url = resource.url();
-
- HRESULT hr = E_FAIL;
-
- if (url.scheme() == QLatin1String("http") || url.scheme() == QLatin1String("https")) {
- static const GUID clsid_WMAsfReader = {
- 0x187463a0, 0x5bb7, 0x11d3, {0xac, 0xbe, 0x00, 0x80, 0xc7, 0x5e, 0x24, 0x6e} };
-
- // {56a868a6-0ad4-11ce-b03a-0020af0ba770}
- static const GUID iid_IFileSourceFilter = {
- 0x56a868a6, 0x0ad4, 0x11ce, {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
-
- if (IFileSourceFilter *fileSource = com_new<IFileSourceFilter>(
- clsid_WMAsfReader, iid_IFileSourceFilter)) {
- locker->unlock();
- hr = fileSource->Load(reinterpret_cast<const OLECHAR *>(url.toString().utf16()), 0);
-
- if (SUCCEEDED(hr)) {
- source = com_cast<IBaseFilter>(fileSource, IID_IBaseFilter);
-
- if (!SUCCEEDED(hr = m_graph->AddFilter(source, L"Source")) && source) {
- source->Release();
- source = 0;
- }
- }
- fileSource->Release();
- locker->relock();
- }
- } else if (url.scheme() == QLatin1String("qrc")) {
- DirectShowRcSource *rcSource = new DirectShowRcSource(m_loop);
-
- locker->unlock();
- if (rcSource->open(url) && SUCCEEDED(hr = m_graph->AddFilter(rcSource, L"Source")))
- source = rcSource;
- else
- rcSource->Release();
- locker->relock();
- }
-
- if (!SUCCEEDED(hr)) {
- locker->unlock();
- hr = m_graph->AddSourceFilter(
- reinterpret_cast<const OLECHAR *>(url.toString().utf16()), L"Source", &source);
- locker->relock();
- }
-
- if (SUCCEEDED(hr)) {
- m_executedTasks = SetSource;
- m_pendingTasks |= Render;
-
- if (m_audioOutput)
- m_pendingTasks |= SetAudioOutput;
- if (m_videoOutput)
- m_pendingTasks |= SetVideoOutput;
-
- if (m_rate != 1.0)
- m_pendingTasks |= SetRate;
-
- m_source = source;
- } else if (!m_resources.isEmpty()) {
- m_pendingTasks |= SetUrlSource;
- } else {
- m_pendingTasks = 0;
- m_graphStatus = InvalidMedia;
-
- switch (hr) {
- case VFW_E_UNKNOWN_FILE_TYPE:
- m_error = QMediaPlayer::FormatError;
- m_errorString = QString();
- break;
- case E_OUTOFMEMORY:
- case VFW_E_CANNOT_LOAD_SOURCE_FILTER:
- case VFW_E_NOT_FOUND:
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- break;
- default:
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- qWarning("DirectShowPlayerService::doSetUrlSource: Unresolved error code %x", uint(hr));
- break;
- }
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
- }
-}
-
-void DirectShowPlayerService::doSetStreamSource(QMutexLocker *locker)
-{
- DirectShowIOSource *source = new DirectShowIOSource(m_loop);
- source->setDevice(m_stream);
-
- if (SUCCEEDED(m_graph->AddFilter(source, L"Source"))) {
- m_executedTasks = SetSource;
- m_pendingTasks |= Render;
-
- if (m_audioOutput)
- m_pendingTasks |= SetAudioOutput;
- if (m_videoOutput)
- m_pendingTasks |= SetVideoOutput;
-
- if (m_rate != 1.0)
- m_pendingTasks |= SetRate;
-
- m_source = source;
- } else {
- source->Release();
-
- m_pendingTasks = 0;
- m_graphStatus = InvalidMedia;
-
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
- }
-}
-
-void DirectShowPlayerService::doRender(QMutexLocker *locker)
-{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
-
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- control->Stop();
- control->Release();
- }
-
- if (m_pendingTasks & SetAudioOutput) {
- m_graph->AddFilter(m_audioOutput, L"AudioOutput");
-
- m_pendingTasks ^= SetAudioOutput;
- m_executedTasks |= SetAudioOutput;
- }
- if (m_pendingTasks & SetVideoOutput) {
- m_graph->AddFilter(m_videoOutput, L"VideoOutput");
-
- m_pendingTasks ^= SetVideoOutput;
- m_executedTasks |= SetVideoOutput;
- }
-
- IFilterGraph2 *graph = m_graph;
- graph->AddRef();
-
- QVarLengthArray<IBaseFilter *, 16> filters;
- m_source->AddRef();
- filters.append(m_source);
-
- bool rendered = false;
-
- HRESULT renderHr = S_OK;
-
- while (!filters.isEmpty()) {
- IEnumPins *pins = 0;
- IBaseFilter *filter = filters[filters.size() - 1];
- filters.removeLast();
-
- if (!(m_pendingTasks & ReleaseFilters) && SUCCEEDED(filter->EnumPins(&pins))) {
- int outputs = 0;
- for (IPin *pin = 0; pins->Next(1, &pin, 0) == S_OK; pin->Release()) {
- PIN_DIRECTION direction;
- if (pin->QueryDirection(&direction) == S_OK && direction == PINDIR_OUTPUT) {
- ++outputs;
-
- IPin *peer = 0;
- if (pin->ConnectedTo(&peer) == S_OK) {
- PIN_INFO peerInfo;
- if (SUCCEEDED(peer->QueryPinInfo(&peerInfo)))
- filters.append(peerInfo.pFilter);
- peer->Release();
- } else {
- locker->unlock();
- HRESULT hr;
- if (SUCCEEDED(hr = graph->RenderEx(
- pin, /*AM_RENDEREX_RENDERTOEXISTINGRENDERERS*/ 1, 0))) {
- rendered = true;
- } else if (renderHr == S_OK || renderHr == VFW_E_NO_DECOMPRESSOR){
- renderHr = hr;
- }
- locker->relock();
- }
- }
- }
-
- pins->Release();
-
- if (outputs == 0)
- rendered = true;
- }
- filter->Release();
- }
-
- if (m_audioOutput && !isConnected(m_audioOutput, PINDIR_INPUT)) {
- graph->RemoveFilter(m_audioOutput);
-
- m_executedTasks &= ~SetAudioOutput;
- }
-
- if (m_videoOutput && !isConnected(m_videoOutput, PINDIR_INPUT)) {
- graph->RemoveFilter(m_videoOutput);
-
- m_executedTasks &= ~SetVideoOutput;
- }
-
- graph->Release();
-
- if (!(m_pendingTasks & ReleaseFilters)) {
- if (rendered) {
- if (!(m_executedTasks & FinalizeLoad))
- m_pendingTasks |= FinalizeLoad;
- } else {
- m_pendingTasks = 0;
-
- m_graphStatus = InvalidMedia;
-
- if (!m_audioOutput && !m_videoOutput) {
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- } else {
- switch (renderHr) {
- case VFW_E_UNSUPPORTED_AUDIO:
- case VFW_E_UNSUPPORTED_VIDEO:
- case VFW_E_UNSUPPORTED_STREAM:
- m_error = QMediaPlayer::FormatError;
- m_errorString = QString();
- break;
- default:
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- qWarning("DirectShowPlayerService::doRender: Unresolved error code %x",
- uint(renderHr));
- }
- }
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
- }
-
- m_executedTasks |= Render;
- }
-
- m_loop->wake();
-}
-
-void DirectShowPlayerService::doFinalizeLoad(QMutexLocker *locker)
-{
- if (m_graphStatus != Loaded) {
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
- event->GetEventHandle(reinterpret_cast<OAEVENT *>(&m_eventHandle));
- event->Release();
- }
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG duration = 0;
- seeking->GetDuration(&duration);
- m_duration = duration / qt_directShowTimeScale;
-
- DWORD capabilities = 0;
- seeking->GetCapabilities(&capabilities);
- m_seekable = capabilities & AM_SEEKING_CanSeekAbsolute;
-
- seeking->Release();
- }
- }
-
- if ((m_executedTasks & SetOutputs) == SetOutputs) {
- m_streamTypes = AudioStream | VideoStream;
- } else {
- m_streamTypes = findStreamTypes(m_source);
- }
-
- m_executedTasks |= FinalizeLoad;
-
- m_graphStatus = Loaded;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(FinalizedLoad)));
-}
-
-void DirectShowPlayerService::releaseGraph()
-{
- if (m_graph) {
- if (m_executingTask != 0) {
- // {8E1C39A1-DE53-11cf-AA63-0080C744528D}
- static const GUID iid_IAMOpenProgress = {
- 0x8E1C39A1, 0xDE53, 0x11cf, {0xAA, 0x63, 0x00, 0x80, 0xC7, 0x44, 0x52, 0x8D} };
-
- if (IAMOpenProgress *progress = com_cast<IAMOpenProgress>(
- m_graph, iid_IAMOpenProgress)) {
- progress->AbortOperation();
- progress->Release();
- }
- m_graph->Abort();
- }
-
- m_pendingTasks = ReleaseGraph;
-
- ::SetEvent(m_taskHandle);
-
- m_loop->wait(&m_mutex);
- }
-}
-
-void DirectShowPlayerService::doReleaseGraph(QMutexLocker *locker)
-{
- Q_UNUSED(locker);
-
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- control->Stop();
- control->Release();
- }
-
- if (m_source) {
- m_source->Release();
- m_source = 0;
- }
-
- m_eventHandle = 0;
-
- m_graph->Release();
- m_graph = 0;
-
- m_loop->wake();
-}
-
-int DirectShowPlayerService::findStreamTypes(IBaseFilter *source) const
-{
- QVarLengthArray<IBaseFilter *, 16> filters;
- source->AddRef();
- filters.append(source);
-
- int streamTypes = 0;
-
- while (!filters.isEmpty()) {
- IEnumPins *pins = 0;
- IBaseFilter *filter = filters[filters.size() - 1];
- filters.removeLast();
-
- if (SUCCEEDED(filter->EnumPins(&pins))) {
- for (IPin *pin = 0; pins->Next(1, &pin, 0) == S_OK; pin->Release()) {
- PIN_DIRECTION direction;
- if (pin->QueryDirection(&direction) == S_OK && direction == PINDIR_OUTPUT) {
- AM_MEDIA_TYPE connectionType;
- if (SUCCEEDED(pin->ConnectionMediaType(&connectionType))) {
- IPin *peer = 0;
-
- if (connectionType.majortype == MEDIATYPE_Audio) {
- streamTypes |= AudioStream;
- } else if (connectionType.majortype == MEDIATYPE_Video) {
- streamTypes |= VideoStream;
- } else if (SUCCEEDED(pin->ConnectedTo(&peer))) {
- PIN_INFO peerInfo;
- if (SUCCEEDED(peer->QueryPinInfo(&peerInfo)))
- filters.append(peerInfo.pFilter);
- peer->Release();
- }
- } else {
- streamTypes |= findStreamType(pin);
- }
- }
- }
- }
- filter->Release();
- }
- return streamTypes;
-}
-
-int DirectShowPlayerService::findStreamType(IPin *pin) const
-{
- IEnumMediaTypes *types;
-
- if (SUCCEEDED(pin->EnumMediaTypes(&types))) {
- bool video = false;
- bool audio = false;
- bool other = false;
-
- for (AM_MEDIA_TYPE *type = 0;
- types->Next(1, &type, 0) == S_OK;
- DirectShowMediaType::deleteType(type)) {
- if (type->majortype == MEDIATYPE_Audio)
- audio = true;
- else if (type->majortype == MEDIATYPE_Video)
- video = true;
- else
- other = true;
- }
- types->Release();
-
- if (other)
- return 0;
- else if (audio && !video)
- return AudioStream;
- else if (!audio && video)
- return VideoStream;
- else
- return 0;
- } else {
- return 0;
- }
-}
-
-void DirectShowPlayerService::play()
-{
- QMutexLocker locker(&m_mutex);
-
- m_pendingTasks &= ~Pause;
- m_pendingTasks |= Play;
-
- if (m_executedTasks & Render) {
- if (m_executedTasks & Stop) {
- m_atEnd = false;
- m_position = 0;
- m_pendingTasks |= Seek;
- m_executedTasks ^= Stop;
- }
-
- ::SetEvent(m_taskHandle);
- }
-
- updateStatus();
-}
-
-void DirectShowPlayerService::doPlay(QMutexLocker *locker)
-{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- locker->unlock();
- HRESULT hr = control->Run();
- locker->relock();
-
- control->Release();
-
- if (SUCCEEDED(hr)) {
- m_executedTasks |= Play;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
- } else {
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- qWarning("DirectShowPlayerService::doPlay: Unresolved error code %x", uint(hr));
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
- }
- }
-}
-
-void DirectShowPlayerService::pause()
-{
- QMutexLocker locker(&m_mutex);
-
- m_pendingTasks &= ~Play;
- m_pendingTasks |= Pause;
-
- if (m_executedTasks & Render) {
- if (m_executedTasks & Stop) {
- m_atEnd = false;
- m_position = 0;
- m_pendingTasks |= Seek;
- m_executedTasks ^= Stop;
- }
-
- ::SetEvent(m_taskHandle);
- }
-
- updateStatus();
-}
-
-void DirectShowPlayerService::doPause(QMutexLocker *locker)
-{
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- locker->unlock();
- HRESULT hr = control->Pause();
- locker->relock();
-
- control->Release();
-
- if (SUCCEEDED(hr)) {
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG position = 0;
-
- seeking->GetCurrentPosition(&position);
- seeking->Release();
-
- m_position = position / qt_directShowTimeScale;
- } else {
- m_position = 0;
- }
-
- m_executedTasks |= Pause;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
- } else {
- m_error = QMediaPlayer::ResourceError;
- m_errorString = QString();
- qWarning("DirectShowPlayerService::doPause: Unresolved error code %x", uint(hr));
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(Error)));
- }
- }
-}
-
-void DirectShowPlayerService::stop()
-{
- QMutexLocker locker(&m_mutex);
-
- m_pendingTasks &= ~(Play | Pause | Seek);
-
- if ((m_executingTask | m_executedTasks) & (Play | Pause | Seek)) {
- m_pendingTasks |= Stop;
-
- ::SetEvent(m_taskHandle);
-
- m_loop->wait(&m_mutex);
- }
-
- updateStatus();
-}
-
-void DirectShowPlayerService::doStop(QMutexLocker *locker)
-{
- if (m_executedTasks & (Play | Pause)) {
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- control->Stop();
- control->Release();
- }
-
- m_position = 0;
- m_pendingTasks |= Seek;
-
- m_executedTasks &= ~(Play | Pause);
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
- }
-
- m_executedTasks |= Stop;
-
- m_loop->wake();
-}
-
-void DirectShowPlayerService::setRate(qreal rate)
-{
- QMutexLocker locker(&m_mutex);
-
- m_rate = rate;
-
- m_pendingTasks |= SetRate;
-
- if (m_executedTasks & FinalizeLoad)
- ::SetEvent(m_taskHandle);
-}
-
-void DirectShowPlayerService::doSetRate(QMutexLocker *locker)
-{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- // Cache current values as we can't query IMediaSeeking during a seek due to the
- // possibility of a deadlock when flushing the VideoSurfaceFilter.
- LONGLONG currentPosition = 0;
- seeking->GetCurrentPosition(&currentPosition);
- m_position = currentPosition / qt_directShowTimeScale;
-
- LONGLONG minimum = 0;
- LONGLONG maximum = 0;
- m_playbackRange = SUCCEEDED(seeking->GetAvailable(&minimum, &maximum))
- ? QMediaTimeRange(minimum / qt_directShowTimeScale, maximum / qt_directShowTimeScale)
- : QMediaTimeRange();
-
- locker->unlock();
- HRESULT hr = seeking->SetRate(m_rate);
- locker->relock();
-
- if (!SUCCEEDED(hr)) {
- double rate = 0.0;
- m_rate = seeking->GetRate(&rate)
- ? rate
- : 1.0;
- }
-
- seeking->Release();
- } else if (m_rate != 1.0) {
- m_rate = 1.0;
- }
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(RateChange)));
-}
-
-qint64 DirectShowPlayerService::position() const
-{
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
-
- if (m_graphStatus == Loaded) {
- if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek)) {
- return m_position;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG position = 0;
-
- seeking->GetCurrentPosition(&position);
- seeking->Release();
-
- const_cast<qint64 &>(m_position) = position / qt_directShowTimeScale;
-
- return m_position;
- }
- }
- return 0;
-}
-
-QMediaTimeRange DirectShowPlayerService::availablePlaybackRanges() const
-{
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
-
- if (m_graphStatus == Loaded) {
- if (m_executingTask == Seek || m_executingTask == SetRate || (m_pendingTasks & Seek)) {
- return m_playbackRange;
- } else if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG minimum = 0;
- LONGLONG maximum = 0;
-
- HRESULT hr = seeking->GetAvailable(&minimum, &maximum);
- seeking->Release();
-
- if (SUCCEEDED(hr))
- return QMediaTimeRange(minimum, maximum);
- }
- }
- return QMediaTimeRange();
-}
-
-void DirectShowPlayerService::seek(qint64 position)
-{
- QMutexLocker locker(&m_mutex);
-
- m_position = position;
-
- m_pendingTasks |= Seek;
-
- if (m_executedTasks & FinalizeLoad)
- ::SetEvent(m_taskHandle);
-}
-
-void DirectShowPlayerService::doSeek(QMutexLocker *locker)
-{
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG seekPosition = LONGLONG(m_position) * qt_directShowTimeScale;
-
- // Cache current values as we can't query IMediaSeeking during a seek due to the
- // possibility of a deadlock when flushing the VideoSurfaceFilter.
- LONGLONG currentPosition = 0;
- seeking->GetCurrentPosition(&currentPosition);
- m_position = currentPosition / qt_directShowTimeScale;
-
- LONGLONG minimum = 0;
- LONGLONG maximum = 0;
- m_playbackRange = SUCCEEDED(seeking->GetAvailable(&minimum, &maximum))
- ? QMediaTimeRange(
- minimum / qt_directShowTimeScale, maximum / qt_directShowTimeScale)
- : QMediaTimeRange();
-
- locker->unlock();
- seeking->SetPositions(
- &seekPosition, AM_SEEKING_AbsolutePositioning, 0, AM_SEEKING_NoPositioning);
- locker->relock();
-
- seeking->GetCurrentPosition(&currentPosition);
- m_position = currentPosition / qt_directShowTimeScale;
-
- seeking->Release();
- } else {
- m_position = 0;
- }
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(PositionChange)));
-}
-
-int DirectShowPlayerService::bufferStatus() const
-{
-#ifndef QT_NO_WMSDK
- QMutexLocker locker(const_cast<QMutex *>(&m_mutex));
-
- if (IWMReaderAdvanced2 *reader = com_cast<IWMReaderAdvanced2>(
- m_source, IID_IWMReaderAdvanced2)) {
- DWORD percentage = 0;
-
- reader->GetBufferProgress(&percentage, 0);
- reader->Release();
-
- return percentage;
- } else {
- return 0;
- }
-#else
- return 0;
-#endif
-}
-
-void DirectShowPlayerService::setAudioOutput(IBaseFilter *filter)
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_graph) {
- if (m_audioOutput) {
- if (m_executedTasks & SetAudioOutput) {
- m_pendingTasks |= ReleaseAudioOutput;
-
- ::SetEvent(m_taskHandle);
-
- m_loop->wait(&m_mutex);
- }
- m_audioOutput->Release();
- }
-
- m_audioOutput = filter;
-
- if (m_audioOutput) {
- m_audioOutput->AddRef();
-
- m_pendingTasks |= SetAudioOutput;
-
- if (m_executedTasks & SetSource) {
- m_pendingTasks |= Render;
-
- ::SetEvent(m_taskHandle);
- }
- } else {
- m_pendingTasks &= ~ SetAudioOutput;
- }
- } else {
- if (m_audioOutput)
- m_audioOutput->Release();
-
- m_audioOutput = filter;
-
- if (m_audioOutput)
- m_audioOutput->AddRef();
- }
-
- m_playerControl->updateAudioOutput(m_audioOutput);
-}
-
-void DirectShowPlayerService::doReleaseAudioOutput(QMutexLocker *locker)
-{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
-
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- control->Stop();
- control->Release();
- }
-
- IBaseFilter *decoder = getConnected(m_audioOutput, PINDIR_INPUT);
- if (!decoder) {
- decoder = m_audioOutput;
- decoder->AddRef();
- }
-
- // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
- static const GUID iid_IFilterChain = {
- 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
-
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
- chain->RemoveChain(decoder, m_audioOutput);
- chain->Release();
- } else {
- m_graph->RemoveFilter(m_audioOutput);
- }
-
- decoder->Release();
-
- m_executedTasks &= ~SetAudioOutput;
-
- m_loop->wake();
-}
-
-void DirectShowPlayerService::setVideoOutput(IBaseFilter *filter)
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_graph) {
- if (m_videoOutput) {
- if (m_executedTasks & SetVideoOutput) {
- m_pendingTasks |= ReleaseVideoOutput;
-
- ::SetEvent(m_taskHandle);
-
- m_loop->wait(&m_mutex);
- }
- m_videoOutput->Release();
- }
-
- m_videoOutput = filter;
-
- if (m_videoOutput) {
- m_videoOutput->AddRef();
-
- m_pendingTasks |= SetVideoOutput;
-
- if (m_executedTasks & SetSource) {
- m_pendingTasks |= Render;
-
- ::SetEvent(m_taskHandle);
- }
- }
- } else {
- if (m_videoOutput)
- m_videoOutput->Release();
-
- m_videoOutput = filter;
-
- if (m_videoOutput)
- m_videoOutput->AddRef();
- }
-}
-
-void DirectShowPlayerService::doReleaseVideoOutput(QMutexLocker *locker)
-{
- m_pendingTasks |= m_executedTasks & (Play | Pause);
-
- if (IMediaControl *control = com_cast<IMediaControl>(m_graph, IID_IMediaControl)) {
- control->Stop();
- control->Release();
- }
-
- IBaseFilter *intermediate = 0;
- if (!SUCCEEDED(m_graph->FindFilterByName(L"Color Space Converter", &intermediate))) {
- intermediate = m_videoOutput;
- intermediate->AddRef();
- }
-
- IBaseFilter *decoder = getConnected(intermediate, PINDIR_INPUT);
- if (!decoder) {
- decoder = intermediate;
- decoder->AddRef();
- }
-
- // {DCFBDCF6-0DC2-45f5-9AB2-7C330EA09C29}
- static const GUID iid_IFilterChain = {
- 0xDCFBDCF6, 0x0DC2, 0x45f5, {0x9A, 0xB2, 0x7C, 0x33, 0x0E, 0xA0, 0x9C, 0x29} };
-
- if (IFilterChain *chain = com_cast<IFilterChain>(m_graph, iid_IFilterChain)) {
- chain->RemoveChain(decoder, m_videoOutput);
- chain->Release();
- } else {
- m_graph->RemoveFilter(m_videoOutput);
- }
-
- intermediate->Release();
- decoder->Release();
-
- m_executedTasks &= ~SetVideoOutput;
-
- m_loop->wake();
-}
-
-void DirectShowPlayerService::customEvent(QEvent *event)
-{
- if (event->type() == QEvent::Type(FinalizedLoad)) {
- QMutexLocker locker(&m_mutex);
-
- m_playerControl->updateMediaInfo(m_duration, m_streamTypes, m_seekable);
- m_metaDataControl->updateGraph(m_graph, m_source);
-
- updateStatus();
- } else if (event->type() == QEvent::Type(Error)) {
- QMutexLocker locker(&m_mutex);
-
- if (m_error != QMediaPlayer::NoError) {
- m_playerControl->updateError(m_error, m_errorString);
- m_playerControl->updateMediaInfo(m_duration, m_streamTypes, m_seekable);
- m_playerControl->updateState(QMediaPlayer::StoppedState);
- updateStatus();
- }
- } else if (event->type() == QEvent::Type(RateChange)) {
- QMutexLocker locker(&m_mutex);
-
- m_playerControl->updatePlaybackRate(m_rate);
- } else if (event->type() == QEvent::Type(StatusChange)) {
- QMutexLocker locker(&m_mutex);
-
- updateStatus();
- m_playerControl->updatePosition(m_position);
- } else if (event->type() == QEvent::Type(DurationChange)) {
- QMutexLocker locker(&m_mutex);
-
- m_playerControl->updateMediaInfo(m_duration, m_streamTypes, m_seekable);
- } else if (event->type() == QEvent::Type(EndOfMedia)) {
- QMutexLocker locker(&m_mutex);
-
- if (m_atEnd) {
- m_playerControl->updateState(QMediaPlayer::StoppedState);
- m_playerControl->updateStatus(QMediaPlayer::EndOfMedia);
- m_playerControl->updatePosition(m_position);
- }
- } else if (event->type() == QEvent::Type(PositionChange)) {
- QMutexLocker locker(&m_mutex);
-
- if (m_playerControl->mediaStatus() == QMediaPlayer::EndOfMedia)
- m_playerControl->updateStatus(QMediaPlayer::LoadedMedia);
- m_playerControl->updatePosition(m_position);
- } else {
- QMediaService::customEvent(event);
- }
-}
-
-void DirectShowPlayerService::videoOutputChanged()
-{
- setVideoOutput(m_videoRendererControl->filter());
-}
-
-void DirectShowPlayerService::graphEvent(QMutexLocker *locker)
-{
- if (IMediaEvent *event = com_cast<IMediaEvent>(m_graph, IID_IMediaEvent)) {
- long eventCode;
- LONG_PTR param1;
- LONG_PTR param2;
-
- while (event->GetEvent(&eventCode, &param1, &param2, 0) == S_OK) {
- switch (eventCode) {
- case EC_BUFFERING_DATA:
- m_buffering = param1;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(StatusChange)));
- break;
- case EC_COMPLETE:
- m_executedTasks &= ~(Play | Pause);
- m_executedTasks |= Stop;
-
- m_buffering = false;
- m_atEnd = true;
-
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG position = 0;
-
- seeking->GetCurrentPosition(&position);
- seeking->Release();
-
- m_position = position / qt_directShowTimeScale;
- }
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(EndOfMedia)));
- break;
- case EC_LENGTH_CHANGED:
- if (IMediaSeeking *seeking = com_cast<IMediaSeeking>(m_graph, IID_IMediaSeeking)) {
- LONGLONG duration = 0;
- seeking->GetDuration(&duration);
- m_duration = duration / qt_directShowTimeScale;
-
- DWORD capabilities = 0;
- seeking->GetCapabilities(&capabilities);
- m_seekable = capabilities & AM_SEEKING_CanSeekAbsolute;
-
- seeking->Release();
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::Type(DurationChange)));
- }
- break;
- default:
- break;
- }
-
- event->FreeEventParams(eventCode, param1, param2);
- }
- event->Release();
- }
-}
-
-void DirectShowPlayerService::updateStatus()
-{
- switch (m_graphStatus) {
- case NoMedia:
- m_playerControl->updateStatus(QMediaPlayer::NoMedia);
- break;
- case Loading:
- m_playerControl->updateStatus(QMediaPlayer::LoadingMedia);
- break;
- case Loaded:
- if ((m_pendingTasks | m_executingTask | m_executedTasks) & (Play | Pause)) {
- if (m_buffering)
- m_playerControl->updateStatus(QMediaPlayer::BufferingMedia);
- else
- m_playerControl->updateStatus(QMediaPlayer::BufferedMedia);
- } else {
- m_playerControl->updateStatus(QMediaPlayer::LoadedMedia);
- }
- break;
- case InvalidMedia:
- m_playerControl->updateStatus(QMediaPlayer::InvalidMedia);
- break;
- default:
- m_playerControl->updateStatus(QMediaPlayer::UnknownMediaStatus);
- }
-}
-
-bool DirectShowPlayerService::isConnected(IBaseFilter *filter, PIN_DIRECTION direction) const
-{
- bool connected = false;
-
- IEnumPins *pins = 0;
-
- if (SUCCEEDED(filter->EnumPins(&pins))) {
- for (IPin *pin = 0; pins->Next(1, &pin, 0) == S_OK; pin->Release()) {
- PIN_DIRECTION dir;
- if (SUCCEEDED(pin->QueryDirection(&dir)) && dir == direction) {
- IPin *peer = 0;
- if (SUCCEEDED(pin->ConnectedTo(&peer))) {
- connected = true;
-
- peer->Release();
- }
- }
- }
- pins->Release();
- }
- return connected;
-}
-
-IBaseFilter *DirectShowPlayerService::getConnected(
- IBaseFilter *filter, PIN_DIRECTION direction) const
-{
- IBaseFilter *connected = 0;
-
- IEnumPins *pins = 0;
-
- if (SUCCEEDED(filter->EnumPins(&pins))) {
- for (IPin *pin = 0; pins->Next(1, &pin, 0) == S_OK; pin->Release()) {
- PIN_DIRECTION dir;
- if (SUCCEEDED(pin->QueryDirection(&dir)) && dir == direction) {
- IPin *peer = 0;
- if (SUCCEEDED(pin->ConnectedTo(&peer))) {
- PIN_INFO info;
-
- if (SUCCEEDED(peer->QueryPinInfo(&info))) {
- if (connected) {
- qWarning("DirectShowPlayerService::getConnected: "
- "Multiple connected filters");
- connected->Release();
- }
- connected = info.pFilter;
- }
- peer->Release();
- }
- }
- }
- pins->Release();
- }
- return connected;
-}
-
-void DirectShowPlayerService::run()
-{
- QMutexLocker locker(&m_mutex);
-
- for (;;) {
- ::ResetEvent(m_taskHandle);
-
- while (m_pendingTasks == 0) {
- DWORD result = 0;
-
- locker.unlock();
- if (m_eventHandle) {
- HANDLE handles[] = { m_taskHandle, m_eventHandle };
-
- result = ::WaitForMultipleObjects(2, handles, false, INFINITE);
- } else {
- result = ::WaitForSingleObject(m_taskHandle, INFINITE);
- }
- locker.relock();
-
- if (result == WAIT_OBJECT_0 + 1) {
- graphEvent(&locker);
- }
- }
-
- if (m_pendingTasks & ReleaseGraph) {
- m_pendingTasks ^= ReleaseGraph;
- m_executingTask = ReleaseGraph;
-
- doReleaseGraph(&locker);
- //if the graph is released, we should not process other operations later
- if (m_pendingTasks & Shutdown) {
- m_pendingTasks = 0;
- return;
- }
- m_pendingTasks = 0;
- } else if (m_pendingTasks & Shutdown) {
- return;
- } else if (m_pendingTasks & ReleaseAudioOutput) {
- m_pendingTasks ^= ReleaseAudioOutput;
- m_executingTask = ReleaseAudioOutput;
-
- doReleaseAudioOutput(&locker);
- } else if (m_pendingTasks & ReleaseVideoOutput) {
- m_pendingTasks ^= ReleaseVideoOutput;
- m_executingTask = ReleaseVideoOutput;
-
- doReleaseVideoOutput(&locker);
- } else if (m_pendingTasks & SetUrlSource) {
- m_pendingTasks ^= SetUrlSource;
- m_executingTask = SetUrlSource;
-
- doSetUrlSource(&locker);
- } else if (m_pendingTasks & SetStreamSource) {
- m_pendingTasks ^= SetStreamSource;
- m_executingTask = SetStreamSource;
-
- doSetStreamSource(&locker);
- } else if (m_pendingTasks & Render) {
- m_pendingTasks ^= Render;
- m_executingTask = Render;
-
- doRender(&locker);
- } else if (!(m_executedTasks & Render)) {
- m_pendingTasks &= ~(FinalizeLoad | SetRate | Stop | Pause | Seek | Play);
- } else if (m_pendingTasks & FinalizeLoad) {
- m_pendingTasks ^= FinalizeLoad;
- m_executingTask = FinalizeLoad;
-
- doFinalizeLoad(&locker);
- } else if (m_pendingTasks & Stop) {
- m_pendingTasks ^= Stop;
- m_executingTask = Stop;
-
- doStop(&locker);
- } else if (m_pendingTasks & SetRate) {
- m_pendingTasks ^= SetRate;
- m_executingTask = SetRate;
-
- doSetRate(&locker);
- } else if (m_pendingTasks & Pause) {
- m_pendingTasks ^= Pause;
- m_executingTask = Pause;
-
- doPause(&locker);
- } else if (m_pendingTasks & Seek) {
- m_pendingTasks ^= Seek;
- m_executingTask = Seek;
-
- doSeek(&locker);
- } else if (m_pendingTasks & Play) {
- m_pendingTasks ^= Play;
- m_executingTask = Play;
-
- doPlay(&locker);
- }
- m_executingTask = 0;
- }
-}
diff --git a/src/plugins/directshow/player/directshowplayerservice.h b/src/plugins/directshow/player/directshowplayerservice.h
deleted file mode 100644
index 0f36bdf..0000000
--- a/src/plugins/directshow/player/directshowplayerservice.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWPLAYERSERVICE_H
-#define DIRECTSHOWPLAYERSERVICE_H
-
-#include "qmediaplayer.h"
-#include "qmediaresource.h"
-#include "qmediaservice.h"
-#include "qmediatimerange.h"
-
-#include "directshoweventloop.h"
-#include "directshowglobal.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qwaitcondition.h>
-
-class DirectShowAudioEndpointControl;
-class DirectShowMetaDataControl;
-class DirectShowPlayerControl;
-class DirectShowVideoRendererControl;
-#ifndef Q_WS_SIMULATOR
-class Vmr9VideoWindowControl;
-#endif
-
-QT_BEGIN_NAMESPACE
-class QMediaContent;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class DirectShowPlayerService : public QMediaService
-{
- Q_OBJECT
-public:
- enum StreamType
- {
- AudioStream = 0x01,
- VideoStream = 0x02
- };
-
- DirectShowPlayerService(QObject *parent = 0);
- ~DirectShowPlayerService();
-
- QMediaControl* requestControl(const char *name);
- void releaseControl(QMediaControl *control);
-
- void load(const QMediaContent &media, QIODevice *stream);
- void play();
- void pause();
- void stop();
-
- qint64 position() const;
- QMediaTimeRange availablePlaybackRanges() const;
-
- void seek(qint64 position);
- void setRate(qreal rate);
-
- int bufferStatus() const;
-
- void setAudioOutput(IBaseFilter *filter);
- void setVideoOutput(IBaseFilter *filter);
-
-protected:
- void customEvent(QEvent *event);
-
-private Q_SLOTS:
- void videoOutputChanged();
-
-private:
- void releaseGraph();
- void updateStatus();
-
- int findStreamTypes(IBaseFilter *source) const;
- int findStreamType(IPin *pin) const;
-
- bool isConnected(IBaseFilter *filter, PIN_DIRECTION direction) const;
- IBaseFilter *getConnected(IBaseFilter *filter, PIN_DIRECTION direction) const;
-
- void run();
-
- void doSetUrlSource(QMutexLocker *locker);
- void doSetStreamSource(QMutexLocker *locker);
- void doRender(QMutexLocker *locker);
- void doFinalizeLoad(QMutexLocker *locker);
- void doSetRate(QMutexLocker *locker);
- void doSeek(QMutexLocker *locker);
- void doPlay(QMutexLocker *locker);
- void doPause(QMutexLocker *locker);
- void doStop(QMutexLocker *locker);
- void doReleaseAudioOutput(QMutexLocker *locker);
- void doReleaseVideoOutput(QMutexLocker *locker);
- void doReleaseGraph(QMutexLocker *locker);
-
- void graphEvent(QMutexLocker *locker);
-
- enum Task
- {
- Shutdown = 0x0001,
- SetUrlSource = 0x0002,
- SetStreamSource = 0x0004,
- SetSource = SetUrlSource | SetStreamSource,
- SetAudioOutput = 0x0008,
- SetVideoOutput = 0x0010,
- SetOutputs = SetAudioOutput | SetVideoOutput,
- Render = 0x0020,
- FinalizeLoad = 0x0040,
- SetRate = 0x0080,
- Seek = 0x0100,
- Play = 0x0200,
- Pause = 0x0400,
- Stop = 0x0800,
- ReleaseGraph = 0x1000,
- ReleaseAudioOutput = 0x2000,
- ReleaseVideoOutput = 0x4000,
- ReleaseFilters = ReleaseGraph | ReleaseAudioOutput | ReleaseVideoOutput
- };
-
- enum Event
- {
- FinalizedLoad = QEvent::User,
- Error,
- RateChange,
- Started,
- Paused,
- DurationChange,
- StatusChange,
- EndOfMedia,
- PositionChange
- };
-
- enum GraphStatus
- {
- NoMedia,
- Loading,
- Loaded,
- InvalidMedia
- };
-
- DirectShowPlayerControl *m_playerControl;
- DirectShowMetaDataControl *m_metaDataControl;
- DirectShowVideoRendererControl *m_videoRendererControl;
-#ifndef Q_WS_SIMULATOR
- Vmr9VideoWindowControl *m_videoWindowControl;
-#endif
- DirectShowAudioEndpointControl *m_audioEndpointControl;
-
- QThread *m_taskThread;
- DirectShowEventLoop *m_loop;
- int m_pendingTasks;
- int m_executingTask;
- int m_executedTasks;
- HANDLE m_taskHandle;
- HANDLE m_eventHandle;
- GraphStatus m_graphStatus;
- QMediaPlayer::Error m_error;
- QIODevice *m_stream;
- IFilterGraph2 *m_graph;
- IBaseFilter *m_source;
- IBaseFilter *m_audioOutput;
- IBaseFilter *m_videoOutput;
- int m_streamTypes;
- qreal m_rate;
- qint64 m_position;
- qint64 m_duration;
- bool m_buffering;
- bool m_seekable;
- bool m_atEnd;
- QMediaTimeRange m_playbackRange;
- QUrl m_url;
- QMediaResourceList m_resources;
- QString m_errorString;
- QMutex m_mutex;
-
- friend class DirectShowPlayerServiceThread;
-};
-
-
-#endif
diff --git a/src/plugins/directshow/player/directshowsamplescheduler.cpp b/src/plugins/directshow/player/directshowsamplescheduler.cpp
deleted file mode 100644
index 6874132..0000000
--- a/src/plugins/directshow/player/directshowsamplescheduler.cpp
+++ /dev/null
@@ -1,437 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowsamplescheduler.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qcoreevent.h>
-
-class DirectShowTimedSample
-{
-public:
- DirectShowTimedSample(IMediaSample *sample)
- : m_next(0)
- , m_sample(sample)
- , m_cookie(0)
- , m_lastSample(false)
- {
- m_sample->AddRef();
- }
-
- ~DirectShowTimedSample()
- {
- m_sample->Release();
- }
-
- IMediaSample *sample() const { return m_sample; }
-
- DirectShowTimedSample *nextSample() const { return m_next; }
- void setNextSample(DirectShowTimedSample *sample) { Q_ASSERT(!m_next); m_next = sample; }
-
- DirectShowTimedSample *remove() {
- DirectShowTimedSample *next = m_next; delete this; return next; }
-
- bool schedule(IReferenceClock *clock, REFERENCE_TIME startTime, HANDLE handle);
- void unschedule(IReferenceClock *clock);
-
- bool isReady(IReferenceClock *clock) const;
-
- bool isLast() const { return m_lastSample; }
- void setLast() { m_lastSample = true; }
-
-private:
- DirectShowTimedSample *m_next;
- IMediaSample *m_sample;
- DWORD_PTR m_cookie;
- bool m_lastSample;
-};
-
-bool DirectShowTimedSample::schedule(
- IReferenceClock *clock, REFERENCE_TIME startTime, HANDLE handle)
-{
- REFERENCE_TIME sampleStartTime;
- REFERENCE_TIME sampleEndTime;
- if (m_sample->GetTime(&sampleStartTime, &sampleEndTime) == S_OK) {
- if (clock->AdviseTime(
- startTime, sampleStartTime, reinterpret_cast<HEVENT>(handle), &m_cookie) == S_OK) {
- return true;
- }
- }
- return false;
-}
-
-void DirectShowTimedSample::unschedule(IReferenceClock *clock)
-{
- clock->Unadvise(m_cookie);
-}
-
-bool DirectShowTimedSample::isReady(IReferenceClock *clock) const
-{
- REFERENCE_TIME sampleStartTime;
- REFERENCE_TIME sampleEndTime;
- REFERENCE_TIME currentTime;
- if (m_sample->GetTime(&sampleStartTime, &sampleEndTime) == S_OK) {
- if (clock->GetTime(&currentTime) == S_OK)
- return currentTime >= sampleStartTime;
- }
- return true;
-}
-
-DirectShowSampleScheduler::DirectShowSampleScheduler(IUnknown *pin, QObject *parent)
- : QObject(parent)
- , m_pin(pin)
- , m_clock(0)
- , m_allocator(0)
- , m_head(0)
- , m_tail(0)
- , m_maximumSamples(1)
- , m_state(Stopped)
- , m_startTime(0)
- , m_timeoutEvent(::CreateEvent(0, 0, 0, 0))
- , m_flushEvent(::CreateEvent(0, 0, 0, 0))
-{
- m_semaphore.release(m_maximumSamples);
-}
-
-DirectShowSampleScheduler::~DirectShowSampleScheduler()
-{
- ::CloseHandle(m_timeoutEvent);
- ::CloseHandle(m_flushEvent);
-
- Q_ASSERT(!m_clock);
- Q_ASSERT(!m_allocator);
-}
-
-HRESULT DirectShowSampleScheduler::QueryInterface(REFIID riid, void **ppvObject)
-{
- return m_pin->QueryInterface(riid, ppvObject);
-}
-
-ULONG DirectShowSampleScheduler::AddRef()
-{
- return m_pin->AddRef();
-}
-
-ULONG DirectShowSampleScheduler::Release()
-{
- return m_pin->Release();
-}
-
-// IMemInputPin
-HRESULT DirectShowSampleScheduler::GetAllocator(IMemAllocator **ppAllocator)
-{
- if (!ppAllocator) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_allocator) {
- return VFW_E_NO_ALLOCATOR;
- } else {
- *ppAllocator = m_allocator;
-
- return S_OK;
- }
- }
-}
-
-HRESULT DirectShowSampleScheduler::NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly)
-{
- Q_UNUSED(bReadOnly);
-
- HRESULT hr;
- ALLOCATOR_PROPERTIES properties;
-
- if (!pAllocator) {
- if (m_allocator)
- m_allocator->Release();
-
- m_allocator = 0;
-
- return S_OK;
- } else if ((hr = pAllocator->GetProperties(&properties)) != S_OK) {
- return hr;
- } else {
- if (properties.cBuffers == 1) {
- ALLOCATOR_PROPERTIES actual;
-
- properties.cBuffers = 2;
- if ((hr = pAllocator->SetProperties(&properties, &actual)) != S_OK)
- return hr;
- }
-
- QMutexLocker locker(&m_mutex);
-
- if (m_allocator)
- m_allocator->Release();
-
- m_allocator = pAllocator;
- m_allocator->AddRef();
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowSampleScheduler::GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps)
-{
- if (!pProps)
- return E_POINTER;
-
- pProps->cBuffers = 2;
-
- return S_OK;
-}
-
-HRESULT DirectShowSampleScheduler::Receive(IMediaSample *pSample)
-{
- if (!pSample)
- return E_POINTER;
-
- m_semaphore.acquire(1);
-
- QMutexLocker locker(&m_mutex);
-
- if (m_state & Flushing) {
- m_semaphore.release(1);
-
- return S_FALSE;
- } else if (m_state == Stopped) {
- m_semaphore.release();
-
- return VFW_E_WRONG_STATE;
- } else {
- DirectShowTimedSample *timedSample = new DirectShowTimedSample(pSample);
-
- if (m_tail)
- m_tail->setNextSample(timedSample);
- else
- m_head = timedSample;
-
- m_tail = timedSample;
-
- if (m_state == Running) {
- if (!timedSample->schedule(m_clock, m_startTime, m_timeoutEvent)) {
- // Timing information is unavailable, so schedule frames immediately.
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- } else {
- locker.unlock();
- HANDLE handles[] = { m_flushEvent, m_timeoutEvent };
- DWORD result = ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
- locker.relock();
-
- if (result == WAIT_OBJECT_0 + 1)
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
- }
- } else if (m_tail == m_head) {
- // If this is the first frame make it available.
- QCoreApplication::postEvent(this, new QEvent(QEvent::UpdateRequest));
-
- if (m_state == Paused) {
- ::ResetEvent(m_timeoutEvent);
-
- locker.unlock();
- HANDLE handles[] = { m_flushEvent, m_timeoutEvent };
- ::WaitForMultipleObjects(2, handles, FALSE, INFINITE);
- locker.relock();
- }
- }
-
- return S_OK;
- }
-}
-
-HRESULT DirectShowSampleScheduler::ReceiveMultiple(
- IMediaSample **pSamples, long nSamples, long *nSamplesProcessed)
-{
- if (!pSamples || !nSamplesProcessed)
- return E_POINTER;
-
- for (*nSamplesProcessed = 0; *nSamplesProcessed < nSamples; ++(*nSamplesProcessed)) {
- HRESULT hr = Receive(pSamples[*nSamplesProcessed]);
-
- if (hr != S_OK)
- return hr;
- }
- return S_OK;
-}
-
-HRESULT DirectShowSampleScheduler::ReceiveCanBlock()
-{
- return S_OK;
-}
-
-void DirectShowSampleScheduler::run(REFERENCE_TIME startTime)
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = (m_state & Flushing) | Running;
- m_startTime = startTime;
-
- for (DirectShowTimedSample *sample = m_head; sample; sample = sample->nextSample()) {
- sample->schedule(m_clock, m_startTime, m_timeoutEvent);
- }
-
- if (!(m_state & Flushing))
- ::ResetEvent(m_flushEvent);
-
- if (!m_head)
- ::SetEvent(m_timeoutEvent);
-
-}
-
-void DirectShowSampleScheduler::pause()
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = (m_state & Flushing) | Paused;
-
- for (DirectShowTimedSample *sample = m_head; sample; sample = sample->nextSample())
- sample->unschedule(m_clock);
-
- if (!(m_state & Flushing))
- ::ResetEvent(m_flushEvent);
-}
-
-void DirectShowSampleScheduler::stop()
-{
- QMutexLocker locker(&m_mutex);
-
- m_state = m_state & Flushing;
-
- for (DirectShowTimedSample *sample = m_head; sample; sample = sample->remove()) {
- sample->unschedule(m_clock);
-
- m_semaphore.release(1);
- }
-
- m_head = 0;
- m_tail = 0;
-
- ::SetEvent(m_flushEvent);
-}
-
-void DirectShowSampleScheduler::setFlushing(bool flushing)
-{
- QMutexLocker locker(&m_mutex);
-
- const bool isFlushing = m_state & Flushing;
-
- if (isFlushing != flushing) {
- if (flushing) {
- m_state |= Flushing;
-
- for (DirectShowTimedSample *sample = m_head; sample; sample = sample->remove()) {
- sample->unschedule(m_clock);
-
- m_semaphore.release(1);
- }
- m_head = 0;
- m_tail = 0;
-
- ::SetEvent(m_flushEvent);
- } else {
- m_state &= ~Flushing;
-
- if (m_state != Stopped)
- ::ResetEvent(m_flushEvent);
- }
- }
-}
-
-void DirectShowSampleScheduler::setClock(IReferenceClock *clock)
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_clock)
- m_clock->Release();
-
- m_clock = clock;
-
- if (m_clock)
- m_clock->AddRef();
-}
-
-IMediaSample *DirectShowSampleScheduler::takeSample(bool *eos)
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_head && m_head->isReady(m_clock)) {
- IMediaSample *sample = m_head->sample();
- sample->AddRef();
-
- *eos = m_head->isLast();
-
- m_head = m_head->remove();
-
- if (!m_head)
- m_tail = 0;
-
- m_semaphore.release(1);
-
- return sample;
- } else {
- return 0;
- }
-}
-
-bool DirectShowSampleScheduler::scheduleEndOfStream()
-{
- QMutexLocker locker(&m_mutex);
-
- if (m_tail) {
- m_tail->setLast();
-
- return true;
- } else {
- return false;
- }
-}
-
-bool DirectShowSampleScheduler::event(QEvent *event)
-{
- if (event->type() == QEvent::UpdateRequest) {
- emit sampleReady();
-
- return true;
- } else {
- return QObject::event(event);
- }
-}
diff --git a/src/plugins/directshow/player/directshowsamplescheduler.h b/src/plugins/directshow/player/directshowsamplescheduler.h
deleted file mode 100644
index c861776..0000000
--- a/src/plugins/directshow/player/directshowsamplescheduler.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWSAMPLESCHEDULER_H
-#define DIRECTSHOWSAMPLESCHEDULER_H
-
-#include <QtCore/qmutex.h>
-#include <QtCore/qobject.h>
-#include <QtCore/qsemaphore.h>
-
-#include <dshow.h>
-
-class DirectShowTimedSample;
-
-class DirectShowSampleScheduler : public QObject, public IMemInputPin
-{
- Q_OBJECT
-public:
-
- enum State
- {
- Stopped = 0x00,
- Running = 0x01,
- Paused = 0x02,
- RunMask = 0x03,
- Flushing = 0x04
- };
-
- DirectShowSampleScheduler(IUnknown *pin, QObject *parent = 0);
- ~DirectShowSampleScheduler();
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IMemInputPin
- HRESULT STDMETHODCALLTYPE GetAllocator(IMemAllocator **ppAllocator);
- HRESULT STDMETHODCALLTYPE NotifyAllocator(IMemAllocator *pAllocator, BOOL bReadOnly);
- HRESULT STDMETHODCALLTYPE GetAllocatorRequirements(ALLOCATOR_PROPERTIES *pProps);
-
- HRESULT STDMETHODCALLTYPE Receive(IMediaSample *pSample);
- HRESULT STDMETHODCALLTYPE ReceiveMultiple(IMediaSample **pSamples, long nSamples, long *nSamplesProcessed);
- HRESULT STDMETHODCALLTYPE ReceiveCanBlock();
-
- void run(REFERENCE_TIME startTime);
- void pause();
- void stop();
- void setFlushing(bool flushing);
-
- IReferenceClock *clock() const { return m_clock; }
- void setClock(IReferenceClock *clock);
-
- bool schedule(IMediaSample *sample);
- bool scheduleEndOfStream();
-
- IMediaSample *takeSample(bool *eos);
-
- bool event(QEvent *event);
-
-Q_SIGNALS:
- void sampleReady();
-
-private:
- IUnknown *m_pin;
- IReferenceClock *m_clock;
- IMemAllocator *m_allocator;
- DirectShowTimedSample *m_head;
- DirectShowTimedSample *m_tail;
- int m_maximumSamples;
- int m_state;
- REFERENCE_TIME m_startTime;
- HANDLE m_timeoutEvent;
- HANDLE m_flushEvent;
- QSemaphore m_semaphore;
- QMutex m_mutex;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp b/src/plugins/directshow/player/directshowvideorenderercontrol.cpp
deleted file mode 100644
index 38ec30d..0000000
--- a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "directshowvideorenderercontrol.h"
-
-#include "videosurfacefilter.h"
-
-DirectShowVideoRendererControl::DirectShowVideoRendererControl(DirectShowEventLoop *loop, QObject *parent)
- : QVideoRendererControl(parent)
- , m_loop(loop)
- , m_surface(0)
- , m_filter(0)
-{
-}
-
-DirectShowVideoRendererControl::~DirectShowVideoRendererControl()
-{
- delete m_filter;
-}
-
-QAbstractVideoSurface *DirectShowVideoRendererControl::surface() const
-{
- return m_surface;
-}
-
-void DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-{
- if (surface != m_surface) {
- m_surface = surface;
-
- VideoSurfaceFilter *existingFilter = m_filter;
-
- if (surface) {
- m_filter = new VideoSurfaceFilter(surface, m_loop);
- } else {
- m_filter = 0;
- }
-
- emit filterChanged();
-
- delete existingFilter;
- }
-}
-
-IBaseFilter *DirectShowVideoRendererControl::filter()
-{
- return m_filter;
-}
diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.h b/src/plugins/directshow/player/directshowvideorenderercontrol.h
deleted file mode 100644
index 8a597d4..0000000
--- a/src/plugins/directshow/player/directshowvideorenderercontrol.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef DIRECTSHOWVIDEORENDERERCONTROL_H
-#define DIRECTSHOWVIDEORENDERERCONTROL_H
-
-#include "qvideorenderercontrol.h"
-
-#include <dshow.h>
-
-class DirectShowEventLoop;
-class VideoSurfaceFilter;
-
-QT_USE_NAMESPACE
-
-class DirectShowVideoRendererControl : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- DirectShowVideoRendererControl(DirectShowEventLoop *loop, QObject *parent = 0);
- ~DirectShowVideoRendererControl();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- IBaseFilter *filter();
-
-Q_SIGNALS:
- void filterChanged();
-
-private:
- DirectShowEventLoop *m_loop;
- QAbstractVideoSurface *m_surface;
- VideoSurfaceFilter *m_filter;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/mediasamplevideobuffer.cpp b/src/plugins/directshow/player/mediasamplevideobuffer.cpp
deleted file mode 100644
index 36bc127..0000000
--- a/src/plugins/directshow/player/mediasamplevideobuffer.cpp
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mediasamplevideobuffer.h"
-
-MediaSampleVideoBuffer::MediaSampleVideoBuffer(IMediaSample *sample, int bytesPerLine)
- : QAbstractVideoBuffer(NoHandle)
- , m_sample(sample)
- , m_bytesPerLine(bytesPerLine)
- , m_mapMode(NotMapped)
-{
- m_sample->AddRef();
-}
-
-MediaSampleVideoBuffer::~MediaSampleVideoBuffer()
-{
- m_sample->Release();
-}
-
-uchar *MediaSampleVideoBuffer::map(MapMode mode, int *numBytes, int *bytesPerLine)
-{
- if (m_mapMode == NotMapped && mode != NotMapped) {
- if (numBytes)
- *numBytes = m_sample->GetActualDataLength();
-
- if (bytesPerLine)
- *bytesPerLine = m_bytesPerLine;
-
- BYTE *bytes = 0;
-
- if (m_sample->GetPointer(&bytes) == S_OK) {
- m_mapMode = mode;
-
- return reinterpret_cast<uchar *>(bytes);
- }
- }
- return 0;
-}
-
-void MediaSampleVideoBuffer::unmap()
-{
- m_mapMode = NotMapped;
-}
-
-QAbstractVideoBuffer::MapMode MediaSampleVideoBuffer::mapMode() const
-{
- return m_mapMode;
-}
diff --git a/src/plugins/directshow/player/mediasamplevideobuffer.h b/src/plugins/directshow/player/mediasamplevideobuffer.h
deleted file mode 100644
index a041019..0000000
--- a/src/plugins/directshow/player/mediasamplevideobuffer.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MEDIASAMPLEVIDEOBUFFER_H
-#define MEDIASAMPLEVIDEOBUFFER_H
-
-#include <qabstractvideobuffer.h>
-
-#include <dshow.h>
-
-class MediaSampleVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- MediaSampleVideoBuffer(IMediaSample *sample, int bytesPerLine);
- ~MediaSampleVideoBuffer();
-
- IMediaSample *sample() { return m_sample; }
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
-
- MapMode mapMode() const;
-
-private:
- IMediaSample *m_sample;
- int m_bytesPerLine;
- MapMode m_mapMode;
-};
-
-
-#endif
diff --git a/src/plugins/directshow/player/player.pri b/src/plugins/directshow/player/player.pri
deleted file mode 100644
index a058b06..0000000
--- a/src/plugins/directshow/player/player.pri
+++ /dev/null
@@ -1,47 +0,0 @@
-INCLUDEPATH += $$PWD
-
-DEFINES += QMEDIA_DIRECTSHOW_PLAYER
-
-HEADERS += \
- $$PWD/directshowaudioendpointcontrol.h \
- $$PWD/directshoweventloop.h \
- $$PWD/directshowglobal.h \
- $$PWD/directshowioreader.h \
- $$PWD/directshowiosource.h \
- $$PWD/directshowmediatype.h \
- $$PWD/directshowmediatypelist.h \
- $$PWD/directshowmetadatacontrol.h \
- $$PWD/directshowpinenum.h \
- $$PWD/directshowplayercontrol.h \
- $$PWD/directshowplayerservice.h \
- $$PWD/directshowsamplescheduler.h \
- $$PWD/directshowvideorenderercontrol.h \
- $$PWD/mediasamplevideobuffer.h \
- $$PWD/videosurfacefilter.h
-
-SOURCES += \
- $$PWD/directshowaudioendpointcontrol.cpp \
- $$PWD/directshoweventloop.cpp \
- $$PWD/directshowioreader.cpp \
- $$PWD/directshowiosource.cpp \
- $$PWD/directshowmediatype.cpp \
- $$PWD/directshowmediatypelist.cpp \
- $$PWD/directshowmetadatacontrol.cpp \
- $$PWD/directshowpinenum.cpp \
- $$PWD/directshowplayercontrol.cpp \
- $$PWD/directshowplayerservice.cpp \
- $$PWD/directshowsamplescheduler.cpp \
- $$PWD/directshowvideorenderercontrol.cpp \
- $$PWD/mediasamplevideobuffer.cpp \
- $$PWD/videosurfacefilter.cpp
-
-!simulator {
-HEADERS += \
- $$PWD/vmr9videowindowcontrol.h
-
-SOURCES += \
- $$PWD/vmr9videowindowcontrol.cpp
-}
-
-LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lgdi32
-
diff --git a/src/plugins/directshow/player/videosurfacefilter.cpp b/src/plugins/directshow/player/videosurfacefilter.cpp
deleted file mode 100644
index 6f34bc4..0000000
--- a/src/plugins/directshow/player/videosurfacefilter.cpp
+++ /dev/null
@@ -1,631 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "videosurfacefilter.h"
-
-#include "directshoweventloop.h"
-#include "directshowglobal.h"
-#include "directshowpinenum.h"
-#include "mediasamplevideobuffer.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qthread.h>
-#include <qabstractvideosurface.h>
-
-#include <initguid.h>
-
-// { e23cad72-153d-406c-bf3f-4c4b523d96f2 }
-DEFINE_GUID(CLSID_VideoSurfaceFilter,
-0xe23cad72, 0x153d, 0x406c, 0xbf, 0x3f, 0x4c, 0x4b, 0x52, 0x3d, 0x96, 0xf2);
-
-VideoSurfaceFilter::VideoSurfaceFilter(
- QAbstractVideoSurface *surface, DirectShowEventLoop *loop, QObject *parent)
- : QObject(parent)
- , m_ref(1)
- , m_state(State_Stopped)
- , m_surface(surface)
- , m_loop(loop)
- , m_graph(0)
- , m_peerPin(0)
- , m_bytesPerLine(0)
- , m_startResult(S_OK)
- , m_pinId(QString::fromLatin1("reference"))
- , m_sampleScheduler(static_cast<IPin *>(this))
-{
- connect(surface, SIGNAL(supportedFormatsChanged()), this, SLOT(supportedFormatsChanged()));
- connect(&m_sampleScheduler, SIGNAL(sampleReady()), this, SLOT(sampleReady()));
-}
-
-VideoSurfaceFilter::~VideoSurfaceFilter()
-{
- Q_ASSERT(m_ref == 1);
-}
-
-HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
-{
- // 2dd74950-a890-11d1-abe8-00a0c905f375
- static const GUID iid_IAmFilterMiscFlags = {
- 0x2dd74950, 0xa890, 0x11d1, {0xab, 0xe8, 0x00, 0xa0, 0xc9, 0x05, 0xf3, 0x75} };
-
- if (!ppvObject) {
- return E_POINTER;
- } else if (riid == IID_IUnknown
- || riid == IID_IPersist
- || riid == IID_IMediaFilter
- || riid == IID_IBaseFilter) {
- *ppvObject = static_cast<IBaseFilter *>(this);
- } else if (riid == iid_IAmFilterMiscFlags) {
- *ppvObject = static_cast<IAMFilterMiscFlags *>(this);
- } else if (riid == IID_IPin) {
- *ppvObject = static_cast<IPin *>(this);
- } else if (riid == IID_IMemInputPin) {
- *ppvObject = static_cast<IMemInputPin *>(&m_sampleScheduler);
- } else {
- *ppvObject = 0;
-
- return E_NOINTERFACE;
- }
-
- AddRef();
-
- return S_OK;
-}
-
-ULONG VideoSurfaceFilter::AddRef()
-{
- return InterlockedIncrement(&m_ref);
-}
-
-ULONG VideoSurfaceFilter::Release()
-{
- ULONG ref = InterlockedDecrement(&m_ref);
-
- Q_ASSERT(ref != 0);
-
- return ref;
-}
-
-HRESULT VideoSurfaceFilter::GetClassID(CLSID *pClassID)
-{
- *pClassID = CLSID_VideoSurfaceFilter;
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::Run(REFERENCE_TIME tStart)
-{
- m_state = State_Running;
-
- m_sampleScheduler.run(tStart);
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::Pause()
-{
- m_state = State_Paused;
-
- m_sampleScheduler.pause();
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::Stop()
-{
- m_state = State_Stopped;
-
- m_sampleScheduler.stop();
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
-{
- if (!pState)
- return E_POINTER;
-
- *pState = m_state;
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::SetSyncSource(IReferenceClock *pClock)
-{
-
- m_sampleScheduler.setClock(pClock);
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::GetSyncSource(IReferenceClock **ppClock)
-{
- if (!ppClock) {
- return E_POINTER;
- } else {
- *ppClock = m_sampleScheduler.clock();
-
- if (*ppClock) {
- (*ppClock)->AddRef();
-
- return S_OK;
- } else {
- return S_FALSE;
- }
- }
-}
-
-HRESULT VideoSurfaceFilter::EnumPins(IEnumPins **ppEnum)
-{
- if (ppEnum) {
- *ppEnum = new DirectShowPinEnum(QList<IPin *>() << this);
-
- return S_OK;
- } else {
- return E_POINTER;
- }
-}
-
-HRESULT VideoSurfaceFilter::FindPin(LPCWSTR pId, IPin **ppPin)
-{
- if (!ppPin || !pId) {
- return E_POINTER;
- } else if (QString::fromWCharArray(pId) == m_pinId) {
- AddRef();
-
- *ppPin = this;
-
- return S_OK;
- } else {
- return VFW_E_NOT_FOUND;
- }
-}
-
-HRESULT VideoSurfaceFilter::JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName)
-{
- m_graph = pGraph;
- m_name = QString::fromWCharArray(pName);
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::QueryFilterInfo(FILTER_INFO *pInfo)
-{
- if (pInfo) {
- QString name = m_name;
-
- if (name.length() >= MAX_FILTER_NAME)
- name.truncate(MAX_FILTER_NAME - 1);
-
- int length = name.toWCharArray(pInfo->achName);
- pInfo->achName[length] = '\0';
-
- if (m_graph)
- m_graph->AddRef();
-
- pInfo->pGraph = m_graph;
-
- return S_OK;
- } else {
- return E_POINTER;
- }
-}
-
-HRESULT VideoSurfaceFilter::QueryVendorInfo(LPWSTR *pVendorInfo)
-{
- Q_UNUSED(pVendorInfo);
-
- return E_NOTIMPL;
-}
-
-ULONG VideoSurfaceFilter::GetMiscFlags()
-{
- return AM_FILTER_MISC_FLAGS_IS_RENDERER;
-}
-
-
-HRESULT VideoSurfaceFilter::Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt)
-{
- // This is an input pin, you shouldn't be calling Connect on it.
- return E_POINTER;
-}
-
-HRESULT VideoSurfaceFilter::ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt)
-{
- if (!pConnector) {
- return E_POINTER;
- } else if (!pmt) {
- return E_POINTER;
- } else {
- HRESULT hr;
- QMutexLocker locker(&m_mutex);
-
- if (m_peerPin) {
- hr = VFW_E_ALREADY_CONNECTED;
- } else if (pmt->majortype != MEDIATYPE_Video) {
- hr = VFW_E_TYPE_NOT_ACCEPTED;
- } else {
- m_surfaceFormat = DirectShowMediaType::formatFromType(*pmt);
- m_bytesPerLine = DirectShowMediaType::bytesPerLine(m_surfaceFormat);
-
- if (thread() == QThread::currentThread()) {
- hr = start();
- } else {
- m_loop->postEvent(this, new QEvent(QEvent::Type(StartSurface)));
-
- m_wait.wait(&m_mutex);
-
- hr = m_startResult;
- }
- }
- if (hr == S_OK) {
- m_peerPin = pConnector;
- m_peerPin->AddRef();
-
- DirectShowMediaType::copy(&m_mediaType, *pmt);
- }
- return hr;
- }
-}
-
-HRESULT VideoSurfaceFilter::start()
-{
- if (!m_surface->isFormatSupported(m_surfaceFormat)) {
- return VFW_E_TYPE_NOT_ACCEPTED;
- }
- if (!m_surface->start(m_surfaceFormat)) {
- return VFW_E_TYPE_NOT_ACCEPTED;
- } else {
- return S_OK;
- }
-}
-
-HRESULT VideoSurfaceFilter::Disconnect()
-{
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin)
- return S_FALSE;
-
- if (thread() == QThread::currentThread()) {
- stop();
- } else {
- m_loop->postEvent(this, new QEvent(QEvent::Type(StopSurface)));
-
- m_wait.wait(&m_mutex);
- }
-
- m_mediaType.clear();
-
- m_sampleScheduler.NotifyAllocator(0, FALSE);
-
- m_peerPin->Release();
- m_peerPin = 0;
-
- return S_OK;
-}
-
-void VideoSurfaceFilter::stop()
-{
- m_surface->stop();
-}
-
-HRESULT VideoSurfaceFilter::ConnectedTo(IPin **ppPin)
-{
- if (!ppPin) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin) {
- return VFW_E_NOT_CONNECTED;
- } else {
- m_peerPin->AddRef();
-
- *ppPin = m_peerPin;
-
- return S_OK;
- }
- }
-}
-
-HRESULT VideoSurfaceFilter::ConnectionMediaType(AM_MEDIA_TYPE *pmt)
-{
- if (!pmt) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- if (!m_peerPin) {
- return VFW_E_NOT_CONNECTED;
- } else {
- DirectShowMediaType::copy(pmt, m_mediaType);
-
- return S_OK;
- }
- }
-}
-
-HRESULT VideoSurfaceFilter::QueryPinInfo(PIN_INFO *pInfo)
-{
- if (!pInfo) {
- return E_POINTER;
- } else {
- AddRef();
-
- pInfo->pFilter = this;
- pInfo->dir = PINDIR_INPUT;
-
- const int bytes = qMin(MAX_FILTER_NAME, (m_pinId.length() + 1) * 2);
-
- qMemCopy(pInfo->achName, m_pinId.utf16(), bytes);
-
- return S_OK;
- }
-}
-
-HRESULT VideoSurfaceFilter::QueryId(LPWSTR *Id)
-{
- if (!Id) {
- return E_POINTER;
- } else {
- const int bytes = (m_pinId.length() + 1) * 2;
-
- *Id = static_cast<LPWSTR>(::CoTaskMemAlloc(bytes));
-
- qMemCopy(*Id, m_pinId.utf16(), bytes);
-
- return S_OK;
- }
-}
-
-HRESULT VideoSurfaceFilter::QueryAccept(const AM_MEDIA_TYPE *pmt)
-{
- return !m_surface->isFormatSupported(DirectShowMediaType::formatFromType(*pmt))
- ? S_OK
- : S_FALSE;
-}
-
-HRESULT VideoSurfaceFilter::EnumMediaTypes(IEnumMediaTypes **ppEnum)
-{
- if (!ppEnum) {
- return E_POINTER;
- } else {
- QMutexLocker locker(&m_mutex);
-
- *ppEnum = createMediaTypeEnum();
-
- return S_OK;
- }
-}
-
-HRESULT VideoSurfaceFilter::QueryInternalConnections(IPin **apPin, ULONG *nPin)
-{
- Q_UNUSED(apPin);
- Q_UNUSED(nPin);
-
- return E_NOTIMPL;
-}
-
-HRESULT VideoSurfaceFilter::EndOfStream()
-{
- QMutexLocker locker(&m_mutex);
-
- if (!m_sampleScheduler.scheduleEndOfStream()) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
- sink->Notify(
- EC_COMPLETE,
- S_OK,
- reinterpret_cast<LONG_PTR>(static_cast<IBaseFilter *>(this)));
- sink->Release();
- }
- }
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::BeginFlush()
-{
- QMutexLocker locker(&m_mutex);
-
- m_sampleScheduler.setFlushing(true);
-
- if (thread() == QThread::currentThread()) {
- flush();
- } else {
- m_loop->postEvent(this, new QEvent(QEvent::Type(FlushSurface)));
-
- m_wait.wait(&m_mutex);
- }
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::EndFlush()
-{
- QMutexLocker locker(&m_mutex);
-
- m_sampleScheduler.setFlushing(false);
-
- return S_OK;
-}
-
-void VideoSurfaceFilter::flush()
-{
- m_surface->present(QVideoFrame());
-
- m_wait.wakeAll();
-}
-
-HRESULT VideoSurfaceFilter::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate)
-{
- Q_UNUSED(tStart);
- Q_UNUSED(tStop);
- Q_UNUSED(dRate);
-
- return S_OK;
-}
-
-HRESULT VideoSurfaceFilter::QueryDirection(PIN_DIRECTION *pPinDir)
-{
- if (!pPinDir) {
- return E_POINTER;
- } else {
- *pPinDir = PINDIR_INPUT;
-
- return S_OK;
- }
-}
-
-int VideoSurfaceFilter::currentMediaTypeToken()
-{
- QMutexLocker locker(&m_mutex);
-
- return DirectShowMediaTypeList::currentMediaTypeToken();
-}
-
-HRESULT VideoSurfaceFilter::nextMediaType(
- int token, int *index, ULONG count, AM_MEDIA_TYPE **types, ULONG *fetchedCount)
-{
- QMutexLocker locker(&m_mutex);
-
- return DirectShowMediaTypeList::nextMediaType(token, index, count, types, fetchedCount);
-
-}
-
-HRESULT VideoSurfaceFilter::skipMediaType(int token, int *index, ULONG count)
-{
- QMutexLocker locker(&m_mutex);
-
- return DirectShowMediaTypeList::skipMediaType(token, index, count);
-}
-
-HRESULT VideoSurfaceFilter::cloneMediaType(int token, int index, IEnumMediaTypes **enumeration)
-{
- QMutexLocker locker(&m_mutex);
-
- return DirectShowMediaTypeList::cloneMediaType(token, index, enumeration);
-}
-
-void VideoSurfaceFilter::customEvent(QEvent *event)
-{
- if (event->type() == StartSurface) {
- QMutexLocker locker(&m_mutex);
-
- m_startResult = start();
-
- m_wait.wakeAll();
- } else if (event->type() == StopSurface) {
- QMutexLocker locker(&m_mutex);
-
- stop();
-
- m_wait.wakeAll();
- } else if (event->type() == FlushSurface) {
- QMutexLocker locker(&m_mutex);
-
- flush();
-
- m_wait.wakeAll();
- } else {
- QObject::customEvent(event);
- }
-}
-
-void VideoSurfaceFilter::supportedFormatsChanged()
-{
- QMutexLocker locker(&m_mutex);
-
- // MEDIASUBTYPE_None;
- static const GUID none = {
- 0xe436eb8e, 0x524f, 0x11ce, {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70} };
-
- QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats();
-
- QVector<AM_MEDIA_TYPE> mediaTypes;
- mediaTypes.reserve(formats.count());
-
- AM_MEDIA_TYPE type;
- type.majortype = MEDIATYPE_Video;
- type.bFixedSizeSamples = TRUE;
- type.bTemporalCompression = FALSE;
- type.lSampleSize = 0;
- type.formattype = GUID_NULL;
- type.pUnk = 0;
- type.cbFormat = 0;
- type.pbFormat = 0;
-
- foreach (QVideoFrame::PixelFormat format, formats) {
- type.subtype = DirectShowMediaType::convertPixelFormat(format);
-
- if (type.subtype != none)
- mediaTypes.append(type);
- }
-
- setMediaTypes(mediaTypes);
-}
-
-void VideoSurfaceFilter::sampleReady()
-{
- bool eos = false;
-
- IMediaSample *sample = m_sampleScheduler.takeSample(&eos);
-
- if (sample) {
- m_surface->present(QVideoFrame(
- new MediaSampleVideoBuffer(sample, m_bytesPerLine),
- m_surfaceFormat.frameSize(),
- m_surfaceFormat.pixelFormat()));
-
- sample->Release();
-
- if (eos) {
- if (IMediaEventSink *sink = com_cast<IMediaEventSink>(m_graph, IID_IMediaEventSink)) {
- sink->Notify(
- EC_COMPLETE,
- S_OK,
- reinterpret_cast<LONG_PTR>(static_cast<IBaseFilter *>(this)));
- sink->Release();
- }
- }
- }
-}
-
diff --git a/src/plugins/directshow/player/videosurfacefilter.h b/src/plugins/directshow/player/videosurfacefilter.h
deleted file mode 100644
index eac15c8..0000000
--- a/src/plugins/directshow/player/videosurfacefilter.h
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VIDEOSURFACEFILTER_H
-#define VIDEOSURFACEFILTER_H
-
-#include "directshowglobal.h"
-#include "directshowmediatypelist.h"
-#include "directshowsamplescheduler.h"
-#include "directshowmediatype.h"
-
-#include <QtCore/qbasictimer.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qsemaphore.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qwaitcondition.h>
-
-#include <dshow.h>
-
-QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-
-class DirectShowEventLoop;
-
-class VideoSurfaceFilter
- : public QObject
- , public DirectShowMediaTypeList
- , public IBaseFilter
- , public IAMFilterMiscFlags
- , public IPin
-{
- Q_OBJECT
-public:
- VideoSurfaceFilter(
- QAbstractVideoSurface *surface, DirectShowEventLoop *loop, QObject *parent = 0);
- ~VideoSurfaceFilter();
-
- // IUnknown
- HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppvObject);
- ULONG STDMETHODCALLTYPE AddRef();
- ULONG STDMETHODCALLTYPE Release();
-
- // IPersist
- HRESULT STDMETHODCALLTYPE GetClassID(CLSID *pClassID);
-
- // IMediaFilter
- HRESULT STDMETHODCALLTYPE Run(REFERENCE_TIME tStart);
- HRESULT STDMETHODCALLTYPE Pause();
- HRESULT STDMETHODCALLTYPE Stop();
-
- HRESULT STDMETHODCALLTYPE GetState(DWORD dwMilliSecsTimeout, FILTER_STATE *pState);
-
- HRESULT STDMETHODCALLTYPE SetSyncSource(IReferenceClock *pClock);
- HRESULT STDMETHODCALLTYPE GetSyncSource(IReferenceClock **ppClock);
-
- // IBaseFilter
- HRESULT STDMETHODCALLTYPE EnumPins(IEnumPins **ppEnum);
- HRESULT STDMETHODCALLTYPE FindPin(LPCWSTR Id, IPin **ppPin);
-
- HRESULT STDMETHODCALLTYPE JoinFilterGraph(IFilterGraph *pGraph, LPCWSTR pName);
-
- HRESULT STDMETHODCALLTYPE QueryFilterInfo(FILTER_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryVendorInfo(LPWSTR *pVendorInfo);
-
- // IAMFilterMiscFlags
- ULONG STDMETHODCALLTYPE GetMiscFlags();
-
- // IPin
- HRESULT STDMETHODCALLTYPE Connect(IPin *pReceivePin, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE ReceiveConnection(IPin *pConnector, const AM_MEDIA_TYPE *pmt);
- HRESULT STDMETHODCALLTYPE Disconnect();
- HRESULT STDMETHODCALLTYPE ConnectedTo(IPin **ppPin);
-
- HRESULT STDMETHODCALLTYPE ConnectionMediaType(AM_MEDIA_TYPE *pmt);
-
- HRESULT STDMETHODCALLTYPE QueryPinInfo(PIN_INFO *pInfo);
- HRESULT STDMETHODCALLTYPE QueryId(LPWSTR *Id);
-
- HRESULT STDMETHODCALLTYPE QueryAccept(const AM_MEDIA_TYPE *pmt);
-
- HRESULT STDMETHODCALLTYPE EnumMediaTypes(IEnumMediaTypes **ppEnum);
-
- HRESULT STDMETHODCALLTYPE QueryInternalConnections(IPin **apPin, ULONG *nPin);
-
- HRESULT STDMETHODCALLTYPE EndOfStream();
-
- HRESULT STDMETHODCALLTYPE BeginFlush();
- HRESULT STDMETHODCALLTYPE EndFlush();
-
- HRESULT STDMETHODCALLTYPE NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, double dRate);
-
- HRESULT STDMETHODCALLTYPE QueryDirection(PIN_DIRECTION *pPinDir);
-
- int currentMediaTypeToken();
- HRESULT nextMediaType(
- int token, int *index, ULONG count, AM_MEDIA_TYPE **types, ULONG *fetchedCount);
- HRESULT skipMediaType(int token, int *index, ULONG count);
- HRESULT cloneMediaType(int token, int index, IEnumMediaTypes **enumeration);
-
-protected:
- void customEvent(QEvent *event);
-
-private Q_SLOTS:
- void supportedFormatsChanged();
- void sampleReady();
-
-private:
- HRESULT start();
- void stop();
- void flush();
-
- enum
- {
- StartSurface = QEvent::User,
- StopSurface,
- FlushSurface
- };
-
- LONG m_ref;
- FILTER_STATE m_state;
- QAbstractVideoSurface *m_surface;
- DirectShowEventLoop *m_loop;
- IFilterGraph *m_graph;
- IPin *m_peerPin;
- int m_bytesPerLine;
- HRESULT m_startResult;
- QString m_name;
- QString m_pinId;
- DirectShowMediaType m_mediaType;
- QVideoSurfaceFormat m_surfaceFormat;
- QMutex m_mutex;
- QWaitCondition m_wait;
- DirectShowSampleScheduler m_sampleScheduler;
-};
-
-#endif
diff --git a/src/plugins/directshow/player/vmr9videowindowcontrol.cpp b/src/plugins/directshow/player/vmr9videowindowcontrol.cpp
deleted file mode 100644
index 9d16c23..0000000
--- a/src/plugins/directshow/player/vmr9videowindowcontrol.cpp
+++ /dev/null
@@ -1,329 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "vmr9videowindowcontrol.h"
-
-#include "directshowglobal.h"
-
-Vmr9VideoWindowControl::Vmr9VideoWindowControl(QObject *parent)
- : QVideoWindowControl(parent)
- , m_filter(com_new<IBaseFilter>(CLSID_VideoMixingRenderer9, IID_IBaseFilter))
- , m_windowId(0)
- , m_dirtyValues(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_brightness(0)
- , m_contrast(0)
- , m_hue(0)
- , m_saturation(0)
- , m_fullScreen(false)
-{
- if (IVMRFilterConfig9 *config = com_cast<IVMRFilterConfig9>(m_filter, IID_IVMRFilterConfig9)) {
- config->SetRenderingMode(VMR9Mode_Windowless);
- config->SetNumberOfStreams(1);
- config->Release();
- }
-}
-
-Vmr9VideoWindowControl::~Vmr9VideoWindowControl()
-{
- if (m_filter)
- m_filter->Release();
-}
-
-
-WId Vmr9VideoWindowControl::winId() const
-{
- return m_windowId;
-
-}
-
-void Vmr9VideoWindowControl::setWinId(WId id)
-{
- m_windowId = id;
-
- if (QWidget *widget = QWidget::find(m_windowId)) {
- const QColor color = widget->palette().color(QPalette::Window);
-
- m_windowColor = RGB(color.red(), color.green(), color.blue());
- }
-
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
- m_filter, IID_IVMRWindowlessControl9)) {
- control->SetVideoClippingWindow(m_windowId);
- control->SetBorderColor(m_windowColor);
- control->Release();
- }
-}
-
-QRect Vmr9VideoWindowControl::displayRect() const
-{
- return m_displayRect;
-}
-
-void Vmr9VideoWindowControl::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
- m_filter, IID_IVMRWindowlessControl9)) {
- RECT sourceRect = { 0, 0, 0, 0 };
- RECT displayRect = { rect.left(), rect.top(), rect.right() + 1, rect.bottom() + 1 };
-
- control->GetNativeVideoSize(&sourceRect.right, &sourceRect.bottom, 0, 0);
-
- if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
- QSize clippedSize = rect.size();
- clippedSize.scale(sourceRect.right, sourceRect.bottom, Qt::KeepAspectRatio);
-
- sourceRect.left = (sourceRect.right - clippedSize.width()) / 2;
- sourceRect.top = (sourceRect.bottom - clippedSize.height()) / 2;
- sourceRect.right = sourceRect.left + clippedSize.width();
- sourceRect.bottom = sourceRect.top + clippedSize.height();
- }
-
- control->SetVideoPosition(&sourceRect, &displayRect);
- control->Release();
- }
-}
-
-bool Vmr9VideoWindowControl::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void Vmr9VideoWindowControl::setFullScreen(bool fullScreen)
-{
- emit fullScreenChanged(m_fullScreen = fullScreen);
-}
-
-void Vmr9VideoWindowControl::repaint()
-{
- PAINTSTRUCT paint;
-
- if (HDC dc = ::BeginPaint(m_windowId, &paint)) {
- HRESULT hr = E_FAIL;
-
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
- m_filter, IID_IVMRWindowlessControl9)) {
- hr = control->RepaintVideo(m_windowId, dc);
- control->Release();
- }
-
- if (!SUCCEEDED(hr)) {
- HPEN pen = ::CreatePen(PS_SOLID, 1, m_windowColor);
- HBRUSH brush = ::CreateSolidBrush(m_windowColor);
- ::SelectObject(dc, pen);
- ::SelectObject(dc, brush);
-
- ::Rectangle(
- dc,
- m_displayRect.left(),
- m_displayRect.top(),
- m_displayRect.right() + 1,
- m_displayRect.bottom() + 1);
-
- ::DeleteObject(pen);
- ::DeleteObject(brush);
- }
- ::EndPaint(m_windowId, &paint);
- }
-}
-
-QSize Vmr9VideoWindowControl::nativeSize() const
-{
- QSize size;
-
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
- m_filter, IID_IVMRWindowlessControl9)) {
- LONG width;
- LONG height;
-
- if (control->GetNativeVideoSize(&width, &height, 0, 0) == S_OK)
- size = QSize(width, height);
- control->Release();
- }
- return size;
-}
-
-Qt::AspectRatioMode Vmr9VideoWindowControl::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void Vmr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
-
- if (IVMRWindowlessControl9 *control = com_cast<IVMRWindowlessControl9>(
- m_filter, IID_IVMRWindowlessControl9)) {
- switch (mode) {
- case Qt::IgnoreAspectRatio:
- control->SetAspectRatioMode(VMR9ARMode_None);
- break;
- case Qt::KeepAspectRatio:
- control->SetAspectRatioMode(VMR9ARMode_LetterBox);
- break;
- case Qt::KeepAspectRatioByExpanding:
- control->SetAspectRatioMode(VMR9ARMode_LetterBox);
- setDisplayRect(m_displayRect);
- break;
- default:
- break;
- }
- control->Release();
- }
-}
-
-int Vmr9VideoWindowControl::brightness() const
-{
- return m_brightness;
-}
-
-void Vmr9VideoWindowControl::setBrightness(int brightness)
-{
- m_brightness = brightness;
-
- m_dirtyValues |= ProcAmpControl9_Brightness;
-
- setProcAmpValues();
-
- emit brightnessChanged(brightness);
-}
-
-int Vmr9VideoWindowControl::contrast() const
-{
- return m_contrast;
-}
-
-void Vmr9VideoWindowControl::setContrast(int contrast)
-{
- m_contrast = contrast;
-
- m_dirtyValues |= ProcAmpControl9_Contrast;
-
- setProcAmpValues();
-
- emit contrastChanged(contrast);
-}
-
-int Vmr9VideoWindowControl::hue() const
-{
- return m_hue;
-}
-
-void Vmr9VideoWindowControl::setHue(int hue)
-{
- m_hue = hue;
-
- m_dirtyValues |= ProcAmpControl9_Hue;
-
- setProcAmpValues();
-
- emit hueChanged(hue);
-}
-
-int Vmr9VideoWindowControl::saturation() const
-{
- return m_saturation;
-}
-
-void Vmr9VideoWindowControl::setSaturation(int saturation)
-{
- m_saturation = saturation;
-
- m_dirtyValues |= ProcAmpControl9_Saturation;
-
- setProcAmpValues();
-
- emit saturationChanged(saturation);
-}
-
-void Vmr9VideoWindowControl::setProcAmpValues()
-{
- if (IVMRMixerControl9 *control = com_cast<IVMRMixerControl9>(m_filter, IID_IVMRMixerControl9)) {
- VMR9ProcAmpControl procAmp;
- procAmp.dwSize = sizeof(VMR9ProcAmpControl);
- procAmp.dwFlags = m_dirtyValues;
-
- if (m_dirtyValues & ProcAmpControl9_Brightness) {
- procAmp.Brightness = scaleProcAmpValue(
- control, ProcAmpControl9_Brightness, m_brightness);
- }
- if (m_dirtyValues & ProcAmpControl9_Contrast) {
- procAmp.Contrast = scaleProcAmpValue(
- control, ProcAmpControl9_Contrast, m_contrast);
- }
- if (m_dirtyValues & ProcAmpControl9_Hue) {
- procAmp.Hue = scaleProcAmpValue(
- control, ProcAmpControl9_Hue, m_hue);
- }
- if (m_dirtyValues & ProcAmpControl9_Saturation) {
- procAmp.Saturation = scaleProcAmpValue(
- control, ProcAmpControl9_Saturation, m_saturation);
- }
-
- if (SUCCEEDED(control->SetProcAmpControl(0, &procAmp))) {
- m_dirtyValues = 0;
- }
-
- control->Release();
- }
-}
-
-float Vmr9VideoWindowControl::scaleProcAmpValue(
- IVMRMixerControl9 *control, VMR9ProcAmpControlFlags property, int value) const
-{
- float scaledValue = 0.0;
-
- VMR9ProcAmpControlRange range;
- range.dwSize = sizeof(VMR9ProcAmpControlRange);
- range.dwProperty = property;
-
- if (SUCCEEDED(control->GetProcAmpControlRange(0, &range))) {
- scaledValue = range.DefaultValue;
- if (value > 0)
- scaledValue += float(value) * (range.MaxValue - range.DefaultValue) / 100;
- else if (value < 0)
- scaledValue -= float(value) * (range.MinValue - range.DefaultValue) / 100;
- }
-
- return scaledValue;
-}
diff --git a/src/plugins/directshow/player/vmr9videowindowcontrol.h b/src/plugins/directshow/player/vmr9videowindowcontrol.h
deleted file mode 100644
index 1e56bb6..0000000
--- a/src/plugins/directshow/player/vmr9videowindowcontrol.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef VMR9VIDEOWINDOWCONTROL_H
-#define VMR9VIDEOWINDOWCONTROL_H
-
-#include "qvideowindowcontrol.h"
-
-#include <dshow.h>
-#include <d3d9.h>
-#include <vmr9.h>
-
-QT_USE_NAMESPACE
-
-class Vmr9VideoWindowControl : public QVideoWindowControl
-{
- Q_OBJECT
-public:
- Vmr9VideoWindowControl(QObject *parent = 0);
- ~Vmr9VideoWindowControl();
-
- IBaseFilter *filter() const { return m_filter; }
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- void repaint();
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
-private:
- void setProcAmpValues();
- float scaleProcAmpValue(
- IVMRMixerControl9 *control, VMR9ProcAmpControlFlags property, int value) const;
-
- IBaseFilter *m_filter;
- WId m_windowId;
- COLORREF m_windowColor;
- DWORD m_dirtyValues;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- bool m_fullScreen;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabin.pri b/src/plugins/gstreamer/camerabin/camerabin.pri
deleted file mode 100644
index 5c266e7..0000000
--- a/src/plugins/gstreamer/camerabin/camerabin.pri
+++ /dev/null
@@ -1,50 +0,0 @@
-INCLUDEPATH += $$PWD \
- $${SOURCE_DIR}/src/multimedia
-
-INCLUDEPATH += camerabin
-
-DEFINES += QMEDIA_GSTREAMER_CAMERABIN
-
-LIBS += -lgstphotography-0.10
-
-DEFINES += GST_USE_UNSTABLE_API #prevents warnings because of unstable photography API
-
-HEADERS += \
- $$PWD/camerabinservice.h \
- $$PWD/camerabinsession.h \
- $$PWD/camerabincontrol.h \
- $$PWD/camerabinaudioencoder.h \
- $$PWD/camerabinfocus.h \
- $$PWD/camerabinimageencoder.h \
- $$PWD/camerabinlocks.h \
- $$PWD/camerabinrecorder.h \
- $$PWD/camerabincontainer.h \
- $$PWD/camerabinexposure.h \
- $$PWD/camerabinflash.h \
- $$PWD/camerabinimagecapture.h \
- $$PWD/camerabinimageprocessing.h \
- $$PWD/camerabinmetadata.h \
- $$PWD/camerabinvideoencoder.h \
- $$PWD/camerabinresourcepolicy.h \
- $$PWD/camerabincapturedestination.h \
- $$PWD/camerabincapturebufferformat.h
-
-SOURCES += \
- $$PWD/camerabinservice.cpp \
- $$PWD/camerabinsession.cpp \
- $$PWD/camerabincontrol.cpp \
- $$PWD/camerabinaudioencoder.cpp \
- $$PWD/camerabincontainer.cpp \
- $$PWD/camerabinexposure.cpp \
- $$PWD/camerabinflash.cpp \
- $$PWD/camerabinfocus.cpp \
- $$PWD/camerabinimagecapture.cpp \
- $$PWD/camerabinimageencoder.cpp \
- $$PWD/camerabinimageprocessing.cpp \
- $$PWD/camerabinlocks.cpp \
- $$PWD/camerabinmetadata.cpp \
- $$PWD/camerabinrecorder.cpp \
- $$PWD/camerabinvideoencoder.cpp \
- $$PWD/camerabinresourcepolicy.cpp \
- $$PWD/camerabincapturedestination.cpp \
- $$PWD/camerabincapturebufferformat.cpp
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
deleted file mode 100644
index c1f2df9..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinaudioencoder.h"
-#include "camerabincontainer.h"
-#include "qgstcodecsinfo.h"
-
-#include <QtCore/qdebug.h>
-
-CameraBinAudioEncoder::CameraBinAudioEncoder(QObject *parent)
- :QAudioEncoderControl(parent),
- m_codecs(QGstCodecsInfo::AudioEncoder)
-{
-}
-
-CameraBinAudioEncoder::~CameraBinAudioEncoder()
-{
-}
-
-QStringList CameraBinAudioEncoder::supportedAudioCodecs() const
-{
- return m_codecs.supportedCodecs();
-}
-
-QString CameraBinAudioEncoder::codecDescription(const QString &codecName) const
-{
- return m_codecs.codecDescription(codecName);
-}
-
-QStringList CameraBinAudioEncoder::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecOptions.value(codec);
-}
-
-QVariant CameraBinAudioEncoder::encodingOption(
- const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void CameraBinAudioEncoder::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QList<int> CameraBinAudioEncoder::supportedSampleRates(const QAudioEncoderSettings &, bool *) const
-{
- //TODO check element caps to find actual values
-
- return QList<int>();
-}
-
-QAudioEncoderSettings CameraBinAudioEncoder::audioSettings() const
-{
- return m_audioSettings;
-}
-
-void CameraBinAudioEncoder::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- m_userSettings = settings;
- m_audioSettings = settings;
- emit settingsChanged();
-}
-
-void CameraBinAudioEncoder::setActualAudioSettings(const QAudioEncoderSettings &settings)
-{
- m_audioSettings = settings;
-}
-
-void CameraBinAudioEncoder::resetActualSettings()
-{
- m_audioSettings = m_userSettings;
-}
-
-GstEncodingProfile *CameraBinAudioEncoder::createProfile()
-{
- QString codec = m_audioSettings.codec();
- GstCaps *caps;
-
- if (codec.isEmpty())
- caps = gst_caps_new_any();
- else
- caps = gst_caps_from_string(codec.toLatin1());
-
- return (GstEncodingProfile *)gst_encoding_audio_profile_new(
- caps,
- NULL, //preset
- NULL, //restriction
- 0); //presence
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h b/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
deleted file mode 100644
index 5468fde..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinaudioencoder.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINAUDIOENCODE_H
-#define CAMERABINAUDIOENCODE_H
-
-#include <qaudioencodercontrol.h>
-class CameraBinSession;
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/pbutils/encoding-profile.h>
-
-#include <qaudioformat.h>
-#include "qgstcodecsinfo.h"
-
-QT_USE_NAMESPACE
-
-class CameraBinAudioEncoder : public QAudioEncoderControl
-{
- Q_OBJECT
-public:
- CameraBinAudioEncoder(QObject *parent);
- virtual ~CameraBinAudioEncoder();
-
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
- QList<int> supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *isContinuous = 0) const;
- QList<int> supportedChannelCounts(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
- QList<int> supportedSampleSizes(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
- void setActualAudioSettings(const QAudioEncoderSettings&);
- void resetActualSettings();
-
- GstEncodingProfile *createProfile();
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QGstCodecsInfo m_codecs;
- QMap<QString,QStringList> m_codecOptions;
- QMap<QString, QMap<QString, QVariant> > m_options;
-
- QAudioEncoderSettings m_audioSettings;
- QAudioEncoderSettings m_userSettings;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
deleted file mode 100644
index 0611d8b..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabincapturebufferformat.h"
-#include "camerabinsession.h"
-
-CameraBinCaptureBufferFormat::CameraBinCaptureBufferFormat(CameraBinSession *session)
- :QCameraCaptureBufferFormatControl(session)
- , m_session(session)
- , m_format(QVideoFrame::Format_Jpeg)
-{
-}
-
-CameraBinCaptureBufferFormat::~CameraBinCaptureBufferFormat()
-{
-}
-
-QList<QVideoFrame::PixelFormat> CameraBinCaptureBufferFormat::supportedBufferFormats() const
-{
- //the exact YUV format is unknown with camerabin until the first capture is requested
- return QList<QVideoFrame::PixelFormat>()
- << QVideoFrame::Format_Jpeg
-#ifdef Q_WS_MAEMO_6
- << QVideoFrame::Format_UYVY
-#endif
- ;
-}
-
-QVideoFrame::PixelFormat CameraBinCaptureBufferFormat::bufferFormat() const
-{
- return m_format;
-}
-
-void CameraBinCaptureBufferFormat::setBufferFormat(QVideoFrame::PixelFormat format)
-{
- if (m_format != format) {
- m_format = format;
- emit bufferFormatChanged(format);
- }
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h b/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
deleted file mode 100644
index af119e0..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturebufferformat.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTUREBUFFERFORMAT_H
-#define CAMERABINCAPTUREBUFFERFORMAT_H
-
-#include <qcamera.h>
-#include <qcameracapturebufferformatcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT CameraBinCaptureBufferFormat : public QCameraCaptureBufferFormatControl
-{
- Q_OBJECT
-public:
- CameraBinCaptureBufferFormat(CameraBinSession *session);
- virtual ~CameraBinCaptureBufferFormat();
-
- QList<QVideoFrame::PixelFormat> supportedBufferFormats() const;
-
- QVideoFrame::PixelFormat bufferFormat() const;
- void setBufferFormat(QVideoFrame::PixelFormat format);
-
-private:
- CameraBinSession *m_session;
- QVideoFrame::PixelFormat m_format;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp b/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
deleted file mode 100644
index 7472d29..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabincapturedestination.h"
-#include "camerabinsession.h"
-
-CameraBinCaptureDestination::CameraBinCaptureDestination(CameraBinSession *session)
- :QCameraCaptureDestinationControl(session)
- , m_session(session)
- , m_destination(QCameraImageCapture::CaptureToFile)
-{
-}
-
-CameraBinCaptureDestination::~CameraBinCaptureDestination()
-{
-}
-
-
-bool CameraBinCaptureDestination::isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const
-{
- //capture to buffer, file and both are supported.
- return destination & (QCameraImageCapture::CaptureToFile | QCameraImageCapture::CaptureToBuffer);
-}
-
-QCameraImageCapture::CaptureDestinations CameraBinCaptureDestination::captureDestination() const
-{
- return m_destination;
-}
-
-void CameraBinCaptureDestination::setCaptureDestination(QCameraImageCapture::CaptureDestinations destination)
-{
- if (m_destination != destination) {
- m_destination = destination;
- emit captureDestinationChanged(m_destination);
- }
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h b/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
deleted file mode 100644
index 387c3ee..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincapturedestination.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTUREDESTINATION_H
-#define CAMERABINCAPTUREDESTINATION_H
-
-#include <qcameraimagecapture.h>
-#include <qcameracapturedestinationcontrol.h>
-
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT CameraBinCaptureDestination : public QCameraCaptureDestinationControl
-{
- Q_OBJECT
-public:
- CameraBinCaptureDestination(CameraBinSession *session);
- virtual ~CameraBinCaptureDestination();
-
- bool isCaptureDestinationSupported(QCameraImageCapture::CaptureDestinations destination) const;
- QCameraImageCapture::CaptureDestinations captureDestination() const;
- void setCaptureDestination(QCameraImageCapture::CaptureDestinations destination);
-
-private:
- CameraBinSession *m_session;
- QCameraImageCapture::CaptureDestinations m_destination;
-};
-
-#endif // CAMERABINFLASHCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp b/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
deleted file mode 100644
index d0d27fb..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabincontainer.h"
-#include <QtCore/qregexp.h>
-
-#include <QtCore/qdebug.h>
-
-CameraBinContainer::CameraBinContainer(QObject *parent)
- :QMediaContainerControl(parent),
- m_supportedContainers(QGstCodecsInfo::Muxer)
-{
- //extension for containers hard to guess from mimetype
- m_fileExtensions["video/x-matroska"] = "mkv";
- m_fileExtensions["video/quicktime"] = "mov";
- m_fileExtensions["video/x-msvideo"] = "avi";
- m_fileExtensions["video/msvideo"] = "avi";
- m_fileExtensions["audio/mpeg"] = "mp3";
- m_fileExtensions["application/x-shockwave-flash"] = "swf";
- m_fileExtensions["application/x-pn-realmedia"] = "rm";
-}
-
-QStringList CameraBinContainer::supportedContainers() const
-{
- return m_supportedContainers.supportedCodecs();
-}
-
-QString CameraBinContainer::containerDescription(const QString &formatMimeType) const
-{
- return m_supportedContainers.codecDescription(formatMimeType);
-}
-
-QString CameraBinContainer::containerMimeType() const
-{
- return m_format;
-}
-
-void CameraBinContainer::setContainerMimeType(const QString &formatMimeType)
-{
- m_format = formatMimeType;
-
- if (m_userFormat != formatMimeType) {
- m_userFormat = formatMimeType;
- emit settingsChanged();
- }
-}
-
-void CameraBinContainer::setActualContainer(const QString &formatMimeType)
-{
- m_format = formatMimeType;
-}
-
-void CameraBinContainer::resetActualContainer()
-{
- m_format = m_userFormat;
-}
-
-GstEncodingContainerProfile *CameraBinContainer::createProfile()
-{
- GstCaps *caps;
-
- if (m_format.isEmpty())
- caps = gst_caps_new_any();
- else
- caps = gst_caps_from_string(m_format.toLatin1());
-
- return (GstEncodingContainerProfile *)gst_encoding_container_profile_new(
- "camerabin2_profile",
- (gchar *)"custom camera profile",
- caps,
- NULL); //preset
-}
-
-/*!
- Suggest file extension for current container mimetype.
- */
-QString CameraBinContainer::suggestedFileExtension() const
-{
- QString format = m_format.left(m_format.indexOf(','));
- QString extension = m_fileExtensions.value(format);
-
- if (!extension.isEmpty() || format.isEmpty())
- return extension;
-
- QRegExp rx("[-/]([\\w]+)$");
-
- if (rx.indexIn(format) != -1)
- extension = rx.cap(1);
-
- return extension;
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabincontainer.h b/src/plugins/gstreamer/camerabin/camerabincontainer.h
deleted file mode 100644
index 5eaa19f..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincontainer.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef CAMERABINMEDIACONTAINERCONTROL_H
-#define CAMERABINMEDIACONTAINERCONTROL_H
-
-#include <qmediacontainercontrol.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/pbutils/encoding-profile.h>
-
-#include "qgstcodecsinfo.h"
-
-QT_USE_NAMESPACE
-
-class CameraBinContainer : public QMediaContainerControl
-{
-Q_OBJECT
-public:
- CameraBinContainer(QObject *parent);
- virtual ~CameraBinContainer() {}
-
- virtual QStringList supportedContainers() const;
- virtual QString containerDescription(const QString &formatMimeType) const;
-
- virtual QString containerMimeType() const;
- virtual void setContainerMimeType(const QString &formatMimeType);
-
- void setActualContainer(const QString &formatMimeType);
- void resetActualContainer();
-
- QString suggestedFileExtension() const;
-
- GstEncodingContainerProfile *createProfile();
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QString m_format; // backend selected format, using m_userFormat
- QString m_userFormat;
- QMap<QString, QString> m_fileExtensions;
-
- QGstCodecsInfo m_supportedContainers;
-};
-
-#endif // CAMERABINMEDIACONTAINERCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp b/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
deleted file mode 100644
index f40133d..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.cpp
+++ /dev/null
@@ -1,341 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabincontrol.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-#include "camerabinresourcepolicy.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qmetaobject.h>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <linux/videodev2.h>
-
-//#define CAMEABIN_DEBUG 1
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
-CameraBinControl::CameraBinControl(CameraBinSession *session)
- :QCameraControl(session),
- m_session(session),
- m_state(QCamera::UnloadedState),
- m_status(QCamera::UnloadedStatus),
- m_reloadPending(false)
-{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)),
- this, SLOT(updateStatus()));
-
- connect(m_session, SIGNAL(viewfinderChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(readyChanged(bool)),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(error(int,QString)),
- SLOT(handleCameraError(int,QString)));
-
- m_resourcePolicy = new CamerabinResourcePolicy(this);
- connect(m_resourcePolicy, SIGNAL(resourcesGranted()),
- SLOT(handleResourcesGranted()));
- connect(m_resourcePolicy, SIGNAL(resourcesDenied()),
- SLOT(handleResourcesLost()));
- connect(m_resourcePolicy, SIGNAL(resourcesLost()),
- SLOT(handleResourcesLost()));
-
- connect(m_session, SIGNAL(busyChanged(bool)),
- SLOT(handleBusyChanged(bool)));
-}
-
-CameraBinControl::~CameraBinControl()
-{
-}
-
-QCamera::CaptureMode CameraBinControl::captureMode() const
-{
- return m_session->captureMode();
-}
-
-void CameraBinControl::setCaptureMode(QCamera::CaptureMode mode)
-{
- if (m_session->captureMode() != mode) {
- m_session->setCaptureMode(mode);
-
- if (m_state == QCamera::ActiveState) {
- m_resourcePolicy->setResourceSet(
- captureMode() == QCamera::CaptureStillImage ?
- CamerabinResourcePolicy::ImageCaptureResources :
- CamerabinResourcePolicy::VideoCaptureResources);
- }
- emit captureModeChanged(mode);
- }
-}
-
-bool CameraBinControl::isCaptureModeSupported(QCamera::CaptureMode mode) const
-{
- return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo;
-}
-
-void CameraBinControl::setState(QCamera::State state)
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", state);
-#endif
- if (m_state != state) {
- m_state = state;
-
- //special case for stopping the camera while it's busy,
- //it should be delayed until the camera is idle
- if (state == QCamera::LoadedState &&
- m_session->state() == QCamera::ActiveState &&
- m_session->isBusy()) {
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Camera is busy, QCamera::stop() is delayed";
-#endif
- emit stateChanged(m_state);
- return;
- }
-
- CamerabinResourcePolicy::ResourceSet resourceSet;
- switch (state) {
- case QCamera::UnloadedState:
- resourceSet = CamerabinResourcePolicy::NoResources;
- break;
- case QCamera::LoadedState:
- resourceSet = CamerabinResourcePolicy::LoadedResources;
- break;
- case QCamera::ActiveState:
- resourceSet = captureMode() == QCamera::CaptureStillImage ?
- CamerabinResourcePolicy::ImageCaptureResources :
- CamerabinResourcePolicy::VideoCaptureResources;
- break;
- }
-
- m_resourcePolicy->setResourceSet(resourceSet);
-
- if (m_resourcePolicy->isResourcesGranted()) {
- //postpone changing to Active if the session is nor ready yet
- if (state == QCamera::ActiveState) {
- if (m_session->isReady()) {
- m_session->setState(state);
- } else {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera session is not ready yet, postpone activating";
-#endif
- }
- } else
- m_session->setState(state);
- }
-
- emit stateChanged(m_state);
- }
-}
-
-QCamera::State CameraBinControl::state() const
-{
- return m_state;
-}
-
-void CameraBinControl::updateStatus()
-{
- QCamera::State sessionState = m_session->state();
- QCamera::Status oldStatus = m_status;
-
- switch (m_state) {
- case QCamera::UnloadedState:
- m_status = QCamera::UnloadedStatus;
- break;
- case QCamera::LoadedState:
- switch (sessionState) {
- case QCamera::UnloadedState:
- m_status = QCamera::LoadingStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::LoadedStatus;
- break;
- case QCamera::ActiveState:
- m_status = QCamera::ActiveStatus;
- break;
- }
- break;
- case QCamera::ActiveState:
- switch (sessionState) {
- case QCamera::UnloadedState:
- m_status = QCamera::LoadingStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::StartingStatus;
- break;
- case QCamera::ActiveState:
- m_status = QCamera::ActiveStatus;
- break;
- }
- }
-
- if (m_status != oldStatus) {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera status changed" << ENUM_NAME(QCamera, "Status", m_status);
-#endif
- emit statusChanged(m_status);
- }
-}
-
-void CameraBinControl::reloadLater()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << "CameraBinControl: reload pipeline requested" << ENUM_NAME(QCamera, "State", m_state);
-#endif
- if (!m_reloadPending && m_state == QCamera::ActiveState) {
- m_reloadPending = true;
-
- if (!m_session->isBusy()) {
- m_session->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
- }
- }
-}
-
-void CameraBinControl::handleResourcesLost()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state);
-#endif
- m_session->setState(QCamera::UnloadedState);
-}
-
-void CameraBinControl::handleResourcesGranted()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << Q_FUNC_INFO << ENUM_NAME(QCamera, "State", m_state);
-#endif
-
- //camera will be started soon by delayedReload()
- if (m_reloadPending && m_state == QCamera::ActiveState)
- return;
-
- if (m_state == QCamera::ActiveState && m_session->isReady())
- m_session->setState(QCamera::ActiveState);
- else if (m_state == QCamera::LoadedState)
- m_session->setState(QCamera::LoadedState);
-}
-
-void CameraBinControl::handleBusyChanged(bool busy)
-{
- if (!busy && m_session->state() == QCamera::ActiveState) {
- if (m_state == QCamera::LoadedState) {
- //handle delayed stop() because of busy camera
- m_resourcePolicy->setResourceSet(CamerabinResourcePolicy::LoadedResources);
- m_session->setState(QCamera::LoadedState);
- } else if (m_state == QCamera::ActiveState && m_reloadPending) {
- //handle delayed reload because of busy camera
- m_session->setState(QCamera::LoadedState);
- QMetaObject::invokeMethod(this, "delayedReload", Qt::QueuedConnection);
- }
- }
-}
-
-void CameraBinControl::handleCameraError(int errorCode, const QString &errorString)
-{
- emit error(errorCode, errorString);
- setState(QCamera::UnloadedState);
-}
-
-void CameraBinControl::delayedReload()
-{
-#ifdef CAMEABIN_DEBUG
- qDebug() << "CameraBinControl: reload pipeline";
-#endif
- if (m_reloadPending) {
- m_reloadPending = false;
- if (m_state == QCamera::ActiveState &&
- m_session->isReady() &&
- m_resourcePolicy->isResourcesGranted()) {
- m_session->setState(QCamera::ActiveState);
- }
- }
-}
-
-bool CameraBinControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-{
- Q_UNUSED(status);
-
- switch (changeType) {
- case QCameraControl::CaptureMode:
- case QCameraControl::ImageEncodingSettings:
- case QCameraControl::VideoEncodingSettings:
- case QCameraControl::Viewfinder:
- return true;
- default:
- return false;
- }
-}
-
-#define VIEWFINDER_COLORSPACE_CONVERSION 0x00000004
-
-bool CameraBinControl::viewfinderColorSpaceConversion() const
-{
- gint flags = 0;
- g_object_get(G_OBJECT(m_session->cameraBin()), "flags", &flags, NULL);
-
- return flags & VIEWFINDER_COLORSPACE_CONVERSION;
-}
-
-void CameraBinControl::setViewfinderColorSpaceConversion(bool enabled)
-{
- gint flags = 0;
- g_object_get(G_OBJECT(m_session->cameraBin()), "flags", &flags, NULL);
-
- if (enabled)
- flags |= VIEWFINDER_COLORSPACE_CONVERSION;
- else
- flags &= ~VIEWFINDER_COLORSPACE_CONVERSION;
-
- g_object_set(G_OBJECT(m_session->cameraBin()), "flags", flags, NULL);
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabincontrol.h b/src/plugins/gstreamer/camerabin/camerabincontrol.h
deleted file mode 100644
index 3f90ca4..0000000
--- a/src/plugins/gstreamer/camerabin/camerabincontrol.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef CAMERABINCONTROL_H
-#define CAMERABINCONTROL_H
-
-#include <QHash>
-#include <qcameracontrol.h>
-#include "camerabinsession.h"
-
-QT_USE_NAMESPACE
-
-class CamerabinResourcePolicy;
-
-class CameraBinControl : public QCameraControl
-{
- Q_OBJECT
- Q_PROPERTY(bool viewfinderColorSpaceConversion READ viewfinderColorSpaceConversion WRITE setViewfinderColorSpaceConversion)
-public:
- CameraBinControl( CameraBinSession *session );
- virtual ~CameraBinControl();
-
- bool isValid() const { return true; }
-
- QCamera::State state() const;
- void setState(QCamera::State state);
-
- QCamera::Status status() const { return m_status; }
-
- QCamera::CaptureMode captureMode() const;
- void setCaptureMode(QCamera::CaptureMode mode);
-
- bool isCaptureModeSupported(QCamera::CaptureMode mode) const;
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
- bool viewfinderColorSpaceConversion() const;
-
-public slots:
- void reloadLater();
- void setViewfinderColorSpaceConversion(bool enabled);
-
-private slots:
- void updateStatus();
- void delayedReload();
-
- void handleResourcesGranted();
- void handleResourcesLost();
-
- void handleBusyChanged(bool);
- void handleCameraError(int error, const QString &errorString);
-
-private:
- void updateSupportedResolutions(const QString &device);
-
- CameraBinSession *m_session;
- QCamera::State m_state;
- QCamera::Status m_status;
- CamerabinResourcePolicy *m_resourcePolicy;
-
- bool m_reloadPending;
-};
-
-#endif // CAMERABINCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp b/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
deleted file mode 100644
index 4c7b8aa..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinexposure.h"
-#include "camerabinsession.h"
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-CameraBinExposure::CameraBinExposure(CameraBinSession *session)
- :QCameraExposureControl(session),
- m_session(session)
-{
-}
-
-CameraBinExposure::~CameraBinExposure()
-{
-}
-
-QCameraExposure::ExposureMode CameraBinExposure::exposureMode() const
-{
- GstSceneMode sceneMode;
- gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
-
- switch (sceneMode) {
- case GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT: return QCameraExposure::ExposurePortrait;
- case GST_PHOTOGRAPHY_SCENE_MODE_SPORT: return QCameraExposure::ExposureSports;
- case GST_PHOTOGRAPHY_SCENE_MODE_NIGHT: return QCameraExposure::ExposureNight;
- case GST_PHOTOGRAPHY_SCENE_MODE_MANUAL: return QCameraExposure::ExposureManual;
- case GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP: //no direct mapping available so mapping to auto mode
- case GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE: //no direct mapping available so mapping to auto mode
- case GST_PHOTOGRAPHY_SCENE_MODE_AUTO:
- default:
- return QCameraExposure::ExposureAuto;
- }
-}
-
-void CameraBinExposure::setExposureMode(QCameraExposure::ExposureMode mode)
-{
- GstSceneMode sceneMode;
- gst_photography_get_scene_mode(m_session->photography(), &sceneMode);
-
- switch (mode) {
- case QCameraExposure::ExposureManual: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_MANUAL; break;
- case QCameraExposure::ExposurePortrait: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT; break;
- case QCameraExposure::ExposureSports: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT; break;
- case QCameraExposure::ExposureNight: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT; break;
- case QCameraExposure::ExposureAuto: sceneMode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO; break;
- default:
- break;
- }
-
- gst_photography_set_scene_mode(m_session->photography(), sceneMode);
-}
-
-bool CameraBinExposure::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
-{
- //Similar mode names can be found in gst as GstSceneMode
- return mode == QCameraExposure::ExposureAuto ||
- mode == QCameraExposure::ExposurePortrait ||
- mode == QCameraExposure::ExposureSports ||
- mode == QCameraExposure::ExposureNight;
-
- //No direct mapping available for GST_PHOTOGRAPHY_SCENE_MODE_CLOSEUP and
- //GST_PHOTOGRAPHY_SCENE_MODE_LANDSCAPE
-}
-
-QCameraExposure::MeteringMode CameraBinExposure::meteringMode() const
-{
- return QCameraExposure::MeteringMatrix;
-}
-
-void CameraBinExposure::setMeteringMode(QCameraExposure::MeteringMode mode)
-{
- Q_UNUSED(mode);
-}
-
-bool CameraBinExposure::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
-{
- return mode == QCameraExposure::MeteringMatrix;
-}
-
-bool CameraBinExposure::isParameterSupported(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- case QCameraExposureControl::ISO:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- return true;
- default:
- return false;
- }
-}
-
-QVariant CameraBinExposure::exposureParameter(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- {
- gfloat ev;
- gst_photography_get_ev_compensation(m_session->photography(), &ev);
- return QVariant(ev);
- }
- case QCameraExposureControl::ISO:
- {
- guint isoSpeed = 0;
- gst_photography_get_iso_speed(m_session->photography(), &isoSpeed);
- return QVariant(isoSpeed);
- }
- case QCameraExposureControl::Aperture:
- return QVariant(2.8);
- case QCameraExposureControl::ShutterSpeed:
- {
- guint32 shutterSpeed = 0;
- gst_photography_get_exposure(m_session->photography(), &shutterSpeed);
-
- return QVariant(shutterSpeed/1000000.0);
- }
- default:
- return QVariant();
- }
-}
-
-QCameraExposureControl::ParameterFlags CameraBinExposure::exposureParameterFlags(ExposureParameter parameter) const
-{
- QCameraExposureControl::ParameterFlags flags = 0;
-
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- flags |= ContinuousRange;
- break;
- case QCameraExposureControl::Aperture:
- flags |= ReadOnly;
- break;
- default:
- break;
- }
-
- return flags;
-}
-
-QVariantList CameraBinExposure::supportedParameterRange(ExposureParameter parameter) const
-{
- QVariantList res;
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- res << -2.0 << 2.0;
- break;
- case QCameraExposureControl::ISO:
- res << 100 << 200 << 400;
- break;
- case QCameraExposureControl::Aperture:
- res << 2.8;
- break;
- default:
- break;
- }
-
- return res;
-}
-
-bool CameraBinExposure::setExposureParameter(ExposureParameter parameter, const QVariant& value)
-{
- QVariant oldValue = exposureParameter(parameter);
-
- switch (parameter) {
- case QCameraExposureControl::ExposureCompensation:
- gst_photography_set_ev_compensation(m_session->photography(), value.toReal());
- break;
- case QCameraExposureControl::ISO:
- gst_photography_set_iso_speed(m_session->photography(), value.toInt());
- break;
- case QCameraExposureControl::Aperture:
- gst_photography_set_aperture(m_session->photography(), guint(value.toReal()*1000000));
- break;
- case QCameraExposureControl::ShutterSpeed:
- gst_photography_set_exposure(m_session->photography(), guint(value.toReal()*1000000));
- break;
- default:
- return false;
- }
-
- QVariant newValue = exposureParameter(parameter);
- if (!qFuzzyCompare(oldValue.toReal(), newValue.toReal()))
- emit exposureParameterChanged(parameter);
-
- return true;
-}
-
-QString CameraBinExposure::extendedParameterName(ExposureParameter)
-{
- return QString();
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinexposure.h b/src/plugins/gstreamer/camerabin/camerabinexposure.h
deleted file mode 100644
index 4be21d3..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinexposure.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINEXPOSURECONTROL_MAEMO_H
-#define CAMERABINEXPOSURECONTROL_MAEMO_H
-
-#include <qcamera.h>
-#include <qcameraexposurecontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT CameraBinExposure : public QCameraExposureControl
-{
- Q_OBJECT
-
-public:
- CameraBinExposure(CameraBinSession *session);
- virtual ~CameraBinExposure();
-
- QCameraExposure::ExposureMode exposureMode() const;
- void setExposureMode(QCameraExposure::ExposureMode mode);
- bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const;
-
- QCameraExposure::MeteringMode meteringMode() const;
- void setMeteringMode(QCameraExposure::MeteringMode mode);
- bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const;
-
- bool isParameterSupported(ExposureParameter parameter) const;
- QVariant exposureParameter(ExposureParameter parameter) const;
- ParameterFlags exposureParameterFlags(ExposureParameter parameter) const;
- QVariantList supportedParameterRange(ExposureParameter parameter) const;
- bool setExposureParameter(ExposureParameter parameter, const QVariant& value);
-
- QString extendedParameterName(ExposureParameter parameter);
-
-private:
- CameraBinSession *m_session;
-};
-
-#endif // CAMERABINEXPOSURECONTROL_MAEMO_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.cpp b/src/plugins/gstreamer/camerabin/camerabinflash.cpp
deleted file mode 100644
index 0882747..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinflash.cpp
+++ /dev/null
@@ -1,104 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinflash.h"
-#include "camerabinsession.h"
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-CameraBinFlash::CameraBinFlash(CameraBinSession *session)
- :QCameraFlashControl(session),
- m_session(session)
-{
-}
-
-CameraBinFlash::~CameraBinFlash()
-{
-}
-
-QCameraExposure::FlashModes CameraBinFlash::flashMode() const
-{
- GstFlashMode flashMode;
- gst_photography_get_flash_mode(m_session->photography(), &flashMode);
-
- QCameraExposure::FlashModes modes;
- switch (flashMode) {
- case GST_PHOTOGRAPHY_FLASH_MODE_AUTO: modes |= QCameraExposure::FlashAuto; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_OFF: modes |= QCameraExposure::FlashOff; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_ON: modes |= QCameraExposure::FlashOn; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN: modes |= QCameraExposure::FlashFill; break;
- case GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE: modes |= QCameraExposure::FlashRedEyeReduction; break;
- default:
- modes |= QCameraExposure::FlashAuto;
- break;
- }
- return modes;
-}
-
-void CameraBinFlash::setFlashMode(QCameraExposure::FlashModes mode)
-{
- GstFlashMode flashMode;
- gst_photography_get_flash_mode(m_session->photography(), &flashMode);
-
- if (mode.testFlag(QCameraExposure::FlashAuto)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO;
- else if (mode.testFlag(QCameraExposure::FlashOff)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_OFF;
- else if (mode.testFlag(QCameraExposure::FlashOn)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_ON;
- else if (mode.testFlag(QCameraExposure::FlashFill)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN;
- else if (mode.testFlag(QCameraExposure::FlashRedEyeReduction)) flashMode = GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE;
-
- gst_photography_set_flash_mode(m_session->photography(), flashMode);
-}
-
-bool CameraBinFlash::isFlashModeSupported(QCameraExposure::FlashModes mode) const
-{
- return mode == QCameraExposure::FlashOff ||
- mode == QCameraExposure::FlashOn ||
- mode == QCameraExposure::FlashAuto ||
- mode == QCameraExposure::FlashRedEyeReduction ||
- mode == QCameraExposure::FlashFill;
-}
-
-bool CameraBinFlash::isFlashReady() const
-{
- return true;
-}
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinflash.h b/src/plugins/gstreamer/camerabin/camerabinflash.h
deleted file mode 100644
index 40b9724..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinflash.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINFLASHCONTROL_H
-#define CAMERABINFLASHCONTROL_H
-
-#include <qcamera.h>
-#include <qcameraflashcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class Q_MULTIMEDIA_EXPORT CameraBinFlash : public QCameraFlashControl
-{
- Q_OBJECT
-public:
- CameraBinFlash(CameraBinSession *session);
- virtual ~CameraBinFlash();
-
- QCameraExposure::FlashModes flashMode() const;
- void setFlashMode(QCameraExposure::FlashModes mode);
- bool isFlashModeSupported(QCameraExposure::FlashModes mode) const;
-
- bool isFlashReady() const;
-
-private:
- CameraBinSession *m_session;
-};
-
-#endif // CAMERABINFLASHCONTROL_H
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp b/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
deleted file mode 100644
index b989c50..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinfocus.h"
-#include "camerabinsession.h"
-
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-#include <QtCore/qmetaobject.h>
-
-//#define CAMERABIN_DEBUG 1
-#define ZOOM_PROPERTY "zoom"
-#define MAX_ZOOM_PROPERTY "max-zoom"
-
-CameraBinFocus::CameraBinFocus(CameraBinSession *session)
- :QCameraFocusControl(session),
- m_session(session),
- m_focusMode(QCameraFocus::AutoFocus),
- m_focusStatus(QCamera::Unlocked),
- m_focusZoneStatus(QCameraFocusZone::Selected)
-{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)),
- this, SLOT(_q_handleCameraStateChange(QCamera::State)));
-}
-
-CameraBinFocus::~CameraBinFocus()
-{
-}
-
-QCameraFocus::FocusMode CameraBinFocus::focusMode() const
-{
- return m_focusMode;
-}
-
-void CameraBinFocus::setFocusMode(QCameraFocus::FocusMode mode)
-{
- if (isFocusModeSupported(mode)) {
- m_focusMode = mode;
- }
-}
-
-bool CameraBinFocus::isFocusModeSupported(QCameraFocus::FocusMode mode) const
-{
- return mode & QCameraFocus::AutoFocus;
-}
-
-qreal CameraBinFocus::maximumOpticalZoom() const
-{
- return 1.0;
-}
-
-qreal CameraBinFocus::maximumDigitalZoom() const
-{
- gfloat zoomFactor = 1.0;
- g_object_get(GST_BIN(m_session->cameraBin()), MAX_ZOOM_PROPERTY, &zoomFactor, NULL);
- return zoomFactor;
-}
-
-qreal CameraBinFocus::opticalZoom() const
-{
- return 1.0;
-}
-
-qreal CameraBinFocus::digitalZoom() const
-{
- gfloat zoomFactor = 1.0;
- g_object_get(GST_BIN(m_session->cameraBin()), ZOOM_PROPERTY, &zoomFactor, NULL);
- return zoomFactor;
-}
-
-void CameraBinFocus::zoomTo(qreal optical, qreal digital)
-{
- Q_UNUSED(optical);
- digital = qBound(qreal(1.0), digital, maximumDigitalZoom());
- g_object_set(GST_BIN(m_session->cameraBin()), ZOOM_PROPERTY, digital, NULL);
- emit digitalZoomChanged(digital);
-}
-
-QCameraFocus::FocusPointMode CameraBinFocus::focusPointMode() const
-{
- return QCameraFocus::FocusPointAuto;
-}
-
-void CameraBinFocus::setFocusPointMode(QCameraFocus::FocusPointMode mode)
-{
- Q_UNUSED(mode);
-}
-
-bool CameraBinFocus::isFocusPointModeSupported(QCameraFocus::FocusPointMode mode) const
-{
- return mode == QCameraFocus::FocusPointAuto;
-}
-
-QPointF CameraBinFocus::customFocusPoint() const
-{
- return QPointF(0.5, 0.5);
-}
-
-void CameraBinFocus::setCustomFocusPoint(const QPointF &point)
-{
- Q_UNUSED(point);
-}
-
-QCameraFocusZoneList CameraBinFocus::focusZones() const
-{
- return QCameraFocusZoneList() << QCameraFocusZone(QRectF(0.35, 0.35, 0.3, 0.3), m_focusZoneStatus);
-}
-
-
-void CameraBinFocus::handleFocusMessage(GstMessage *gm)
-{
- //it's a sync message, so it's called from non main thread
- if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE)) {
- gint status = GST_PHOTOGRAPHY_FOCUS_STATUS_NONE;
- gst_structure_get_int (gm->structure, "status", &status);
- QCamera::LockStatus focusStatus = m_focusStatus;
- QCamera::LockChangeReason reason = QCamera::UserRequest;
-
- switch (status) {
- case GST_PHOTOGRAPHY_FOCUS_STATUS_FAIL:
- focusStatus = QCamera::Unlocked;
- reason = QCamera::LockFailed;
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_SUCCESS:
- focusStatus = QCamera::Locked;
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_NONE:
- break;
- case GST_PHOTOGRAPHY_FOCUS_STATUS_RUNNING:
- focusStatus = QCamera::Searching;
- break;
- default:
- break;
- }
-
- static int signalIndex = metaObject()->indexOfSlot(
- "_q_setFocusStatus(QCamera::LockStatus,QCamera::LockChangeReason)");
- metaObject()->method(signalIndex).invoke(this,
- Qt::QueuedConnection,
- Q_ARG(QCamera::LockStatus,focusStatus),
- Q_ARG(QCamera::LockChangeReason,reason));
- }
-}
-
-void CameraBinFocus::_q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
-#ifdef CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Current:"
- << m_focusStatus
- << "New:"
- << status << reason;
-#endif
-
- if (m_focusStatus != status) {
- m_focusStatus = status;
-
- QCameraFocusZone::FocusZoneStatus zonesStatus =
- m_focusStatus == QCamera::Locked ?
- QCameraFocusZone::Focused : QCameraFocusZone::Selected;
-
- if (m_focusZoneStatus != zonesStatus) {
- m_focusZoneStatus = zonesStatus;
- emit focusZonesChanged();
- }
-
- emit _q_focusStatusChanged(m_focusStatus, reason);
- }
-}
-
-void CameraBinFocus::_q_handleCameraStateChange(QCamera::State state)
-{
- if (state != QCamera::ActiveState)
- _q_setFocusStatus(QCamera::Unlocked, QCamera::LockLost);
-}
-
-void CameraBinFocus::_q_startFocusing()
-{
- _q_setFocusStatus(QCamera::Searching, QCamera::UserRequest);
- gst_photography_set_autofocus(m_session->photography(), TRUE);
-}
-
-void CameraBinFocus::_q_stopFocusing()
-{
- gst_photography_set_autofocus(m_session->photography(), FALSE);
- _q_setFocusStatus(QCamera::Unlocked, QCamera::UserRequest);
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinfocus.h b/src/plugins/gstreamer/camerabin/camerabinfocus.h
deleted file mode 100644
index df9448a..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinfocus.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINFOCUSCONTROL_H
-#define CAMERABINFOCUSCONTROL_H
-
-#include <qcamera.h>
-#include <qcamerafocuscontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class CameraBinFocus : public QCameraFocusControl
-{
- Q_OBJECT
-
-public:
- CameraBinFocus(CameraBinSession *session);
- virtual ~CameraBinFocus();
-
- QCameraFocus::FocusMode focusMode() const;
- void setFocusMode(QCameraFocus::FocusMode mode);
- bool isFocusModeSupported(QCameraFocus::FocusMode mode) const;
-
- qreal maximumOpticalZoom() const;
- qreal maximumDigitalZoom() const;
- qreal opticalZoom() const;
- qreal digitalZoom() const;
-
- void zoomTo(qreal optical, qreal digital) ;
-
- QCameraFocus::FocusPointMode focusPointMode() const;
- void setFocusPointMode(QCameraFocus::FocusPointMode mode) ;
- bool isFocusPointModeSupported(QCameraFocus::FocusPointMode) const;
- QPointF customFocusPoint() const;
- void setCustomFocusPoint(const QPointF &point);
-
- QCameraFocusZoneList focusZones() const;
-
- void handleFocusMessage(GstMessage*);
- QCamera::LockStatus focusStatus() const { return m_focusStatus; }
-
-Q_SIGNALS:
- void _q_focusStatusChanged(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
-public Q_SLOTS:
- void _q_startFocusing();
- void _q_stopFocusing();
-
-private Q_SLOTS:
- void _q_setFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
- void _q_handleCameraStateChange(QCamera::State state);
-
-private:
- CameraBinSession *m_session;
- QCameraFocus::FocusMode m_focusMode;
- QCamera::LockStatus m_focusStatus;
- QCameraFocusZone::FocusZoneStatus m_focusZoneStatus;
-};
-
-#endif // CAMERABINFOCUSCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp b/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
deleted file mode 100644
index 874361e..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.cpp
+++ /dev/null
@@ -1,339 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinimagecapture.h"
-#include "camerabincapturedestination.h"
-#include "camerabincapturebufferformat.h"
-#include "camerabinsession.h"
-#include <private/qgstvideobuffer_p.h>
-#include <private/qvideosurfacegstsink_p.h>
-#include <private/qgstutils_p.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qbuffer.h>
-#include <QtGui/qimagereader.h>
-
-//#define DEBUG_CAPTURE
-
-#define IMAGE_DONE_SIGNAL "image-done"
-
-Q_DECLARE_METATYPE(QVideoFrame)
-Q_DECLARE_METATYPE(QtMultimedia::MetaData)
-
-namespace
-{
-class CameraRegisterMetaTypes
-{
-public:
- CameraRegisterMetaTypes()
- {
- qRegisterMetaType<QVideoFrame>("QVideoFrame");
- qRegisterMetaType<QtMultimedia::MetaData>("QtMultimedia::MetaData");
- }
-} _registerCameraMetaTypes;
-}
-
-
-CameraBinImageCapture::CameraBinImageCapture(CameraBinSession *session)
- :QCameraImageCaptureControl(session)
- , m_session(session)
- , m_ready(false)
- , m_requestId(0)
- , m_jpegEncoderElement(0)
- , m_metadataMuxerElement(0)
-{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateState()));
- connect(m_session, SIGNAL(imageExposed(int)), this, SIGNAL(imageExposed(int)));
- connect(m_session, SIGNAL(imageCaptured(int,QImage)), this, SIGNAL(imageCaptured(int,QImage)));
-
- m_session->bus()->installMessageFilter(this);
-}
-
-CameraBinImageCapture::~CameraBinImageCapture()
-{
-}
-
-bool CameraBinImageCapture::isReadyForCapture() const
-{
- return m_ready;
-}
-
-int CameraBinImageCapture::capture(const QString &fileName)
-{
- m_requestId++;
-
- if (!m_ready) {
- emit error(m_requestId, QCameraImageCapture::NotReadyError, tr("Camera not ready"));
- return m_requestId;
- }
-
-#ifdef DEBUG_CAPTURE
- qDebug() << Q_FUNC_INFO << m_requestId << fileName;
-#endif
- m_session->captureImage(m_requestId, fileName);
- return m_requestId;
-}
-
-void CameraBinImageCapture::cancelCapture()
-{
-}
-
-void CameraBinImageCapture::updateState()
-{
- bool ready = m_session->state() == QCamera::ActiveState;
- if (m_ready != ready) {
-#ifdef DEBUG_CAPTURE
- qDebug() << "readyForCaptureChanged" << ready;
-#endif
- emit readyForCaptureChanged(m_ready = ready);
- }
-}
-
-gboolean CameraBinImageCapture::metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *self)
-{
- Q_UNUSED(pad);
-
- if (GST_EVENT_TYPE(event) == GST_EVENT_TAG) {
- GstTagList *gstTags;
- gst_event_parse_tag(event, &gstTags);
- QMap<QByteArray, QVariant> extendedTags = QGstUtils::gstTagListToMap(gstTags);
-
-#ifdef DEBUG_CAPTURE
- qDebug() << QString(gst_structure_to_string(gst_event_get_structure(event))).right(768);
- qDebug() << "Capture event probe" << extendedTags;
-#endif
-
- QMap<QtMultimedia::MetaData, QVariant> tags;
- tags[QtMultimedia::ISOSpeedRatings] = extendedTags.value("capturing-iso-speed");
- tags[QtMultimedia::DigitalZoomRatio] = extendedTags.value("capturing-digital-zoom-ratio");
- tags[QtMultimedia::ExposureTime] = extendedTags.value("capturing-shutter-speed");
- tags[QtMultimedia::WhiteBalance] = extendedTags.value("capturing-white-balance");
- tags[QtMultimedia::Flash] = extendedTags.value("capturing-flash-fired");
- tags[QtMultimedia::FocalLengthIn35mmFilm] = extendedTags.value("capturing-focal-length");
- tags[QtMultimedia::MeteringMode] = extendedTags.value("capturing-metering-mode");
- tags[QtMultimedia::ExposureMode] = extendedTags.value("capturing-exposure-mode");
- tags[QtMultimedia::FNumber] = extendedTags.value("capturing-focal-ratio");
- tags[QtMultimedia::ExposureMode] = extendedTags.value("capturing-exposure-mode");
-
- QMapIterator<QtMultimedia::MetaData, QVariant> i(tags);
- while (i.hasNext()) {
- i.next();
- if (i.value().isValid()) {
- QMetaObject::invokeMethod(self, "imageMetadataAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
- Q_ARG(QtMultimedia::MetaData, i.key()),
- Q_ARG(QVariant, i.value()));
- }
- }
- }
-
- return true;
-}
-
-gboolean CameraBinImageCapture::uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self)
-{
- Q_UNUSED(pad);
- CameraBinSession *session = self->m_session;
-
-#ifdef DEBUG_CAPTURE
- qDebug() << "Uncompressed buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer));
-#endif
-
- QCameraImageCapture::CaptureDestinations destination =
- session->captureDestinationControl()->captureDestination();
- QVideoFrame::PixelFormat format = session->captureBufferFormatControl()->bufferFormat();
-
- if (destination & QCameraImageCapture::CaptureToBuffer) {
- if (format != QVideoFrame::Format_Jpeg) {
- GstCaps *caps = GST_BUFFER_CAPS(buffer);
- int bytesPerLine = -1;
- QVideoSurfaceFormat format = QVideoSurfaceGstSink::formatForCaps(caps, &bytesPerLine);
-#ifdef DEBUG_CAPTURE
- qDebug() << "imageAvailable(uncompressed):" << format;
-#endif
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer, bytesPerLine);
-
- QVideoFrame frame(videoBuffer,
- format.frameSize(),
- format.pixelFormat());
-
- QMetaObject::invokeMethod(self, "imageAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
- Q_ARG(QVideoFrame, frame));
- }
- }
-
- //keep the buffer if capture to file or jpeg buffer capture was reuqsted
- bool keepBuffer = (destination & QCameraImageCapture::CaptureToFile) ||
- ((destination & QCameraImageCapture::CaptureToBuffer) &&
- format == QVideoFrame::Format_Jpeg);
-
- return keepBuffer;
-}
-
-gboolean CameraBinImageCapture::jpegBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *self)
-{
- Q_UNUSED(pad);
- CameraBinSession *session = self->m_session;
-
-#ifdef DEBUG_CAPTURE
- qDebug() << "Jpeg buffer probe" << gst_caps_to_string(GST_BUFFER_CAPS(buffer));
-#endif
-
- QCameraImageCapture::CaptureDestinations destination =
- session->captureDestinationControl()->captureDestination();
-
- if ((destination & QCameraImageCapture::CaptureToBuffer) &&
- session->captureBufferFormatControl()->bufferFormat() == QVideoFrame::Format_Jpeg) {
- QGstVideoBuffer *videoBuffer = new QGstVideoBuffer(buffer,
- -1); //bytesPerLine is not available for jpegs
-
- QSize resolution = QGstUtils::capsCorrectedResolution(GST_BUFFER_CAPS(buffer));
- //if resolution is not presented in caps, try to find it from encoded jpeg data:
- if (resolution.isEmpty()) {
- QBuffer data;
- data.setData(reinterpret_cast<const char*>(GST_BUFFER_DATA(buffer)), GST_BUFFER_SIZE(buffer));
- QImageReader reader(&data, "JPEG");
- resolution = reader.size();
- }
-
- QVideoFrame frame(videoBuffer,
- resolution,
- QVideoFrame::Format_Jpeg);
-
- QMetaObject::invokeMethod(self, "imageAvailable",
- Qt::QueuedConnection,
- Q_ARG(int, self->m_requestId),
- Q_ARG(QVideoFrame, frame));
- }
-
- //drop the buffer if capture to file was disabled
- return destination & QCameraImageCapture::CaptureToFile;
-}
-
-bool CameraBinImageCapture::processBusMessage(const QGstreamerMessage &message)
-{
- //Install metadata event and buffer probes
-
- //The image capture pipiline is built dynamically,
- //it's necessary to wait until jpeg encoder is added to pipeline
-
- GstMessage *gm = message.rawMessage();
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED) {
- GstState oldState;
- GstState newState;
- GstState pending;
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
- if (newState == GST_STATE_READY) {
- GstElement *element = GST_ELEMENT(GST_MESSAGE_SRC(gm));
- if (!element)
- return false;
-
- QString elementName = QString::fromLatin1(gst_element_get_name(element));
- if (elementName.contains("jpegenc") && element != m_jpegEncoderElement) {
- m_jpegEncoderElement = element;
- GstPad *sinkpad = gst_element_get_static_pad(element, "sink");
-
- //metadata event probe is installed before jpeg encoder
- //to emit metadata available signal as soon as possible.
-#ifdef DEBUG_CAPTURE
- qDebug() << "install metadata probe";
-#endif
- gst_pad_add_event_probe(sinkpad,
- G_CALLBACK(CameraBinImageCapture::metadataEventProbe),
- this);
-
-#ifdef DEBUG_CAPTURE
- qDebug() << "install uncompressed buffer probe";
-#endif
- gst_pad_add_buffer_probe(sinkpad,
- G_CALLBACK(CameraBinImageCapture::uncompressedBufferProbe),
- this);
-
- gst_object_unref(sinkpad);
- } else if ((elementName.contains("jifmux") || elementName.startsWith("metadatamux"))
- && element != m_metadataMuxerElement) {
- //Jpeg encoded buffer probe is added after jifmux/metadatamux
- //element to ensure the resulting jpeg buffer contains capture metadata
- m_metadataMuxerElement = element;
-
- GstPad *srcpad = gst_element_get_static_pad(element, "src");
-#ifdef DEBUG_CAPTURE
- qDebug() << "install jpeg buffer probe";
-#endif
- gst_pad_add_buffer_probe(srcpad,
- G_CALLBACK(CameraBinImageCapture::jpegBufferProbe),
- this);
- gst_object_unref(srcpad);
- }
- }
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
- if (GST_MESSAGE_SRC(gm) == (GstObject *)m_session->cameraBin()) {
- const GstStructure *structure = gst_message_get_structure(gm);
-
- if (gst_structure_has_name (structure, "image-done")) {
- const gchar *fileName = gst_structure_get_string (structure, "filename");
-#ifdef DEBUG_CAPTURE
- qDebug() << "Image saved" << fileName;
-#endif
-
- if (m_session->captureDestinationControl()->captureDestination() & QCameraImageCapture::CaptureToFile) {
- emit imageSaved(m_requestId, QString::fromUtf8(fileName));
- } else {
-#ifdef DEBUG_CAPTURE
- qDebug() << Q_FUNC_INFO << "Dropped saving file" << fileName;
-#endif
- //camerabin creates an empty file when captured buffer is dropped,
- //let's remove it
- QFileInfo info(QString::fromUtf8(fileName));
- if (info.exists() && info.isFile() && info.size() == 0) {
- QFile(info.absoluteFilePath()).remove();
- }
- }
- }
- }
- }
-
- return false;
-}
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h b/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
deleted file mode 100644
index 4a902e9..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimagecapture.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef CAMERABINIMAGECAPTURECONTROL_H
-#define CAMERABINIMAGECAPTURECONTROL_H
-
-#include <qcameraimagecapturecontrol.h>
-#include "camerabinsession.h"
-
-QT_USE_NAMESPACE
-
-class CameraBinImageCapture : public QCameraImageCaptureControl, public QGstreamerBusMessageFilter
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerBusMessageFilter)
-public:
- CameraBinImageCapture(CameraBinSession *session);
- virtual ~CameraBinImageCapture();
-
- QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) {}
-
- bool isReadyForCapture() const;
- int capture(const QString &fileName);
- void cancelCapture();
-
- bool processBusMessage(const QGstreamerMessage &message);
-
-private slots:
- void updateState();
-
-private:
- static gboolean metadataEventProbe(GstPad *pad, GstEvent *event, CameraBinImageCapture *);
- static gboolean uncompressedBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *);
- static gboolean jpegBufferProbe(GstPad *pad, GstBuffer *buffer, CameraBinImageCapture *);
-
- CameraBinSession *m_session;
- bool m_ready;
- int m_requestId;
- GstElement *m_jpegEncoderElement;
- GstElement *m_metadataMuxerElement;
-};
-
-#endif // CAMERABINCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
deleted file mode 100644
index c020400..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinimageencoder.h"
-#include "camerabinsession.h"
-
-#include <QtCore/qdebug.h>
-
-CameraBinImageEncoder::CameraBinImageEncoder(CameraBinSession *session)
- :QImageEncoderControl(session), m_session(session)
-{
-}
-
-CameraBinImageEncoder::~CameraBinImageEncoder()
-{
-}
-
-QList<QSize> CameraBinImageEncoder::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const
-{
- qDebug() << "CameraBinImageEncoder::supportedResolutions()";
- if (continuous)
- *continuous = false;
-
- return m_session->supportedResolutions(qMakePair<int,int>(0,0), continuous, QCamera::CaptureStillImage);
-}
-
-QStringList CameraBinImageEncoder::supportedImageCodecs() const
-{
- return QStringList() << "jpeg";
-}
-
-QString CameraBinImageEncoder::imageCodecDescription(const QString &codecName) const
-{
- if (codecName == "jpeg")
- return tr("JPEG image");
-
- return QString();
-}
-
-QImageEncoderSettings CameraBinImageEncoder::imageSettings() const
-{
- return m_settings;
-}
-
-void CameraBinImageEncoder::setImageSettings(const QImageEncoderSettings &settings)
-{
- m_settings = settings;
- emit settingsChanged();
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h b/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
deleted file mode 100644
index 6d49b2f..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageencoder.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINIMAGEENCODE_H
-#define CAMERABINIMAGEENCODE_H
-
-class CameraBinSession;
-
-#include <qimageencodercontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <gst/gst.h>
-QT_USE_NAMESPACE
-
-class CameraBinImageEncoder : public QImageEncoderControl
-{
- Q_OBJECT
-public:
- CameraBinImageEncoder(CameraBinSession *session);
- virtual ~CameraBinImageEncoder();
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const;
-
- QStringList supportedImageCodecs() const;
- QString imageCodecDescription(const QString &formatName) const;
-
- QImageEncoderSettings imageSettings() const;
- void setImageSettings(const QImageEncoderSettings &settings);
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QImageEncoderSettings m_settings;
-
- CameraBinSession *m_session;
-
- // Added
- QStringList m_codecs;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QStringList> m_codecOptions;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
deleted file mode 100644
index b219146..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.cpp
+++ /dev/null
@@ -1,171 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinimageprocessing.h"
-#include "camerabinsession.h"
-
-CameraBinImageProcessing::CameraBinImageProcessing(CameraBinSession *session)
- :QCameraImageProcessingControl(session),
- m_session(session)
-{
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_AUTO] = QCameraImageProcessing::WhiteBalanceAuto;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT] = QCameraImageProcessing::WhiteBalanceSunlight;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_CLOUDY] = QCameraImageProcessing::WhiteBalanceCloudy;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_SUNSET] = QCameraImageProcessing::WhiteBalanceSunset;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN] = QCameraImageProcessing::WhiteBalanceTungsten;
- m_mappedWbValues[GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT] = QCameraImageProcessing::WhiteBalanceFluorescent;
-
- updateColorBalanceValues();
-}
-
-CameraBinImageProcessing::~CameraBinImageProcessing()
-{
-}
-
-void CameraBinImageProcessing::updateColorBalanceValues()
-{
- if (!GST_IS_COLOR_BALANCE(m_session->cameraBin())) {
- // Camerabin doesn't implement gstcolorbalance interface
- return;
- }
-
- GstColorBalance *balance = GST_COLOR_BALANCE(m_session->cameraBin());
- const GList *controls = gst_color_balance_list_channels(balance);
-
- const GList *item;
- GstColorBalanceChannel *channel;
- gint cur_value;
-
- for (item = controls; item; item = g_list_next (item)) {
- channel = (GstColorBalanceChannel *)item->data;
- cur_value = gst_color_balance_get_value (balance, channel);
-
- if (!g_ascii_strcasecmp (channel->label, "brightness")) {
- m_values[QCameraImageProcessingControl::Brightness] = cur_value;
- } else if (!g_ascii_strcasecmp (channel->label, "contrast")) {
- m_values[QCameraImageProcessingControl::Contrast] = cur_value;
- } else if (!g_ascii_strcasecmp (channel->label, "saturation")) {
- m_values[QCameraImageProcessingControl::Saturation] = cur_value;
- }
- }
-}
-
-bool CameraBinImageProcessing::setColorBalanceValue(const QString& channel, int value)
-{
-
- if (!GST_IS_COLOR_BALANCE(m_session->cameraBin())) {
- // Camerabin doesn't implement gstcolorbalance interface
- return false;
- }
-
- GstColorBalance *balance = GST_COLOR_BALANCE(m_session->cameraBin());
- const GList *controls = gst_color_balance_list_channels(balance);
-
- const GList *item;
- GstColorBalanceChannel *colorBalanceChannel;
-
- for (item = controls; item; item = g_list_next (item)) {
- colorBalanceChannel = (GstColorBalanceChannel *)item->data;
-
- if (!g_ascii_strcasecmp (colorBalanceChannel->label, channel.toAscii())) {
- gst_color_balance_set_value (balance, colorBalanceChannel, value);
- return true;
- }
- }
-
- return false;
-}
-
-QCameraImageProcessing::WhiteBalanceMode CameraBinImageProcessing::whiteBalanceMode() const
-{
- GstWhiteBalanceMode wbMode;
- gst_photography_get_white_balance_mode(m_session->photography(), &wbMode);
- return m_mappedWbValues[wbMode];
-}
-
-void CameraBinImageProcessing::setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
-{
- if (isWhiteBalanceModeSupported(mode))
- gst_photography_set_white_balance_mode(m_session->photography(), m_mappedWbValues.key(mode));
-}
-
-bool CameraBinImageProcessing::isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
-{
- return m_mappedWbValues.values().contains(mode);
-}
-
-bool CameraBinImageProcessing::isProcessingParameterSupported(QCameraImageProcessingControl::ProcessingParameter parameter) const
-{
- return parameter == QCameraImageProcessingControl::Contrast
- || parameter == QCameraImageProcessingControl::Brightness
- || parameter == QCameraImageProcessingControl::Saturation;
-}
-
-QVariant CameraBinImageProcessing::processingParameter(
- QCameraImageProcessingControl::ProcessingParameter parameter) const
-{
- if (m_values.contains(parameter))
- return m_values.value(parameter);
- else
- return QVariant();
-}
-
-void CameraBinImageProcessing::setProcessingParameter(
- QCameraImageProcessingControl::ProcessingParameter parameter,
- QVariant value)
-{
- switch (parameter) {
- case Contrast:
- setColorBalanceValue("contrast", value.toInt());
- break;
- case Brightness:
- setColorBalanceValue("brightness", value.toInt());
- break;
- case Saturation:
- setColorBalanceValue("saturation", value.toInt());
- break;
- default:
- break;
- }
-
- updateColorBalanceValues();
-}
-
diff --git a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h b/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
deleted file mode 100644
index ffee55b..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinimageprocessing.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINIMAGEPROCESSINGCONTROL_H
-#define CAMERABINIMAGEPROCESSINGCONTROL_H
-
-#include <qcamera.h>
-#include <qcameraimageprocessingcontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-#include <gst/interfaces/photography.h>
-#include <gst/interfaces/colorbalance.h>
-
-class CameraBinSession;
-
-QT_USE_NAMESPACE
-
-class CameraBinImageProcessing : public QCameraImageProcessingControl
-{
- Q_OBJECT
-
-public:
- CameraBinImageProcessing(CameraBinSession *session);
- virtual ~CameraBinImageProcessing();
-
- QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const;
- void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode);
- bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const;
-
- bool isProcessingParameterSupported(ProcessingParameter) const;
- QVariant processingParameter(ProcessingParameter parameter) const;
- void setProcessingParameter(ProcessingParameter parameter, QVariant value);
-
-private:
- bool setColorBalanceValue(const QString& channel, int value);
- void updateColorBalanceValues();
-
-private:
- CameraBinSession *m_session;
- QMap<QCameraImageProcessingControl::ProcessingParameter, int> m_values;
- QMap<GstWhiteBalanceMode, QCameraImageProcessing::WhiteBalanceMode> m_mappedWbValues;
-};
-
-#endif // CAMERABINIMAGEPROCESSINGCONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp b/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
deleted file mode 100644
index cc0e3eb..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.cpp
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinlocks.h"
-#include "camerabinsession.h"
-#include "camerabinfocus.h"
-
-#include <gst/interfaces/photography.h>
-
-#include <QDebug>
-
-CameraBinLocks::CameraBinLocks(CameraBinSession *session)
- :QCameraLocksControl(session),
- m_session(session),
- m_focus(m_session->cameraFocusControl())
-{
- connect(m_focus, SIGNAL(_q_focusStatusChanged(QCamera::LockStatus, QCamera::LockChangeReason)),
- this, SLOT(updateFocusStatus(QCamera::LockStatus, QCamera::LockChangeReason)));
-}
-
-CameraBinLocks::~CameraBinLocks()
-{
-}
-
-QCamera::LockTypes CameraBinLocks::supportedLocks() const
-{
- return QCamera::LockFocus;
-}
-
-QCamera::LockStatus CameraBinLocks::lockStatus(QCamera::LockType lock) const
-{
- return lock == QCamera::LockFocus ? m_focus->focusStatus() : QCamera::Unlocked;
-}
-
-void CameraBinLocks::searchAndLock(QCamera::LockTypes locks)
-{
- if (locks & QCamera::LockFocus)
- m_focus->_q_startFocusing();
-}
-
-void CameraBinLocks::unlock(QCamera::LockTypes locks)
-{
- if (locks & QCamera::LockFocus)
- m_focus->_q_stopFocusing();
-}
-
-void CameraBinLocks::updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason)
-{
- emit lockStatusChanged(QCamera::LockFocus, status, reason);
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinlocks.h b/src/plugins/gstreamer/camerabin/camerabinlocks.h
deleted file mode 100644
index 07cb9d1..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinlocks.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINLOCKSCONTROL_H
-#define CAMERABINLOCKSCONTROL_H
-
-#include <qcamera.h>
-#include <qcameralockscontrol.h>
-
-#include <gst/gst.h>
-#include <glib.h>
-
-class CameraBinSession;
-class CameraBinFocus;
-
-QT_USE_NAMESPACE
-
-class CameraBinLocks : public QCameraLocksControl
-{
- Q_OBJECT
-
-public:
- CameraBinLocks(CameraBinSession *session);
- virtual ~CameraBinLocks();
-
- QCamera::LockTypes supportedLocks() const;
-
- QCamera::LockStatus lockStatus(QCamera::LockType lock) const;
-
- void searchAndLock(QCamera::LockTypes locks);
- void unlock(QCamera::LockTypes locks);
-
-private slots:
- void updateFocusStatus(QCamera::LockStatus status, QCamera::LockChangeReason reason);
-
-private:
- CameraBinSession *m_session;
- CameraBinFocus *m_focus;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp b/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
deleted file mode 100644
index 235f5b0..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinmetadata.h"
-
-#include <gst/gst.h>
-#include <gst/gstversion.h>
-
-struct QGstreamerMetaDataKeyLookup
-{
- QtMultimedia::MetaData key;
- const char *token;
-};
-
-static const QGstreamerMetaDataKeyLookup qt_gstreamerMetaDataKeys[] =
-{
- { QtMultimedia::Title, GST_TAG_TITLE },
- //{ QtMultimedia::SubTitle, 0 },
- //{ QtMultimedia::Author, 0 },
- { QtMultimedia::Comment, GST_TAG_COMMENT },
- { QtMultimedia::Description, GST_TAG_DESCRIPTION },
- //{ QtMultimedia::Category, 0 },
- { QtMultimedia::Genre, GST_TAG_GENRE },
- //{ QtMultimedia::Year, 0 },
- //{ QtMultimedia::UserRating, 0 },
-
- { QtMultimedia::Language, GST_TAG_LANGUAGE_CODE },
-
- { QtMultimedia::Publisher, GST_TAG_ORGANIZATION },
- { QtMultimedia::Copyright, GST_TAG_COPYRIGHT },
- //{ QtMultimedia::ParentalRating, 0 },
- //{ QtMultimedia::RatingOrganisation, 0 },
-
- // Media
- //{ QtMultimedia::Size, 0 },
- //{ QtMultimedia::MediaType, 0 },
- { QtMultimedia::Duration, GST_TAG_DURATION },
-
- // Audio
- { QtMultimedia::AudioBitRate, GST_TAG_BITRATE },
- { QtMultimedia::AudioCodec, GST_TAG_AUDIO_CODEC },
- //{ QtMultimedia::ChannelCount, 0 },
- //{ QtMultimedia::SampleRate, 0 },
-
- // Music
- { QtMultimedia::AlbumTitle, GST_TAG_ALBUM },
- { QtMultimedia::AlbumArtist, GST_TAG_ARTIST},
- { QtMultimedia::ContributingArtist, GST_TAG_PERFORMER },
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
- { QtMultimedia::Composer, GST_TAG_COMPOSER },
-#endif
- //{ QtMultimedia::Conductor, 0 },
- //{ QtMultimedia::Lyrics, 0 },
- //{ QtMultimedia::Mood, 0 },
- { QtMultimedia::TrackNumber, GST_TAG_TRACK_NUMBER },
-
- //{ QtMultimedia::CoverArtUrlSmall, 0 },
- //{ QtMultimedia::CoverArtUrlLarge, 0 },
-
- // Image/Video
- //{ QtMultimedia::Resolution, 0 },
- //{ QtMultimedia::PixelAspectRatio, 0 },
-
- // Video
- //{ QtMultimedia::VideoFrameRate, 0 },
- //{ QtMultimedia::VideoBitRate, 0 },
- { QtMultimedia::VideoCodec, GST_TAG_VIDEO_CODEC },
-
- //{ QtMultimedia::PosterUrl, 0 },
-
- // Movie
- //{ QtMultimedia::ChapterNumber, 0 },
- //{ QtMultimedia::Director, 0 },
- { QtMultimedia::LeadPerformer, GST_TAG_PERFORMER },
- //{ QtMultimedia::Writer, 0 },
-
- // Photos
- //{ QtMultimedia::CameraManufacturer, 0 },
- //{ QtMultimedia::CameraModel, 0 },
- //{ QtMultimedia::Event, 0 },
- //{ QtMultimedia::Subject, 0 }
-};
-
-CameraBinMetaData::CameraBinMetaData(QObject *parent)
- :QMetaDataWriterControl(parent)
-{
-}
-
-QVariant CameraBinMetaData::metaData(QtMultimedia::MetaData key) const
-{
- static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
-
- for (int i = 0; i < count; ++i) {
- if (qt_gstreamerMetaDataKeys[i].key == key) {
- const char *name = qt_gstreamerMetaDataKeys[i].token;
-
- return m_values.value(QByteArray::fromRawData(name, qstrlen(name)));
- }
- }
- return QVariant();
-}
-
-void CameraBinMetaData::setMetaData(QtMultimedia::MetaData key, const QVariant &value)
-{
- static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
-
- for (int i = 0; i < count; ++i) {
- if (qt_gstreamerMetaDataKeys[i].key == key) {
- const char *name = qt_gstreamerMetaDataKeys[i].token;
-
- m_values.insert(QByteArray::fromRawData(name, qstrlen(name)), value);
-
- emit QMetaDataWriterControl::metaDataChanged();
- emit metaDataChanged(m_values);
-
- return;
- }
- }
-}
-
-QList<QtMultimedia::MetaData> CameraBinMetaData::availableMetaData() const
-{
- static QMap<QByteArray, QtMultimedia::MetaData> keysMap;
- if (keysMap.isEmpty()) {
- const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
- for (int i = 0; i < count; ++i) {
- keysMap[QByteArray(qt_gstreamerMetaDataKeys[i].token)] = qt_gstreamerMetaDataKeys[i].key;
- }
- }
-
- QList<QtMultimedia::MetaData> res;
- foreach (const QByteArray &key, m_values.keys()) {
- QtMultimedia::MetaData tag = keysMap.value(key, QtMultimedia::MetaData(-1));
- if (tag != -1)
- res.append(tag);
- }
-
- return res;
-}
-
-QVariant CameraBinMetaData::extendedMetaData(QString const &name) const
-{
- return m_values.value(name.toLatin1());
-}
-
-void CameraBinMetaData::setExtendedMetaData(QString const &name, QVariant const &value)
-{
- m_values.insert(name.toLatin1(), value);
- emit QMetaDataWriterControl::metaDataChanged();
- emit metaDataChanged(m_values);
-}
-
-QStringList CameraBinMetaData::availableExtendedMetaData() const
-{
- QStringList res;
- foreach (const QByteArray &key, m_values.keys())
- res.append(QString(key));
-
- return res;
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinmetadata.h b/src/plugins/gstreamer/camerabin/camerabinmetadata.h
deleted file mode 100644
index 16a86a6..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinmetadata.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTUREMETADATACONTROL_H
-#define CAMERABINCAPTUREMETADATACONTROL_H
-
-#include <qmetadatawritercontrol.h>
-
-QT_USE_NAMESPACE
-
-class CameraBinMetaData : public QMetaDataWriterControl
-{
- Q_OBJECT
-public:
- CameraBinMetaData(QObject *parent);
- virtual ~CameraBinMetaData() {}
-
-
- bool isMetaDataAvailable() const { return true; }
- bool isWritable() const { return true; }
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- void setMetaData(QtMultimedia::MetaData key, const QVariant &value);
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(QString const &name) const;
- void setExtendedMetaData(QString const &name, QVariant const &value);
- QStringList availableExtendedMetaData() const;
-
-Q_SIGNALS:
- void metaDataChanged(const QMap<QByteArray, QVariant>&);
-
-private:
- QMap<QByteArray, QVariant> m_values;
-};
-
-#endif // CAMERABINCAPTUREMETADATACONTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp b/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
deleted file mode 100644
index ff97c3f..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinrecorder.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabincontainer.h"
-#include <QtCore/QDebug>
-
-#include <gst/pbutils/encoding-profile.h>
-
-CameraBinRecorder::CameraBinRecorder(CameraBinSession *session)
- :QMediaRecorderControl(session),
- m_session(session),
- m_state(QMediaRecorder::StoppedState)
-{
- connect(m_session, SIGNAL(stateChanged(QCamera::State)), SLOT(updateState()));
- connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool)));
-}
-
-CameraBinRecorder::~CameraBinRecorder()
-{
-}
-
-QUrl CameraBinRecorder::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool CameraBinRecorder::setOutputLocation(const QUrl &sink)
-{
- m_session->setOutputLocation(sink);
- return true;
-}
-
-QMediaRecorder::State CameraBinRecorder::state() const
-{
- return m_state;
-}
-
-void CameraBinRecorder::updateState()
-{
- if (m_session->state() != QCamera::ActiveState &&
- m_state != QMediaRecorder::StoppedState) {
- m_session->stopVideoRecording();
- emit stateChanged(m_state = QMediaRecorder::StoppedState);
- }
-}
-
-qint64 CameraBinRecorder::duration() const
-{
- return m_session->duration();
-}
-
-void CameraBinRecorder::record()
-{
- if (m_session->state() == QCamera::ActiveState) {
- m_session->recordVideo();
- emit stateChanged(m_state = QMediaRecorder::RecordingState);
- } else
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
-}
-
-void CameraBinRecorder::pause()
-{
- emit error(QMediaRecorder::ResourceError, tr("QMediaRecorder::pause() is not supported by camerabin2."));
-}
-
-void CameraBinRecorder::stop()
-{
- if (m_session->state() == QCamera::ActiveState) {
- m_session->stopVideoRecording();
- emit stateChanged(m_state = QMediaRecorder::StoppedState);
- }
-}
-
-void CameraBinRecorder::applySettings()
-{
- GstEncodingContainerProfile *containerProfile = m_session->mediaContainerControl()->createProfile();
-
- if (containerProfile) {
- GstEncodingProfile *audioProfile = m_session->audioEncodeControl()->createProfile();
- GstEncodingProfile *videoProfile = m_session->videoEncodeControl()->createProfile();
-
- gst_encoding_container_profile_add_profile(containerProfile, audioProfile);
- gst_encoding_container_profile_add_profile(containerProfile, videoProfile);
- }
-
- g_object_set (G_OBJECT(m_session->cameraBin()), "video-profile", containerProfile, NULL);
-}
-
-bool CameraBinRecorder::isMuted() const
-{
- return m_session->isMuted();
-}
-
-void CameraBinRecorder::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinrecorder.h b/src/plugins/gstreamer/camerabin/camerabinrecorder.h
deleted file mode 100644
index f68c4ee..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinrecorder.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef CAMERABINRECORDERCONTROL_H
-#define CAMERABINRECORDERCONTROL_H
-
-#include <qmediarecordercontrol.h>
-#include "camerabinsession.h"
-QT_USE_NAMESPACE
-
-class CameraBinRecorder : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- CameraBinRecorder(CameraBinSession *session);
- virtual ~CameraBinRecorder();
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
-
- QMediaRecorder::State state() const;
-
- qint64 duration() const;
-
- bool isMuted() const;
-
- void applySettings();
-
-public slots:
- void record();
- void pause();
- void stop();
- void setMuted(bool);
-
-private slots:
- void updateState();
-
-private:
- CameraBinSession *m_session;
- QMediaRecorder::State m_state;
-};
-
-#endif // CAMERABINCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
deleted file mode 100644
index df5583d..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinresourcepolicy.h"
-
-//#define DEBUG_RESOURCE_POLICY
-#include <QtCore/qdebug.h>
-#include <QtCore/qset.h>
-
-#ifdef HAVE_RESOURCE_POLICY
-#include <policy/resource.h>
-#include <policy/resources.h>
-#include <policy/resource-set.h>
-#endif
-
-CamerabinResourcePolicy::CamerabinResourcePolicy(QObject *parent) :
- QObject(parent),
- m_resourceSet(NoResources),
- m_releasingResources(false)
-{
-#ifdef HAVE_RESOURCE_POLICY
- //loaded resource set is also kept requested for image and video capture sets
- m_resource = new ResourcePolicy::ResourceSet("camera");
- m_resource->setAlwaysReply();
- m_resource->initAndConnect();
-
- connect(m_resource, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>)),
- SIGNAL(resourcesGranted()));
- connect(m_resource, SIGNAL(resourcesDenied()), SIGNAL(resourcesDenied()));
- connect(m_resource, SIGNAL(lostResources()), SIGNAL(resourcesLost()));
- connect(m_resource, SIGNAL(resourcesReleased()), SLOT(handleResourcesReleased()));
-#endif
-}
-
-CamerabinResourcePolicy::~CamerabinResourcePolicy()
-{
-#ifdef HAVE_RESOURCE_POLICY
- //ensure the resources are released
- if (m_resourceSet != NoResources)
- setResourceSet(NoResources);
-
- //don't delete the resource set until resources are released
- if (m_releasingResources) {
- m_resource->connect(m_resource, SIGNAL(resourcesReleased()),
- SLOT(deleteLater()));
- } else {
- delete m_resource;
- m_resource = 0;
- }
-#endif
-}
-
-CamerabinResourcePolicy::ResourceSet CamerabinResourcePolicy::resourceSet() const
-{
- return m_resourceSet;
-}
-
-void CamerabinResourcePolicy::setResourceSet(CamerabinResourcePolicy::ResourceSet set)
-{
- CamerabinResourcePolicy::ResourceSet oldSet = m_resourceSet;
- m_resourceSet = set;
-
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << set;
-#endif
-
-#ifdef HAVE_RESOURCE_POLICY
- QSet<ResourcePolicy::ResourceType> requestedTypes;
-
- switch (set) {
- case NoResources:
- break;
- case LoadedResources:
- requestedTypes << ResourcePolicy::LensCoverType //to detect lens cover is opened/closed
- << ResourcePolicy::VideoRecorderType //to open camera device
- << ResourcePolicy::SnapButtonType; //to detect capture button events
- break;
- case ImageCaptureResources:
- requestedTypes << ResourcePolicy::LensCoverType
- << ResourcePolicy::VideoPlaybackType
- << ResourcePolicy::VideoRecorderType
- << ResourcePolicy::AudioPlaybackType
- << ResourcePolicy::ScaleButtonType
- << ResourcePolicy::LedsType
- << ResourcePolicy::SnapButtonType;
- break;
- case VideoCaptureResources:
- requestedTypes << ResourcePolicy::LensCoverType
- << ResourcePolicy::VideoPlaybackType
- << ResourcePolicy::VideoRecorderType
- << ResourcePolicy::AudioPlaybackType
- << ResourcePolicy::AudioRecorderType
- << ResourcePolicy::ScaleButtonType
- << ResourcePolicy::LedsType
- << ResourcePolicy::SnapButtonType;
- break;
- }
-
- QSet<ResourcePolicy::ResourceType> currentTypes;
- foreach (ResourcePolicy::Resource *resource, m_resource->resources())
- currentTypes << resource->type();
-
- foreach (ResourcePolicy::ResourceType resourceType, currentTypes - requestedTypes)
- m_resource->deleteResource(resourceType);
-
- foreach (ResourcePolicy::ResourceType resourceType, requestedTypes - currentTypes) {
- if (resourceType == ResourcePolicy::LensCoverType) {
- ResourcePolicy::LensCoverResource *lensCoverResource = new ResourcePolicy::LensCoverResource;
- lensCoverResource->setOptional(true);
- m_resource->addResourceObject(lensCoverResource);
- } else {
- m_resource->addResource(resourceType);
- }
- }
-
- m_resource->update();
- if (set != NoResources) {
- m_resource->acquire();
- } else {
- if (oldSet != NoResources) {
- m_releasingResources = true;
- m_resource->release();
- }
- }
-#endif
-}
-
-bool CamerabinResourcePolicy::isResourcesGranted() const
-{
-#ifdef HAVE_RESOURCE_POLICY
- foreach (ResourcePolicy::Resource *resource, m_resource->resources())
- if (!resource->isOptional() && !resource->isGranted())
- return false;
-#endif
- return true;
-}
-
-void CamerabinResourcePolicy::handleResourcesReleased()
-{
-#ifdef HAVE_RESOURCE_POLICY
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO;
-#endif
- m_releasingResources = false;
-#endif
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h b/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
deleted file mode 100644
index bd483bf..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinresourcepolicy.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERARESOURCEPOLICY_H
-#define CAMERARESOURCEPOLICY_H
-
-#include <QtCore/qobject.h>
-
-namespace ResourcePolicy {
-class ResourceSet;
-};
-
-class CamerabinResourcePolicy : public QObject
-{
- Q_OBJECT
-public:
- enum ResourceSet {
- NoResources,
- LoadedResources,
- ImageCaptureResources,
- VideoCaptureResources
- };
-
- CamerabinResourcePolicy(QObject *parent);
- ~CamerabinResourcePolicy();
-
- ResourceSet resourceSet() const;
- void setResourceSet(ResourceSet set);
-
- bool isResourcesGranted() const;
-
-Q_SIGNALS:
- void resourcesDenied();
- void resourcesGranted();
- void resourcesLost();
-
-private Q_SLOTS:
- void handleResourcesReleased();
-
-private:
- ResourceSet m_resourceSet;
- ResourcePolicy::ResourceSet *m_resource;
- bool m_releasingResources;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.cpp b/src/plugins/gstreamer/camerabin/camerabinservice.cpp
deleted file mode 100644
index f0aaca7..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinservice.cpp
+++ /dev/null
@@ -1,250 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinservice.h"
-#include "camerabinsession.h"
-#include "camerabinrecorder.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-#include "camerabincontrol.h"
-#include "camerabinlocks.h"
-#include "camerabinmetadata.h"
-#include "camerabinexposure.h"
-#include "camerabinflash.h"
-#include "camerabinfocus.h"
-#include "camerabinimagecapture.h"
-#include "camerabinimageprocessing.h"
-#include "camerabincapturebufferformat.h"
-#include "camerabincapturedestination.h"
-#include <private/qgstreamerbushelper_p.h>
-
-#include "qgstreameraudioinputendpointselector.h"
-#include "qgstreamervideoinputdevicecontrol.h"
-
-#include "qgstreamervideooverlay.h"
-#include "qgstreamervideowindow.h"
-#include "qgstreamervideorenderer.h"
-
-#if defined(Q_WS_MAEMO_6) && defined(__arm__)
-#include "qgstreamergltexturerenderer.h"
-#endif
-
-#include "qgstreamervideowidget.h"
-
-#include <qmediaserviceprovider.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qprocess.h>
-
-#if defined(Q_WS_MAEMO_6)
-#include "camerabuttonlistener_meego.h"
-#endif
-
-CameraBinService::CameraBinService(const QString &service, QObject *parent):
- QMediaService(parent)
-{
- m_captureSession = 0;
- m_cameraControl = 0;
- m_metaDataControl = 0;
-
- m_audioInputEndpointSelector = 0;
- m_videoInputDevice = 0;
-
- m_videoOutput = 0;
- m_videoRenderer = 0;
- m_videoWindow = 0;
- m_videoWidgetControl = 0;
- m_imageCaptureControl = 0;
-
- if (service == Q_MEDIASERVICE_CAMERA) {
- m_captureSession = new CameraBinSession(this);
- m_cameraControl = new CameraBinControl(m_captureSession);
- m_videoInputDevice = new QGstreamerVideoInputDeviceControl(m_captureSession);
- m_imageCaptureControl = new CameraBinImageCapture(m_captureSession);
-
- connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
- m_captureSession, SLOT(setDevice(QString)));
-
- if (m_videoInputDevice->deviceCount())
- m_captureSession->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
-
-#if defined(Q_WS_MAEMO_6) && defined(__arm__)
- m_videoRenderer = new QGstreamerGLTextureRenderer(this);
-#else
- m_videoRenderer = new QGstreamerVideoRenderer(this);
-#endif
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-
-#ifdef Q_WS_MAEMO_6
- m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
- //m_videoWindow = new QGstreamerVideoWindow(this);
-#else
- m_videoWindow = new QGstreamerVideoOverlay(this);
-#endif
-
- m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
-
-#endif
-
- }
-
- if (!m_captureSession) {
- qWarning() << Q_FUNC_INFO << "Service type is not supported:" << service;
- return;
- }
-
- m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this);
- connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
-
- if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0)
- m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint());
-
- m_metaDataControl = new CameraBinMetaData(this);
- connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
- m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
-
-#if defined(Q_WS_MAEMO_6)
- new CameraButtonListener(this);
-#endif
-}
-
-CameraBinService::~CameraBinService()
-{
-}
-
-QMediaControl *CameraBinService::requestControl(const char *name)
-{
- if (!m_captureSession)
- return 0;
-
- //qDebug() << "Request control" << name;
-
- if (!m_videoOutput) {
- if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- m_videoOutput = m_videoRenderer;
- } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- m_videoOutput = m_videoWindow;
- } else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
- m_videoOutput = m_videoWidgetControl;
- }
-
- if (m_videoOutput) {
- m_captureSession->setViewfinder(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- if (qstrcmp(name,QAudioEndpointSelector_iid) == 0)
- return m_audioInputEndpointSelector;
-
- if (qstrcmp(name,QVideoDeviceControl_iid) == 0)
- return m_videoInputDevice;
-
- if (qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return m_captureSession->recorderControl();
-
- if (qstrcmp(name,QAudioEncoderControl_iid) == 0)
- return m_captureSession->audioEncodeControl();
-
- if (qstrcmp(name,QVideoEncoderControl_iid) == 0)
- return m_captureSession->videoEncodeControl();
-
- if (qstrcmp(name,QImageEncoderControl_iid) == 0)
- return m_captureSession->imageEncodeControl();
-
-
- if (qstrcmp(name,QMediaContainerControl_iid) == 0)
- return m_captureSession->mediaContainerControl();
-
- if (qstrcmp(name,QCameraControl_iid) == 0)
- return m_cameraControl;
-
- if (qstrcmp(name,QMetaDataWriterControl_iid) == 0)
- return m_metaDataControl;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return m_imageCaptureControl;
-
- if (qstrcmp(name, QCameraExposureControl_iid) == 0)
- return m_captureSession->cameraExposureControl();
-
- if (qstrcmp(name, QCameraFlashControl_iid) == 0)
- return m_captureSession->cameraFlashControl();
-
- if (qstrcmp(name, QCameraFocusControl_iid) == 0)
- return m_captureSession->cameraFocusControl();
-
- if (qstrcmp(name, QCameraImageProcessingControl_iid) == 0)
- return m_captureSession->imageProcessingControl();
-
- if (qstrcmp(name, QCameraLocksControl_iid) == 0)
- return m_captureSession->cameraLocksControl();
-
- if (qstrcmp(name, QCameraCaptureDestinationControl_iid) == 0)
- return m_captureSession->captureDestinationControl();
-
- if (qstrcmp(name, QCameraCaptureBufferFormatControl_iid) == 0)
- return m_captureSession->captureBufferFormatControl();
-
- return 0;
-}
-
-void CameraBinService::releaseControl(QMediaControl *control)
-{
- if (control && control == m_videoOutput) {
- m_videoOutput = 0;
- m_captureSession->setViewfinder(0);
- }
-}
-
-bool CameraBinService::isCameraBinAvailable()
-{
- GstElementFactory *factory = gst_element_factory_find("camerabin2");
- if (factory) {
- gst_object_unref(GST_OBJECT(factory));
- return true;
- }
-
- return false;
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinservice.h b/src/plugins/gstreamer/camerabin/camerabinservice.h
deleted file mode 100644
index 5513dd8..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinservice.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTURESERVICE_H
-#define CAMERABINCAPTURESERVICE_H
-
-#include <qmediaservice.h>
-
-#include <gst/gst.h>
-QT_BEGIN_NAMESPACE
-class QAudioEndpointSelector;
-class QVideoDeviceControl;
-QT_END_NAMESPACE
-
-class CameraBinSession;
-class CameraBinControl;
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoOverlay;
-class QGstreamerVideoWidgetControl;
-class QGstreamerElementFactory;
-class CameraBinMetaData;
-class CameraBinImageCapture;
-class CameraBinMetaData;
-
-class CameraBinService : public QMediaService
-{
- Q_OBJECT
-
-public:
- CameraBinService(const QString &service, QObject *parent = 0);
- virtual ~CameraBinService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
-
- static bool isCameraBinAvailable();
-
-private:
- void setAudioPreview(GstElement*);
-
- CameraBinSession *m_captureSession;
- CameraBinControl *m_cameraControl;
- CameraBinMetaData *m_metaDataControl;
-
- QAudioEndpointSelector *m_audioInputEndpointSelector;
- QVideoDeviceControl *m_videoInputDevice;
-
- QMediaControl *m_videoOutput;
-
- QMediaControl *m_videoRenderer;
- QMediaControl *m_videoWindow;
- QGstreamerVideoWidgetControl *m_videoWidgetControl;
- CameraBinImageCapture *m_imageCaptureControl;
-};
-
-#endif // CAMERABINCAPTURESERVICE_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.cpp b/src/plugins/gstreamer/camerabin/camerabinsession.cpp
deleted file mode 100644
index 996e149..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinsession.cpp
+++ /dev/null
@@ -1,1216 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "camerabinsession.h"
-#include "camerabinrecorder.h"
-#include "camerabincontainer.h"
-#include "camerabinaudioencoder.h"
-#include "camerabinvideoencoder.h"
-#include "camerabinimageencoder.h"
-#include "camerabinexposure.h"
-#include "camerabinflash.h"
-#include "camerabinfocus.h"
-#include "camerabinimageprocessing.h"
-#include "camerabinlocks.h"
-#include "camerabincapturedestination.h"
-#include "camerabincapturebufferformat.h"
-#include <private/qgstreamerbushelper_p.h>
-#include "qgstreamervideorendererinterface.h"
-#include <qmediarecorder.h>
-#include <gst/interfaces/photography.h>
-#include <gst/gsttagsetter.h>
-#include <gst/gstversion.h>
-
-#include <QtCore/qdebug.h>
-#include <QCoreApplication>
-#include <QtCore/qmetaobject.h>
-#include <QtGui/qdesktopservices.h>
-
-#include <QtGui/qimage.h>
-
-//#define CAMERABIN_DEBUG 1
-//#define CAMERABIN_DEBUG_DUMP_BIN 1
-#define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
-#define FILENAME_PROPERTY "location"
-#define MODE_PROPERTY "mode"
-#define MUTE_PROPERTY "mute"
-#define IMAGE_PP_PROPERTY "image-post-processing"
-#define IMAGE_ENCODER_PROPERTY "image-encoder"
-#define VIDEO_PP_PROPERTY "video-post-processing"
-#define VIEWFINDER_SINK_PROPERTY "viewfinder-sink"
-#define CAMERA_SOURCE_PROPERTY "camera-source"
-#define AUDIO_SOURCE_PROPERTY "audio-source"
-#define SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY "image-capture-supported-caps"
-#define SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY "video-capture-supported-caps"
-#define FILTER_CAPS_PROPERTY "filter-caps"
-#define PREVIEW_CAPS_PROPERTY "preview-caps"
-
-#define CAPTURE_START "start-capture"
-#define CAPTURE_STOP "stop-capture"
-#define SET_VIDEO_RESOLUTION_FPS "set-video-resolution-fps"
-#define SET_IMAGE_RESOLUTION "set-image-resolution"
-
-#define CAMERABIN_IMAGE_MODE 1
-#define CAMERABIN_VIDEO_MODE 2
-
-#define gstRef(element) { gst_object_ref(GST_OBJECT(element)); gst_object_sink(GST_OBJECT(element)); }
-#define gstUnref(element) { if (element) { gst_object_unref(GST_OBJECT(element)); element = 0; } }
-
-#define PREVIEW_CAPS_4_3 \
- "video/x-raw-rgb, width = (int) 640, height = (int) 480"
-
-#define VIEWFINDER_RESOLUTION_4x3 QSize(640, 480)
-#define VIEWFINDER_RESOLUTION_3x2 QSize(720, 480)
-#define VIEWFINDER_RESOLUTION_16x9 QSize(800, 450)
-
-//using GST_STATE_READY for QCamera::LoadedState
-//may not work reliably at least with some webcams.
-
-//#define USE_READY_STATE_ON_LOADED
-
-
-CameraBinSession::CameraBinSession(QObject *parent)
- :QObject(parent),
- m_recordingActive(false),
- m_state(QCamera::UnloadedState),
- m_pendingState(QCamera::UnloadedState),
- m_pendingResolutionUpdate(false),
- m_muted(false),
- m_busy(false),
- m_captureMode(QCamera::CaptureStillImage),
- m_audioInputFactory(0),
- m_videoInputFactory(0),
- m_viewfinder(0),
- m_viewfinderInterface(0),
- m_videoSrc(0),
- m_viewfinderElement(0),
- m_viewfinderHasChanged(true),
- m_videoInputHasChanged(true),
- m_audioSrc(0),
- m_audioConvert(0),
- m_capsFilter(0),
- m_fileSink(0),
- m_audioEncoder(0),
- m_muxer(0)
-{
- m_camerabin = gst_element_factory_make("camerabin2", "camerabin2");
- g_signal_connect(G_OBJECT(m_camerabin), "notify::idle", G_CALLBACK(updateBusyStatus), this);
- gstRef(m_camerabin);
-
- m_bus = gst_element_get_bus(m_camerabin);
-
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- m_audioEncodeControl = new CameraBinAudioEncoder(this);
- m_videoEncodeControl = new CameraBinVideoEncoder(this);
- m_imageEncodeControl = new CameraBinImageEncoder(this);
- m_recorderControl = new CameraBinRecorder(this);
- m_mediaContainerControl = new CameraBinContainer(this);
- m_cameraExposureControl = new CameraBinExposure(this);
- m_cameraFlashControl = new CameraBinFlash(this);
- m_cameraFocusControl = new CameraBinFocus(this);
- m_imageProcessingControl = new CameraBinImageProcessing(this);
- m_cameraLocksControl = new CameraBinLocks(this);
- m_captureDestinationControl = new CameraBinCaptureDestination(this);
- m_captureBufferFormatControl = new CameraBinCaptureBufferFormat(this);
-
- //post image preview in RGB format
- GstCaps *previewCaps = gst_caps_from_string("video/x-raw-rgb");
- g_object_set(G_OBJECT(m_camerabin), PREVIEW_CAPS_PROPERTY, previewCaps, NULL);
- gst_caps_unref(previewCaps);
-}
-
-CameraBinSession::~CameraBinSession()
-{
- if (m_camerabin) {
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- gst_element_get_state(m_camerabin, NULL, NULL, GST_CLOCK_TIME_NONE);
- gstUnref(m_camerabin);
- gstUnref(m_viewfinderElement);
- }
-}
-
-GstPhotography *CameraBinSession::photography()
-{
- if (GST_IS_PHOTOGRAPHY(m_camerabin)) {
- return GST_PHOTOGRAPHY(m_camerabin);
- }
-
- if (!m_videoSrc) {
- m_videoSrc = buildCameraSource();
-
- if (m_videoSrc)
- g_object_set(m_camerabin, CAMERA_SOURCE_PROPERTY, m_videoSrc, NULL);
- else
- g_object_get(m_camerabin, CAMERA_SOURCE_PROPERTY, &m_videoSrc, NULL);
-
- m_videoInputHasChanged = false;
- }
-
- if (m_videoSrc && GST_IS_PHOTOGRAPHY(m_videoSrc))
- return GST_PHOTOGRAPHY(m_videoSrc);
-
- return 0;
-}
-
-CameraBinSession::CameraRole CameraBinSession::cameraRole() const
-{
- return BackCamera;
-}
-
-/*
- Configure camera during Loaded->Active states stansition.
-*/
-bool CameraBinSession::setupCameraBin()
-{
- if (m_videoInputHasChanged) {
- m_videoSrc = buildCameraSource();
-
- if (m_videoSrc)
- g_object_set(m_camerabin, CAMERA_SOURCE_PROPERTY, m_videoSrc, NULL);
- else
- g_object_get(m_camerabin, CAMERA_SOURCE_PROPERTY, &m_videoSrc, NULL);
-
- m_videoInputHasChanged = false;
- }
-
-
- if (m_viewfinderHasChanged) {
- if (m_viewfinderElement)
- gst_object_unref(GST_OBJECT(m_viewfinderElement));
-
- m_viewfinderElement = m_viewfinderInterface ? m_viewfinderInterface->videoSink() : 0;
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "Viewfinder changed, reconfigure.";
-#endif
- m_viewfinderHasChanged = false;
- if (!m_viewfinderElement) {
- qWarning() << "Staring camera without viewfinder available";
- m_viewfinderElement = gst_element_factory_make("fakesink", NULL);
- }
- gst_object_ref(GST_OBJECT(m_viewfinderElement));
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- g_object_set(G_OBJECT(m_camerabin), VIEWFINDER_SINK_PROPERTY, m_viewfinderElement, NULL);
- }
-
- return true;
-}
-
-static GstCaps *resolutionToCaps(const QSize &resolution,
- const QPair<int, int> &rate = qMakePair<int,int>(0,0))
-{
- if (resolution.isEmpty())
- return gst_caps_new_any();
-
- GstCaps *caps = 0;
- if (rate.second > 0) {
- caps = gst_caps_new_full(gst_structure_new("video/x-raw-yuv",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL),
- gst_structure_new("video/x-raw-rgb",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- "framerate", GST_TYPE_FRACTION, rate.first, rate.second,
- NULL), NULL);
- } else {
- caps = gst_caps_new_full (gst_structure_new ("video/x-raw-yuv",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(),
- NULL),
- gst_structure_new ("video/x-raw-rgb",
- "width", G_TYPE_INT, resolution.width(),
- "height", G_TYPE_INT, resolution.height(), NULL), NULL);
- }
- return caps;
-}
-
-void CameraBinSession::setupCaptureResolution()
-{
- if (m_captureMode == QCamera::CaptureStillImage) {
- QSize resolution = m_imageEncodeControl->imageSettings().resolution();
-
- //by default select the maximum supported resolution
- if (resolution.isEmpty()) {
- bool continuous = false;
- QList<QSize> resolutions = supportedResolutions(qMakePair<int,int>(0,0),
- &continuous,
- QCamera::CaptureStillImage);
- if (!resolutions.isEmpty())
- resolution = resolutions.last();
- }
-
- QSize viewfinderResolution = VIEWFINDER_RESOLUTION_4x3;
-
- if (!resolution.isEmpty()) {
- GstCaps *caps = resolutionToCaps(resolution);
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "set image resolution" << resolution << gst_caps_to_string(caps);
-#endif
- g_object_set(m_camerabin, "image-capture-caps", caps, NULL);
- gst_caps_unref(caps);
-
- if (!resolution.isEmpty()) {
- qreal aspectRatio = qreal(resolution.width()) / resolution.height();
- if (aspectRatio < 1.4)
- viewfinderResolution = VIEWFINDER_RESOLUTION_4x3;
- else if (aspectRatio > 1.7)
- viewfinderResolution = VIEWFINDER_RESOLUTION_16x9;
- else
- viewfinderResolution = VIEWFINDER_RESOLUTION_3x2;
- }
- }
-
- //on low res cameras the viewfinder resolution should not be bigger
- //then capture resolution
- if (viewfinderResolution.width() > resolution.width() && !resolution.isEmpty())
- viewfinderResolution = resolution;
-
- GstCaps *viewfinderCaps = resolutionToCaps(viewfinderResolution);
-#if CAMERABIN_DEBUG
- qDebug() << "Set viewfinder resolution" << viewfinderResolution <<gst_caps_to_string(viewfinderCaps);
-#endif
- g_object_set(m_camerabin, "viewfinder-caps", viewfinderCaps, NULL);
- gst_caps_unref(viewfinderCaps);
- }
-
- if (m_captureMode == QCamera::CaptureVideo) {
- QSize resolution = m_videoEncodeControl->videoSettings().resolution();
- //qreal framerate = m_videoEncodeControl->videoSettings().frameRate();
-
- if (resolution.isEmpty()) {
- //select the hightest supported resolution
- bool continuous = false;
- QList<QSize> resolutions = supportedResolutions(qMakePair<int,int>(0,0),
- &continuous,
- QCamera::CaptureVideo);
- if (!resolutions.isEmpty())
- resolution = resolutions.last();
- }
-
- GstCaps *caps = resolutionToCaps(resolution /*, framerate*/); //convert to rational
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << "set video resolution" << resolution << gst_caps_to_string(caps);
-#endif
-
- g_object_set(m_camerabin, "video-capture-caps", caps, NULL);
- gst_caps_unref(caps);
- }
-}
-
-GstElement *CameraBinSession::buildCameraSource()
-{
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO;
-#endif
- GstElement *videoSrc = 0;
- if (m_videoInputFactory) {
- videoSrc = m_videoInputFactory->buildElement();
- } else {
- QList<QByteArray> candidates;
- candidates << "wrappercamerabinsrc";
- QByteArray sourceElementName;
-
- foreach(sourceElementName, candidates) {
- videoSrc = gst_element_factory_make(sourceElementName.constData(), "camera_source");
- if (videoSrc)
- break;
- }
-
- if (videoSrc && !m_inputDevice.isEmpty()) {
-#if CAMERABIN_DEBUG
- qDebug() << "set camera device" << m_inputDevice;
-#endif
- if (sourceElementName == "subdevsrc") {
- if (m_inputDevice == QLatin1String("secondary"))
- g_object_set(G_OBJECT(videoSrc), "camera-device", 1, NULL);
- else
- g_object_set(G_OBJECT(videoSrc), "camera-device", 0, NULL);
- } else {
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(videoSrc), "device"))
- g_object_set(G_OBJECT(videoSrc),
- "device",
- m_inputDevice.toLocal8Bit().constData(),
- NULL);
- }
- }
- }
-
- return videoSrc;
-}
-
-void CameraBinSession::captureImage(int requestId, const QString &fileName)
-{
- QString actualFileName = fileName;
- if (actualFileName.isEmpty())
- actualFileName = generateFileName("img_", defaultDir(QCamera::CaptureStillImage), "jpg");
-
- m_requestId = requestId;
-
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << m_requestId << fileName << "actual file name:" << actualFileName;
-#endif
-
- g_object_set(G_OBJECT(m_camerabin), FILENAME_PROPERTY, actualFileName.toLocal8Bit().constData(), NULL);
-
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_START, NULL);
-
- m_imageFileName = actualFileName;
-}
-
-void CameraBinSession::setCaptureMode(QCamera::CaptureMode mode)
-{
- m_captureMode = mode;
-
- switch (m_captureMode) {
- case QCamera::CaptureStillImage:
- g_object_set(m_camerabin, MODE_PROPERTY, CAMERABIN_IMAGE_MODE, NULL);
- break;
- case QCamera::CaptureVideo:
- g_object_set(m_camerabin, MODE_PROPERTY, CAMERABIN_VIDEO_MODE, NULL);
- break;
- }
-}
-
-QUrl CameraBinSession::outputLocation() const
-{
- //return the location service wrote data to, not one set by user, it can be empty.
- return m_actualSink;
-}
-
-bool CameraBinSession::setOutputLocation(const QUrl& sink)
-{
- m_sink = m_actualSink = sink;
- return true;
-}
-
-QDir CameraBinSession::defaultDir(QCamera::CaptureMode mode) const
-{
- QStringList dirCandidates;
-
-#if defined(Q_WS_MAEMO_6)
- dirCandidates << QLatin1String("/home/user/MyDocs/DCIM");
- dirCandidates << QLatin1String("/home/user/MyDocs/");
-#endif
-
- if (mode == QCamera::CaptureVideo) {
- dirCandidates << QDesktopServices::storageLocation(QDesktopServices::MoviesLocation);
- dirCandidates << QDir::home().filePath("Documents/Video");
- dirCandidates << QDir::home().filePath("Documents/Videos");
- } else {
- dirCandidates << QDesktopServices::storageLocation(QDesktopServices::PicturesLocation);
- dirCandidates << QDir::home().filePath("Documents/Photo");
- dirCandidates << QDir::home().filePath("Documents/Photos");
- dirCandidates << QDir::home().filePath("Documents/photo");
- dirCandidates << QDir::home().filePath("Documents/photos");
- dirCandidates << QDir::home().filePath("Documents/Images");
- }
-
- dirCandidates << QDir::home().filePath("Documents");
- dirCandidates << QDir::home().filePath("My Documents");
- dirCandidates << QDir::homePath();
- dirCandidates << QDir::currentPath();
- dirCandidates << QDir::tempPath();
-
- foreach (const QString &path, dirCandidates) {
- if (QFileInfo(path).isWritable())
- return QDir(path);
- }
-
- return QDir();
-}
-
-QString CameraBinSession::generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const
-{
- int lastClip = 0;
- foreach(QString fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext))) {
- int imgNumber = fileName.mid(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("%1%2.%3").arg(prefix)
- .arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0'))
- .arg(ext);
-
- return dir.absoluteFilePath(name);
-}
-
-void CameraBinSession::setDevice(const QString &device)
-{
- if (m_inputDevice != device) {
- m_inputDevice = device;
- m_videoInputHasChanged = true;
- }
-}
-
-void CameraBinSession::setAudioInput(QGstreamerElementFactory *audioInput)
-{
- m_audioInputFactory = audioInput;
-}
-
-void CameraBinSession::setVideoInput(QGstreamerElementFactory *videoInput)
-{
- m_videoInputFactory = videoInput;
- m_videoInputHasChanged = true;
-}
-
-bool CameraBinSession::isReady() const
-{
- //it's possible to use QCamera without any viewfinder attached
- return !m_viewfinderInterface || m_viewfinderInterface->isReady();
-}
-
-void CameraBinSession::setViewfinder(QObject *viewfinder)
-{
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- m_viewfinderInterface = qobject_cast<QGstreamerVideoRendererInterface*>(viewfinder);
- if (!m_viewfinderInterface)
- viewfinder = 0;
-
- if (m_viewfinder != viewfinder) {
- bool oldReady = isReady();
-
- if (m_viewfinder) {
- disconnect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SLOT(handleViewfinderChange()));
- disconnect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->removeMessageFilter(m_viewfinder);
- }
-
- m_viewfinder = viewfinder;
- m_viewfinderHasChanged = true;
-
- if (m_viewfinder) {
- connect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SLOT(handleViewfinderChange()));
- connect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->installMessageFilter(m_viewfinder);
- }
-
- emit viewfinderChanged();
- if (oldReady != isReady())
- emit readyChanged(isReady());
- }
-}
-
-void CameraBinSession::handleViewfinderChange()
-{
- //the viewfinder will be reloaded
- //shortly when the pipeline is started
- m_viewfinderHasChanged = true;
- emit viewfinderChanged();
-}
-
-QCamera::State CameraBinSession::state() const
-{
- return m_state;
-}
-
-void CameraBinSession::setState(QCamera::State newState)
-{
- if (newState == m_pendingState)
- return;
-
- m_pendingState = newState;
-
-#if CAMERABIN_DEBUG
- qDebug() << Q_FUNC_INFO << newState;
-#endif
-
- switch (newState) {
- case QCamera::UnloadedState:
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- m_state = newState;
- if (m_busy)
- emit busyChanged(m_busy = false);
-
- emit stateChanged(m_state);
- break;
- case QCamera::LoadedState:
- if (m_recordingActive)
- stopVideoRecording();
-
- if (m_videoInputHasChanged) {
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
-
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- m_videoSrc = buildCameraSource();
- g_object_set(m_camerabin, CAMERA_SOURCE_PROPERTY, m_videoSrc, NULL);
- m_videoInputHasChanged = false;
- }
-#ifdef USE_READY_STATE_ON_LOADED
- gst_element_set_state(m_camerabin, GST_STATE_READY);
-#else
- m_state = QCamera::LoadedState;
- if (m_viewfinderInterface)
- m_viewfinderInterface->stopRenderer();
- gst_element_set_state(m_camerabin, GST_STATE_NULL);
- emit stateChanged(m_state);
-#endif
- break;
- case QCamera::ActiveState:
- if (setupCameraBin()) {
- GstState binState = GST_STATE_NULL;
- GstState pending = GST_STATE_NULL;
- gst_element_get_state(m_camerabin, &binState, &pending, 0);
-
- if (pending == GST_STATE_VOID_PENDING && binState == GST_STATE_READY) {
- m_pendingResolutionUpdate = false;
- setupCaptureResolution();
- gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
- } else {
- m_pendingResolutionUpdate = true;
- gst_element_set_state(m_camerabin, GST_STATE_READY);
- }
- }
- }
-}
-
-bool CameraBinSession::isBusy() const
-{
- return m_busy;
-}
-
-void CameraBinSession::updateBusyStatus(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(p);
- CameraBinSession *session = reinterpret_cast<CameraBinSession *>(d);
-
- bool idle = false;
- g_object_get(o, "idle", &idle, NULL);
- bool busy = !idle;
-
- if (session->m_busy != busy) {
- session->m_busy = busy;
- QMetaObject::invokeMethod(session, "busyChanged",
- Qt::QueuedConnection,
- Q_ARG(bool, busy));
- }
-}
-
-qint64 CameraBinSession::duration() const
-{
- GstFormat format = GST_FORMAT_TIME;
- gint64 duration = 0;
-
- if ( m_camerabin && gst_element_query_position(m_camerabin, &format, &duration))
- return duration / 1000000;
- else
- return 0;
-}
-
-bool CameraBinSession::isMuted() const
-{
- return m_muted;
-}
-
-void CameraBinSession::setMuted(bool muted)
-{
- if (m_muted != muted) {
- m_muted = muted;
-
- if (m_camerabin)
- g_object_set(G_OBJECT(m_camerabin), MUTE_PROPERTY, m_muted, NULL);
- emit mutedChanged(m_muted);
- }
-}
-
-void CameraBinSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
-}
-
-void CameraBinSession::setMetaData(const QMap<QByteArray, QVariant> &data)
-{
- m_metaData = data;
-
- if (m_camerabin) {
- GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_camerabin), GST_TYPE_TAG_SETTER);
- GstElement *element = 0;
- while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) {
- QMapIterator<QByteArray, QVariant> it(data);
- while (it.hasNext()) {
- it.next();
- const QString tagName = it.key();
- const QVariant tagValue = it.value();
-
- switch(tagValue.type()) {
- case QVariant::String:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toString().toUtf8().constData(),
- NULL);
- break;
- case QVariant::Int:
- case QVariant::LongLong:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toInt(),
- NULL);
- break;
- case QVariant::Double:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toDouble(),
- NULL);
- break;
- default:
- break;
- }
- }
- }
- }
-}
-
-bool CameraBinSession::processSyncMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
- const GstStructure *st;
- const GValue *image;
- GstBuffer *buffer = NULL;
-
- if (gm && GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) {
- if (m_captureMode == QCamera::CaptureStillImage &&
- gst_structure_has_name(gm->structure, "preview-image")) {
- st = gst_message_get_structure(gm);
-
- if (gst_structure_has_field_typed(st, "buffer", GST_TYPE_BUFFER)) {
- image = gst_structure_get_value(st, "buffer");
- if (image) {
- buffer = gst_value_get_buffer(image);
-
- QImage img;
-
- GstCaps *caps = gst_buffer_get_caps(buffer);
- if (caps) {
- GstStructure *structure = gst_caps_get_structure(caps, 0);
- gint width = 0;
- gint height = 0;
-#if CAMERABIN_DEBUG
- qDebug() << "Preview caps:" << gst_structure_to_string(structure);
-#endif
-
- if (structure &&
- gst_structure_get_int(structure, "width", &width) &&
- gst_structure_get_int(structure, "height", &height) &&
- width > 0 && height > 0) {
- if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) {
- QImage::Format format = QImage::Format_Invalid;
- int bpp = 0;
- gst_structure_get_int(structure, "bpp", &bpp);
-
- if (bpp == 24)
- format = QImage::Format_RGB888;
- else if (bpp == 32)
- format = QImage::Format_RGB32;
-
- if (format != QImage::Format_Invalid) {
- img = QImage((const uchar *)buffer->data, width, height, format);
- img.bits(); //detach
- }
- }
- }
- gst_caps_unref(caps);
-
- static int exposedSignalIndex = metaObject()->indexOfSignal("imageExposed(int)");
- metaObject()->method(exposedSignalIndex).invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId));
-
- static int signalIndex = metaObject()->indexOfSignal("imageCaptured(int,QImage)");
- metaObject()->method(signalIndex).invoke(this,
- Qt::QueuedConnection,
- Q_ARG(int,m_requestId),
- Q_ARG(QImage,img));
- }
-
- }
- return true;
- }
- }
-
- if (gst_structure_has_name(gm->structure, GST_PHOTOGRAPHY_AUTOFOCUS_DONE))
- m_cameraFocusControl->handleFocusMessage(gm);
- }
-
- return false;
-}
-
-bool CameraBinSession::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (gm) {
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error (gm, &err, &debug);
-
- QString message;
-
- if (err && err->message) {
- message = QString::fromUtf8(err->message);
- qWarning() << "CameraBin error:" << message;
- }
-
- //only report error messager from camerabin
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_camerabin)) {
- if (message.isEmpty())
- message = tr("Camera error");
-
- emit error(int(QMediaRecorder::ResourceError), message);
- }
-
-#ifdef CAMERABIN_DEBUG_DUMP_BIN
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_camerabin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "camerabin_error");
-#endif
-
-
- if (err)
- g_error_free (err);
-
- if (debug)
- g_free (debug);
- }
-
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) {
- GError *err;
- gchar *debug;
- gst_message_parse_warning (gm, &err, &debug);
-
- if (err && err->message)
- qWarning() << "CameraBin warning:" << QString::fromUtf8(err->message);
-
- if (err)
- g_error_free (err);
- if (debug)
- g_free (debug);
- }
-
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_camerabin)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
- case GST_MESSAGE_STATE_CHANGED:
- {
-
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
-
-#if CAMERABIN_DEBUG
- QStringList states;
- states << "GST_STATE_VOID_PENDING" << "GST_STATE_NULL" << "GST_STATE_READY" << "GST_STATE_PAUSED" << "GST_STATE_PLAYING";
-
-
- qDebug() << QString("state changed: old: %1 new: %2 pending: %3") \
- .arg(states[oldState]) \
- .arg(states[newState]) \
- .arg(states[pending]);
-#endif
-
-#ifdef CAMERABIN_DEBUG_DUMP_BIN
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_camerabin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /*GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "camerabin");
-#endif
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- if (m_state != QCamera::UnloadedState)
- emit stateChanged(m_state = QCamera::UnloadedState);
- break;
- case GST_STATE_READY:
- if (m_pendingResolutionUpdate) {
- m_pendingResolutionUpdate = false;
- setupCaptureResolution();
- gst_element_set_state(m_camerabin, GST_STATE_PLAYING);
- }
- if (m_state != QCamera::LoadedState)
- emit stateChanged(m_state = QCamera::LoadedState);
- break;
- case GST_STATE_PAUSED:
- case GST_STATE_PLAYING:
- emit stateChanged(m_state = QCamera::ActiveState);
- break;
- }
- }
- break;
- default:
- break;
- }
- //qDebug() << "New session state:" << ENUM_NAME(CameraBinSession,"State",m_state);
- }
- }
-
- return false;
-}
-
-void CameraBinSession::recordVideo()
-{
- m_recordingActive = true;
- m_actualSink = m_sink;
- if (m_actualSink.isEmpty()) {
- QString ext = m_mediaContainerControl->suggestedFileExtension();
- m_actualSink = generateFileName("clip_", defaultDir(QCamera::CaptureVideo), ext);
- }
-
- g_object_set(G_OBJECT(m_camerabin), FILENAME_PROPERTY, m_actualSink.toEncoded().constData(), NULL);
-
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_START, NULL);
-}
-
-void CameraBinSession::stopVideoRecording()
-{
- m_recordingActive = false;
- g_signal_emit_by_name(G_OBJECT(m_camerabin), CAPTURE_STOP, NULL);
-}
-
-//internal, only used by CameraBinSession::supportedFrameRates.
-//recursively fills the list of framerates res from value data.
-static void readValue(const GValue *value, QList< QPair<int,int> > *res, bool *continuous)
-{
- if (GST_VALUE_HOLDS_FRACTION(value)) {
- int num = gst_value_get_fraction_numerator(value);
- int denum = gst_value_get_fraction_denominator(value);
-
- *res << QPair<int,int>(num, denum);
- } else if (GST_VALUE_HOLDS_FRACTION_RANGE(value)) {
- const GValue *rateValueMin = gst_value_get_fraction_range_min(value);
- const GValue *rateValueMax = gst_value_get_fraction_range_max(value);
-
- if (continuous)
- *continuous = true;
-
- readValue(rateValueMin, res, continuous);
- readValue(rateValueMax, res, continuous);
- } else if (GST_VALUE_HOLDS_LIST(value)) {
- for (uint i=0; i<gst_value_list_get_size(value); i++) {
- readValue(gst_value_list_get_value(value, i), res, continuous);
- }
- }
-}
-
-static bool rateLessThan(const QPair<int,int> &r1, const QPair<int,int> &r2)
-{
- return r1.first*r2.second < r2.first*r1.second;
-}
-
-QList< QPair<int,int> > CameraBinSession::supportedFrameRates(const QSize &frameSize, bool *continuous) const
-{
- QList< QPair<int,int> > res;
-
- GstCaps *supportedCaps = 0;
- g_object_get(G_OBJECT(m_camerabin),
- SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
- &supportedCaps, NULL);
-
- if (!supportedCaps)
- return res;
-
- GstCaps *caps = 0;
-
- if (frameSize.isEmpty()) {
- caps = gst_caps_copy(supportedCaps);
- } else {
- GstCaps *filter = gst_caps_new_full(
- gst_structure_new(
- "video/x-raw-rgb",
- "width" , G_TYPE_INT , frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- gst_structure_new(
- "video/x-raw-yuv",
- "width" , G_TYPE_INT, frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- gst_structure_new(
- "image/jpeg",
- "width" , G_TYPE_INT, frameSize.width(),
- "height" , G_TYPE_INT, frameSize.height(), NULL),
- NULL);
-
- caps = gst_caps_intersect(supportedCaps, filter);
- gst_caps_unref(filter);
- }
- gst_caps_unref(supportedCaps);
-
- //simplify to the list of rates only:
- caps = gst_caps_make_writable(caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw-yuv");
- const GValue *oldRate = gst_structure_get_value(structure, "framerate");
- GValue rate;
- memset(&rate, 0, sizeof(rate));
- g_value_init(&rate, G_VALUE_TYPE(oldRate));
- g_value_copy(oldRate, &rate);
- gst_structure_remove_all_fields(structure);
- gst_structure_set_value(structure, "framerate", &rate);
- }
- gst_caps_do_simplify(caps);
-
-
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- const GValue *rateValue = gst_structure_get_value(structure, "framerate");
- readValue(rateValue, &res, continuous);
- }
-
- qSort(res.begin(), res.end(), rateLessThan);
-
-#if CAMERABIN_DEBUG
- qDebug() << "Supported rates:" << gst_caps_to_string(caps);
- qDebug() << res;
-#endif
-
- gst_caps_unref(caps);
-
- return res;
-}
-
-//internal, only used by CameraBinSession::supportedResolutions
-//recursively find the supported resolutions range.
-static QPair<int,int> valueRange(const GValue *value, bool *continuous)
-{
- int minValue = 0;
- int maxValue = 0;
-
- if (g_value_type_compatible(G_VALUE_TYPE(value), G_TYPE_INT)) {
- minValue = maxValue = g_value_get_int(value);
- } else if (GST_VALUE_HOLDS_INT_RANGE(value)) {
- minValue = gst_value_get_int_range_min(value);
- maxValue = gst_value_get_int_range_max(value);
- *continuous = true;
- } else if (GST_VALUE_HOLDS_LIST(value)) {
- for (uint i=0; i<gst_value_list_get_size(value); i++) {
- QPair<int,int> res = valueRange(gst_value_list_get_value(value, i), continuous);
-
- if (res.first > 0 && minValue > 0)
- minValue = qMin(minValue, res.first);
- else //select non 0 valid value
- minValue = qMax(minValue, res.first);
-
- maxValue = qMax(maxValue, res.second);
- }
- }
-
- return QPair<int,int>(minValue, maxValue);
-}
-
-static bool resolutionLessThan(const QSize &r1, const QSize &r2)
-{
- return r1.width()*r1.height() < r2.width()*r2.height();
-}
-
-
-QList<QSize> CameraBinSession::supportedResolutions(QPair<int,int> rate,
- bool *continuous,
- QCamera::CaptureMode mode) const
-{
- QList<QSize> res;
-
- if (continuous)
- *continuous = false;
-
- GstCaps *supportedCaps = 0;
- g_object_get(G_OBJECT(m_camerabin),
- (mode == QCamera::CaptureStillImage) ?
- SUPPORTED_IMAGE_CAPTURE_CAPS_PROPERTY : SUPPORTED_VIDEO_CAPTURE_CAPS_PROPERTY,
- &supportedCaps, NULL);
-
- if (!supportedCaps)
- return res;
-
-#if CAMERABIN_DEBUG
- qDebug() << "Source caps:" << gst_caps_to_string(supportedCaps);
-#endif
-
- GstCaps *caps = 0;
- bool isContinuous = false;
-
- if (rate.first <= 0 || rate.second <= 0) {
- caps = gst_caps_copy(supportedCaps);
- } else {
- GstCaps *filter = gst_caps_new_full(
- gst_structure_new(
- "video/x-raw-rgb",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- gst_structure_new(
- "video/x-raw-yuv",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- gst_structure_new(
- "image/jpeg",
- "framerate" , GST_TYPE_FRACTION , rate.first, rate.second, NULL),
- NULL);
-
- caps = gst_caps_intersect(supportedCaps, filter);
- gst_caps_unref(filter);
- }
- gst_caps_unref(supportedCaps);
-
- //simplify to the list of resolutions only:
- caps = gst_caps_make_writable(caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- gst_structure_set_name(structure, "video/x-raw-yuv");
- const GValue *oldW = gst_structure_get_value(structure, "width");
- const GValue *oldH = gst_structure_get_value(structure, "height");
- GValue w;
- memset(&w, 0, sizeof(GValue));
- GValue h;
- memset(&h, 0, sizeof(GValue));
- g_value_init(&w, G_VALUE_TYPE(oldW));
- g_value_init(&h, G_VALUE_TYPE(oldH));
- g_value_copy(oldW, &w);
- g_value_copy(oldH, &h);
- gst_structure_remove_all_fields(structure);
- gst_structure_set_value(structure, "width", &w);
- gst_structure_set_value(structure, "height", &h);
- }
- gst_caps_do_simplify(caps);
-
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- const GValue *wValue = gst_structure_get_value(structure, "width");
- const GValue *hValue = gst_structure_get_value(structure, "height");
-
- QPair<int,int> wRange = valueRange(wValue, &isContinuous);
- QPair<int,int> hRange = valueRange(hValue, &isContinuous);
-
- QSize minSize(wRange.first, hRange.first);
- QSize maxSize(wRange.second, hRange.second);
-
- if (!minSize.isEmpty())
- res << minSize;
-
- if (minSize != maxSize && !maxSize.isEmpty())
- res << maxSize;
- }
-
-
- qSort(res.begin(), res.end(), resolutionLessThan);
-
- //if the range is continuos, populate is with the common rates
- if (isContinuous && res.size() >= 2) {
- //fill the ragne with common value
- static QList<QSize> commonSizes =
- QList<QSize>() << QSize(128, 96)
- << QSize(160,120)
- << QSize(176, 144)
- << QSize(320, 240)
- << QSize(352, 288)
- << QSize(640, 480)
- << QSize(848, 480)
- << QSize(854, 480)
- << QSize(1024, 768)
- << QSize(1280, 720) // HD 720
- << QSize(1280, 1024)
- << QSize(1600, 1200)
- << QSize(1920, 1080) // HD
- << QSize(1920, 1200)
- << QSize(2048, 1536)
- << QSize(2560, 1600)
- << QSize(2580, 1936);
- QSize minSize = res.first();
- QSize maxSize = res.last();
- res.clear();
-
- foreach (const QSize &candidate, commonSizes) {
- int w = candidate.width();
- int h = candidate.height();
-
- if (w > maxSize.width() && h > maxSize.height())
- break;
-
- if (w >= minSize.width() && h >= minSize.height() &&
- w <= maxSize.width() && h <= maxSize.height())
- res << candidate;
- }
-
- if (res.isEmpty() || res.first() != minSize)
- res.prepend(minSize);
-
- if (res.last() != maxSize)
- res.append(maxSize);
- }
-
-#if CAMERABIN_DEBUG
- qDebug() << "Supported resolutions:" << gst_caps_to_string(caps);
- qDebug() << res;
-#endif
-
- gst_caps_unref(caps);
-
- if (continuous)
- *continuous = isContinuous;
-
- return res;
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinsession.h b/src/plugins/gstreamer/camerabin/camerabinsession.h
deleted file mode 100644
index fea1ad5..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinsession.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINCAPTURESESSION_MAEMO_H
-#define CAMERABINCAPTURESESSION_MAEMO_H
-
-#include <qmediarecordercontrol.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qdir.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/photography.h>
-
-#include "qgstreamerbushelper.h"
-#include "qcamera.h"
-
-
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class CameraBinAudioEncoder;
-class CameraBinVideoEncoder;
-class CameraBinImageEncoder;
-class CameraBinRecorder;
-class CameraBinContainer;
-class CameraBinExposure;
-class CameraBinFlash;
-class CameraBinFocus;
-class CameraBinImageProcessing;
-class CameraBinLocks;
-class CameraBinCaptureDestination;
-class CameraBinCaptureBufferFormat;
-class QGstreamerVideoRendererInterface;
-
-class QGstreamerElementFactory
-{
-public:
- virtual GstElement *buildElement() = 0;
-};
-
-class CameraBinSession : public QObject,
- public QGstreamerBusMessageFilter,
- public QGstreamerSyncMessageFilter
-{
- Q_OBJECT
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_INTERFACES(QGstreamerBusMessageFilter QGstreamerSyncMessageFilter)
-public:
- enum CameraRole {
- FrontCamera, // Secondary camera
- BackCamera // Main photo camera
- };
-
- CameraBinSession(QObject *parent);
- ~CameraBinSession();
-
- GstPhotography *photography();
- GstElement *cameraBin() { return m_camerabin; }
- QGstreamerBusHelper *bus() { return m_busHelper; }
-
- CameraRole cameraRole() const;
-
- QList< QPair<int,int> > supportedFrameRates(const QSize &frameSize, bool *continuous) const;
- QList<QSize> supportedResolutions( QPair<int,int> rate, bool *continuous, QCamera::CaptureMode mode) const;
-
- QCamera::CaptureMode captureMode() { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureMode mode);
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl& sink);
-
- QDir defaultDir(QCamera::CaptureMode mode) const;
- QString generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const;
-
- CameraBinAudioEncoder *audioEncodeControl() const { return m_audioEncodeControl; }
- CameraBinVideoEncoder *videoEncodeControl() const { return m_videoEncodeControl; }
- CameraBinImageEncoder *imageEncodeControl() const { return m_imageEncodeControl; }
- CameraBinExposure *cameraExposureControl() const { return m_cameraExposureControl; }
- CameraBinFlash *cameraFlashControl() const { return m_cameraFlashControl; }
- CameraBinFocus *cameraFocusControl() const { return m_cameraFocusControl; }
- CameraBinImageProcessing *imageProcessingControl() const { return m_imageProcessingControl; }
- CameraBinLocks *cameraLocksControl() const { return m_cameraLocksControl; }
- CameraBinCaptureDestination *captureDestinationControl() const { return m_captureDestinationControl; }
- CameraBinCaptureBufferFormat *captureBufferFormatControl() const { return m_captureBufferFormatControl; }
-
-
- CameraBinRecorder *recorderControl() const { return m_recorderControl; }
- CameraBinContainer *mediaContainerControl() const { return m_mediaContainerControl; }
-
- QGstreamerElementFactory *audioInput() const { return m_audioInputFactory; }
- void setAudioInput(QGstreamerElementFactory *audioInput);
-
- QGstreamerElementFactory *videoInput() const { return m_videoInputFactory; }
- void setVideoInput(QGstreamerElementFactory *videoInput);
- bool isReady() const;
-
- QObject *viewfinder() const { return m_viewfinder; }
- void setViewfinder(QObject *viewfinder);
-
- void captureImage(int requestId, const QString &fileName);
-
- QCamera::State state() const;
- bool isBusy() const;
-
- qint64 duration() const;
-
- void recordVideo();
- void stopVideoRecording();
-
- bool isMuted() const;
-
- bool processSyncMessage(const QGstreamerMessage &message);
- bool processBusMessage(const QGstreamerMessage &message);
-
-signals:
- void stateChanged(QCamera::State state);
- void durationChanged(qint64 duration);
- void error(int error, const QString &errorString);
- void imageExposed(int requestId);
- void imageCaptured(int requestId, const QImage &img);
- void mutedChanged(bool);
- void viewfinderChanged();
- void readyChanged(bool);
- void busyChanged(bool);
-
-public slots:
- void setDevice(const QString &device);
- void setState(QCamera::State);
- void setCaptureDevice(const QString &deviceName);
- void setMetaData(const QMap<QByteArray, QVariant>&);
- void setMuted(bool);
-
-private slots:
- void handleViewfinderChange();
-
-private:
- bool setupCameraBin();
- void setupCaptureResolution();
- GstElement *buildCameraSource();
- static void updateBusyStatus(GObject *o, GParamSpec *p, gpointer d);
-
- QUrl m_sink;
- QUrl m_actualSink;
- bool m_recordingActive;
- QString m_captureDevice;
- QCamera::State m_state;
- QCamera::State m_pendingState;
- QString m_inputDevice;
- bool m_pendingResolutionUpdate;
- bool m_muted;
- bool m_busy;
-
- QCamera::CaptureMode m_captureMode;
- QMap<QByteArray, QVariant> m_metaData;
-
- QGstreamerElementFactory *m_audioInputFactory;
- QGstreamerElementFactory *m_videoInputFactory;
- QObject *m_viewfinder;
- QGstreamerVideoRendererInterface *m_viewfinderInterface;
-
- CameraBinAudioEncoder *m_audioEncodeControl;
- CameraBinVideoEncoder *m_videoEncodeControl;
- CameraBinImageEncoder *m_imageEncodeControl;
- CameraBinRecorder *m_recorderControl;
- CameraBinContainer *m_mediaContainerControl;
- CameraBinExposure *m_cameraExposureControl;
- CameraBinFlash *m_cameraFlashControl;
- CameraBinFocus *m_cameraFocusControl;
- CameraBinImageProcessing *m_imageProcessingControl;
- CameraBinLocks *m_cameraLocksControl;
- CameraBinCaptureDestination *m_captureDestinationControl;
- CameraBinCaptureBufferFormat *m_captureBufferFormatControl;
-
- QGstreamerBusHelper *m_busHelper;
- GstBus* m_bus;
- GstElement *m_camerabin;
- GstElement *m_videoSrc;
- GstElement *m_viewfinderElement;
- bool m_viewfinderHasChanged;
- bool m_videoInputHasChanged;
-
- GstElement *m_audioSrc;
- GstElement *m_audioConvert;
- GstElement *m_capsFilter;
- GstElement *m_fileSink;
- GstElement *m_audioEncoder;
- GstElement *m_muxer;
-
-public:
- QString m_imageFileName;
- int m_requestId;
-};
-
-#endif // CAMERABINCAPTURESESSION_MAEMO_H
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
deleted file mode 100644
index 1e49000..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.cpp
+++ /dev/null
@@ -1,182 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabinvideoencoder.h"
-#include "camerabinsession.h"
-#include "camerabincontainer.h"
-
-#include <QtCore/qdebug.h>
-
-CameraBinVideoEncoder::CameraBinVideoEncoder(CameraBinSession *session)
- :QVideoEncoderControl(session),
- m_session(session),
- m_codecs(QGstCodecsInfo::VideoEncoder)
-{
-}
-
-CameraBinVideoEncoder::~CameraBinVideoEncoder()
-{
-}
-
-QList<QSize> CameraBinVideoEncoder::supportedResolutions(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QPair<int,int> rate = rateAsRational(settings.frameRate());
-
- //select the closest supported rational rate to settings.frameRate()
-
- return m_session->supportedResolutions(rate, continuous, QCamera::CaptureVideo);
-}
-
-QList< qreal > CameraBinVideoEncoder::supportedFrameRates(const QVideoEncoderSettings &settings, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- QList< qreal > res;
- QPair<int,int> rate;
-
- foreach(rate, m_session->supportedFrameRates(settings.resolution(), continuous)) {
- if (rate.second > 0)
- res << qreal(rate.first)/rate.second;
- }
-
- return res;
-}
-
-QStringList CameraBinVideoEncoder::supportedVideoCodecs() const
-{
- return m_codecs.supportedCodecs();
-}
-
-QString CameraBinVideoEncoder::videoCodecDescription(const QString &codecName) const
-{
- return m_codecs.codecDescription(codecName);
-}
-
-QStringList CameraBinVideoEncoder::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecOptions.value(codec);
-}
-
-QVariant CameraBinVideoEncoder::encodingOption(const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void CameraBinVideoEncoder::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QVideoEncoderSettings CameraBinVideoEncoder::videoSettings() const
-{
- return m_videoSettings;
-}
-
-void CameraBinVideoEncoder::setVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_videoSettings = settings;
- m_userSettings = settings;
- emit settingsChanged();
-}
-
-void CameraBinVideoEncoder::setActualVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_videoSettings = settings;
-}
-
-void CameraBinVideoEncoder::resetActualSettings()
-{
- m_videoSettings = m_userSettings;
-}
-
-
-QPair<int,int> CameraBinVideoEncoder::rateAsRational(qreal frameRate) const
-{
- if (frameRate > 0.001) {
- //convert to rational number
- QList<int> denumCandidates;
- denumCandidates << 1 << 2 << 3 << 5 << 10 << 25 << 30 << 50 << 100 << 1001 << 1000;
-
- qreal error = 1.0;
- int num = 1;
- int denum = 1;
-
- foreach (int curDenum, denumCandidates) {
- int curNum = qRound(frameRate*curDenum);
- qreal curError = qAbs(qreal(curNum)/curDenum - frameRate);
-
- if (curError < error) {
- error = curError;
- num = curNum;
- denum = curDenum;
- }
-
- if (curError < 1e-8)
- break;
- }
-
- return QPair<int,int>(num,denum);
- }
-
- return QPair<int,int>();
-}
-
-GstEncodingProfile *CameraBinVideoEncoder::createProfile()
-{
- QString codec = m_videoSettings.codec();
- GstCaps *caps;
-
- if (codec.isEmpty())
- caps = gst_caps_new_any();
- else
- caps = gst_caps_from_string(codec.toLatin1());
-
- return (GstEncodingProfile *)gst_encoding_video_profile_new(
- caps,
- NULL, //preset
- NULL, //restriction
- 0); //presence
-}
diff --git a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h b/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
deleted file mode 100644
index 29fc595..0000000
--- a/src/plugins/gstreamer/camerabin/camerabinvideoencoder.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef CAMERABINVIDEOENCODE_H
-#define CAMERABINVIDEOENCODE_H
-
-#include <qvideoencodercontrol.h>
-class CameraBinSession;
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-#include <gst/pbutils/pbutils.h>
-#include <gst/pbutils/encoding-profile.h>
-#include "qgstcodecsinfo.h"
-
-QT_USE_NAMESPACE
-
-class CameraBinVideoEncoder : public QVideoEncoderControl
-{
- Q_OBJECT
-public:
- CameraBinVideoEncoder(CameraBinSession *session);
- virtual ~CameraBinVideoEncoder();
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QPair<int,int> rateAsRational(qreal) const;
-
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
-
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings &settings);
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
- void setActualVideoSettings(const QVideoEncoderSettings&);
- void resetActualSettings();
-
- GstEncodingProfile *createProfile();
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- CameraBinSession *m_session;
-
- QGstCodecsInfo m_codecs;
- QMap<QString,QStringList> m_codecOptions;
- QMap<QString, QMap<QString, QVariant> > m_options;
-
- QVideoEncoderSettings m_videoSettings; // backend selected settings, using m_userSettings
- QVideoEncoderSettings m_userSettings;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/camerabuttonlistener_meego.cpp b/src/plugins/gstreamer/camerabuttonlistener_meego.cpp
deleted file mode 100644
index 5ee1daf..0000000
--- a/src/plugins/gstreamer/camerabuttonlistener_meego.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "camerabuttonlistener_meego.h"
-
-#include <QtWidgets/qapplication.h>
-#include <QtGui/qevent.h>
-#include <QtWidgets/qwidget.h>
-#include <QtCore/qdebug.h>
-
-CameraButtonListener::CameraButtonListener(QObject *parent) :
- QObject(parent),
- m_focusPressed(false),
- m_shutterPressed(false)
-{
- m_keys = new MeeGo::QmKeys(this);
- connect(m_keys, SIGNAL(keyEvent(MeeGo::QmKeys::Key, MeeGo::QmKeys::State)),
- this, SLOT(handleQmKeyEvent(MeeGo::QmKeys::Key,MeeGo::QmKeys::State)));
-}
-
-CameraButtonListener::~CameraButtonListener()
-{
-}
-
-void CameraButtonListener::handleQmKeyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state)
-{
- if (key == MeeGo::QmKeys::Camera) {
- QWidget *window = QApplication::focusWidget();
-
- bool focusPressed = (state == MeeGo::QmKeys::KeyHalfDown) ||
- (state == MeeGo::QmKeys::KeyDown);
-
- if (m_focusPressed != focusPressed) {
- m_focusPressed = focusPressed;
- if (window) {
- QApplication::postEvent(window,
- new QKeyEvent(focusPressed ? QEvent::KeyPress : QEvent::KeyRelease,
- Qt::Key_CameraFocus,
- Qt::NoModifier));
- }
- }
-
- bool shutterPressed = (state == MeeGo::QmKeys::KeyDown);
- if (m_shutterPressed != shutterPressed) {
- m_shutterPressed = shutterPressed;
- if (window) {
- QApplication::postEvent(window,
- new QKeyEvent(shutterPressed ? QEvent::KeyPress : QEvent::KeyRelease,
- Qt::Key_Camera,
- Qt::NoModifier));
- }
- }
- }
-}
diff --git a/src/plugins/gstreamer/camerabuttonlistener_meego.h b/src/plugins/gstreamer/camerabuttonlistener_meego.h
deleted file mode 100644
index 5f13d07..0000000
--- a/src/plugins/gstreamer/camerabuttonlistener_meego.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef CAMERABUTTONLISTENER_MEEGO_H
-#define CAMERABUTTONLISTENER_MEEGO_H
-
-#include <QtCore/qobject.h>
-#include <qmsystem2/qmkeys.h>
-
-class CameraButtonListener : public QObject
-{
- Q_OBJECT
-public:
- CameraButtonListener(QObject *parent = 0);
- ~CameraButtonListener();
-
-private slots:
- void handleQmKeyEvent(MeeGo::QmKeys::Key key, MeeGo::QmKeys::State state);
-
-private:
- MeeGo::QmKeys *m_keys;
- bool m_focusPressed;
- bool m_shutterPressed;
-};
-
-#endif // CAMERABUTTONLISTENER_MEEGO_H
diff --git a/src/plugins/gstreamer/gstreamer.pro b/src/plugins/gstreamer/gstreamer.pro
deleted file mode 100644
index 28becfb..0000000
--- a/src/plugins/gstreamer/gstreamer.pro
+++ /dev/null
@@ -1,94 +0,0 @@
-
-load(qt_module)
-
-TARGET = qgstengine
-QT += multimedia-private network multimediawidgets-private
-PLUGIN_TYPE=mediaservice
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-LIBS += -lqgsttools_p
-
-unix:!maemo*:contains(QT_CONFIG, alsa) {
-DEFINES += HAVE_ALSA
-LIBS += \
- -lasound
-}
-
-CONFIG += link_pkgconfig
-
-PKGCONFIG += \
- gstreamer-0.10 \
- gstreamer-base-0.10 \
- gstreamer-interfaces-0.10 \
- gstreamer-audio-0.10 \
- gstreamer-video-0.10 \
- gstreamer-pbutils-0.10
-
-maemo*:PKGCONFIG +=gstreamer-plugins-bad-0.10
-contains(config_test_gstreamer_appsrc, yes): PKGCONFIG += gstreamer-app-0.10
-
-contains(config_test_resourcepolicy, yes) {
- DEFINES += HAVE_RESOURCE_POLICY
- PKGCONFIG += libresourceqt1
-}
-
-maemo6 {
- HEADERS += camerabuttonlistener_meego.h
- SOURCES += camerabuttonlistener_meego.cpp
-
- PKGCONFIG += qmsystem2
-
- isEqual(QT_ARCH,armv6) {
- HEADERS += qgstreamergltexturerenderer.h
- SOURCES += qgstreamergltexturerenderer.cpp
- QT += opengl
- LIBS += -lEGL -lgstmeegointerfaces-0.10
- }
-}
-
-# Input
-HEADERS += \
- qgstreamervideorendererinterface.h \
- qgstreamerserviceplugin.h \
- qgstreameraudioinputendpointselector.h \
- qgstreamervideorenderer.h \
- qgstreamervideoinputdevicecontrol.h \
- gstvideoconnector.h \
- qgstcodecsinfo.h \
-
-SOURCES += \
- qgstreamervideorendererinterface.cpp \
- qgstreamerserviceplugin.cpp \
- qgstreameraudioinputendpointselector.cpp \
- qgstreamervideorenderer.cpp \
- qgstreamervideoinputdevicecontrol.cpp \
- qgstcodecsinfo.cpp \
- gstvideoconnector.c \
-
-
-!win32:!contains(QT_CONFIG,embedded):!mac:!simulator:!contains(QT_CONFIG, qpa) {
- LIBS += -lXv -lX11 -lXext
-
- HEADERS += \
- qgstreamervideooverlay.h \
- qgstreamervideowindow.h \
- qgstreamervideowidget.h \
- qx11videosurface.h \
-
- SOURCES += \
- qgstreamervideooverlay.cpp \
- qgstreamervideowindow.cpp \
- qgstreamervideowidget.cpp \
- qx11videosurface.cpp \
-}
-include(mediaplayer/mediaplayer.pri)
-include(mediacapture/mediacapture.pri)
-
-contains(config_test_gstreamer_photography, yes) {
- include(camerabin/camerabin.pri)
-}
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/gstreamer/gstvideoconnector.c b/src/plugins/gstreamer/gstvideoconnector.c
deleted file mode 100644
index d5b56c7..0000000
--- a/src/plugins/gstreamer/gstvideoconnector.c
+++ /dev/null
@@ -1,425 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "gstvideoconnector.h"
-
-/* signals */
-enum
-{
- SIGNAL_RESEND_NEW_SEGMENT,
- SIGNAL_CONNECTION_FAILED,
- LAST_SIGNAL
-};
-static guint gst_video_connector_signals[LAST_SIGNAL] = { 0 };
-
-
-GST_DEBUG_CATEGORY_STATIC (video_connector_debug);
-#define GST_CAT_DEFAULT video_connector_debug
-
-static GstStaticPadTemplate gst_video_connector_sink_factory =
-GST_STATIC_PAD_TEMPLATE ("sink",
- GST_PAD_SINK,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-static GstStaticPadTemplate gst_video_connector_src_factory =
-GST_STATIC_PAD_TEMPLATE ("src",
- GST_PAD_SRC,
- GST_PAD_ALWAYS,
- GST_STATIC_CAPS_ANY);
-
-#define _do_init(bla) \
- GST_DEBUG_CATEGORY_INIT (video_connector_debug, \
- "video-connector", 0, "An identity like element for reconnecting video stream");
-
-GST_BOILERPLATE_FULL (GstVideoConnector, gst_video_connector, GstElement,
- GST_TYPE_ELEMENT, _do_init);
-
-static void gst_video_connector_dispose (GObject * object);
-static GstFlowReturn gst_video_connector_chain (GstPad * pad, GstBuffer * buf);
-static GstFlowReturn gst_video_connector_buffer_alloc (GstPad * pad,
- guint64 offset, guint size, GstCaps * caps, GstBuffer ** buf);
-static GstStateChangeReturn gst_video_connector_change_state (GstElement *
- element, GstStateChange transition);
-static gboolean gst_video_connector_handle_sink_event (GstPad * pad,
- GstEvent * event);
-static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object);
-static void gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal);
-static gboolean gst_video_connector_setcaps (GstPad *pad, GstCaps *caps);
-static GstCaps *gst_video_connector_getcaps (GstPad * pad);
-static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps);
-
-static void
-gst_video_connector_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Video Connector",
- "Generic",
- "An identity like element used for reconnecting video stream",
- "Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>");
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_video_connector_sink_factory));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_video_connector_src_factory));
-}
-
-static void
-gst_video_connector_class_init (GstVideoConnectorClass * klass)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- gobject_class->dispose = gst_video_connector_dispose;
- gstelement_class->change_state = gst_video_connector_change_state;
- klass->resend_new_segment = gst_video_connector_resend_new_segment;
-
- gst_video_connector_signals[SIGNAL_RESEND_NEW_SEGMENT] =
- g_signal_new ("resend-new-segment", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (GstVideoConnectorClass, resend_new_segment), NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-
- gst_video_connector_signals[SIGNAL_CONNECTION_FAILED] =
- g_signal_new ("connection-failed", G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
-}
-
-static void
-gst_video_connector_init (GstVideoConnector *element,
- GstVideoConnectorClass *g_class)
-{
- (void) g_class;
- element->sinkpad =
- gst_pad_new_from_static_template (&gst_video_connector_sink_factory,
- "sink");
- gst_pad_set_chain_function(element->sinkpad,
- GST_DEBUG_FUNCPTR (gst_video_connector_chain));
- gst_pad_set_event_function(element->sinkpad,
- GST_DEBUG_FUNCPTR (gst_video_connector_handle_sink_event));
- gst_pad_set_bufferalloc_function(element->sinkpad,
- GST_DEBUG_FUNCPTR (gst_video_connector_buffer_alloc));
- gst_pad_set_setcaps_function(element->sinkpad,
- GST_DEBUG_FUNCPTR (gst_video_connector_setcaps));
- gst_pad_set_getcaps_function(element->sinkpad,
- GST_DEBUG_FUNCPTR(gst_video_connector_getcaps));
- gst_pad_set_acceptcaps_function(element->sinkpad,
- GST_DEBUG_FUNCPTR(gst_video_connector_acceptcaps));
-
- gst_element_add_pad (GST_ELEMENT (element), element->sinkpad);
-
- element->srcpad =
- gst_pad_new_from_static_template (&gst_video_connector_src_factory,
- "src");
- gst_pad_add_buffer_probe(element->srcpad,
- G_CALLBACK(gst_video_connector_new_buffer_probe), element);
- gst_element_add_pad (GST_ELEMENT (element), element->srcpad);
-
- element->relinked = FALSE;
- element->failedSignalEmited = FALSE;
- gst_segment_init (&element->segment, GST_FORMAT_TIME);
- element->latest_buffer = NULL;
-}
-
-static void
-gst_video_connector_reset (GstVideoConnector * element)
-{
- element->relinked = FALSE;
- element->failedSignalEmited = FALSE;
- if (element->latest_buffer != NULL) {
- gst_buffer_unref (element->latest_buffer);
- element->latest_buffer = NULL;
- }
- gst_segment_init (&element->segment, GST_FORMAT_UNDEFINED);
-}
-
-static void
-gst_video_connector_dispose (GObject * object)
-{
- GstVideoConnector *element = GST_VIDEO_CONNECTOR (object);
-
- gst_video_connector_reset (element);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static GstFlowReturn
-gst_video_connector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
- GstCaps * caps, GstBuffer ** buf)
-{
- GstVideoConnector *element;
- GstFlowReturn res = GST_FLOW_OK;
- element = GST_VIDEO_CONNECTOR (GST_PAD_PARENT (pad));
-
- if (!buf)
- return GST_FLOW_ERROR;
- *buf = NULL;
-
- GST_OBJECT_LOCK (element);
- gst_object_ref(element->srcpad);
- GST_OBJECT_UNLOCK (element);
-
- res = gst_pad_alloc_buffer(element->srcpad, offset, size, caps, buf);
- gst_object_unref (element->srcpad);
-
- GST_DEBUG_OBJECT (element, "buffer alloc finished: %s", gst_flow_get_name (res));
-
- return res;
-}
-
-static gboolean
-gst_video_connector_setcaps (GstPad *pad, GstCaps *caps)
-{
- GstVideoConnector *element;
- element = GST_VIDEO_CONNECTOR (GST_PAD_PARENT (pad));
-
- /* forward-negotiate */
- gboolean res = gst_pad_set_caps(element->srcpad, caps);
-
- GST_DEBUG_OBJECT(element, "gst_video_connector_setcaps %s %i", gst_caps_to_string(caps), res);
-
- if (!res) {
- //if set_caps failed, emit "connection-failed" signal
- //so colorspace transformation elemnt can be inserted
- GST_INFO_OBJECT(element, "gst_video_connector_setcaps failed, emit connection-failed signal");
- g_signal_emit(G_OBJECT(element), gst_video_connector_signals[SIGNAL_CONNECTION_FAILED], 0);
-
- return gst_pad_set_caps(element->srcpad, caps);
- }
-
- return TRUE;
-}
-
-static GstCaps *gst_video_connector_getcaps (GstPad * pad)
-{
- GstVideoConnector *element;
- element = GST_VIDEO_CONNECTOR (GST_PAD_PARENT (pad));
-
-#if (GST_VERSION_MICRO > 25)
- GstCaps *caps = gst_pad_peer_get_caps_reffed(element->srcpad);
-#else
- GstCaps *caps = gst_pad_peer_get_caps(element->srcpad);
-#endif
-
- if (!caps)
- caps = gst_caps_new_any();
-
- return caps;
-}
-
-static gboolean gst_video_connector_acceptcaps (GstPad * pad, GstCaps * caps)
-{
- GstVideoConnector *element;
- element = GST_VIDEO_CONNECTOR (GST_PAD_PARENT (pad));
-
- return gst_pad_peer_accept_caps(element->srcpad, caps);
-}
-
-static void
-gst_video_connector_resend_new_segment(GstElement * element, gboolean emitFailedSignal)
-{
- GST_INFO_OBJECT(element, "New segment requested, failed signal enabled: %i", emitFailedSignal);
- GstVideoConnector *connector = GST_VIDEO_CONNECTOR(element);
- connector->relinked = TRUE;
- if (emitFailedSignal)
- connector->failedSignalEmited = FALSE;
-}
-
-
-static gboolean gst_video_connector_new_buffer_probe(GstObject *pad, GstBuffer *buffer, guint * object)
-{
- (void) pad;
- (void) buffer;
-
- GstVideoConnector *element = GST_VIDEO_CONNECTOR (object);
-
- /*
- If relinking is requested, the current buffer should be rejected and
- the new segment + previous buffer should be pushed first
- */
-
- if (element->relinked)
- GST_LOG_OBJECT(element, "rejected buffer because of new segment request");
-
- return !element->relinked;
-}
-
-
-static GstFlowReturn
-gst_video_connector_chain (GstPad * pad, GstBuffer * buf)
-{
- GstFlowReturn res;
- GstVideoConnector *element;
-
- element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
-
- do {
- /*
- Resend the segment message and last buffer to preroll the new sink.
- Sinks can be changed multiple times while paused,
- while loop allows to send the segment message and preroll
- all of them with the same buffer.
- */
- while (element->relinked) {
- element->relinked = FALSE;
-
- gint64 pos = element->segment.last_stop;
-
- if (element->latest_buffer && GST_BUFFER_TIMESTAMP_IS_VALID(element->latest_buffer)) {
- pos = GST_BUFFER_TIMESTAMP (element->latest_buffer);
- }
-
- //push a new segment and last buffer
- GstEvent *ev = gst_event_new_new_segment (TRUE,
- element->segment.rate,
- element->segment.format,
- pos, //start
- element->segment.stop,
- pos);
-
- GST_DEBUG_OBJECT (element, "Pushing new segment event");
- if (!gst_pad_push_event (element->srcpad, ev)) {
- GST_WARNING_OBJECT (element,
- "Newsegment handling failed in %" GST_PTR_FORMAT,
- element->srcpad);
- }
-
- if (element->latest_buffer) {
- GST_DEBUG_OBJECT (element, "Pushing latest buffer...");
- gst_buffer_ref(element->latest_buffer);
- gst_pad_push(element->srcpad, element->latest_buffer);
- }
- }
-
- gst_buffer_ref(buf);
-
- //it's possible video sink is changed during gst_pad_push blocked by
- //pad lock, in this case ( element->relinked == TRUE )
- //the buffer should be rejected by the buffer probe and
- //the new segment + prev buffer should be sent before
-
- GST_LOG_OBJECT (element, "Pushing buffer...");
- res = gst_pad_push (element->srcpad, buf);
- GST_LOG_OBJECT (element, "Pushed buffer: %s", gst_flow_get_name (res));
-
- //if gst_pad_push failed give the service another chance,
- //it may still work with the colorspace element added
- if (!element->failedSignalEmited && res == GST_FLOW_NOT_NEGOTIATED) {
- element->failedSignalEmited = TRUE;
- GST_INFO_OBJECT(element, "gst_pad_push failed, emit connection-failed signal");
- g_signal_emit(G_OBJECT(element), gst_video_connector_signals[SIGNAL_CONNECTION_FAILED], 0);
- }
-
- } while (element->relinked);
-
-
- if (element->latest_buffer) {
- gst_buffer_unref (element->latest_buffer);
- element->latest_buffer = NULL;
- }
-
- //don't save the last video buffer on maemo6 because of buffers shortage
- //with omapxvsink
-#ifndef Q_WS_MAEMO_6
- element->latest_buffer = gst_buffer_ref(buf);
-#endif
-
- gst_buffer_unref(buf);
- gst_object_unref (element);
-
- return res;
-}
-
-static GstStateChangeReturn
-gst_video_connector_change_state (GstElement * element,
- GstStateChange transition)
-{
- GstVideoConnector *connector;
- GstStateChangeReturn result;
-
- connector = GST_VIDEO_CONNECTOR(element);
- result = GST_ELEMENT_CLASS (parent_class)->change_state(element, transition);
-
- switch (transition) {
- case GST_STATE_CHANGE_PAUSED_TO_READY:
- gst_video_connector_reset (connector);
- break;
- case GST_STATE_CHANGE_READY_TO_PAUSED:
- connector->relinked = FALSE;
- break;
- default:
- break;
- }
-
- return result;
-}
-
-static gboolean
-gst_video_connector_handle_sink_event (GstPad * pad, GstEvent * event)
-{
- if (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT) {
- GstVideoConnector *element = GST_VIDEO_CONNECTOR (gst_pad_get_parent (pad));
-
- gboolean update;
- GstFormat format;
- gdouble rate, arate;
- gint64 start, stop, time;
-
- gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
- &start, &stop, &time);
-
- GST_LOG_OBJECT (element,
- "NEWSEGMENT update %d, rate %lf, applied rate %lf, "
- "format %d, " "%" G_GINT64_FORMAT " -- %" G_GINT64_FORMAT ", time %"
- G_GINT64_FORMAT, update, rate, arate, format, start, stop, time);
-
- gst_segment_set_newsegment_full (&element->segment, update,
- rate, arate, format, start, stop, time);
-
- gst_object_unref (element);
- }
-
- return gst_pad_event_default (pad, event);
-}
diff --git a/src/plugins/gstreamer/gstvideoconnector.h b/src/plugins/gstreamer/gstvideoconnector.h
deleted file mode 100644
index aa3d775..0000000
--- a/src/plugins/gstreamer/gstvideoconnector.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTVIDEOCONNECTOR_H
-#define QGSTVIDEOCONNECTOR_H
-
-#include <gst/gst.h>
-
-G_BEGIN_DECLS
-
-#define GST_TYPE_VIDEO_CONNECTOR \
- (gst_video_connector_get_type())
-#define GST_VIDEO_CONNECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_CONNECTOR, GstVideoConnector))
-#define GST_VIDEO_CONNECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_CONNECTOR, GstVideoConnectorClass))
-#define GST_IS_VIDEO_CONNECTOR(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_CONNECTOR))
-#define GST_IS_VIDEO_CONNECTOR_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_CONNECTOR))
-
-typedef struct _GstVideoConnector GstVideoConnector;
-typedef struct _GstVideoConnectorClass GstVideoConnectorClass;
-
-struct _GstVideoConnector {
- GstElement element;
-
- GstPad *srcpad;
- GstPad *sinkpad;
-
- gboolean relinked;
- gboolean failedSignalEmited;
- GstSegment segment;
- GstBuffer *latest_buffer;
-};
-
-struct _GstVideoConnectorClass {
- GstElementClass parent_class;
-
- /* action signal to resend new segment */
- void (*resend_new_segment) (GstElement * element, gboolean emitFailedSignal);
-};
-
-GType gst_video_connector_get_type (void);
-
-G_END_DECLS
-
-#endif
-
diff --git a/src/plugins/gstreamer/mediacapture/mediacapture.pri b/src/plugins/gstreamer/mediacapture/mediacapture.pri
deleted file mode 100644
index b7f7794..0000000
--- a/src/plugins/gstreamer/mediacapture/mediacapture.pri
+++ /dev/null
@@ -1,27 +0,0 @@
-INCLUDEPATH += $$PWD
-
-DEFINES += QMEDIA_GSTREAMER_CAPTURE
-
-HEADERS += $$PWD/qgstreamercaptureservice.h \
- $$PWD/qgstreamercapturesession.h \
- $$PWD/qgstreameraudioencode.h \
- $$PWD/qgstreamervideoencode.h \
- $$PWD/qgstreamerrecordercontrol.h \
- $$PWD/qgstreamermediacontainercontrol.h \
- $$PWD/qgstreamercameracontrol.h \
- $$PWD/qgstreamerv4l2input.h \
- $$PWD/qgstreamercapturemetadatacontrol.h \
- $$PWD/qgstreamerimagecapturecontrol.h \
- $$PWD/qgstreamerimageencode.h
-
-SOURCES += $$PWD/qgstreamercaptureservice.cpp \
- $$PWD/qgstreamercapturesession.cpp \
- $$PWD/qgstreameraudioencode.cpp \
- $$PWD/qgstreamervideoencode.cpp \
- $$PWD/qgstreamerrecordercontrol.cpp \
- $$PWD/qgstreamermediacontainercontrol.cpp \
- $$PWD/qgstreamercameracontrol.cpp \
- $$PWD/qgstreamerv4l2input.cpp \
- $$PWD/qgstreamercapturemetadatacontrol.cpp \
- $$PWD/qgstreamerimagecapturecontrol.cpp \
- $$PWD/qgstreamerimageencode.cpp
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
deleted file mode 100644
index 2f7c6a8..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.cpp
+++ /dev/null
@@ -1,290 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreameraudioencode.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamermediacontainercontrol.h"
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerAudioEncode::QGstreamerAudioEncode(QObject *parent)
- :QAudioEncoderControl(parent)
-{
- QList<QByteArray> codecCandidates;
-
-#if defined(Q_WS_MAEMO_6)
- codecCandidates << "audio/AAC" << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
- << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
-#else
- codecCandidates << "audio/mpeg" << "audio/vorbis" << "audio/speex" << "audio/GSM"
- << "audio/PCM" << "audio/AMR" << "audio/AMR-WB" << "audio/FLAC";
-#endif
-
-#if defined(Q_WS_MAEMO_6)
- m_elementNames["audio/AMR"] = "nokiaamrnbenc";
- m_elementNames["audio/AMR-WB"] = "nokiaamrwbenc";
- m_elementNames["audio/AAC"] = "nokiaaacenc";
-#else
- m_elementNames["audio/mpeg"] = "lamemp3enc";
- m_elementNames["audio/AMR"] = "amrnbenc";
- m_elementNames["audio/AMR-WB"] = "amrwbenc";
-#endif
-
- m_elementNames["audio/vorbis"] = "vorbisenc";
- m_elementNames["audio/speex"] = "speexenc";
- m_elementNames["audio/PCM"] = "audioresample";
- m_elementNames["audio/FLAC"] = "flacenc";
- m_elementNames["audio/GSM"] = "gsmenc";
-
- m_codecOptions["audio/vorbis"] = QStringList() << "min-bitrate" << "max-bitrate";
- m_codecOptions["audio/mpeg"] = QStringList() << "mode";
- m_codecOptions["audio/speex"] = QStringList() << "mode" << "vbr" << "vad" << "dtx";
- m_codecOptions["audio/GSM"] = QStringList();
- m_codecOptions["audio/PCM"] = QStringList();
- m_codecOptions["audio/AMR"] = QStringList();
- m_codecOptions["audio/AMR-WB"] = QStringList();
-
- foreach( const QByteArray& codecName, codecCandidates ) {
- QByteArray elementName = m_elementNames[codecName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
-
- if (factory) {
- m_codecs.append(codecName);
- const gchar *descr = gst_element_factory_get_description(factory);
-
- if (codecName == QByteArray("audio/PCM"))
- m_codecDescriptions.insert(codecName, tr("Raw PCM audio"));
- else
- m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));
-
- m_streamTypes.insert(codecName,
- QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));
-
- gst_object_unref(GST_OBJECT(factory));
- }
- }
-
- //if (!m_codecs.isEmpty())
- // m_audioSettings.setCodec(m_codecs[0]);
-}
-
-QGstreamerAudioEncode::~QGstreamerAudioEncode()
-{
-}
-
-QStringList QGstreamerAudioEncode::supportedAudioCodecs() const
-{
- return m_codecs;
-}
-
-QString QGstreamerAudioEncode::codecDescription(const QString &codecName) const
-{
- return m_codecDescriptions.value(codecName);
-}
-
-QStringList QGstreamerAudioEncode::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecOptions.value(codec);
-}
-
-QVariant QGstreamerAudioEncode::encodingOption(
- const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void QGstreamerAudioEncode::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QList<int> QGstreamerAudioEncode::supportedSampleRates(const QAudioEncoderSettings &, bool *) const
-{
- //TODO check element caps to find actual values
-
- return QList<int>();
-}
-
-QAudioEncoderSettings QGstreamerAudioEncode::audioSettings() const
-{
- return m_audioSettings;
-}
-
-void QGstreamerAudioEncode::setAudioSettings(const QAudioEncoderSettings &settings)
-{
- m_audioSettings = settings;
-}
-
-
-GstElement *QGstreamerAudioEncode::createEncoder()
-{
- QString codec = m_audioSettings.codec();
- GstElement *encoderElement = gst_element_factory_make(m_elementNames.value(codec).constData(), NULL);
- if (!encoderElement)
- return 0;
-
- GstBin * encoderBin = GST_BIN(gst_bin_new("audio-encoder-bin"));
-
- GstElement *capsFilter = gst_element_factory_make("capsfilter", NULL);
-
- gst_bin_add(encoderBin, capsFilter);
- gst_bin_add(encoderBin, encoderElement);
- gst_element_link(capsFilter, encoderElement);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(capsFilter, "sink");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- pad = gst_element_get_static_pad(encoderElement, "src");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- if (m_audioSettings.sampleRate() > 0 || m_audioSettings.channelCount() > 0) {
- GstCaps *caps = gst_caps_new_empty();
- GstStructure *structure = gst_structure_new("audio/x-raw-int", NULL);
-
- if (m_audioSettings.sampleRate() > 0)
- gst_structure_set(structure, "rate", G_TYPE_INT, m_audioSettings.sampleRate(), NULL );
-
- if (m_audioSettings.channelCount() > 0)
- gst_structure_set(structure, "channels", G_TYPE_INT, m_audioSettings.channelCount(), NULL );
-
- gst_caps_append_structure(caps,structure);
-
- //qDebug() << "set caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
- }
-
- if (encoderElement) {
- if (m_audioSettings.encodingMode() == QtMultimedia::ConstantQualityEncoding) {
- QtMultimedia::EncodingQuality qualityValue = m_audioSettings.quality();
-
- if (codec == QLatin1String("audio/vorbis")) {
- double qualityTable[] = {
- 0.1, //VeryLow
- 0.3, //Low
- 0.5, //Normal
- 0.7, //High
- 1.0 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", qualityTable[qualityValue], NULL);
- } else if (codec == QLatin1String("audio/mpeg")) {
- g_object_set(G_OBJECT(encoderElement), "target", 0, NULL); //constant quality mode
- qreal quality[] = {
- 1, //VeryLow
- 3, //Low
- 5, //Normal
- 7, //High
- 9 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", quality[qualityValue], NULL);
- } else if (codec == QLatin1String("audio/speex")) {
- //0-10 range with default 8
- double qualityTable[] = {
- 2, //VeryLow
- 5, //Low
- 8, //Normal
- 9, //High
- 10 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quality", qualityTable[qualityValue], NULL);
- } else if (codec.startsWith("audio/AMR")) {
- int band[] = {
- 0, //VeryLow
- 2, //Low
- 4, //Normal
- 6, //High
- 7 //VeryHigh
- };
-
- g_object_set(G_OBJECT(encoderElement), "band-mode", band[qualityValue], NULL);
- }
- } else {
- int bitrate = m_audioSettings.bitRate();
- if (bitrate > 0) {
- if (codec == QLatin1String("audio/mpeg")) {
- g_object_set(G_OBJECT(encoderElement), "target", 1, NULL); //constant bitrate mode
- }
- g_object_set(G_OBJECT(encoderElement), "bitrate", bitrate, NULL);
- }
- }
-
- QMap<QString, QVariant> options = m_options.value(codec);
- QMapIterator<QString,QVariant> it(options);
- while (it.hasNext()) {
- it.next();
- QString option = it.key();
- QVariant value = it.value();
-
- switch (value.type()) {
- case QVariant::Int:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toInt(), NULL);
- break;
- case QVariant::Bool:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toBool(), NULL);
- break;
- case QVariant::Double:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toDouble(), NULL);
- break;
- case QVariant::String:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toString().toUtf8().constData(), NULL);
- break;
- default:
- qWarning() << "unsupported option type:" << option << value;
- break;
- }
-
- }
- }
-
- return GST_ELEMENT(encoderBin);
-}
-
-
-QSet<QString> QGstreamerAudioEncode::supportedStreamTypes(const QString &codecName) const
-{
- return m_streamTypes.value(codecName);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h b/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
deleted file mode 100644
index 117aa6d..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreameraudioencode.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERAUDIOENCODE_H
-#define QGSTREAMERAUDIOENCODE_H
-
-#include <qaudioencodercontrol.h>
-class QGstreamerCaptureSession;
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-
-#include <qaudioformat.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerAudioEncode : public QAudioEncoderControl
-{
- Q_OBJECT
-public:
- QGstreamerAudioEncode(QObject *parent);
- virtual ~QGstreamerAudioEncode();
-
- QStringList supportedAudioCodecs() const;
- QString codecDescription(const QString &codecName) const;
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
- QList<int> supportedSampleRates(const QAudioEncoderSettings &settings = QAudioEncoderSettings(),
- bool *isContinuous = 0) const;
- QList<int> supportedChannelCounts(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
- QList<int> supportedSampleSizes(const QAudioEncoderSettings &settings = QAudioEncoderSettings()) const;
-
- QAudioEncoderSettings audioSettings() const;
- void setAudioSettings(const QAudioEncoderSettings&);
-
- GstElement *createEncoder();
-
- QSet<QString> supportedStreamTypes(const QString &codecName) const;
-
-private:
- QStringList m_codecs;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QStringList> m_codecOptions;
-
- QMap<QString, QMap<QString, QVariant> > m_options;
-
- QMap<QString, QSet<QString> > m_streamTypes;
-
- QAudioEncoderSettings m_audioSettings;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp
deleted file mode 100644
index 3f4592c..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.cpp
+++ /dev/null
@@ -1,185 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamercameracontrol.h"
-#include "qgstreamerimageencode.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-
-
-QGstreamerCameraControl::QGstreamerCameraControl(QGstreamerCaptureSession *session)
- :QCameraControl(session),
- m_captureMode(QCamera::CaptureStillImage),
- m_session(session),
- m_state(QCamera::UnloadedState),
- m_status(QCamera::UnloadedStatus),
- m_reloadPending(false)
-
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)),
- this, SLOT(updateStatus()));
-
- connect(m_session->imageEncodeControl(), SIGNAL(settingsChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(viewfinderChanged()),
- SLOT(reloadLater()));
- connect(m_session, SIGNAL(readyChanged(bool)),
- SLOT(reloadLater()));
-}
-
-QGstreamerCameraControl::~QGstreamerCameraControl()
-{
-}
-
-void QGstreamerCameraControl::setCaptureMode(QCamera::CaptureMode mode)
-{
- if (m_captureMode == mode)
- return;
-
- switch (mode) {
- case QCamera::CaptureStillImage:
- m_session->setCaptureMode(QGstreamerCaptureSession::Image);
- break;
- case QCamera::CaptureVideo:
- m_session->setCaptureMode(QGstreamerCaptureSession::AudioAndVideo);
- break;
- }
-
- emit captureModeChanged(mode);
- updateStatus();
- reloadLater();
-}
-
-void QGstreamerCameraControl::setState(QCamera::State state)
-{
- if (m_state == state)
- return;
-
- m_state = state;
- switch (state) {
- case QCamera::UnloadedState:
- case QCamera::LoadedState:
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- break;
- case QCamera::ActiveState:
- //postpone changing to Active if the session is nor ready yet
- if (m_session->isReady()) {
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- } else {
-#ifdef CAMEABIN_DEBUG
- qDebug() << "Camera session is not ready yet, postpone activating";
-#endif
- }
- break;
- default:
- emit error(QCamera::NotSupportedFeatureError, tr("State not supported."));
- }
-
- updateStatus();
- emit stateChanged(m_state);
-}
-
-QCamera::State QGstreamerCameraControl::state() const
-{
- return m_state;
-}
-
-void QGstreamerCameraControl::updateStatus()
-{
- QCamera::Status oldStatus = m_status;
-
- switch (m_state) {
- case QCamera::UnloadedState:
- m_status = QCamera::UnloadedStatus;
- break;
- case QCamera::LoadedState:
- m_status = QCamera::LoadedStatus;
- break;
- case QCamera::ActiveState:
- if (m_session->state() == QGstreamerCaptureSession::StoppedState)
- m_status = QCamera::StartingStatus;
- else
- m_status = QCamera::ActiveStatus;
- break;
- }
-
- if (oldStatus != m_status) {
- //qDebug() << "Status changed:" << m_status;
- emit statusChanged(m_status);
- }
-}
-
-void QGstreamerCameraControl::reloadLater()
-{
- //qDebug() << "reload pipeline requested";
- if (!m_reloadPending && m_state == QCamera::ActiveState) {
- m_reloadPending = true;
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- QMetaObject::invokeMethod(this, "reloadPipeline", Qt::QueuedConnection);
- }
-}
-
-void QGstreamerCameraControl::reloadPipeline()
-{
- //qDebug() << "reload pipeline";
- if (m_reloadPending) {
- m_reloadPending = false;
- if (m_state == QCamera::ActiveState && m_session->isReady()) {
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- }
- }
-}
-
-bool QGstreamerCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-{
- Q_UNUSED(status);
-
- switch (changeType) {
- case QCameraControl::CaptureMode:
- case QCameraControl::ImageEncodingSettings:
- case QCameraControl::VideoEncodingSettings:
- case QCameraControl::Viewfinder:
- return true;
- default:
- return false;
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
deleted file mode 100644
index 6e8fb0e..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercameracontrol.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERCAMERACONTROL_H
-#define QGSTREAMERCAMERACONTROL_H
-
-#include <QHash>
-#include <qcameracontrol.h>
-#include "qgstreamercapturesession.h"
-
-QT_USE_NAMESPACE
-QT_USE_NAMESPACE
-
-class QGstreamerCameraControl : public QCameraControl
-{
- Q_OBJECT
-public:
- QGstreamerCameraControl( QGstreamerCaptureSession *session );
- virtual ~QGstreamerCameraControl();
-
- bool isValid() const { return true; }
-
- QCamera::State state() const;
- void setState(QCamera::State state);
-
- QCamera::Status status() const { return m_status; }
-
- QCamera::CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(QCamera::CaptureMode mode);
-
- bool isCaptureModeSupported(QCamera::CaptureMode mode) const
- {
- return mode == QCamera::CaptureStillImage || mode == QCamera::CaptureVideo;
- }
-
- QCamera::LockTypes supportedLocks() const
- {
- return QCamera::NoLock;
- }
-
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
-
-public slots:
- void reloadLater();
-
-private slots:
- void updateStatus();
- void reloadPipeline();
-
-
-private:
- QCamera::CaptureMode m_captureMode;
- QGstreamerCaptureSession *m_session;
- QCamera::State m_state;
- QCamera::Status m_status;
- bool m_reloadPending;
-};
-
-#endif // QGSTREAMERCAMERACONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp
deleted file mode 100644
index b874afc..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.cpp
+++ /dev/null
@@ -1,198 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamercapturemetadatacontrol.h"
-
-#include <gst/gst.h>
-#include <gst/gstversion.h>
-
-struct QGstreamerMetaDataKeyLookup
-{
- QtMultimedia::MetaData key;
- const char *token;
-};
-
-static const QGstreamerMetaDataKeyLookup qt_gstreamerMetaDataKeys[] =
-{
- { QtMultimedia::Title, GST_TAG_TITLE },
- //{ QtMultimedia::SubTitle, 0 },
- //{ QtMultimedia::Author, 0 },
- { QtMultimedia::Comment, GST_TAG_COMMENT },
- { QtMultimedia::Description, GST_TAG_DESCRIPTION },
- //{ QtMultimedia::Category, 0 },
- { QtMultimedia::Genre, GST_TAG_GENRE },
- //{ QtMultimedia::Year, 0 },
- //{ QtMultimedia::UserRating, 0 },
-
- { QtMultimedia::Language, GST_TAG_LANGUAGE_CODE },
-
- { QtMultimedia::Publisher, GST_TAG_ORGANIZATION },
- { QtMultimedia::Copyright, GST_TAG_COPYRIGHT },
- //{ QtMultimedia::ParentalRating, 0 },
- //{ QtMultimedia::RatingOrganisation, 0 },
-
- // Media
- //{ QtMultimedia::Size, 0 },
- //{ QtMultimedia::MediaType, 0 },
- { QtMultimedia::Duration, GST_TAG_DURATION },
-
- // Audio
- { QtMultimedia::AudioBitRate, GST_TAG_BITRATE },
- { QtMultimedia::AudioCodec, GST_TAG_AUDIO_CODEC },
- //{ QtMultimedia::ChannelCount, 0 },
- //{ QtMultimedia::SampleRate, 0 },
-
- // Music
- { QtMultimedia::AlbumTitle, GST_TAG_ALBUM },
- { QtMultimedia::AlbumArtist, GST_TAG_ARTIST},
- { QtMultimedia::ContributingArtist, GST_TAG_PERFORMER },
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
- { QtMultimedia::Composer, GST_TAG_COMPOSER },
-#endif
- //{ QtMultimedia::Conductor, 0 },
- //{ QtMultimedia::Lyrics, 0 },
- //{ QtMultimedia::Mood, 0 },
- { QtMultimedia::TrackNumber, GST_TAG_TRACK_NUMBER },
-
- //{ QtMultimedia::CoverArtUrlSmall, 0 },
- //{ QtMultimedia::CoverArtUrlLarge, 0 },
-
- // Image/Video
- //{ QtMultimedia::Resolution, 0 },
- //{ QtMultimedia::PixelAspectRatio, 0 },
-
- // Video
- //{ QtMultimedia::VideoFrameRate, 0 },
- //{ QtMultimedia::VideoBitRate, 0 },
- { QtMultimedia::VideoCodec, GST_TAG_VIDEO_CODEC },
-
- //{ QtMultimedia::PosterUrl, 0 },
-
- // Movie
- //{ QtMultimedia::ChapterNumber, 0 },
- //{ QtMultimedia::Director, 0 },
- { QtMultimedia::LeadPerformer, GST_TAG_PERFORMER },
- //{ QtMultimedia::Writer, 0 },
-
- // Photos
- //{ QtMultimedia::CameraManufacturer, 0 },
- //{ QtMultimedia::CameraModel, 0 },
- //{ QtMultimedia::Event, 0 },
- //{ QtMultimedia::Subject, 0 }
-};
-
-QGstreamerCaptureMetaDataControl::QGstreamerCaptureMetaDataControl(QObject *parent)
- :QMetaDataWriterControl(parent)
-{
-}
-
-QVariant QGstreamerCaptureMetaDataControl::metaData(QtMultimedia::MetaData key) const
-{
- static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
-
- for (int i = 0; i < count; ++i) {
- if (qt_gstreamerMetaDataKeys[i].key == key) {
- const char *name = qt_gstreamerMetaDataKeys[i].token;
-
- return m_values.value(QByteArray::fromRawData(name, qstrlen(name)));
- }
- }
- return QVariant();
-}
-
-void QGstreamerCaptureMetaDataControl::setMetaData(QtMultimedia::MetaData key, const QVariant &value)
-{
- static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
-
- for (int i = 0; i < count; ++i) {
- if (qt_gstreamerMetaDataKeys[i].key == key) {
- const char *name = qt_gstreamerMetaDataKeys[i].token;
-
- m_values.insert(QByteArray::fromRawData(name, qstrlen(name)), value);
-
- emit QMetaDataWriterControl::metaDataChanged();
- emit metaDataChanged(m_values);
-
- return;
- }
- }
-}
-
-QList<QtMultimedia::MetaData> QGstreamerCaptureMetaDataControl::availableMetaData() const
-{
- static QMap<QByteArray, QtMultimedia::MetaData> keysMap;
- if (keysMap.isEmpty()) {
- const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
- for (int i = 0; i < count; ++i) {
- keysMap[QByteArray(qt_gstreamerMetaDataKeys[i].token)] = qt_gstreamerMetaDataKeys[i].key;
- }
- }
-
- QList<QtMultimedia::MetaData> res;
- foreach (const QByteArray &key, m_values.keys()) {
- QtMultimedia::MetaData tag = keysMap.value(key, QtMultimedia::MetaData(-1));
- if (tag != -1)
- res.append(tag);
- }
-
- return res;
-}
-
-QVariant QGstreamerCaptureMetaDataControl::extendedMetaData(QString const &name) const
-{
- return m_values.value(name.toLatin1());
-}
-
-void QGstreamerCaptureMetaDataControl::setExtendedMetaData(QString const &name, QVariant const &value)
-{
- m_values.insert(name.toLatin1(), value);
- emit QMetaDataWriterControl::metaDataChanged();
- emit metaDataChanged(m_values);
-}
-
-QStringList QGstreamerCaptureMetaDataControl::availableExtendedMetaData() const
-{
- QStringList res;
- foreach (const QByteArray &key, m_values.keys())
- res.append(QString(key));
-
- return res;
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
deleted file mode 100644
index 031f630..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturemetadatacontrol.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERCAPTUREMETADATACONTROL_H
-#define QGSTREAMERCAPTUREMETADATACONTROL_H
-
-#include <qmetadatawritercontrol.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerCaptureMetaDataControl : public QMetaDataWriterControl
-{
- Q_OBJECT
-public:
- QGstreamerCaptureMetaDataControl(QObject *parent);
- virtual ~QGstreamerCaptureMetaDataControl() {};
-
-
- bool isMetaDataAvailable() const { return true; }
- bool isWritable() const { return true; }
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- void setMetaData(QtMultimedia::MetaData key, const QVariant &value);
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(QString const &name) const;
- void setExtendedMetaData(QString const &name, QVariant const &value);
- QStringList availableExtendedMetaData() const;
-
-Q_SIGNALS:
- void metaDataChanged(const QMap<QByteArray, QVariant>&);
-
-private:
- QMap<QByteArray, QVariant> m_values;
-};
-
-#endif // QGSTREAMERCAPTUREMETADATACONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp
deleted file mode 100644
index ee64b2c..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamercaptureservice.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamerrecordercontrol.h"
-#include "qgstreamermediacontainercontrol.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamerimageencode.h"
-#include "qgstreamercameracontrol.h"
-#include <private/qgstreamerbushelper_p.h>
-#include "qgstreamerv4l2input.h"
-#include "qgstreamercapturemetadatacontrol.h"
-
-#include "qgstreameraudioinputendpointselector.h"
-#include "qgstreamervideoinputdevicecontrol.h"
-#include "qgstreamerimagecapturecontrol.h"
-
-#include "qgstreamervideooverlay.h"
-#include "qgstreamervideorenderer.h"
-
-#include "qgstreamervideowidget.h"
-
-#include <qmediaserviceprovider.h>
-
-
-QGstreamerCaptureService::QGstreamerCaptureService(const QString &service, QObject *parent):
- QMediaService(parent)
-{
- m_captureSession = 0;
- m_cameraControl = 0;
- m_metaDataControl = 0;
-
- m_videoInput = 0;
- m_audioInputEndpointSelector = 0;
- m_videoInputDevice = 0;
-
- m_videoOutput = 0;
- m_videoRenderer = 0;
- m_videoWindow = 0;
- m_videoWidgetControl = 0;
- m_imageCaptureControl = 0;
-
- if (service == Q_MEDIASERVICE_AUDIOSOURCE) {
- m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::Audio, this);
- }
-
- if (service == Q_MEDIASERVICE_CAMERA) {
- m_captureSession = new QGstreamerCaptureSession(QGstreamerCaptureSession::AudioAndVideo, this);
- m_cameraControl = new QGstreamerCameraControl(m_captureSession);
- m_videoInput = new QGstreamerV4L2Input(this);
- m_captureSession->setVideoInput(m_videoInput);
- m_videoInputDevice = new QGstreamerVideoInputDeviceControl(this);
-
- connect(m_videoInputDevice, SIGNAL(selectedDeviceChanged(QString)),
- m_videoInput, SLOT(setDevice(QString)));
-
- if (m_videoInputDevice->deviceCount())
- m_videoInput->setDevice(m_videoInputDevice->deviceName(m_videoInputDevice->selectedDevice()));
-
- m_videoRenderer = new QGstreamerVideoRenderer(this);
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
- m_videoWindow = new QGstreamerVideoOverlay(this);
- m_videoWidgetControl = new QGstreamerVideoWidgetControl(this);
-#endif
- m_imageCaptureControl = new QGstreamerImageCaptureControl(m_captureSession);
- }
-
- m_audioInputEndpointSelector = new QGstreamerAudioInputEndpointSelector(this);
- connect(m_audioInputEndpointSelector, SIGNAL(activeEndpointChanged(QString)), m_captureSession, SLOT(setCaptureDevice(QString)));
-
- if (m_captureSession && m_audioInputEndpointSelector->availableEndpoints().size() > 0)
- m_captureSession->setCaptureDevice(m_audioInputEndpointSelector->defaultEndpoint());
-
- m_metaDataControl = new QGstreamerCaptureMetaDataControl(this);
- connect(m_metaDataControl, SIGNAL(metaDataChanged(QMap<QByteArray,QVariant>)),
- m_captureSession, SLOT(setMetaData(QMap<QByteArray,QVariant>)));
-}
-
-QGstreamerCaptureService::~QGstreamerCaptureService()
-{
-}
-
-QMediaControl *QGstreamerCaptureService::requestControl(const char *name)
-{
- if (!m_captureSession)
- return 0;
-
- if (qstrcmp(name,QAudioEndpointSelector_iid) == 0)
- return m_audioInputEndpointSelector;
-
- if (qstrcmp(name,QVideoDeviceControl_iid) == 0)
- return m_videoInputDevice;
-
- if (qstrcmp(name,QMediaRecorderControl_iid) == 0)
- return m_captureSession->recorderControl();
-
- if (qstrcmp(name,QAudioEncoderControl_iid) == 0)
- return m_captureSession->audioEncodeControl();
-
- if (qstrcmp(name,QVideoEncoderControl_iid) == 0)
- return m_captureSession->videoEncodeControl();
-
- if (qstrcmp(name,QImageEncoderControl_iid) == 0)
- return m_captureSession->imageEncodeControl();
-
-
- if (qstrcmp(name,QMediaContainerControl_iid) == 0)
- return m_captureSession->mediaContainerControl();
-
- if (qstrcmp(name,QCameraControl_iid) == 0)
- return m_cameraControl;
-
- if (qstrcmp(name,QMetaDataWriterControl_iid) == 0)
- return m_metaDataControl;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return m_imageCaptureControl;
-
- if (!m_videoOutput) {
- if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
- m_videoOutput = m_videoRenderer;
- } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- m_videoOutput = m_videoWindow;
- } else if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
- m_videoOutput = m_videoWidgetControl;
- }
-
- if (m_videoOutput) {
- m_captureSession->setVideoPreview(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- return 0;
-}
-
-void QGstreamerCaptureService::releaseControl(QMediaControl *control)
-{
- if (control && control == m_videoOutput) {
- m_videoOutput = 0;
- m_captureSession->setVideoPreview(0);
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h b/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
deleted file mode 100644
index 41ba4a9..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercaptureservice.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERCAPTURESERVICE_H
-#define QGSTREAMERCAPTURESERVICE_H
-
-#include <qmediaservice.h>
-#include <qmediacontrol.h>
-
-#include <gst/gst.h>
-QT_BEGIN_NAMESPACE
-class QAudioEndpointSelector;
-class QVideoDeviceControl;
-QT_END_NAMESPACE
-
-class QGstreamerCaptureSession;
-class QGstreamerCameraControl;
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoOverlay;
-class QGstreamerVideoWidgetControl;
-class QGstreamerElementFactory;
-class QGstreamerCaptureMetaDataControl;
-class QGstreamerImageCaptureControl;
-class QGstreamerV4L2Input;
-
-class QGstreamerCaptureService : public QMediaService
-{
- Q_OBJECT
-
-public:
- QGstreamerCaptureService(const QString &service, QObject *parent = 0);
- virtual ~QGstreamerCaptureService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
-
-private:
- void setAudioPreview(GstElement*);
-
- QGstreamerCaptureSession *m_captureSession;
- QGstreamerCameraControl *m_cameraControl;
- QGstreamerV4L2Input *m_videoInput;
- QGstreamerCaptureMetaDataControl *m_metaDataControl;
-
- QAudioEndpointSelector *m_audioInputEndpointSelector;
- QVideoDeviceControl *m_videoInputDevice;
-
- QMediaControl *m_videoOutput;
-
- QGstreamerVideoRenderer *m_videoRenderer;
- QMediaControl *m_videoWindow;
- QMediaControl *m_videoWidgetControl;
- QGstreamerImageCaptureControl *m_imageCaptureControl;
-};
-
-#endif // QGSTREAMERCAPTURESERVICE_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
deleted file mode 100644
index 8d87bb3..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.cpp
+++ /dev/null
@@ -1,1024 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamercapturesession.h"
-#include "qgstreamerrecordercontrol.h"
-#include "qgstreamermediacontainercontrol.h"
-#include "qgstreamervideorendererinterface.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamerimageencode.h"
-#include <qmediarecorder.h>
-#include <private/qgstreamerbushelper_p.h>
-
-#include <gst/gsttagsetter.h>
-#include <gst/gstversion.h>
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qset.h>
-#include <QCoreApplication>
-#include <QtCore/qmetaobject.h>
-#include <QtCore/qfile.h>
-
-#include <QtGui/qimage.h>
-
-#define gstRef(element) { gst_object_ref(GST_OBJECT(element)); gst_object_sink(GST_OBJECT(element)); }
-#define gstUnref(element) { if (element) { gst_object_unref(GST_OBJECT(element)); element = 0; } }
-
-QGstreamerCaptureSession::QGstreamerCaptureSession(QGstreamerCaptureSession::CaptureMode captureMode, QObject *parent)
- :QObject(parent),
- m_state(StoppedState),
- m_pendingState(StoppedState),
- m_waitingForEos(false),
- m_pipelineMode(EmptyPipeline),
- m_captureMode(captureMode),
- m_audioInputFactory(0),
- m_audioPreviewFactory(0),
- m_videoInputFactory(0),
- m_viewfinder(0),
- m_viewfinderInterface(0),
- m_audioSrc(0),
- m_audioTee(0),
- m_audioPreviewQueue(0),
- m_audioPreview(0),
- m_audioVolume(0),
- m_muted(false),
- m_videoSrc(0),
- m_videoTee(0),
- m_videoPreviewQueue(0),
- m_videoPreview(0),
- m_imageCaptureBin(0),
- m_encodeBin(0),
- m_passImage(false),
- m_passPrerollImage(false)
-{
- m_pipeline = gst_pipeline_new("media-capture-pipeline");
- gstRef(m_pipeline);
-
- m_bus = gst_element_get_bus(m_pipeline);
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- m_audioEncodeControl = new QGstreamerAudioEncode(this);
- m_videoEncodeControl = new QGstreamerVideoEncode(this);
- m_imageEncodeControl = new QGstreamerImageEncode(this);
- m_recorderControl = new QGstreamerRecorderControl(this);
- m_mediaContainerControl = new QGstreamerMediaContainerControl(this);
-
- setState(StoppedState);
-}
-
-QGstreamerCaptureSession::~QGstreamerCaptureSession()
-{
- setState(StoppedState);
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
- gst_object_unref(GST_OBJECT(m_pipeline));
-}
-
-void QGstreamerCaptureSession::setCaptureMode(CaptureMode mode)
-{
- m_captureMode = mode;
-}
-
-GstElement *QGstreamerCaptureSession::buildEncodeBin()
-{
- GstElement *encodeBin = gst_bin_new("encode-bin");
-
- GstElement *muxer = gst_element_factory_make( m_mediaContainerControl->formatElementName().constData(), "muxer");
- if (!muxer) {
- qWarning() << "Could not create a media muxer element:" << m_mediaContainerControl->formatElementName();
- gst_object_unref(encodeBin);
- return 0;
- }
-
- GstElement *fileSink = gst_element_factory_make("filesink", "filesink");
- g_object_set(G_OBJECT(fileSink), "location", m_sink.toString().toLocal8Bit().constData(), NULL);
- gst_bin_add_many(GST_BIN(encodeBin), muxer, fileSink, NULL);
-
- if (!gst_element_link(muxer, fileSink)) {
- gst_object_unref(encodeBin);
- return 0;
- }
-
- if (m_captureMode & Audio) {
- GstElement *audioConvert = gst_element_factory_make("audioconvert", "audioconvert");
- GstElement *audioQueue = gst_element_factory_make("queue", "audio-encode-queue");
- m_audioVolume = gst_element_factory_make("volume", "volume");
- gst_bin_add_many(GST_BIN(encodeBin), audioConvert, audioQueue, m_audioVolume, NULL);
-
- GstElement *audioEncoder = m_audioEncodeControl->createEncoder();
- if (!audioEncoder) {
- gst_object_unref(encodeBin);
- qWarning() << "Could not create an audio encoder element:" << m_audioEncodeControl->audioSettings().codec();
- return 0;
- }
-
- gst_bin_add(GST_BIN(encodeBin), audioEncoder);
-
- if (!gst_element_link_many(audioConvert, audioQueue, m_audioVolume, audioEncoder, muxer, NULL)) {
- gst_object_unref(encodeBin);
- return 0;
- }
-
- g_object_set(G_OBJECT(m_audioVolume), "volume", (m_muted ? 0.0 : 1.0), NULL);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(audioConvert, "sink");
- gst_element_add_pad(GST_ELEMENT(encodeBin), gst_ghost_pad_new("audiosink", pad));
- gst_object_unref(GST_OBJECT(pad));
- }
-
- if (m_captureMode & Video) {
- GstElement *videoQueue = gst_element_factory_make("queue", "video-encode-queue");
- GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-encoder");
- GstElement *videoscale = gst_element_factory_make("videoscale","videoscale-encoder");
- gst_bin_add_many(GST_BIN(encodeBin), videoQueue, colorspace, videoscale, NULL);
-
- GstElement *videoEncoder = m_videoEncodeControl->createEncoder();
- if (!videoEncoder) {
- gst_object_unref(encodeBin);
- qWarning() << "Could not create a video encoder element:" << m_videoEncodeControl->videoSettings().codec();
- return 0;
- }
-
- gst_bin_add(GST_BIN(encodeBin), videoEncoder);
-
- if (!gst_element_link_many(videoQueue, colorspace, videoscale, videoEncoder, muxer, NULL)) {
- gst_object_unref(encodeBin);
- return 0;
- }
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(videoQueue, "sink");
- gst_element_add_pad(GST_ELEMENT(encodeBin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
- }
-
- return encodeBin;
-}
-
-GstElement *QGstreamerCaptureSession::buildAudioSrc()
-{
- GstElement *audioSrc = 0;
- if (m_audioInputFactory)
- audioSrc = m_audioInputFactory->buildElement();
- else {
- audioSrc = gst_element_factory_make("pulsesrc", "audio_src");
- QString elementName = "alsasrc";
- QString device;
-
- if (m_captureDevice.startsWith("alsa:")) {
- device = m_captureDevice.mid(QString("alsa:").length());
- } else if (m_captureDevice.startsWith("oss:")) {
- elementName = "osssrc";
- device = m_captureDevice.mid(QString("oss:").length());
- } else if (m_captureDevice.startsWith("pulseaudio:")) {
- elementName = "pulsesrc";
- } else {
- elementName = "autoaudiosrc";
- }
-
- audioSrc = gst_element_factory_make(elementName.toAscii().constData(), "audio_src");
- if (audioSrc && !device.isEmpty())
- g_object_set(G_OBJECT(audioSrc), "device", device.toLocal8Bit().constData(), NULL);
- }
-
- if (!audioSrc) {
- emit error(int(QMediaRecorder::ResourceError), tr("Could not create an audio source element"));
- audioSrc = gst_element_factory_make("fakesrc", NULL);
- }
-
- return audioSrc;
-}
-
-GstElement *QGstreamerCaptureSession::buildAudioPreview()
-{
- GstElement *previewElement = 0;
-
- if (m_audioPreviewFactory) {
- previewElement = m_audioPreviewFactory->buildElement();
- } else {
-
-
-#if 1
- previewElement = gst_element_factory_make("fakesink", "audio-preview");
-#else
- GstElement *bin = gst_bin_new("audio-preview-bin");
- GstElement *visual = gst_element_factory_make("libvisual_lv_scope", "audio-preview");
- GstElement *sink = gst_element_factory_make("ximagesink", NULL);
- gst_bin_add_many(GST_BIN(bin), visual, sink, NULL);
- gst_element_link_many(visual,sink, NULL);
-
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(visual, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("audiosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
-#endif
- }
-
- return previewElement;
-}
-
-GstElement *QGstreamerCaptureSession::buildVideoSrc()
-{
- GstElement *videoSrc = 0;
- if (m_videoInputFactory) {
- videoSrc = m_videoInputFactory->buildElement();
- } else {
- videoSrc = gst_element_factory_make("videotestsrc", "video_test_src");
- //videoSrc = gst_element_factory_make("v4l2src", "video_test_src");
- }
-
- return videoSrc;
-}
-
-GstElement *QGstreamerCaptureSession::buildVideoPreview()
-{
- GstElement *previewElement = 0;
-
- if (m_viewfinderInterface) {
- GstElement *bin = gst_bin_new("video-preview-bin");
- GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-preview");
- GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video-preview");
- GstElement *preview = m_viewfinderInterface->videoSink();
-
- gst_bin_add_many(GST_BIN(bin), colorspace, capsFilter, preview, NULL);
- gst_element_link(colorspace,capsFilter);
- gst_element_link(capsFilter,preview);
-
- QSize resolution;
- qreal frameRate = 0;
-
- if (m_captureMode & Video) {
- QVideoEncoderSettings videoSettings = m_videoEncodeControl->videoSettings();
- resolution = videoSettings.resolution();
- frameRate = videoSettings.frameRate();
- } else if (m_captureMode & Image) {
- resolution = m_imageEncodeControl->imageSettings().resolution();
- }
-
- if (!resolution.isEmpty() || frameRate > 0.001) {
- GstCaps *caps = gst_caps_new_empty();
- QStringList structureTypes;
- structureTypes << "video/x-raw-yuv" << "video/x-raw-rgb";
-
- foreach(const QString &structureType, structureTypes) {
- GstStructure *structure = gst_structure_new(structureType.toAscii().constData(), NULL);
-
- if (!resolution.isEmpty()) {
- gst_structure_set(structure, "width", G_TYPE_INT, resolution.width(), NULL);
- gst_structure_set(structure, "height", G_TYPE_INT, resolution.height(), NULL);
- }
-
- if (frameRate > 0.001) {
- QPair<int,int> rate = m_videoEncodeControl->rateAsRational();
-
- //qDebug() << "frame rate:" << num << denum;
-
- gst_structure_set(structure, "framerate", GST_TYPE_FRACTION, rate.first, rate.second, NULL);
- }
-
- gst_caps_append_structure(caps,structure);
- }
-
- //qDebug() << "set video preview caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
-
- }
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(colorspace, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
- } else {
-#if 1
- previewElement = gst_element_factory_make("fakesink", "video-preview");
-#else
- GstElement *bin = gst_bin_new("video-preview-bin");
- GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-preview");
- GstElement *preview = gst_element_factory_make("ximagesink", "video-preview");
- gst_bin_add_many(GST_BIN(bin), colorspace, preview, NULL);
- gst_element_link(colorspace,preview);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(colorspace, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- previewElement = bin;
-#endif
- }
-
- return previewElement;
-}
-
-
-static gboolean passImageFilter(GstElement *element,
- GstBuffer *buffer,
- void *appdata)
-{
- Q_UNUSED(element);
- Q_UNUSED(buffer);
-
- QGstreamerCaptureSession *session = (QGstreamerCaptureSession *)appdata;
- if (session->m_passImage || session->m_passPrerollImage) {
- session->m_passImage = false;
-
- if (session->m_passPrerollImage) {
- session->m_passPrerollImage = false;
- return TRUE;
- }
- session->m_passPrerollImage = false;
-
- QImage img;
-
- GstCaps *caps = gst_buffer_get_caps(buffer);
- if (caps) {
- GstStructure *structure = gst_caps_get_structure (caps, 0);
- gint width = 0;
- gint height = 0;
-
- if (structure &&
- gst_structure_get_int(structure, "width", &width) &&
- gst_structure_get_int(structure, "height", &height) &&
- width > 0 && height > 0) {
- if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-yuv") == 0) {
- guint32 fourcc = 0;
- gst_structure_get_fourcc(structure, "format", &fourcc);
-
- if (fourcc == GST_MAKE_FOURCC('I','4','2','0')) {
- img = QImage(width/2, height/2, QImage::Format_RGB32);
-
- const uchar *data = (const uchar *)buffer->data;
-
- for (int y=0; y<height; y+=2) {
- const uchar *yLine = data + y*width;
- const uchar *uLine = data + width*height + y*width/4;
- const uchar *vLine = data + width*height*5/4 + y*width/4;
-
- for (int x=0; x<width; x+=2) {
- const qreal Y = 1.164*(yLine[x]-16);
- const int U = uLine[x/2]-128;
- const int V = vLine[x/2]-128;
-
- int b = qBound(0, int(Y + 2.018*U), 255);
- int g = qBound(0, int(Y - 0.813*V - 0.391*U), 255);
- int r = qBound(0, int(Y + 1.596*V), 255);
-
- img.setPixel(x/2,y/2,qRgb(r,g,b));
- }
- }
- }
-
- } else if (qstrcmp(gst_structure_get_name(structure), "video/x-raw-rgb") == 0) {
- QImage::Format format = QImage::Format_Invalid;
- int bpp = 0;
- gst_structure_get_int(structure, "bpp", &bpp);
-
- if (bpp == 24)
- format = QImage::Format_RGB888;
- else if (bpp == 32)
- format = QImage::Format_RGB32;
-
- if (format != QImage::Format_Invalid) {
- img = QImage((const uchar *)buffer->data,
- width,
- height,
- format);
- img.bits(); //detach
- }
- }
- }
- gst_caps_unref(caps);
- }
-
- static int exposedSignalIndex = session->metaObject()->indexOfSignal("imageExposed(int)");
- session->metaObject()->method(exposedSignalIndex).invoke(session,
- Qt::QueuedConnection,
- Q_ARG(int,session->m_imageRequestId));
-
- static int capturedSignalIndex = session->metaObject()->indexOfSignal("imageCaptured(int,QImage)");
- session->metaObject()->method(capturedSignalIndex).invoke(session,
- Qt::QueuedConnection,
- Q_ARG(int,session->m_imageRequestId),
- Q_ARG(QImage,img));
-
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static gboolean saveImageFilter(GstElement *element,
- GstBuffer *buffer,
- GstPad *pad,
- void *appdata)
-{
- Q_UNUSED(element);
- Q_UNUSED(pad);
- QGstreamerCaptureSession *session = (QGstreamerCaptureSession *)appdata;
-
- QString fileName = session->m_imageFileName;
-
- if (!fileName.isEmpty()) {
- QFile f(fileName);
- if (f.open(QFile::WriteOnly)) {
- f.write((const char *)buffer->data, buffer->size);
- f.close();
-
- static int signalIndex = session->metaObject()->indexOfSignal("imageSaved(int,QString)");
- session->metaObject()->method(signalIndex).invoke(session,
- Qt::QueuedConnection,
- Q_ARG(int,session->m_imageRequestId),
- Q_ARG(QString,fileName));
- }
- }
-
- return TRUE;
-}
-
-GstElement *QGstreamerCaptureSession::buildImageCapture()
-{
- GstElement *bin = gst_bin_new("image-capture-bin");
- GstElement *queue = gst_element_factory_make("queue", "queue-image-capture");
- GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-image-capture");
- GstElement *encoder = gst_element_factory_make("jpegenc", "image-encoder");
- GstElement *sink = gst_element_factory_make("fakesink","sink-image-capture");
-
- GstPad *pad = gst_element_get_static_pad(queue, "src");
- Q_ASSERT(pad);
- gst_pad_add_buffer_probe(pad, G_CALLBACK(passImageFilter), this);
-
- g_object_set(G_OBJECT(sink), "signal-handoffs", TRUE, NULL);
- g_signal_connect(G_OBJECT(sink), "handoff",
- G_CALLBACK(saveImageFilter), this);
-
- gst_bin_add_many(GST_BIN(bin), queue, colorspace, encoder, sink, NULL);
- gst_element_link_many(queue, colorspace, encoder, sink, NULL);
-
- // add ghostpads
- pad = gst_element_get_static_pad(queue, "sink");
- Q_ASSERT(pad);
- gst_element_add_pad(GST_ELEMENT(bin), gst_ghost_pad_new("imagesink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- m_passImage = false;
- m_passPrerollImage = true;
- m_imageFileName = QString();
-
- return bin;
-}
-
-void QGstreamerCaptureSession::captureImage(int requestId, const QString &fileName)
-{
- m_imageRequestId = requestId;
- m_imageFileName = fileName;
- m_passImage = true;
-}
-
-
-#define REMOVE_ELEMENT(element) { if (element) {gst_bin_remove(GST_BIN(m_pipeline), element); element = 0;} }
-
-bool QGstreamerCaptureSession::rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode)
-{
- REMOVE_ELEMENT(m_audioSrc);
- REMOVE_ELEMENT(m_audioPreview);
- REMOVE_ELEMENT(m_audioPreviewQueue);
- REMOVE_ELEMENT(m_audioTee);
- REMOVE_ELEMENT(m_videoSrc);
- REMOVE_ELEMENT(m_videoPreview);
- REMOVE_ELEMENT(m_videoPreviewQueue);
- REMOVE_ELEMENT(m_videoTee);
- REMOVE_ELEMENT(m_encodeBin);
- REMOVE_ELEMENT(m_imageCaptureBin);
- m_audioVolume = 0;
-
- bool ok = true;
-
- switch (newMode) {
- case EmptyPipeline:
- break;
- case PreviewPipeline:
- if (m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- m_audioPreview = buildAudioPreview();
-
- ok &= m_audioSrc && m_audioPreview;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_audioSrc, m_audioPreview, NULL);
- ok &= gst_element_link(m_audioSrc, m_audioPreview);
- }
- }
- if (m_captureMode & Video || m_captureMode & Image) {
- m_videoSrc = buildVideoSrc();
- m_videoTee = gst_element_factory_make("tee", "video-preview-tee");
- m_videoPreviewQueue = gst_element_factory_make("queue", "video-preview-queue");
- m_videoPreview = buildVideoPreview();
- m_imageCaptureBin = buildImageCapture();
-
- ok &= m_videoSrc && m_videoTee && m_videoPreviewQueue && m_videoPreview && m_imageCaptureBin;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_videoSrc, m_videoTee,
- m_videoPreviewQueue, m_videoPreview,
- m_imageCaptureBin, NULL);
-
- ok &= gst_element_link(m_videoSrc, m_videoTee);
- ok &= gst_element_link(m_videoTee, m_videoPreviewQueue);
- ok &= gst_element_link(m_videoPreviewQueue, m_videoPreview);
- ok &= gst_element_link(m_videoTee, m_imageCaptureBin);
- }
- }
- break;
- case RecordingPipeline:
- m_encodeBin = buildEncodeBin();
- gst_bin_add(GST_BIN(m_pipeline), m_encodeBin);
-
- if (m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- ok &= m_audioSrc != 0;
-
- gst_bin_add(GST_BIN(m_pipeline), m_audioSrc);
- ok &= gst_element_link(m_audioSrc, m_encodeBin);
- }
-
- if (m_captureMode & Video) {
- m_videoSrc = buildVideoSrc();
- ok &= m_videoSrc != 0;
-
- gst_bin_add(GST_BIN(m_pipeline), m_videoSrc);
- ok &= gst_element_link(m_videoSrc, m_encodeBin);
- }
-
- if (!m_metaData.isEmpty())
- setMetaData(m_metaData);
-
- break;
- case PreviewAndRecordingPipeline:
- m_encodeBin = buildEncodeBin();
- if (m_encodeBin)
- gst_bin_add(GST_BIN(m_pipeline), m_encodeBin);
-
- ok &= m_encodeBin != 0;
-
- if (ok && m_captureMode & Audio) {
- m_audioSrc = buildAudioSrc();
- m_audioPreview = buildAudioPreview();
- m_audioTee = gst_element_factory_make("tee", NULL);
- m_audioPreviewQueue = gst_element_factory_make("queue", NULL);
-
- ok &= m_audioSrc && m_audioPreview && m_audioTee && m_audioPreviewQueue;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_audioSrc, m_audioTee,
- m_audioPreviewQueue, m_audioPreview, NULL);
- ok &= gst_element_link(m_audioSrc, m_audioTee);
- ok &= gst_element_link(m_audioTee, m_audioPreviewQueue);
- ok &= gst_element_link(m_audioPreviewQueue, m_audioPreview);
- ok &= gst_element_link(m_audioTee, m_encodeBin);
- }
- }
-
- if (ok && (m_captureMode & Video || m_captureMode & Image)) {
- m_videoSrc = buildVideoSrc();
- m_videoPreview = buildVideoPreview();
- m_videoTee = gst_element_factory_make("tee", NULL);
- m_videoPreviewQueue = gst_element_factory_make("queue", NULL);
-
- ok &= m_videoSrc && m_videoPreview && m_videoTee && m_videoPreviewQueue;
-
- if (ok) {
- gst_bin_add_many(GST_BIN(m_pipeline), m_videoSrc, m_videoTee,
- m_videoPreviewQueue, m_videoPreview, NULL);
- ok &= gst_element_link(m_videoSrc, m_videoTee);
- ok &= gst_element_link(m_videoTee, m_videoPreviewQueue);
- ok &= gst_element_link(m_videoPreviewQueue, m_videoPreview);
- }
-
- if (ok && (m_captureMode & Video))
- ok &= gst_element_link(m_videoTee, m_encodeBin);
- }
-
- if (!m_metaData.isEmpty())
- setMetaData(m_metaData);
-
-
- break;
- }
-
- if (!ok) {
- emit error(int(QMediaRecorder::FormatError),tr("Failed to build media capture pipeline."));
- }
-
- dumpGraph( QString("rebuild_graph_%1_%2").arg(m_pipelineMode).arg(newMode) );
- if (m_encodeBin) {
- QString fileName = QString("rebuild_graph_encode_%1_%2").arg(m_pipelineMode).arg(newMode);
-#if !(GST_DISABLE_GST_DEBUG) && (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
- _gst_debug_bin_to_dot_file(GST_BIN(m_encodeBin), GST_DEBUG_GRAPH_SHOW_ALL, fileName.toAscii());
-#endif
- }
-
- if (ok) {
- m_pipelineMode = newMode;
- } else {
- m_pipelineMode = EmptyPipeline;
-
- REMOVE_ELEMENT(m_audioSrc);
- REMOVE_ELEMENT(m_audioPreview);
- REMOVE_ELEMENT(m_audioPreviewQueue);
- REMOVE_ELEMENT(m_audioTee);
- REMOVE_ELEMENT(m_videoSrc);
- REMOVE_ELEMENT(m_videoPreview);
- REMOVE_ELEMENT(m_videoPreviewQueue);
- REMOVE_ELEMENT(m_videoTee);
- REMOVE_ELEMENT(m_encodeBin);
- }
-
- return ok;
-}
-
-void QGstreamerCaptureSession::dumpGraph(const QString &fileName)
-{
-#if !(GST_DISABLE_GST_DEBUG) && (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
- _gst_debug_bin_to_dot_file(GST_BIN(m_pipeline),
- GstDebugGraphDetails(/*GST_DEBUG_GRAPH_SHOW_ALL |*/ GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES),
- fileName.toAscii());
-#endif
-}
-
-QUrl QGstreamerCaptureSession::outputLocation() const
-{
- return m_sink;
-}
-
-bool QGstreamerCaptureSession::setOutputLocation(const QUrl& sink)
-{
- m_sink = sink;
- return true;
-}
-
-void QGstreamerCaptureSession::setAudioInput(QGstreamerElementFactory *audioInput)
-{
- m_audioInputFactory = audioInput;
-}
-
-void QGstreamerCaptureSession::setAudioPreview(QGstreamerElementFactory *audioPreview)
-{
- m_audioPreviewFactory = audioPreview;
-}
-
-void QGstreamerCaptureSession::setVideoInput(QGstreamerVideoInput *videoInput)
-{
- m_videoInputFactory = videoInput;
-}
-
-void QGstreamerCaptureSession::setVideoPreview(QObject *viewfinder)
-{
- m_viewfinderInterface = qobject_cast<QGstreamerVideoRendererInterface*>(viewfinder);
- if (!m_viewfinderInterface)
- viewfinder = 0;
-
- if (m_viewfinder != viewfinder) {
- bool oldReady = isReady();
-
- if (m_viewfinder) {
- disconnect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SIGNAL(viewfinderChanged()));
- disconnect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->removeMessageFilter(m_viewfinder);
- }
-
- m_viewfinder = viewfinder;
- //m_viewfinderHasChanged = true;
-
- if (m_viewfinder) {
- connect(m_viewfinder, SIGNAL(sinkChanged()),
- this, SIGNAL(viewfinderChanged()));
- connect(m_viewfinder, SIGNAL(readyChanged(bool)),
- this, SIGNAL(readyChanged(bool)));
-
- m_busHelper->installMessageFilter(m_viewfinder);
- }
-
- emit viewfinderChanged();
- if (oldReady != isReady())
- emit readyChanged(isReady());
- }
-}
-
-bool QGstreamerCaptureSession::isReady() const
-{
- return m_viewfinderInterface != 0 && m_viewfinderInterface->isReady();
-}
-
-QGstreamerCaptureSession::State QGstreamerCaptureSession::state() const
-{
- return m_state;
-}
-
-void QGstreamerCaptureSession::waitForStopped()
-{
- GstState state = GST_STATE_PLAYING;
- gst_element_get_state(m_pipeline, &state, 0, 0);
-
- while (state != GST_STATE_NULL) {
- qApp->processEvents();
- gst_element_get_state(m_pipeline, &state, 0, 0);
- }
-}
-
-void QGstreamerCaptureSession::setState(QGstreamerCaptureSession::State newState)
-{
- if (newState == m_pendingState && !m_waitingForEos)
- return;
-
- m_pendingState = newState;
-
- PipelineMode newMode = EmptyPipeline;
-
- switch (newState) {
- case PausedState:
- case RecordingState:
- newMode = PreviewAndRecordingPipeline;
- break;
- case PreviewState:
- newMode = PreviewPipeline;
- break;
- case StoppedState:
- newMode = EmptyPipeline;
- break;
- }
-
- if (newMode != m_pipelineMode) {
- if (m_pipelineMode == PreviewAndRecordingPipeline) {
- if (!m_waitingForEos) {
- m_waitingForEos = true;
- //qDebug() << "Waiting for EOS";
- //with live sources it's necessary to send EOS even to pipeline
- //before going to STOPPED state
- gst_element_send_event(m_pipeline, gst_event_new_eos());
- // Unless gstreamer is in GST_STATE_PLAYING our EOS message will not be received.
- gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
-
- return;
- } else {
- m_waitingForEos = false;
- //qDebug() << "EOS received";
- }
- }
-
- //select suitable default codecs/containers, if necessary
- m_recorderControl->applySettings();
-
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
-
- //It would be better to do this async. but
- //gstreamer doesn't notify about pipeline went to NULL state
- waitForStopped();
- if (!rebuildGraph(newMode)) {
- m_pendingState = StoppedState;
- m_state = StoppedState;
- emit stateChanged(StoppedState);
-
- return;
- }
- }
-
- switch (newState) {
- case PausedState:
- gst_element_set_state(m_pipeline, GST_STATE_PAUSED);
- break;
- case RecordingState:
- case PreviewState:
- gst_element_set_state(m_pipeline, GST_STATE_PLAYING);
- break;
- case StoppedState:
- gst_element_set_state(m_pipeline, GST_STATE_NULL);
- }
-
- //we have to do it here, since gstreamer will not emit bus messages any more
- if (newState == StoppedState) {
- m_state = StoppedState;
- emit stateChanged(StoppedState);
- }
-}
-
-
-qint64 QGstreamerCaptureSession::duration() const
-{
- GstFormat format = GST_FORMAT_TIME;
- gint64 duration = 0;
-
- if ( m_encodeBin && gst_element_query_position(m_encodeBin, &format, &duration))
- return duration / 1000000;
- else
- return 0;
-}
-
-void QGstreamerCaptureSession::setCaptureDevice(const QString &deviceName)
-{
- m_captureDevice = deviceName;
-}
-
-void QGstreamerCaptureSession::setMetaData(const QMap<QByteArray, QVariant> &data)
-{
- //qDebug() << "QGstreamerCaptureSession::setMetaData" << data;
- m_metaData = data;
-
- if (m_encodeBin) {
- GstIterator *elements = gst_bin_iterate_all_by_interface(GST_BIN(m_encodeBin), GST_TYPE_TAG_SETTER);
- GstElement *element = 0;
- while (gst_iterator_next(elements, (void**)&element) == GST_ITERATOR_OK) {
- //qDebug() << "found element with tag setter interface:" << gst_element_get_name(element);
- QMapIterator<QByteArray, QVariant> it(data);
- while (it.hasNext()) {
- it.next();
- const QString tagName = it.key();
- const QVariant tagValue = it.value();
-
-
- switch(tagValue.type()) {
- case QVariant::String:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toString().toUtf8().constData(),
- NULL);
- break;
- case QVariant::Int:
- case QVariant::LongLong:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toInt(),
- NULL);
- break;
- case QVariant::Double:
- gst_tag_setter_add_tags(GST_TAG_SETTER(element),
- GST_TAG_MERGE_REPLACE_ALL,
- tagName.toUtf8().constData(),
- tagValue.toDouble(),
- NULL);
- break;
- default:
- break;
- }
-
- }
-
- }
- }
-}
-
-bool QGstreamerCaptureSession::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (gm) {
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error (gm, &err, &debug);
- emit error(int(QMediaRecorder::ResourceError),QString::fromUtf8(err->message));
- g_error_free (err);
- g_free (debug);
- }
-
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_pipeline)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_DURATION:
- break;
-
- case GST_MESSAGE_EOS:
- if (m_waitingForEos)
- setState(m_pendingState);
- break;
-
- case GST_MESSAGE_STATE_CHANGED:
- {
-
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
- QStringList states;
- states << "GST_STATE_VOID_PENDING" << "GST_STATE_NULL" << "GST_STATE_READY" << "GST_STATE_PAUSED" << "GST_STATE_PLAYING";
-
- /*
- qDebug() << QString("state changed: old: %1 new: %2 pending: %3") \
- .arg(states[oldState]) \
- .arg(states[newState]) \
- .arg(states[pending]);
-
- #define ENUM_NAME(c,e,v) (c::staticMetaObject.enumerator(c::staticMetaObject.indexOfEnumerator(e)).valueToKey((v)))
-
- qDebug() << "Current session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_state);
- qDebug() << "Pending session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_pendingState);
- */
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- case GST_STATE_READY:
- if (m_state != StoppedState && m_pendingState == StoppedState) {
- emit stateChanged(m_state = StoppedState);
- dumpGraph("stopped");
- }
- break;
- case GST_STATE_PAUSED:
- if (m_state != PausedState && m_pendingState == PausedState)
- emit stateChanged(m_state = PausedState);
- dumpGraph("paused");
-
- if (m_pipelineMode == RecordingPipeline && !m_metaData.isEmpty())
- setMetaData(m_metaData);
- break;
- case GST_STATE_PLAYING:
- {
- if ((m_pendingState == PreviewState || m_pendingState == RecordingState) &&
- m_state != m_pendingState)
- {
- m_state = m_pendingState;
- emit stateChanged(m_state);
- }
-
- if (m_pipelineMode == PreviewPipeline)
- dumpGraph("preview");
- else
- dumpGraph("recording");
- }
- break;
- }
- }
- break;
- default:
- break;
- }
- //qDebug() << "New session state:" << ENUM_NAME(QGstreamerCaptureSession,"State",m_state);
- }
- }
- return false;
-}
-
-void QGstreamerCaptureSession::setMuted(bool muted)
-{
- if (m_muted != muted) {
- m_muted = muted;
- if (m_audioVolume)
- g_object_set(G_OBJECT(m_audioVolume), "volume", (m_muted ? 0.0 : 1.0), NULL);
- emit mutedChanged(muted);
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h b/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
deleted file mode 100644
index aa5a09c..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamercapturesession.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERCAPTURESESSION_H
-#define QGSTREAMERCAPTURESESSION_H
-
-#include <qmediarecordercontrol.h>
-#include <qmediarecorder.h>
-
-#include <QtCore/qurl.h>
-
-#include <gst/gst.h>
-
-#include <private/qgstreamerbushelper_p.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerMessage;
-class QGstreamerBusHelper;
-class QGstreamerAudioEncode;
-class QGstreamerVideoEncode;
-class QGstreamerImageEncode;
-class QGstreamerRecorderControl;
-class QGstreamerMediaContainerControl;
-class QGstreamerVideoRendererInterface;
-
-class QGstreamerElementFactory
-{
-public:
- virtual GstElement *buildElement() = 0;
- virtual void prepareWinId() {}
-};
-
-class QGstreamerVideoInput : public QGstreamerElementFactory
-{
-public:
- virtual QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const = 0;
- virtual QList<QSize> supportedResolutions(qreal frameRate = -1) const = 0;
-};
-
-class QGstreamerCaptureSession : public QObject, public QGstreamerBusMessageFilter
-{
- Q_OBJECT
- Q_PROPERTY(qint64 duration READ duration NOTIFY durationChanged)
- Q_ENUMS(State)
- Q_ENUMS(CaptureMode)
- Q_INTERFACES(QGstreamerBusMessageFilter)
-public:
- enum CaptureMode { Audio = 1, Video = 2, Image=4, AudioAndVideo = Audio | Video };
- enum State { StoppedState, PreviewState, PausedState, RecordingState };
-
- QGstreamerCaptureSession(CaptureMode captureMode, QObject *parent);
- ~QGstreamerCaptureSession();
-
- QGstreamerBusHelper *bus() { return m_busHelper; }
-
- CaptureMode captureMode() const { return m_captureMode; }
- void setCaptureMode(CaptureMode);
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl& sink);
-
- QGstreamerAudioEncode *audioEncodeControl() const { return m_audioEncodeControl; }
- QGstreamerVideoEncode *videoEncodeControl() const { return m_videoEncodeControl; }
- QGstreamerImageEncode *imageEncodeControl() const { return m_imageEncodeControl; }
-
- QGstreamerRecorderControl *recorderControl() const { return m_recorderControl; }
- QGstreamerMediaContainerControl *mediaContainerControl() const { return m_mediaContainerControl; }
-
- QGstreamerElementFactory *audioInput() const { return m_audioInputFactory; }
- void setAudioInput(QGstreamerElementFactory *audioInput);
-
- QGstreamerElementFactory *audioPreview() const { return m_audioPreviewFactory; }
- void setAudioPreview(QGstreamerElementFactory *audioPreview);
-
- QGstreamerVideoInput *videoInput() const { return m_videoInputFactory; }
- void setVideoInput(QGstreamerVideoInput *videoInput);
-
- QObject *videoPreview() const { return m_viewfinder; }
- void setVideoPreview(QObject *viewfinder);
-
- void captureImage(int requestId, const QString &fileName);
-
- State state() const;
- qint64 duration() const;
- bool isMuted() const { return m_muted; }
-
- bool isReady() const;
-
- bool processBusMessage(const QGstreamerMessage &message);
-
-signals:
- void stateChanged(QGstreamerCaptureSession::State state);
- void durationChanged(qint64 duration);
- void error(int error, const QString &errorString);
- void imageExposed(int requestId);
- void imageCaptured(int requestId, const QImage &img);
- void imageSaved(int requestId, const QString &path);
- void mutedChanged(bool);
- void readyChanged(bool);
- void viewfinderChanged();
-
-public slots:
- void setState(QGstreamerCaptureSession::State);
- void setCaptureDevice(const QString &deviceName);
-
- void dumpGraph(const QString &fileName);
-
- void setMetaData(const QMap<QByteArray, QVariant>&);
- void setMuted(bool);
-
-private:
- enum PipelineMode { EmptyPipeline, PreviewPipeline, RecordingPipeline, PreviewAndRecordingPipeline };
-
- GstElement *buildEncodeBin();
- GstElement *buildAudioSrc();
- GstElement *buildAudioPreview();
- GstElement *buildVideoSrc();
- GstElement *buildVideoPreview();
- GstElement *buildImageCapture();
-
- void waitForStopped();
- bool rebuildGraph(QGstreamerCaptureSession::PipelineMode newMode);
-
- QUrl m_sink;
- QString m_captureDevice;
- State m_state;
- State m_pendingState;
- bool m_waitingForEos;
- PipelineMode m_pipelineMode;
- QGstreamerCaptureSession::CaptureMode m_captureMode;
- QMap<QByteArray, QVariant> m_metaData;
-
- QGstreamerElementFactory *m_audioInputFactory;
- QGstreamerElementFactory *m_audioPreviewFactory;
- QGstreamerVideoInput *m_videoInputFactory;
- QObject *m_viewfinder;
- QGstreamerVideoRendererInterface *m_viewfinderInterface;
-
- QGstreamerAudioEncode *m_audioEncodeControl;
- QGstreamerVideoEncode *m_videoEncodeControl;
- QGstreamerImageEncode *m_imageEncodeControl;
- QGstreamerRecorderControl *m_recorderControl;
- QGstreamerMediaContainerControl *m_mediaContainerControl;
-
- QGstreamerBusHelper *m_busHelper;
- GstBus* m_bus;
- GstElement *m_pipeline;
-
- GstElement *m_audioSrc;
- GstElement *m_audioTee;
- GstElement *m_audioPreviewQueue;
- GstElement *m_audioPreview;
- GstElement *m_audioVolume;
- bool m_muted;
-
- GstElement *m_videoSrc;
- GstElement *m_videoTee;
- GstElement *m_videoPreviewQueue;
- GstElement *m_videoPreview;
-
- GstElement *m_imageCaptureBin;
-
- GstElement *m_encodeBin;
-
-public:
- bool m_passImage;
- bool m_passPrerollImage;
- QString m_imageFileName;
- int m_imageRequestId;
-};
-
-#endif // QGSTREAMERCAPTURESESSION_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
deleted file mode 100644
index efa7089..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.cpp
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerimagecapturecontrol.h"
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-
-QGstreamerImageCaptureControl::QGstreamerImageCaptureControl(QGstreamerCaptureSession *session)
- :QCameraImageCaptureControl(session), m_session(session), m_ready(false), m_lastId(0)
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)), SLOT(updateState()));
- 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(imageSaved(int,QString)), this, SIGNAL(imageSaved(int,QString)));
-}
-
-QGstreamerImageCaptureControl::~QGstreamerImageCaptureControl()
-{
-}
-
-bool QGstreamerImageCaptureControl::isReadyForCapture() const
-{
- return m_ready;
-}
-
-int QGstreamerImageCaptureControl::capture(const QString &fileName)
-{
- QString path = fileName;
- if (path.isEmpty()) {
- int lastImage = 0;
- QDir outputDir = QDir::currentPath();
- foreach(QString fileName, outputDir.entryList(QStringList() << "img_*.jpg")) {
- int imgNumber = fileName.mid(4, fileName.size()-8).toInt();
- lastImage = qMax(lastImage, imgNumber);
- }
-
- path = QString("img_%1.jpg").arg(lastImage+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0'));
- }
- m_lastId++;
-
- m_session->captureImage(m_lastId, path);
-
- return m_lastId;
-}
-
-void QGstreamerImageCaptureControl::cancelCapture()
-{
-
-}
-
-void QGstreamerImageCaptureControl::updateState()
-{
- bool ready = m_session->state() == QGstreamerCaptureSession::PreviewState;
- if (m_ready != ready) {
- emit readyForCaptureChanged(m_ready = ready);
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
deleted file mode 100644
index 186aa39..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimagecapturecontrol.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERIMAGECAPTURECONTROL_H
-#define QGSTREAMERIMAGECAPTURECONTROL_H
-
-#include <qcameraimagecapturecontrol.h>
-#include "qgstreamercapturesession.h"
-QT_USE_NAMESPACE
-
-class QGstreamerImageCaptureControl : public QCameraImageCaptureControl
-{
- Q_OBJECT
-public:
- QGstreamerImageCaptureControl(QGstreamerCaptureSession *session);
- virtual ~QGstreamerImageCaptureControl();
-
- QCameraImageCapture::DriveMode driveMode() const { return QCameraImageCapture::SingleImageCapture; }
- void setDriveMode(QCameraImageCapture::DriveMode) {}
-
- bool isReadyForCapture() const;
- int capture(const QString &fileName);
- void cancelCapture();
-
-private slots:
- void updateState();
-
-private:
- QGstreamerCaptureSession *m_session;
- bool m_ready;
- int m_lastId;
-};
-
-#endif // QGSTREAMERCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp
deleted file mode 100644
index 1fbc450..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.cpp
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerimageencode.h"
-#include "qgstreamercapturesession.h"
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerImageEncode::QGstreamerImageEncode(QGstreamerCaptureSession *session)
- :QImageEncoderControl(session), m_session(session)
-{
-}
-
-QGstreamerImageEncode::~QGstreamerImageEncode()
-{
-}
-
-QList<QSize> QGstreamerImageEncode::supportedResolutions(const QImageEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = m_session->videoInput() != 0;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedResolutions() : QList<QSize>();
-}
-
-QStringList QGstreamerImageEncode::supportedImageCodecs() const
-{
- return QStringList() << "jpeg";
-}
-
-QString QGstreamerImageEncode::imageCodecDescription(const QString &codecName) const
-{
- if (codecName == "jpeg")
- return tr("JPEG image encoder");
-
- return QString();
-}
-
-QImageEncoderSettings QGstreamerImageEncode::imageSettings() const
-{
- return m_settings;
-}
-
-void QGstreamerImageEncode::setImageSettings(const QImageEncoderSettings &settings)
-{
- if (m_settings != settings) {
- m_settings = settings;
- emit settingsChanged();
- }
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h b/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
deleted file mode 100644
index a3c6294..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerimageencode.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERIMAGEENCODE_H
-#define QGSTREAMERIMAGEENCODE_H
-
-class QGstreamerCaptureSession;
-
-#include <qimageencodercontrol.h>
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-
-#include <gst/gst.h>
-QT_USE_NAMESPACE
-
-class QGstreamerImageEncode : public QImageEncoderControl
-{
- Q_OBJECT
-public:
- QGstreamerImageEncode(QGstreamerCaptureSession *session);
- virtual ~QGstreamerImageEncode();
-
- QList<QSize> supportedResolutions(const QImageEncoderSettings &settings = QImageEncoderSettings(),
- bool *continuous = 0) const;
-
- QStringList supportedImageCodecs() const;
- QString imageCodecDescription(const QString &codecName) const;
-
- QImageEncoderSettings imageSettings() const;
- void setImageSettings(const QImageEncoderSettings &settings);
-
-Q_SIGNALS:
- void settingsChanged();
-
-private:
- QImageEncoderSettings m_settings;
-
- QGstreamerCaptureSession *m_session;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
deleted file mode 100644
index b0d48f2..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.cpp
+++ /dev/null
@@ -1,135 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamermediacontainercontrol.h"
-
-
-#include <QtCore/qdebug.h>
-
-QGstreamerMediaContainerControl::QGstreamerMediaContainerControl(QObject *parent)
- :QMediaContainerControl(parent)
-{
- QList<QByteArray> formatCandidates;
- formatCandidates << "matroska" << "ogg" << "mp4" << "wav" << "quicktime" << "avi" << "3gpp";
- formatCandidates << "flv" << "amr" << "asf" << "dv" << "gif";
- formatCandidates << "mpeg" << "vob" << "mpegts" << "3g2" << "3gp";
- formatCandidates << "raw";
-
- m_elementNames["matroska"] = "matroskamux";
- m_elementNames["ogg"] = "oggmux";
- m_elementNames["mp4"] = "ffmux_mp4";
- m_elementNames["quicktime"] = "ffmux_mov";
- m_elementNames["avi"] = "avimux";
- m_elementNames["3gpp"] = "gppmux";
- m_elementNames["flv"] = "flvmux";
- m_elementNames["wav"] = "wavenc";
- m_elementNames["amr"] = "ffmux_amr";
- m_elementNames["asf"] = "ffmux_asf";
- m_elementNames["dv"] = "ffmux_dv";
- m_elementNames["gif"] = "ffmux_gif";
- m_elementNames["mpeg"] = "ffmux_mpeg";
- m_elementNames["vob"] = "ffmux_vob";
- m_elementNames["mpegts"] = "ffmux_mpegts";
- m_elementNames["3g2"] = "ffmux_3g2";
- m_elementNames["3gp"] = "ffmux_3gp";
- m_elementNames["raw"] = "identity";
-
- m_containerExtensions["matroska"] = "mkv";
- m_containerExtensions["quicktime"] = "mov";
- m_containerExtensions["mpegts"] = "m2t";
- m_containerExtensions["mpeg"] = "mpg";
-
- QSet<QString> allTypes;
-
- foreach( const QByteArray& formatName, formatCandidates ) {
- QByteArray elementName = m_elementNames[formatName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
- if (factory) {
- m_supportedContainers.append(formatName);
- const gchar *descr = gst_element_factory_get_description(factory);
- m_containerDescriptions.insert(formatName, QString::fromUtf8(descr));
-
-
- if (formatName == QByteArray("raw")) {
- m_streamTypes.insert(formatName, allTypes);
- } else {
- QSet<QString> types = supportedStreamTypes(factory, GST_PAD_SINK);
- m_streamTypes.insert(formatName, types);
- allTypes.unite(types);
- }
-
- gst_object_unref(GST_OBJECT(factory));
- }
- }
-
- //if (!m_supportedContainers.isEmpty())
- // setContainerMimeType(m_supportedContainers[0]);
-}
-
-QSet<QString> QGstreamerMediaContainerControl::supportedStreamTypes(GstElementFactory *factory, GstPadDirection direction)
-{
- QSet<QString> types;
- const GList *pads = gst_element_factory_get_static_pad_templates(factory);
- for (const GList *pad = pads; pad; pad = g_list_next(pad)) {
- GstStaticPadTemplate *templ = (GstStaticPadTemplate*)pad->data;
- if (templ->direction == direction) {
- GstCaps *caps = gst_static_caps_get(&templ->static_caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- types.insert( QString::fromUtf8(gst_structure_get_name(structure)) );
- }
- gst_caps_unref(caps);
- }
- }
-
- return types;
-}
-
-
-QSet<QString> QGstreamerMediaContainerControl::supportedStreamTypes(const QString &container) const
-{
- return m_streamTypes.value(container);
-}
-
-QString QGstreamerMediaContainerControl::containerExtension() const
-{
- return m_containerExtensions.value(m_format, m_format);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
deleted file mode 100644
index 345226b..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamermediacontainercontrol.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERMEDIACONTAINERCONTROL_H
-#define QGSTREAMERMEDIACONTAINERCONTROL_H
-
-#include <qmediacontainercontrol.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerMediaContainerControl : public QMediaContainerControl
-{
-Q_OBJECT
-public:
- QGstreamerMediaContainerControl(QObject *parent);
- virtual ~QGstreamerMediaContainerControl() {};
-
- virtual QStringList supportedContainers() const { return m_supportedContainers; }
- virtual QString containerMimeType() const { return m_format; }
- virtual void setContainerMimeType(const QString &formatMimeType) { m_format = formatMimeType; }
-
- virtual QString containerDescription(const QString &formatMimeType) const { return m_containerDescriptions.value(formatMimeType); }
-
- QByteArray formatElementName() const { return m_elementNames.value(containerMimeType()); }
-
- QSet<QString> supportedStreamTypes(const QString &container) const;
-
- static QSet<QString> supportedStreamTypes(GstElementFactory *factory, GstPadDirection direction);
-
- QString containerExtension() const;
-
-private:
- QString m_format;
- QStringList m_supportedContainers;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString, QString> m_containerDescriptions;
- QMap<QString, QString> m_containerExtensions;
- QMap<QString, QSet<QString> > m_streamTypes;
-};
-
-#endif // QGSTREAMERMEDIACONTAINERCONTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
deleted file mode 100644
index 250a6b2..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.cpp
+++ /dev/null
@@ -1,289 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerrecordercontrol.h"
-#include "qgstreameraudioencode.h"
-#include "qgstreamervideoencode.h"
-#include "qgstreamermediacontainercontrol.h"
-#include <QtCore/QDebug>
-
-QGstreamerRecorderControl::QGstreamerRecorderControl(QGstreamerCaptureSession *session)
- :QMediaRecorderControl(session), m_session(session), m_state(QMediaRecorder::StoppedState)
-{
- connect(m_session, SIGNAL(stateChanged(QGstreamerCaptureSession::State)), SLOT(updateState()));
- connect(m_session, SIGNAL(error(int,QString)), SIGNAL(error(int,QString)));
- connect(m_session, SIGNAL(durationChanged(qint64)), SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedChanged(bool)), SIGNAL(mutedChanged(bool)));
- m_hasPreviewState = m_session->captureMode() != QGstreamerCaptureSession::Audio;
-}
-
-QGstreamerRecorderControl::~QGstreamerRecorderControl()
-{
-}
-
-QUrl QGstreamerRecorderControl::outputLocation() const
-{
- return m_session->outputLocation();
-}
-
-bool QGstreamerRecorderControl::setOutputLocation(const QUrl &sink)
-{
- m_outputLocation = sink;
- m_session->setOutputLocation(sink);
- return true;
-}
-
-
-QMediaRecorder::State QGstreamerRecorderControl::state() const
-{
- switch ( m_session->state() ) {
- case QGstreamerCaptureSession::RecordingState:
- return QMediaRecorder::RecordingState;
- case QGstreamerCaptureSession::PausedState:
- return QMediaRecorder::PausedState;
- case QGstreamerCaptureSession::PreviewState:
- case QGstreamerCaptureSession::StoppedState:
- return QMediaRecorder::StoppedState;
- }
-
- return QMediaRecorder::StoppedState;
-
-}
-
-void QGstreamerRecorderControl::updateState()
-{
- QMediaRecorder::State newState = state();
- if (m_state != newState) {
- m_state = newState;
- emit stateChanged(m_state);
- }
-}
-
-qint64 QGstreamerRecorderControl::duration() const
-{
- return m_session->duration();
-}
-
-void QGstreamerRecorderControl::record()
-{
- if (m_outputLocation.isEmpty()) {
- QString container = m_session->mediaContainerControl()->containerExtension();
- if (container.isEmpty())
- container = "raw";
-
- m_session->setOutputLocation(QUrl(generateFileName(defaultDir(), container)));
- }
-
- m_session->dumpGraph("before-record");
- if (!m_hasPreviewState || m_session->state() != QGstreamerCaptureSession::StoppedState) {
- m_session->setState(QGstreamerCaptureSession::RecordingState);
- } else
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
-
- m_session->dumpGraph("after-record");
-}
-
-void QGstreamerRecorderControl::pause()
-{
- m_session->dumpGraph("before-pause");
- if (!m_hasPreviewState || m_session->state() != QGstreamerCaptureSession::StoppedState) {
- m_session->setState(QGstreamerCaptureSession::PausedState);
- } else
- emit error(QMediaRecorder::ResourceError, tr("Service has not been started"));
-}
-
-void QGstreamerRecorderControl::stop()
-{
- if (!m_hasPreviewState) {
- m_session->setState(QGstreamerCaptureSession::StoppedState);
- } else {
- if (m_session->state() != QGstreamerCaptureSession::StoppedState)
- m_session->setState(QGstreamerCaptureSession::PreviewState);
- }
-}
-
-void QGstreamerRecorderControl::applySettings()
-{
- //Check the codecs are compatible with container,
- //and choose the compatible codecs/container if omitted
- QGstreamerAudioEncode *audioEncodeControl = m_session->audioEncodeControl();
- QGstreamerVideoEncode *videoEncodeControl = m_session->videoEncodeControl();
- QGstreamerMediaContainerControl *mediaContainerControl = m_session->mediaContainerControl();
-
- bool needAudio = m_session->captureMode() & QGstreamerCaptureSession::Audio;
- bool needVideo = m_session->captureMode() & QGstreamerCaptureSession::Video;
-
- QStringList containerCandidates;
- if (mediaContainerControl->containerMimeType().isEmpty())
- containerCandidates = mediaContainerControl->supportedContainers();
- else
- containerCandidates << mediaContainerControl->containerMimeType();
-
-
- QStringList audioCandidates;
- if (needAudio) {
- QAudioEncoderSettings audioSettings = audioEncodeControl->audioSettings();
- if (audioSettings.codec().isEmpty())
- audioCandidates = audioEncodeControl->supportedAudioCodecs();
- else
- audioCandidates << audioSettings.codec();
- }
-
- QStringList videoCandidates;
- if (needVideo) {
- QVideoEncoderSettings videoSettings = videoEncodeControl->videoSettings();
- if (videoSettings.codec().isEmpty())
- videoCandidates = videoEncodeControl->supportedVideoCodecs();
- else
- videoCandidates << videoSettings.codec();
- }
-
- QString container;
- QString audioCodec;
- QString videoCodec;
-
- foreach (const QString &containerCandidate, containerCandidates) {
- QSet<QString> supportedTypes = mediaContainerControl->supportedStreamTypes(containerCandidate);
-
- audioCodec.clear();
- videoCodec.clear();
-
- if (needAudio) {
- bool found = false;
- foreach (const QString &audioCandidate, audioCandidates) {
- QSet<QString> audioTypes = audioEncodeControl->supportedStreamTypes(audioCandidate);
- if (!audioTypes.intersect(supportedTypes).isEmpty()) {
- found = true;
- audioCodec = audioCandidate;
- break;
- }
- }
- if (!found)
- continue;
- }
-
- if (needVideo) {
- bool found = false;
- foreach (const QString &videoCandidate, videoCandidates) {
- QSet<QString> videoTypes = videoEncodeControl->supportedStreamTypes(videoCandidate);
- if (!videoTypes.intersect(supportedTypes).isEmpty()) {
- found = true;
- videoCodec = videoCandidate;
- break;
- }
- }
- if (!found)
- continue;
- }
-
- container = containerCandidate;
- break;
- }
-
- if (container.isEmpty()) {
- emit error(QMediaRecorder::FormatError, tr("Not compatible codecs and container format."));
- } else {
- mediaContainerControl->setContainerMimeType(container);
-
- if (needAudio) {
- QAudioEncoderSettings audioSettings = audioEncodeControl->audioSettings();
- audioSettings.setCodec(audioCodec);
- audioEncodeControl->setAudioSettings(audioSettings);
- }
-
- if (needVideo) {
- QVideoEncoderSettings videoSettings = videoEncodeControl->videoSettings();
- videoSettings.setCodec(videoCodec);
- videoEncodeControl->setVideoSettings(videoSettings);
- }
- }
-}
-
-
-bool QGstreamerRecorderControl::isMuted() const
-{
- return m_session->isMuted();
-}
-
-void QGstreamerRecorderControl::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-QDir QGstreamerRecorderControl::defaultDir() const
-{
- QStringList dirCandidates;
-
-#if defined(Q_WS_MAEMO_6)
- dirCandidates << QLatin1String("/home/user/MyDocs");
-#endif
-
- dirCandidates << QDir::home().filePath("Documents");
- dirCandidates << QDir::home().filePath("My Documents");
- dirCandidates << QDir::homePath();
- dirCandidates << QDir::currentPath();
- dirCandidates << QDir::tempPath();
-
- foreach (const QString &path, dirCandidates) {
- QDir dir(path);
- if (dir.exists() && QFileInfo(path).isWritable())
- return dir;
- }
-
- return QDir();
-}
-
-QString QGstreamerRecorderControl::generateFileName(const QDir &dir, const QString &ext) const
-{
-
- int lastClip = 0;
- foreach(QString fileName, dir.entryList(QStringList() << QString("clip_*.%1").arg(ext))) {
- int imgNumber = fileName.mid(5, fileName.size()-6-ext.length()).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("clip_%1.%2").arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0')).arg(ext);
-
- return dir.absoluteFilePath(name);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h b/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
deleted file mode 100644
index 66f4ee6..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerrecordercontrol.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERRECORDERCONTROL_H
-#define QGSTREAMERRECORDERCONTROL_H
-
-#include <QtCore/QDir>
-
-#include <qmediarecordercontrol.h>
-#include "qgstreamercapturesession.h"
-
-QT_USE_NAMESPACE
-
-class QGstreamerRecorderControl : public QMediaRecorderControl
-{
- Q_OBJECT
-
-public:
- QGstreamerRecorderControl(QGstreamerCaptureSession *session);
- virtual ~QGstreamerRecorderControl();
-
- QUrl outputLocation() const;
- bool setOutputLocation(const QUrl &sink);
-
- QMediaRecorder::State state() const;
-
- qint64 duration() const;
-
- bool isMuted() const;
-
- void applySettings();
-
-public slots:
- void record();
- void pause();
- void stop();
- void setMuted(bool);
-
-private slots:
- void updateState();
-
-private:
- QDir defaultDir() const;
- QString generateFileName(const QDir &dir, const QString &ext) const;
-
- QUrl m_outputLocation;
- QGstreamerCaptureSession *m_session;
- QMediaRecorder::State m_state;
- bool m_hasPreviewState;
-};
-
-#endif // QGSTREAMERCAPTURECORNTROL_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp
deleted file mode 100644
index 0d9d083..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.cpp
+++ /dev/null
@@ -1,293 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerv4l2input.h"
-
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <linux/videodev2.h>
-
-QT_BEGIN_NAMESPACE
-static inline uint qHash(const QSize& key) { return uint(key.width()*256+key.height()); }
-
-static bool operator<(const QSize &s1, const QSize s2)
-{
- return s1.width()*s1.height() < s2.width()*s2.height();
-}
-QT_END_NAMESPACE
-
-QGstreamerV4L2Input::QGstreamerV4L2Input(QObject *parent)
- :QObject(parent)
-{
-}
-
-QGstreamerV4L2Input::~QGstreamerV4L2Input()
-{
-}
-
-GstElement *QGstreamerV4L2Input::buildElement()
-{
- GstElement *camera = gst_element_factory_make("v4l2src", "camera_source");
- if (camera && !m_device.isEmpty() )
- g_object_set(G_OBJECT(camera), "device", m_device.constData(), NULL);
-
- return camera;
-}
-
-void QGstreamerV4L2Input::setDevice(const QByteArray &newDevice)
-{
- if (m_device != newDevice) {
- m_device = newDevice;
- updateSupportedResolutions(newDevice);
- }
-}
-
-void QGstreamerV4L2Input::setDevice(const QString &device)
-{
- setDevice(QFile::encodeName(device));
-}
-
-void QGstreamerV4L2Input::updateSupportedResolutions(const QByteArray &device)
-{
- m_frameRates.clear();
- m_resolutions.clear();
- m_ratesByResolution.clear();
-
- QSet<QSize> allResolutions;
- QSet<int> allFrameRates;
-
- QFile f(device);
-
- if (!f.open(QFile::ReadOnly))
- return;
-
- int fd = f.handle();
-
- //get the list of formats:
- QList<quint32> supportedFormats;
-
- {
- v4l2_fmtdesc fmt;
- memset(&fmt, 0, sizeof(v4l2_fmtdesc));
-
- fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
- int sanity = 0;
-
- for (fmt.index = 0;; fmt.index++) {
- if (sanity++ > 8)
- break;
- if( ::ioctl(fd, VIDIOC_ENUM_FMT, &fmt) == -1) {
- if(errno == EINVAL)
- break;
- }
- supportedFormats.append(fmt.pixelformat);
- }
- }
-
- QList<QSize> commonSizes;
- commonSizes << QSize(128, 96)
- <<QSize(160,120)
- <<QSize(176, 144)
- <<QSize(320, 240)
- <<QSize(352, 288)
- <<QSize(640, 480)
- <<QSize(1024, 768)
- <<QSize(1280, 1024)
- <<QSize(1600, 1200)
- <<QSize(1920, 1200)
- <<QSize(2048, 1536)
- <<QSize(2560, 1600)
- <<QSize(2580, 1936);
-
- QList<int> commonRates;
- commonRates << 05*1000 << 75*1000 << 10*1000 << 15*1000 << 20*1000
- << 24*1000 << 25*1000 << 30*1000 << 50*1000 << 60*1000;
-
-
- //get the list of resolutions:
-
- foreach (quint32 format, supportedFormats) {
- struct v4l2_frmsizeenum formatSize;
- memset(&formatSize, 0, sizeof(formatSize));
- formatSize.pixel_format = format;
-
- QList<QSize> sizeList;
-
- if (0) {
- char formatStr[5];
- memcpy(formatStr, &format, 4);
- formatStr[4] = 0;
- //qDebug() << "trying format" << formatStr;
- }
-
- for (int i=0;;i++) {
- formatSize.index = i;
- if (ioctl (fd, VIDIOC_ENUM_FRAMESIZES, &formatSize) < 0)
- break;
-
- if (formatSize.type == V4L2_FRMSIZE_TYPE_DISCRETE) {
- sizeList.append(QSize(formatSize.discrete.width, formatSize.discrete.height));
- } else {
-
- foreach (const QSize& candidate, commonSizes) {
- if (candidate.width() <= (int)formatSize.stepwise.max_width &&
- candidate.height() >= (int)formatSize.stepwise.min_width &&
- candidate.width() % formatSize.stepwise.step_width == 0 &&
- candidate.height() <= (int)formatSize.stepwise.max_height &&
- candidate.height() >= (int)formatSize.stepwise.min_height &&
- candidate.height() % formatSize.stepwise.step_height == 0) {
- sizeList.append(candidate);
- }
- }
-
- if (!sizeList.contains(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height)))
- sizeList.prepend(QSize(formatSize.stepwise.min_width, formatSize.stepwise.min_height));
-
- if (!sizeList.contains(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height)))
- sizeList.append(QSize(formatSize.stepwise.max_width, formatSize.stepwise.max_height));
-
- break; //stepwise values are returned only for index 0
- }
-
- }
-
- //and frameRates for each resolution.
-
- foreach (const QSize &s, sizeList) {
- allResolutions.insert(s);
-
- struct v4l2_frmivalenum formatInterval;
- memset(&formatInterval, 0, sizeof(formatInterval));
- formatInterval.pixel_format = format;
- formatInterval.width = s.width();
- formatInterval.height = s.height();
-
- QList<int> frameRates; //in 1/1000 of fps
-
- for (int i=0; ; i++) {
- formatInterval.index = i;
-
- if (ioctl(fd, VIDIOC_ENUM_FRAMEINTERVALS, &formatInterval) < 0)
- break;
-
- if (formatInterval.type == V4L2_FRMIVAL_TYPE_DISCRETE) {
- //converts seconds to fps*1000
- if (formatInterval.discrete.numerator)
- frameRates.append(qRound(formatInterval.discrete.denominator*1000.0 / formatInterval.discrete.numerator));
- } else {
- if (formatInterval.stepwise.min.numerator == 0 ||
- formatInterval.stepwise.max.numerator == 0) {
- qWarning() << "received invalid frame interval";
- break;
- }
-
-
- int minRate = qRound(formatInterval.stepwise.min.denominator*1000.0 /
- formatInterval.stepwise.min.numerator);
-
- int maxRate = qRound(formatInterval.stepwise.max.denominator*1000.0 /
- formatInterval.stepwise.max.numerator);
-
-
- foreach (int candidate, commonRates) {
- if (candidate >= minRate && candidate <= maxRate)
- frameRates.append(candidate);
- }
-
- if (!frameRates.contains(minRate))
- frameRates.prepend(minRate);
-
- if (!frameRates.contains(maxRate))
- frameRates.append(maxRate);
-
- break; //stepwise values are returned only for index 0
- }
- }
- allFrameRates.unite(frameRates.toSet());
- m_ratesByResolution[s].unite(frameRates.toSet());
- }
- }
-
- f.close();
-
- foreach(int rate, allFrameRates) {
- m_frameRates.append(rate/1000.0);
- }
-
- qSort(m_frameRates);
-
- m_resolutions = allResolutions.toList();
- qSort(m_resolutions);
-
- //qDebug() << "frame rates:" << m_frameRates;
- //qDebug() << "resolutions:" << m_resolutions;
-}
-
-
-QList<qreal> QGstreamerV4L2Input::supportedFrameRates(const QSize &frameSize) const
-{
- if (frameSize.isEmpty())
- return m_frameRates;
- else {
- QList<qreal> res;
- foreach(int rate, m_ratesByResolution[frameSize]) {
- res.append(rate/1000.0);
- }
- return res;
- }
-}
-
-QList<QSize> QGstreamerV4L2Input::supportedResolutions(qreal frameRate) const
-{
- Q_UNUSED(frameRate);
- return m_resolutions;
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h b/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
deleted file mode 100644
index 278f642..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamerv4l2input.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERV4L2INPUT_H
-#define QGSTREAMERV4L2INPUT_H
-
-#include <QtCore/qhash.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qlist.h>
-#include <QtCore/qsize.h>
-#include "qgstreamercapturesession.h"
-
-QT_USE_NAMESPACE
-
-class QGstreamerV4L2Input : public QObject, public QGstreamerVideoInput
-{
- Q_OBJECT
-public:
- QGstreamerV4L2Input(QObject *parent = 0);
- virtual ~QGstreamerV4L2Input();
-
- GstElement *buildElement();
-
- QList<qreal> supportedFrameRates(const QSize &frameSize = QSize()) const;
- QList<QSize> supportedResolutions(qreal frameRate = -1) const;
-
- QByteArray device() const;
-
-public slots:
- void setDevice(const QByteArray &device);
- void setDevice(const QString &device);
-
-private:
- void updateSupportedResolutions(const QByteArray &device);
-
- QList<qreal> m_frameRates;
- QList<QSize> m_resolutions;
-
- QHash<QSize, QSet<int> > m_ratesByResolution;
-
- QByteArray m_device;
-};
-
-#endif // QGSTREAMERV4L2INPUT_H
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
deleted file mode 100644
index a2f139e..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideoencode.h"
-#include "qgstreamercapturesession.h"
-#include "qgstreamermediacontainercontrol.h"
-
-#include <QtCore/qdebug.h>
-
-#include <math.h>
-
-QGstreamerVideoEncode::QGstreamerVideoEncode(QGstreamerCaptureSession *session)
- :QVideoEncoderControl(session), m_session(session)
-{
- QList<QByteArray> codecCandidates;
- codecCandidates << "video/h264" << "video/xvid" << "video/mpeg4" << "video/mpeg1" << "video/mpeg2" << "video/theora";
-
- m_elementNames["video/h264"] = "x264enc";
- m_elementNames["video/xvid"] = "xvidenc";
- m_elementNames["video/mpeg4"] = "ffenc_mpeg4";
- m_elementNames["video/mpeg1"] = "ffenc_mpeg1video";
- m_elementNames["video/mpeg2"] = "ffenc_mpeg2video";
- m_elementNames["video/theora"] = "theoraenc";
-
- m_codecOptions["video/h264"] = QStringList() << "quantizer";
- m_codecOptions["video/xvid"] = QStringList() << "quantizer" << "profile";
- m_codecOptions["video/mpeg4"] = QStringList() << "quantizer";
- m_codecOptions["video/mpeg1"] = QStringList() << "quantizer";
- m_codecOptions["video/mpeg2"] = QStringList() << "quantizer";
- m_codecOptions["video/theora"] = QStringList();
-
- foreach( const QByteArray& codecName, codecCandidates ) {
- QByteArray elementName = m_elementNames[codecName];
- GstElementFactory *factory = gst_element_factory_find(elementName.constData());
- if (factory) {
- m_codecs.append(codecName);
- const gchar *descr = gst_element_factory_get_description(factory);
- m_codecDescriptions.insert(codecName, QString::fromUtf8(descr));
-
- m_streamTypes.insert(codecName,
- QGstreamerMediaContainerControl::supportedStreamTypes(factory, GST_PAD_SRC));
-
- gst_object_unref(GST_OBJECT(factory));
- }
- }
-
- //if (!m_codecs.isEmpty())
- // m_videoSettings.setCodec(m_codecs[0]);
-}
-
-QGstreamerVideoEncode::~QGstreamerVideoEncode()
-{
-}
-
-QList<QSize> QGstreamerVideoEncode::supportedResolutions(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = m_session->videoInput() != 0;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedResolutions() : QList<QSize>();
-}
-
-QList< qreal > QGstreamerVideoEncode::supportedFrameRates(const QVideoEncoderSettings &, bool *continuous) const
-{
- if (continuous)
- *continuous = false;
-
- return m_session->videoInput() ? m_session->videoInput()->supportedFrameRates() : QList<qreal>();
-}
-
-QStringList QGstreamerVideoEncode::supportedVideoCodecs() const
-{
- return m_codecs;
-}
-
-QString QGstreamerVideoEncode::videoCodecDescription(const QString &codecName) const
-{
- return m_codecDescriptions.value(codecName);
-}
-
-QStringList QGstreamerVideoEncode::supportedEncodingOptions(const QString &codec) const
-{
- return m_codecOptions.value(codec);
-}
-
-QVariant QGstreamerVideoEncode::encodingOption(const QString &codec, const QString &name) const
-{
- return m_options[codec].value(name);
-}
-
-void QGstreamerVideoEncode::setEncodingOption(
- const QString &codec, const QString &name, const QVariant &value)
-{
- m_options[codec][name] = value;
-}
-
-QVideoEncoderSettings QGstreamerVideoEncode::videoSettings() const
-{
- return m_videoSettings;
-}
-
-void QGstreamerVideoEncode::setVideoSettings(const QVideoEncoderSettings &settings)
-{
- m_videoSettings = settings;
-}
-
-GstElement *QGstreamerVideoEncode::createEncoder()
-{
- QString codec = m_videoSettings.codec();
- //qDebug() << "create encoder for video codec" << codec;
- GstElement *encoderElement = gst_element_factory_make( m_elementNames.value(codec).constData(), "video-encoder");
- if (!encoderElement)
- return 0;
-
- GstBin *encoderBin = GST_BIN(gst_bin_new("video-encoder-bin"));
-
- GstElement *capsFilter = gst_element_factory_make("capsfilter", "capsfilter-video");
- gst_bin_add(encoderBin, capsFilter);
-
- GstElement *colorspace = gst_element_factory_make("ffmpegcolorspace", NULL);
- gst_bin_add(encoderBin, colorspace);
- gst_bin_add(encoderBin, encoderElement);
-
- gst_element_link_many(capsFilter, colorspace, encoderElement, NULL);
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(capsFilter, "sink");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("sink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- pad = gst_element_get_static_pad(encoderElement, "src");
- gst_element_add_pad(GST_ELEMENT(encoderBin), gst_ghost_pad_new("src", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- if (encoderElement) {
- if (m_videoSettings.encodingMode() == QtMultimedia::ConstantQualityEncoding) {
- QtMultimedia::EncodingQuality qualityValue = m_videoSettings.quality();
-
- if (codec == QLatin1String("video/h264")) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 4, NULL);
- int qualityTable[] = {
- 50, //VeryLow
- 35, //Low
- 21, //Normal
- 15, //High
- 8 //VeryHigh
- };
- g_object_set(G_OBJECT(encoderElement), "quantizer", qualityTable[qualityValue], NULL);
- } else if (codec == QLatin1String("video/xvid")) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 3, NULL);
- int qualityTable[] = {
- 32, //VeryLow
- 12, //Low
- 5, //Normal
- 3, //High
- 2 //VeryHigh
- };
- int quant = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec == QLatin1String("video/mpeg4") ||
- codec == QLatin1String("video/mpeg1") ||
- codec == QLatin1String("video/mpeg2") ) {
- //constant quantizer mode
- g_object_set(G_OBJECT(encoderElement), "pass", 2, NULL);
- //quant from 1 to 30, default ~3
- double qualityTable[] = {
- 20, //VeryLow
- 8.0, //Low
- 3.0, //Normal
- 2.5, //High
- 2.0 //VeryHigh
- };
- double quant = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quantizer", quant, NULL);
- } else if (codec == QLatin1String("video/theora")) {
- int qualityTable[] = {
- 8, //VeryLow
- 16, //Low
- 32, //Normal
- 45, //High
- 60 //VeryHigh
- };
- //quality from 0 to 63
- int quality = qualityTable[qualityValue];
- g_object_set(G_OBJECT(encoderElement), "quality", quality, NULL);
- }
- } else {
- int bitrate = m_videoSettings.bitRate();
- if (bitrate > 0) {
- g_object_set(G_OBJECT(encoderElement), "bitrate", bitrate, NULL);
- }
- }
-
- QMap<QString,QVariant> options = m_options.value(codec);
- QMapIterator<QString,QVariant> it(options);
- while (it.hasNext()) {
- it.next();
- QString option = it.key();
- QVariant value = it.value();
-
- switch (value.type()) {
- case QVariant::Int:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toInt(), NULL);
- break;
- case QVariant::Bool:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toBool(), NULL);
- break;
- case QVariant::Double:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toDouble(), NULL);
- break;
- case QVariant::String:
- g_object_set(G_OBJECT(encoderElement), option.toAscii(), value.toString().toUtf8().constData(), NULL);
- break;
- default:
- qWarning() << "unsupported option type:" << option << value;
- break;
- }
-
- }
- }
-
- if (!m_videoSettings.resolution().isEmpty() || m_videoSettings.frameRate() > 0.001) {
- GstCaps *caps = gst_caps_new_empty();
- QStringList structureTypes;
- structureTypes << "video/x-raw-yuv" << "video/x-raw-rgb";
-
- foreach(const QString &structureType, structureTypes) {
- GstStructure *structure = gst_structure_new(structureType.toAscii().constData(), NULL);
-
- if (!m_videoSettings.resolution().isEmpty()) {
- gst_structure_set(structure, "width", G_TYPE_INT, m_videoSettings.resolution().width(), NULL);
- gst_structure_set(structure, "height", G_TYPE_INT, m_videoSettings.resolution().height(), NULL);
- }
-
- if (m_videoSettings.frameRate() > 0.001) {
- QPair<int,int> rate = rateAsRational();
-
- //qDebug() << "frame rate:" << num << denum;
-
- gst_structure_set(structure, "framerate", GST_TYPE_FRACTION, rate.first, rate.second, NULL);
- }
-
- gst_caps_append_structure(caps,structure);
- }
-
- //qDebug() << "set video caps filter:" << gst_caps_to_string(caps);
-
- g_object_set(G_OBJECT(capsFilter), "caps", caps, NULL);
- }
-
- return GST_ELEMENT(encoderBin);
-}
-
-QPair<int,int> QGstreamerVideoEncode::rateAsRational() const
-{
- qreal frameRate = m_videoSettings.frameRate();
-
- if (frameRate > 0.001) {
- //convert to rational number
- QList<int> denumCandidates;
- denumCandidates << 1 << 2 << 3 << 5 << 10 << 1001 << 1000;
-
- qreal error = 1.0;
- int num = 1;
- int denum = 1;
-
- foreach (int curDenum, denumCandidates) {
- int curNum = qRound(frameRate*curDenum);
- qreal curError = qAbs(qreal(curNum)/curDenum - frameRate);
-
- if (curError < error) {
- error = curError;
- num = curNum;
- denum = curDenum;
- }
-
- if (curError < 1e-8)
- break;
- }
-
- return QPair<int,int>(num,denum);
- }
-
- return QPair<int,int>();
-}
-
-
-QSet<QString> QGstreamerVideoEncode::supportedStreamTypes(const QString &codecName) const
-{
- return m_streamTypes.value(codecName);
-}
diff --git a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h b/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
deleted file mode 100644
index f2b7a41..0000000
--- a/src/plugins/gstreamer/mediacapture/qgstreamervideoencode.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOENCODE_H
-#define QGSTREAMERVIDEOENCODE_H
-
-#include <qvideoencodercontrol.h>
-class QGstreamerCaptureSession;
-
-#include <QtCore/qstringlist.h>
-#include <QtCore/qmap.h>
-#include <QtCore/qset.h>
-
-#include <gst/gst.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoEncode : public QVideoEncoderControl
-{
- Q_OBJECT
-public:
- QGstreamerVideoEncode(QGstreamerCaptureSession *session);
- virtual ~QGstreamerVideoEncode();
-
- QList<QSize> supportedResolutions(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QList< qreal > supportedFrameRates(const QVideoEncoderSettings &settings = QVideoEncoderSettings(),
- bool *continuous = 0) const;
-
- QPair<int,int> rateAsRational() const;
-
- QStringList supportedVideoCodecs() const;
- QString videoCodecDescription(const QString &codecName) const;
-
- QVideoEncoderSettings videoSettings() const;
- void setVideoSettings(const QVideoEncoderSettings &settings);
-
- QStringList supportedEncodingOptions(const QString &codec) const;
- QVariant encodingOption(const QString &codec, const QString &name) const;
- void setEncodingOption(const QString &codec, const QString &name, const QVariant &value);
-
- GstElement *createEncoder();
-
- QSet<QString> supportedStreamTypes(const QString &codecName) const;
-
-private:
- QGstreamerCaptureSession *m_session;
-
- QStringList m_codecs;
- QMap<QString,QString> m_codecDescriptions;
- QMap<QString,QByteArray> m_elementNames;
- QMap<QString,QStringList> m_codecOptions;
-
- QVideoEncoderSettings m_videoSettings;
- QMap<QString, QMap<QString, QVariant> > m_options;
- QMap<QString, QSet<QString> > m_streamTypes;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri b/src/plugins/gstreamer/mediaplayer/mediaplayer.pri
deleted file mode 100644
index 310ed6f..0000000
--- a/src/plugins/gstreamer/mediaplayer/mediaplayer.pri
+++ /dev/null
@@ -1,30 +0,0 @@
-INCLUDEPATH += $$PWD
-
-DEFINES += QMEDIA_GSTREAMER_PLAYER
-
-contains(config_test_gstreamer_appsrc, yes) {
- HEADERS += $$PWD/qgstappsrc.h
- SOURCES += $$PWD/qgstappsrc.cpp
-
- DEFINES += HAVE_GST_APPSRC
-
- LIBS += -lgstapp-0.10
-}
-
-HEADERS += \
- $$PWD/qgstreamerplayercontrol.h \
- $$PWD/qgstreamerplayerservice.h \
- $$PWD/qgstreamerplayersession.h \
- $$PWD/qgstreamerstreamscontrol.h \
- $$PWD/qgstreamermetadataprovider.h \
- $$PWD/playerresourcepolicy.h
-
-SOURCES += \
- $$PWD/qgstreamerplayercontrol.cpp \
- $$PWD/qgstreamerplayerservice.cpp \
- $$PWD/qgstreamerplayersession.cpp \
- $$PWD/qgstreamerstreamscontrol.cpp \
- $$PWD/qgstreamermetadataprovider.cpp \
- $$PWD/playerresourcepolicy.cpp
-
-
diff --git a/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.cpp b/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.cpp
deleted file mode 100644
index 8b49cfc..0000000
--- a/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.cpp
+++ /dev/null
@@ -1,176 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "playerresourcepolicy.h"
-
-//#define DEBUG_RESOURCE_POLICY
-#include <QtCore/qdebug.h>
-
-#ifdef HAVE_RESOURCE_POLICY
-#include <policy/resource.h>
-#include <policy/resources.h>
-#include <policy/resource-set.h>
-#endif
-
-PlayerResourcePolicy::PlayerResourcePolicy(QObject *parent) :
- QObject(parent),
- m_videoEnabled(true),
- m_resourceSet(0),
- m_status(PlayerResourcePolicy::Initial)
-{
-#ifdef HAVE_RESOURCE_POLICY
- m_resourceSet = new ResourcePolicy::ResourceSet("player", this);
- m_resourceSet->setAlwaysReply();
-
- ResourcePolicy::AudioResource *audioResource = new ResourcePolicy::AudioResource("player");
- audioResource->setProcessID(QCoreApplication::applicationPid());
- audioResource->setStreamTag("media.name", "*");
- m_resourceSet->addResourceObject(audioResource);
-
- m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType);
- m_resourceSet->update();
-
- connect(m_resourceSet, SIGNAL(resourcesGranted(const QList<ResourcePolicy::ResourceType>)),
- this, SLOT(handleResourcesGranted()));
- connect(m_resourceSet, SIGNAL(resourcesDenied()),
- this, SLOT(handleResourcesDenied()));
- connect(m_resourceSet, SIGNAL(lostResources()),
- this, SLOT(handleResourcesLost()));
- connect(m_resourceSet, SIGNAL(resourcesReleasedByManager()),
- this, SLOT(handleResourcesLost()));
-#endif
-}
-
-PlayerResourcePolicy::~PlayerResourcePolicy()
-{
-}
-
-bool PlayerResourcePolicy::isVideoEnabled() const
-{
- return m_videoEnabled;
-}
-
-void PlayerResourcePolicy::setVideoEnabled(bool enabled)
-{
- if (m_videoEnabled != enabled) {
- m_videoEnabled = enabled;
-
-#ifdef HAVE_RESOURCE_POLICY
- if (enabled)
- m_resourceSet->addResource(ResourcePolicy::VideoPlaybackType);
- else
- m_resourceSet->deleteResource(ResourcePolicy::VideoPlaybackType);
-
- m_resourceSet->update();
-#endif
- }
-}
-
-void PlayerResourcePolicy::acquire()
-{
-#ifdef HAVE_RESOURCE_POLICY
-
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << "Acquire resource";
-#endif
- m_status = RequestedResource;
- m_resourceSet->acquire();
-#else
- m_status = GrantedResource;
-#endif
-}
-
-void PlayerResourcePolicy::release()
-{
-#ifdef HAVE_RESOURCE_POLICY
-
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << "Release resource";
-#endif
-
- m_resourceSet->release();
-#endif
- m_status = Initial;
-
-}
-
-bool PlayerResourcePolicy::isGranted() const
-{
- return m_status == GrantedResource;
-}
-
-bool PlayerResourcePolicy::isRequested() const
-{
- return m_status == RequestedResource;
-}
-
-void PlayerResourcePolicy::handleResourcesGranted()
-{
- m_status = GrantedResource;
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << "Resource granted";
-#endif
- emit resourcesGranted();
-}
-
-void PlayerResourcePolicy::handleResourcesDenied()
-{
- m_status = Initial;
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << "Resource denied";
-#endif
- emit resourcesDenied();
-}
-
-void PlayerResourcePolicy::handleResourcesLost()
-{
-#ifdef DEBUG_RESOURCE_POLICY
- qDebug() << Q_FUNC_INFO << "Resource lost";
-#endif
- if (m_status != Initial) {
- m_status = Initial;
- emit resourcesLost();
- }
-
-#ifdef HAVE_RESOURCE_POLICY
- m_resourceSet->release();
-#endif
-}
diff --git a/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.h b/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.h
deleted file mode 100644
index d51fd2d..0000000
--- a/src/plugins/gstreamer/mediaplayer/playerresourcepolicy.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef PLAYERRESOURCEPOLICY_H
-#define PLAYERRESOURCEPOLICY_H
-
-#include <QtCore/qobject.h>
-
-namespace ResourcePolicy {
-class ResourceSet;
-};
-
-class PlayerResourcePolicy : public QObject
-{
- Q_OBJECT
-public:
- PlayerResourcePolicy(QObject *parent = 0);
- ~PlayerResourcePolicy();
-
- bool isVideoEnabled() const;
- bool isGranted() const;
- bool isRequested() const;
-
-Q_SIGNALS:
- void resourcesDenied();
- void resourcesGranted();
- void resourcesLost();
-
-public Q_SLOTS:
- void acquire();
- void release();
-
- void setVideoEnabled(bool enabled);
-
-private Q_SLOTS:
- void handleResourcesGranted();
- void handleResourcesDenied();
- void handleResourcesLost();
-
-private:
- enum ResourceStatus {
- Initial = 0,
- RequestedResource,
- GrantedResource
- };
-
- bool m_videoEnabled;
- ResourcePolicy::ResourceSet *m_resourceSet;
- ResourceStatus m_status;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/qgstappsrc.cpp b/src/plugins/gstreamer/mediaplayer/qgstappsrc.cpp
deleted file mode 100644
index dc1f21e..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstappsrc.cpp
+++ /dev/null
@@ -1,227 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QDebug>
-
-#include "qgstappsrc.h"
-#include <QtNetwork>
-
-QGstAppSrc::QGstAppSrc(QObject *parent)
- :QObject(parent)
- ,m_stream(0)
- ,m_appSrc(0)
- ,m_sequential(false)
- ,m_maxBytes(0)
- ,m_setup(false)
- ,m_dataRequestSize(-1)
- ,m_dataRequested(false)
- ,m_enoughData(false)
- ,m_forceData(false)
-{
-}
-
-QGstAppSrc::~QGstAppSrc()
-{
- if (m_appSrc)
- gst_object_unref(G_OBJECT(m_appSrc));
-}
-
-bool QGstAppSrc::setup(GstElement* appsrc)
-{
- if (m_setup || m_stream == 0 || appsrc == 0)
- return false;
-
- m_appSrc = GST_APP_SRC(appsrc);
- m_callbacks.need_data = &QGstAppSrc::on_need_data;
- m_callbacks.enough_data = &QGstAppSrc::on_enough_data;
- m_callbacks.seek_data = &QGstAppSrc::on_seek_data;
- gst_app_src_set_callbacks(m_appSrc, (GstAppSrcCallbacks*)&m_callbacks, this, (GDestroyNotify)&QGstAppSrc::destroy_notify);
-
- g_object_get(G_OBJECT(m_appSrc), "max-bytes", &m_maxBytes, NULL);
-
- if (m_sequential)
- m_streamType = GST_APP_STREAM_TYPE_STREAM;
- else
- m_streamType = GST_APP_STREAM_TYPE_RANDOM_ACCESS;
- gst_app_src_set_stream_type(m_appSrc, m_streamType);
- gst_app_src_set_size(m_appSrc, (m_sequential) ? -1 : m_stream->size());
-
- return m_setup = true;
-}
-
-void QGstAppSrc::setStream(QIODevice *stream)
-{
- if (stream == 0)
- return;
- if (m_stream) {
- disconnect(m_stream, SIGNAL(readyRead()), this, SLOT(onDataReady()));
- disconnect(m_stream, SIGNAL(destroyed()), this, SLOT(streamDestroyed()));
- }
- if (m_appSrc)
- gst_object_unref(G_OBJECT(m_appSrc));
-
- m_dataRequestSize = -1;
- m_dataRequested = false;
- m_enoughData = false;
- m_forceData = false;
- m_maxBytes = 0;
-
- m_appSrc = 0;
- m_stream = stream;
- connect(m_stream, SIGNAL(destroyed()), SLOT(streamDestroyed()));
- connect(m_stream, SIGNAL(readyRead()), this, SLOT(onDataReady()));
- m_sequential = m_stream->isSequential();
- m_setup = false;
-}
-
-QIODevice *QGstAppSrc::stream() const
-{
- return m_stream;
-}
-
-GstAppSrc *QGstAppSrc::element()
-{
- return m_appSrc;
-}
-
-void QGstAppSrc::onDataReady()
-{
- if (!m_enoughData) {
- m_dataRequested = true;
- pushDataToAppSrc();
- }
-}
-
-void QGstAppSrc::streamDestroyed()
-{
- if (sender() == m_stream) {
- m_stream = 0;
- sendEOS();
- }
-}
-
-void QGstAppSrc::pushDataToAppSrc()
-{
- if (!isStreamValid() || !m_setup)
- return;
-
- if (m_dataRequested && !m_enoughData) {
- qint64 size;
- if (m_dataRequestSize == (unsigned int)-1)
- size = qMin(m_stream->bytesAvailable(), queueSize());
- else
- size = qMin(m_stream->bytesAvailable(), (qint64)m_dataRequestSize);
- void *data = g_malloc(size);
- GstBuffer* buffer = gst_app_buffer_new(data, size, g_free, data);
- buffer->offset = m_stream->pos();
- qint64 bytesRead = m_stream->read((char*)GST_BUFFER_DATA(buffer), size);
- buffer->offset_end = buffer->offset + bytesRead - 1;
-
- if (bytesRead > 0) {
- m_dataRequested = false;
- m_enoughData = false;
- GstFlowReturn ret = gst_app_src_push_buffer (GST_APP_SRC (element()), buffer);
- if (ret == GST_FLOW_ERROR) {
- qWarning()<<"appsrc: push buffer error";
- } else if (ret == GST_FLOW_WRONG_STATE) {
- qWarning()<<"appsrc: push buffer wrong state";
- } else if (ret == GST_FLOW_RESEND) {
- qWarning()<<"appsrc: push buffer resend";
- }
- }
- } else if (m_stream->atEnd()) {
- sendEOS();
- }
-}
-
-bool QGstAppSrc::doSeek(qint64 value)
-{
- if (isStreamValid())
- return stream()->seek(value);
- return false;
-}
-
-
-gboolean QGstAppSrc::on_seek_data(GstAppSrc *element, guint64 arg0, gpointer userdata)
-{
- Q_UNUSED(element);
- QGstAppSrc *self = reinterpret_cast<QGstAppSrc*>(userdata);
- if (self && self->isStreamValid()) {
- if (!self->stream()->isSequential())
- QMetaObject::invokeMethod(self, "doSeek", Qt::AutoConnection, Q_ARG(qint64, arg0));
- }
- else
- return false;
-
- return true;
-}
-
-void QGstAppSrc::on_enough_data(GstAppSrc *element, gpointer userdata)
-{
- Q_UNUSED(element);
- QGstAppSrc *self = reinterpret_cast<QGstAppSrc*>(userdata);
- if (self)
- self->enoughData() = true;
-}
-
-void QGstAppSrc::on_need_data(GstAppSrc *element, guint arg0, gpointer userdata)
-{
- Q_UNUSED(element);
- QGstAppSrc *self = reinterpret_cast<QGstAppSrc*>(userdata);
- if (self) {
- self->dataRequested() = true;
- self->enoughData() = false;
- self->dataRequestSize()= arg0;
- QMetaObject::invokeMethod(self, "pushDataToAppSrc", Qt::AutoConnection);
- }
-}
-
-void QGstAppSrc::destroy_notify(gpointer data)
-{
- Q_UNUSED(data);
-}
-
-void QGstAppSrc::sendEOS()
-{
- gst_app_src_end_of_stream(GST_APP_SRC(m_appSrc));
- if (isStreamValid() && !stream()->isSequential())
- stream()->reset();
-}
diff --git a/src/plugins/gstreamer/mediaplayer/qgstappsrc.h b/src/plugins/gstreamer/mediaplayer/qgstappsrc.h
deleted file mode 100644
index a636dde..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstappsrc.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTAPPSRC_H
-#define QGSTAPPSRC_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qiodevice.h>
-
-#include <gst/gst.h>
-#include <gst/app/gstappsrc.h>
-#include <gst/app/gstappbuffer.h>
-
-class QGstAppSrc : public QObject
-{
- Q_OBJECT
-public:
- QGstAppSrc(QObject *parent = 0);
- ~QGstAppSrc();
-
- bool setup(GstElement *);
- bool isReady() const { return m_setup; }
-
- void setStream(QIODevice *);
- QIODevice *stream() const;
-
- GstAppSrc *element();
-
- qint64 queueSize() const { return m_maxBytes; }
-
- bool& enoughData() { return m_enoughData; }
- bool& dataRequested() { return m_dataRequested; }
- unsigned int& dataRequestSize() { return m_dataRequestSize; }
-
- bool isStreamValid() const
- {
- return m_stream != 0 &&
- m_stream->isOpen();
- }
-
-private slots:
- void pushDataToAppSrc();
- bool doSeek(qint64);
- void onDataReady();
-
- void streamDestroyed();
-private:
- static gboolean on_seek_data(GstAppSrc *element, guint64 arg0, gpointer userdata);
- static void on_enough_data(GstAppSrc *element, gpointer userdata);
- static void on_need_data(GstAppSrc *element, uint arg0, gpointer userdata);
- static void destroy_notify(gpointer data);
-
- void sendEOS();
-
- QIODevice *m_stream;
- GstAppSrc *m_appSrc;
- bool m_sequential;
- GstAppStreamType m_streamType;
- GstAppSrcCallbacks m_callbacks;
- qint64 m_maxBytes;
- bool m_setup;
- unsigned int m_dataRequestSize;
- bool m_dataRequested;
- bool m_enoughData;
- bool m_forceData;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
deleted file mode 100644
index 6670672..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.cpp
+++ /dev/null
@@ -1,192 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamermetadataprovider.h"
-#include "qgstreamerplayersession.h"
-#include <QDebug>
-
-#include <gst/gstversion.h>
-
-struct QGstreamerMetaDataKeyLookup
-{
- QtMultimedia::MetaData key;
- const char *token;
-};
-
-static const QGstreamerMetaDataKeyLookup qt_gstreamerMetaDataKeys[] =
-{
- { QtMultimedia::Title, GST_TAG_TITLE },
- //{ QtMultimedia::SubTitle, 0 },
- //{ QtMultimedia::Author, 0 },
- { QtMultimedia::Comment, GST_TAG_COMMENT },
- { QtMultimedia::Description, GST_TAG_DESCRIPTION },
- //{ QtMultimedia::Category, 0 },
- { QtMultimedia::Genre, GST_TAG_GENRE },
- { QtMultimedia::Year, "year" },
- //{ QtMultimedia::UserRating, 0 },
-
- { QtMultimedia::Language, GST_TAG_LANGUAGE_CODE },
-
- { QtMultimedia::Publisher, GST_TAG_ORGANIZATION },
- { QtMultimedia::Copyright, GST_TAG_COPYRIGHT },
- //{ QtMultimedia::ParentalRating, 0 },
- //{ QtMultimedia::RatingOrganisation, 0 },
-
- // Media
- //{ QtMultimedia::Size, 0 },
- //{ QtMultimedia::MediaType, 0 },
- { QtMultimedia::Duration, GST_TAG_DURATION },
-
- // Audio
- { QtMultimedia::AudioBitRate, GST_TAG_BITRATE },
- { QtMultimedia::AudioCodec, GST_TAG_AUDIO_CODEC },
- //{ QtMultimedia::ChannelCount, 0 },
- //{ QtMultimedia::SampleRate, 0 },
-
- // Music
- { QtMultimedia::AlbumTitle, GST_TAG_ALBUM },
- { QtMultimedia::AlbumArtist, GST_TAG_ARTIST},
- { QtMultimedia::ContributingArtist, GST_TAG_PERFORMER },
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 19)
- { QtMultimedia::Composer, GST_TAG_COMPOSER },
-#endif
- //{ QtMultimedia::Conductor, 0 },
- //{ QtMultimedia::Lyrics, 0 },
- //{ QtMultimedia::Mood, 0 },
- { QtMultimedia::TrackNumber, GST_TAG_TRACK_NUMBER },
-
- //{ QtMultimedia::CoverArtUrlSmall, 0 },
- //{ QtMultimedia::CoverArtUrlLarge, 0 },
-
- // Image/Video
- { QtMultimedia::Resolution, "resolution" },
- { QtMultimedia::PixelAspectRatio, "pixel-aspect-ratio" },
-
- // Video
- //{ QtMultimedia::VideoFrameRate, 0 },
- //{ QtMultimedia::VideoBitRate, 0 },
- { QtMultimedia::VideoCodec, GST_TAG_VIDEO_CODEC },
-
- //{ QtMultimedia::PosterUrl, 0 },
-
- // Movie
- //{ QtMultimedia::ChapterNumber, 0 },
- //{ QtMultimedia::Director, 0 },
- { QtMultimedia::LeadPerformer, GST_TAG_PERFORMER },
- //{ QtMultimedia::Writer, 0 },
-
- // Photos
- //{ QtMultimedia::CameraManufacturer, 0 },
- //{ QtMultimedia::CameraModel, 0 },
- //{ QtMultimedia::Event, 0 },
- //{ QtMultimedia::Subject, 0 }
-};
-
-QGstreamerMetaDataProvider::QGstreamerMetaDataProvider(QGstreamerPlayerSession *session, QObject *parent)
- :QMetaDataReaderControl(parent), m_session(session)
-{
- connect(m_session, SIGNAL(tagsChanged()), SLOT(updateTags()));
-}
-
-QGstreamerMetaDataProvider::~QGstreamerMetaDataProvider()
-{
-}
-
-bool QGstreamerMetaDataProvider::isMetaDataAvailable() const
-{
- return !m_session->tags().isEmpty();
-}
-
-bool QGstreamerMetaDataProvider::isWritable() const
-{
- return false;
-}
-
-QVariant QGstreamerMetaDataProvider::metaData(QtMultimedia::MetaData key) const
-{
- static const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
-
- for (int i = 0; i < count; ++i) {
- if (qt_gstreamerMetaDataKeys[i].key == key) {
- return m_session->tags().value(QByteArray(qt_gstreamerMetaDataKeys[i].token));
- }
- }
- return QVariant();
-}
-
-QList<QtMultimedia::MetaData> QGstreamerMetaDataProvider::availableMetaData() const
-{
- static QMap<QByteArray, QtMultimedia::MetaData> keysMap;
- if (keysMap.isEmpty()) {
- const int count = sizeof(qt_gstreamerMetaDataKeys) / sizeof(QGstreamerMetaDataKeyLookup);
- for (int i = 0; i < count; ++i) {
- keysMap[QByteArray(qt_gstreamerMetaDataKeys[i].token)] = qt_gstreamerMetaDataKeys[i].key;
- }
- }
-
- QList<QtMultimedia::MetaData> res;
- foreach (const QByteArray &key, m_session->tags().keys()) {
- QtMultimedia::MetaData tag = keysMap.value(key, QtMultimedia::MetaData(-1));
- if (tag != -1)
- res.append(tag);
- }
-
- return res;
-}
-
-QVariant QGstreamerMetaDataProvider::extendedMetaData(const QString &key) const
-{
- return m_session->tags().value(key.toLatin1());
-}
-
-QStringList QGstreamerMetaDataProvider::availableExtendedMetaData() const
-{
- QStringList res;
- foreach (const QByteArray &key, m_session->tags().keys())
- res.append(QString(key));
-
- return res;
-}
-
-void QGstreamerMetaDataProvider::updateTags()
-{
- emit metaDataChanged();
-}
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h b/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
deleted file mode 100644
index efba79c..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamermetadataprovider.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERMETADATAPROVIDER_H
-#define QGSTREAMERMETADATAPROVIDER_H
-
-#include <qmetadatareadercontrol.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerPlayerSession;
-
-class QGstreamerMetaDataProvider : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- QGstreamerMetaDataProvider( QGstreamerPlayerSession *session, QObject *parent );
- virtual ~QGstreamerMetaDataProvider();
-
- bool isMetaDataAvailable() const;
- bool isWritable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const ;
- QStringList availableExtendedMetaData() const;
-
-private slots:
- void updateTags();
-
-private:
- QGstreamerPlayerSession *m_session;
-};
-
-#endif // QGSTREAMERMETADATAPROVIDER_H
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
deleted file mode 100644
index 6198163..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.cpp
+++ /dev/null
@@ -1,775 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerplayercontrol.h"
-#include "qgstreamerplayersession.h"
-#include "playerresourcepolicy.h"
-
-#include <qmediaplaylistnavigator.h>
-
-
-#include <QtCore/qdir.h>
-#include <QtCore/qsocketnotifier.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qdebug.h>
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-//#define DEBUG_PLAYBIN
-
-QGstreamerPlayerControl::QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent)
- : QMediaPlayerControl(parent)
- , m_ownStream(false)
- , m_session(session)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_bufferProgress(-1)
- , m_seekToStartPending(false)
- , m_pendingSeekPosition(-1)
- , m_stream(0)
- , m_fifoNotifier(0)
- , m_fifoCanWrite(false)
- , m_bufferSize(0)
- , m_bufferOffset(0)
-{
- m_fifoFd[0] = -1;
- m_fifoFd[1] = -1;
-
- m_resources = new PlayerResourcePolicy(this);
-
- connect(m_session, SIGNAL(positionChanged(qint64)),
- this, SLOT(updatePosition(qint64)));
- connect(m_session, SIGNAL(durationChanged(qint64)),
- this, SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(mutedStateChanged(bool)),
- this, SIGNAL(mutedChanged(bool)));
- connect(m_session, SIGNAL(volumeChanged(int)),
- this, SIGNAL(volumeChanged(int)));
- connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SLOT(updateSessionState(QMediaPlayer::State)));
- connect(m_session,SIGNAL(bufferingProgressChanged(int)),
- this, SLOT(setBufferProgress(int)));
- connect(m_session, SIGNAL(playbackFinished()),
- this, SLOT(processEOS()));
- connect(m_session, SIGNAL(audioAvailableChanged(bool)),
- this, SIGNAL(audioAvailableChanged(bool)));
- connect(m_session, SIGNAL(videoAvailableChanged(bool)),
- this, SIGNAL(videoAvailableChanged(bool)));
- connect(m_session, SIGNAL(seekableChanged(bool)),
- this, SIGNAL(seekableChanged(bool)));
- connect(m_session, SIGNAL(error(int,QString)),
- this, SIGNAL(error(int,QString)));
- connect(m_session, SIGNAL(invalidMedia()),
- this, SLOT(handleInvalidMedia()));
- connect(m_session, SIGNAL(playbackRateChanged(qreal)),
- this, SIGNAL(playbackRateChanged(qreal)));
- connect(m_session, SIGNAL(seekableChanged(bool)),
- this, SLOT(applyPendingSeek(bool)));
-
- connect(m_resources, SIGNAL(resourcesGranted()), SLOT(handleResourcesGranted()));
- connect(m_resources, SIGNAL(resourcesDenied()), SLOT(handleResourcesLost()));
- connect(m_resources, SIGNAL(resourcesLost()), SLOT(handleResourcesLost()));
-}
-
-QGstreamerPlayerControl::~QGstreamerPlayerControl()
-{
- if (m_fifoFd[0] >= 0) {
- ::close(m_fifoFd[0]);
- ::close(m_fifoFd[1]);
- m_fifoFd[0] = -1;
- m_fifoFd[1] = -1;
- }
-}
-
-qint64 QGstreamerPlayerControl::position() const
-{
- return m_seekToStartPending ? 0 : m_session->position();
-}
-
-qint64 QGstreamerPlayerControl::duration() const
-{
- return m_session->duration();
-}
-
-QMediaPlayer::State QGstreamerPlayerControl::state() const
-{
- return m_state;
-}
-
-QMediaPlayer::MediaStatus QGstreamerPlayerControl::mediaStatus() const
-{
- return m_mediaStatus;
-}
-
-int QGstreamerPlayerControl::bufferStatus() const
-{
- if (m_bufferProgress == -1) {
- return m_session->state() == QMediaPlayer::StoppedState ? 0 : 100;
- } else
- return m_bufferProgress;
-}
-
-int QGstreamerPlayerControl::volume() const
-{
- return m_session->volume();
-}
-
-bool QGstreamerPlayerControl::isMuted() const
-{
- return m_session->isMuted();
-}
-
-bool QGstreamerPlayerControl::isSeekable() const
-{
- return m_session->isSeekable();
-}
-
-QMediaTimeRange QGstreamerPlayerControl::availablePlaybackRanges() const
-{
- return m_session->availablePlaybackRanges();
-}
-
-qreal QGstreamerPlayerControl::playbackRate() const
-{
- return m_session->playbackRate();
-}
-
-void QGstreamerPlayerControl::setPlaybackRate(qreal rate)
-{
- m_session->setPlaybackRate(rate);
-}
-
-void QGstreamerPlayerControl::setPosition(qint64 pos)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << pos/1000.0;
-#endif
-
- pushState();
-
- if (m_mediaStatus == QMediaPlayer::EndOfMedia) {
- m_mediaStatus = QMediaPlayer::LoadedMedia;
- m_seekToStartPending = true;
- }
-
- if (m_session->isSeekable() && m_session->seek(pos)) {
- m_seekToStartPending = false;
- } else {
- m_pendingSeekPosition = pos;
- //don't display the first video frame since it's not what user requested.
- m_session->showPrerollFrames(false);
- }
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::play()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
-
- playOrPause(QMediaPlayer::PlayingState);
-}
-
-void QGstreamerPlayerControl::pause()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
-
- playOrPause(QMediaPlayer::PausedState);
-}
-
-void QGstreamerPlayerControl::playOrPause(QMediaPlayer::State newState)
-{
- if (m_mediaStatus == QMediaPlayer::NoMedia)
- return;
-
- pushState();
-#ifdef Q_WS_MAEMO_6
- //this is a work around for the gstreamer bug,
- //should be remove once it get fixed
- if (newState == QMediaPlayer::PlayingState && m_mediaStatus == QMediaPlayer::InvalidMedia) {
- setMedia(m_currentResource, m_stream);
- }
-#endif
-
- if (m_mediaStatus == QMediaPlayer::EndOfMedia) {
- m_mediaStatus = QMediaPlayer::BufferedMedia;
- m_seekToStartPending = true;
- }
-
- if (!m_resources->isGranted() && !m_resources->isRequested())
- m_resources->acquire();
-
- if (m_resources->isGranted()) {
- if (m_seekToStartPending) {
- m_session->pause();
- if (!m_session->seek(0)) {
- m_bufferProgress = -1;
- m_session->stop();
- m_mediaStatus = QMediaPlayer::LoadingMedia;
- }
- m_seekToStartPending = false;
- }
-
- bool ok = false;
-
- //To prevent displaying the first video frame when playback is resumed
- //the pipeline is paused instead of playing, seeked to requested position,
- //and after seeking is finished (position updated) playback is restarted
- //with show-preroll-frame enabled.
- if (newState == QMediaPlayer::PlayingState && m_pendingSeekPosition == -1)
- ok = m_session->play();
- else
- ok = m_session->pause();
-
- if (!ok)
- newState = QMediaPlayer::StoppedState;
- }
-
- if (m_mediaStatus == QMediaPlayer::InvalidMedia)
- m_mediaStatus = QMediaPlayer::LoadingMedia;
-
- m_state = newState;
-
- if (m_mediaStatus == QMediaPlayer::EndOfMedia || m_mediaStatus == QMediaPlayer::LoadedMedia) {
- if (m_bufferProgress == -1 || m_bufferProgress == 100)
- m_mediaStatus = QMediaPlayer::BufferedMedia;
- else
- m_mediaStatus = QMediaPlayer::BufferingMedia;
- }
-
- popAndNotifyState();
-
- emit positionChanged(position());
-}
-
-void QGstreamerPlayerControl::stop()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
-
- pushState();
-
- if (m_state != QMediaPlayer::StoppedState) {
- m_state = QMediaPlayer::StoppedState;
- if (m_resources->isGranted())
- m_session->pause();
-
- if (m_mediaStatus != QMediaPlayer::EndOfMedia) {
- m_seekToStartPending = true;
- emit positionChanged(position());
- }
- }
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::setVolume(int volume)
-{
- m_session->setVolume(volume);
-}
-
-void QGstreamerPlayerControl::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-QMediaContent QGstreamerPlayerControl::media() const
-{
- return m_currentResource;
-}
-
-const QIODevice *QGstreamerPlayerControl::mediaStream() const
-{
- return m_stream;
-}
-
-void QGstreamerPlayerControl::setMedia(const QMediaContent &content, QIODevice *stream)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
-
- pushState();
-
- m_state = QMediaPlayer::StoppedState;
- QMediaContent oldMedia = m_currentResource;
- m_pendingSeekPosition = -1;
- m_session->showPrerollFrames(true);
-
- if (!content.isNull() || stream) {
- if (!m_resources->isRequested() && !m_resources->isGranted())
- m_resources->acquire();
-
- if (!m_resources->isGranted()) {
- m_currentResource = content;
- m_stream = stream;
-
- m_state = QMediaPlayer::StoppedState;
- m_mediaStatus = QMediaPlayer::LoadingMedia;
- if (m_currentResource != oldMedia)
- emit mediaChanged(m_currentResource);
- popAndNotifyState();
- return;
- }
- } else {
- m_resources->release();
- }
-
- m_session->stop();
-
- bool userStreamValid = false;
-
- if (m_bufferProgress != -1) {
- m_bufferProgress = -1;
- emit bufferStatusChanged(0);
- }
-
- if (m_stream) {
-#if !defined(HAVE_GST_APPSRC)
- closeFifo();
-
- disconnect(m_stream, SIGNAL(readyRead()), this, SLOT(writeFifo()));
-#endif
-
- if (m_ownStream)
- delete m_stream;
- m_stream = 0;
- m_ownStream = false;
- }
-
- // If the canonical URL refers to a Qt resource, open with QFile and use
- // the stream playback capability to play.
- if (stream == 0 && content.canonicalUrl().scheme() == QLatin1String("qrc")) {
- stream = new QFile(QLatin1Char(':') + content.canonicalUrl().path(), this);
- if (!stream->open(QIODevice::ReadOnly)) {
- delete stream;
- m_mediaStatus = QMediaPlayer::InvalidMedia;
- m_currentResource = content;
- emit mediaChanged(m_currentResource);
- emit error(QMediaPlayer::FormatError, tr("Attempting to play invalid Qt resource"));
- if (m_state != QMediaPlayer::PlayingState)
- m_resources->release();
- popAndNotifyState();
- return;
- }
- m_ownStream = true;
- }
-
- m_currentResource = content;
- m_stream = stream;
- m_seekToStartPending = false;
-
- QNetworkRequest request;
-
- if (m_stream) {
-#if !defined(HAVE_GST_APPSRC)
- if (m_stream->isReadable() && openFifo()) {
- request = QNetworkRequest(QUrl(QString(QLatin1String("fd://%1")).arg(m_fifoFd[0])));
- }
-#else
- userStreamValid = stream->isOpen() && m_stream->isReadable();
- request = content.canonicalRequest();
-#endif
- } else if (!content.isNull()) {
- request = content.canonicalRequest();
- }
-
-#if !defined(HAVE_GST_APPSRC)
- m_session->loadFromUri(request);
-#else
- if (m_stream) {
- if (userStreamValid){
- m_session->loadFromStream(request, m_stream);
- } else {
- m_mediaStatus = QMediaPlayer::InvalidMedia;
- emit error(QMediaPlayer::FormatError, tr("Attempting to play invalid user stream"));
- if (m_state != QMediaPlayer::PlayingState)
- m_resources->release();
- popAndNotifyState();
- return;
- }
- } else
- m_session->loadFromUri(request);
-#endif
-
-#if !defined(HAVE_GST_APPSRC)
- if (m_fifoFd[1] >= 0) {
- m_fifoCanWrite = true;
-
- writeFifo();
- }
-#endif
-
-#if defined(HAVE_GST_APPSRC)
- if (!request.url().isEmpty() || userStreamValid) {
-#else
- if (!request.url().isEmpty()) {
-#endif
- m_mediaStatus = QMediaPlayer::LoadingMedia;
- m_session->pause();
- } else {
- m_mediaStatus = QMediaPlayer::NoMedia;
- setBufferProgress(0);
- }
-
- if (m_currentResource != oldMedia)
- emit mediaChanged(m_currentResource);
-
- emit positionChanged(position());
-
- if (content.isNull() && !stream)
- m_resources->release();
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::setVideoOutput(QObject *output)
-{
- m_session->setVideoRenderer(output);
-}
-
-bool QGstreamerPlayerControl::isAudioAvailable() const
-{
- return m_session->isAudioAvailable();
-}
-
-bool QGstreamerPlayerControl::isVideoAvailable() const
-{
- return m_session->isVideoAvailable();
-}
-
-void QGstreamerPlayerControl::updateSessionState(QMediaPlayer::State state)
-{
- pushState();
-
- if (state == QMediaPlayer::StoppedState)
- m_state = QMediaPlayer::StoppedState;
-
- updateMediaStatus();
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::updateMediaStatus()
-{
- pushState();
- QMediaPlayer::MediaStatus oldStatus = m_mediaStatus;
-
- switch (m_session->state()) {
- case QMediaPlayer::StoppedState:
- if (m_currentResource.isNull())
- m_mediaStatus = QMediaPlayer::NoMedia;
- else if (oldStatus != QMediaPlayer::InvalidMedia)
- m_mediaStatus = QMediaPlayer::LoadingMedia;
- break;
-
- case QMediaPlayer::PlayingState:
- case QMediaPlayer::PausedState:
- if (m_state == QMediaPlayer::StoppedState) {
- m_mediaStatus = QMediaPlayer::LoadedMedia;
- } else {
- if (m_bufferProgress == -1 || m_bufferProgress == 100)
- m_mediaStatus = QMediaPlayer::BufferedMedia;
- else
- m_mediaStatus = QMediaPlayer::StalledMedia;
- }
- break;
- }
-
- if (m_state == QMediaPlayer::PlayingState && !m_resources->isGranted())
- m_mediaStatus = QMediaPlayer::StalledMedia;
-
- //EndOfMedia status should be kept, until reset by pause, play or setMedia
- if (oldStatus == QMediaPlayer::EndOfMedia)
- m_mediaStatus = QMediaPlayer::EndOfMedia;
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::processEOS()
-{
- pushState();
- m_mediaStatus = QMediaPlayer::EndOfMedia;
- emit positionChanged(position());
- stop();
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::setBufferProgress(int progress)
-{
- if (m_bufferProgress == progress || m_mediaStatus == QMediaPlayer::NoMedia)
- return;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << progress;
-#endif
- m_bufferProgress = progress;
-
- if (m_resources->isGranted()) {
- if (m_state == QMediaPlayer::PlayingState &&
- m_bufferProgress == 100 &&
- m_session->state() != QMediaPlayer::PlayingState)
- m_session->play();
-
- if (!m_session->isLiveSource() && m_bufferProgress < 100 &&
- (m_session->state() == QMediaPlayer::PlayingState ||
- m_session->pendingState() == QMediaPlayer::PlayingState))
- m_session->pause();
- }
-
- updateMediaStatus();
-
- emit bufferStatusChanged(m_bufferProgress);
-}
-
-void QGstreamerPlayerControl::writeFifo()
-{
- if (m_fifoCanWrite) {
- qint64 bytesToRead = qMin<qint64>(
- m_stream->bytesAvailable(), PIPE_BUF - m_bufferSize);
-
- if (bytesToRead > 0) {
- int bytesRead = m_stream->read(&m_buffer[m_bufferOffset + m_bufferSize], bytesToRead);
-
- if (bytesRead > 0)
- m_bufferSize += bytesRead;
- }
-
- if (m_bufferSize > 0) {
- int bytesWritten = ::write(m_fifoFd[1], &m_buffer[m_bufferOffset], size_t(m_bufferSize));
-
- if (bytesWritten > 0) {
- m_bufferOffset += bytesWritten;
- m_bufferSize -= bytesWritten;
-
- if (m_bufferSize == 0)
- m_bufferOffset = 0;
- } else if (errno == EAGAIN) {
- m_fifoCanWrite = false;
- } else {
- closeFifo();
- }
- }
- }
-
- m_fifoNotifier->setEnabled(m_stream->bytesAvailable() > 0);
-}
-
-void QGstreamerPlayerControl::fifoReadyWrite(int socket)
-{
- if (socket == m_fifoFd[1]) {
- m_fifoCanWrite = true;
-
- writeFifo();
- }
-}
-
-bool QGstreamerPlayerControl::openFifo()
-{
- Q_ASSERT(m_fifoFd[0] < 0);
- Q_ASSERT(m_fifoFd[1] < 0);
-
- if (::pipe(m_fifoFd) == 0) {
- int flags = ::fcntl(m_fifoFd[1], F_GETFD);
-
- if (::fcntl(m_fifoFd[1], F_SETFD, flags | O_NONBLOCK) >= 0) {
- m_fifoNotifier = new QSocketNotifier(m_fifoFd[1], QSocketNotifier::Write);
-
- connect(m_fifoNotifier, SIGNAL(activated(int)), this, SLOT(fifoReadyWrite(int)));
-
- return true;
- } else {
- qWarning("Failed to make pipe non blocking %d", errno);
-
- ::close(m_fifoFd[0]);
- ::close(m_fifoFd[1]);
-
- m_fifoFd[0] = -1;
- m_fifoFd[1] = -1;
-
- return false;
- }
- } else {
- qWarning("Failed to create pipe %d", errno);
-
- return false;
- }
-}
-
-void QGstreamerPlayerControl::closeFifo()
-{
- if (m_fifoFd[0] >= 0) {
- delete m_fifoNotifier;
- m_fifoNotifier = 0;
-
- ::close(m_fifoFd[0]);
- ::close(m_fifoFd[1]);
- m_fifoFd[0] = -1;
- m_fifoFd[1] = -1;
-
- m_fifoCanWrite = false;
-
- m_bufferSize = 0;
- m_bufferOffset = 0;
- }
-}
-
-void QGstreamerPlayerControl::applyPendingSeek(bool isSeekable)
-{
- if (isSeekable && m_pendingSeekPosition != -1)
- setPosition(m_pendingSeekPosition);
-}
-
-void QGstreamerPlayerControl::handleInvalidMedia()
-{
- pushState();
- m_mediaStatus = QMediaPlayer::InvalidMedia;
- m_state = QMediaPlayer::StoppedState;
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::handleResourcesGranted()
-{
- pushState();
-
- QMediaPlayer::State state = m_state;
-
- //preserve m_pendingSeekPosition, it's reset on setMedia
- qint64 pos = m_pendingSeekPosition;
- setMedia(m_currentResource, m_stream);
-
- if (pos != -1)
- setPosition(pos);
-
- if (state != QMediaPlayer::StoppedState)
- playOrPause(state);
- else
- updateMediaStatus();
-
- popAndNotifyState();
-}
-
-void QGstreamerPlayerControl::handleResourcesLost()
-{
- //on resource lost the pipeline should be stopped
- //player status is changed to paused
-
- pushState();
- QMediaPlayer::State oldState = m_state;
-
- qint64 pos = m_session->position();
- m_session->stop();
- m_pendingSeekPosition = pos;
- //don't blink the first video frame after playback is restored
- m_session->showPrerollFrames(false);
-
- if (oldState != QMediaPlayer::StoppedState )
- m_state = QMediaPlayer::PausedState;
-
- popAndNotifyState();
-}
-
-bool QGstreamerPlayerControl::isMediaDownloadEnabled() const
-{
- return m_session->property("mediaDownloadEnabled").toBool();
-}
-
-void QGstreamerPlayerControl::setMediaDownloadEnabled(bool enabled)
-{
- m_session->setProperty("mediaDownloadEnabled", enabled);
-}
-
-void QGstreamerPlayerControl::pushState()
-{
- m_stateStack.push(m_state);
- m_mediaStatusStack.push(m_mediaStatus);
-}
-
-void QGstreamerPlayerControl::popAndNotifyState()
-{
- Q_ASSERT(!m_stateStack.isEmpty());
-
- QMediaPlayer::State oldState = m_stateStack.pop();
- QMediaPlayer::MediaStatus oldMediaStatus = m_mediaStatusStack.pop();
-
- if (m_stateStack.isEmpty()) {
- if (m_state != oldState) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "State changed:" << m_state;
-#endif
- emit stateChanged(m_state);
- }
-
- if (m_mediaStatus != oldMediaStatus) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Media status changed:" << m_mediaStatus;
-#endif
- emit mediaStatusChanged(m_mediaStatus);
- }
- }
-}
-
-void QGstreamerPlayerControl::updatePosition(qint64 pos)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << pos/1000.0 << "pending:" << m_pendingSeekPosition/1000.0;
-#endif
-
- if (m_pendingSeekPosition != -1) {
- //seek request is complete, it's safe to resume playback
- //with prerolled frame displayed
- m_pendingSeekPosition = -1;
- m_session->showPrerollFrames(true);
- if (m_state == QMediaPlayer::PlayingState) {
- m_session->play();
- }
- }
-
- emit positionChanged(pos);
-}
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
deleted file mode 100644
index ea02c97..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayercontrol.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERPLAYERCONTROL_H
-#define QGSTREAMERPLAYERCONTROL_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qstack.h>
-
-#include <qmediaplayercontrol.h>
-#include <qmediaplayer.h>
-
-#include <limits.h>
-
-QT_BEGIN_NAMESPACE
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-class QSocketNotifier;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class QGstreamerPlayerSession;
-class QGstreamerPlayerService;
-class PlayerResourcePolicy;
-
-class QGstreamerPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
- Q_PROPERTY(bool mediaDownloadEnabled READ isMediaDownloadEnabled WRITE setMediaDownloadEnabled)
-
-public:
- QGstreamerPlayerControl(QGstreamerPlayerSession *session, QObject *parent = 0);
- ~QGstreamerPlayerControl();
-
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
-
- qint64 position() const;
- qint64 duration() const;
-
- int bufferStatus() const;
-
- int volume() const;
- bool isMuted() const;
-
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
- void setVideoOutput(QObject *output);
-
- bool isSeekable() const;
- QMediaTimeRange availablePlaybackRanges() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent&, QIODevice *);
-
- bool isMediaDownloadEnabled() const;
- void setMediaDownloadEnabled(bool enabled);
-
-public Q_SLOTS:
- void setPosition(qint64 pos);
-
- void play();
- void pause();
- void stop();
-
- void setVolume(int volume);
- void setMuted(bool muted);
-
-private Q_SLOTS:
- void writeFifo();
- void fifoReadyWrite(int socket);
-
- void updateSessionState(QMediaPlayer::State state);
- void updateMediaStatus();
- void processEOS();
- void setBufferProgress(int progress);
- void applyPendingSeek(bool isSeekable);
- void updatePosition(qint64 pos);
-
- void handleInvalidMedia();
-
- void handleResourcesGranted();
- void handleResourcesLost();
-
-private:
- bool openFifo();
- void closeFifo();
- void playOrPause(QMediaPlayer::State state);
-
- void pushState();
- void popAndNotifyState();
-
- bool m_ownStream;
- QGstreamerPlayerSession *m_session;
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- QStack<QMediaPlayer::State> m_stateStack;
- QStack<QMediaPlayer::MediaStatus> m_mediaStatusStack;
-
- int m_bufferProgress;
- bool m_seekToStartPending;
- qint64 m_pendingSeekPosition;
- QMediaContent m_currentResource;
- QIODevice *m_stream;
- QSocketNotifier *m_fifoNotifier;
- int m_fifoFd[2];
- bool m_fifoCanWrite;
- int m_bufferSize;
- int m_bufferOffset;
- char m_buffer[PIPE_BUF];
-
- PlayerResourcePolicy *m_resources;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
deleted file mode 100644
index 7c017e2..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.cpp
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/qwidget.h>
-
-#include "qgstreamerplayerservice.h"
-#include "qgstreamerplayercontrol.h"
-#include "qgstreamerplayersession.h"
-#include "qgstreamermetadataprovider.h"
-
-#include "qgstreamervideooverlay.h"
-#include "qgstreamervideowindow.h"
-#include "qgstreamervideorenderer.h"
-
-#if defined(Q_WS_MAEMO_6) && defined(__arm__)
-#include "qgstreamergltexturerenderer.h"
-#endif
-
-#include "qgstreamervideowidget.h"
-#include "qgstreamerstreamscontrol.h"
-
-#include <qmediaplaylistnavigator.h>
-#include <qmediaplaylist.h>
-
-QGstreamerPlayerService::QGstreamerPlayerService(QObject *parent):
- QMediaService(parent),
- m_videoOutput(0),
- m_videoRenderer(0),
- m_videoWindow(0),
- m_videoWidget(0)
-{
- m_session = new QGstreamerPlayerSession(this);
- m_control = new QGstreamerPlayerControl(m_session, this);
- m_metaData = new QGstreamerMetaDataProvider(m_session, this);
- m_streamsControl = new QGstreamerStreamsControl(m_session,this);
-
-#if defined(Q_WS_MAEMO_6) && defined(__arm__)
- m_videoRenderer = new QGstreamerGLTextureRenderer(this);
-#else
- m_videoRenderer = new QGstreamerVideoRenderer(this);
-#endif
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-
-#ifdef Q_WS_MAEMO_6
- m_videoWindow = new QGstreamerVideoWindow(this, "omapxvsink");
-#else
- m_videoWindow = new QGstreamerVideoOverlay(this);
-#endif
-
- m_videoWidget = new QGstreamerVideoWidgetControl(this);
-#endif
-}
-
-QGstreamerPlayerService::~QGstreamerPlayerService()
-{
-}
-
-QMediaControl *QGstreamerPlayerService::requestControl(const char *name)
-{
- if (qstrcmp(name,QMediaPlayerControl_iid) == 0)
- return m_control;
-
- if (qstrcmp(name,QMetaDataReaderControl_iid) == 0)
- return m_metaData;
-
- if (qstrcmp(name,QMediaStreamsControl_iid) == 0)
- return m_streamsControl;
-
- if (!m_videoOutput) {
- if (qstrcmp(name, QVideoWidgetControl_iid) == 0)
- m_videoOutput = m_videoWidget;
- else if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- m_videoOutput = m_videoRenderer;
- else if (qstrcmp(name, QVideoWindowControl_iid) == 0)
- m_videoOutput = m_videoWindow;
-
- if (m_videoOutput) {
- m_control->setVideoOutput(m_videoOutput);
- return m_videoOutput;
- }
- }
-
- return 0;
-}
-
-void QGstreamerPlayerService::releaseControl(QMediaControl *control)
-{
- if (control == m_videoOutput) {
- m_videoOutput = 0;
- m_control->setVideoOutput(0);
- }
-}
-
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
deleted file mode 100644
index ffaae17..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayerservice.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERPLAYERSERVICE_H
-#define QGSTREAMERPLAYERSERVICE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qiodevice.h>
-
-#include <qmediaservice.h>
-
-QT_BEGIN_NAMESPACE
-class QMediaMetaData;
-class QMediaPlayerControl;
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-QT_END_NAMESPACE
-
-class QGstreamerMetaData;
-class QGstreamerPlayerControl;
-class QGstreamerPlayerSession;
-class QGstreamerMetaDataProvider;
-class QGstreamerStreamsControl;
-class QGstreamerVideoRenderer;
-class QGstreamerVideoOverlay;
-class QGstreamerVideoWidgetControl;
-
-QT_USE_NAMESPACE
-
-class QGstreamerPlayerService : public QMediaService
-{
- Q_OBJECT
-public:
- QGstreamerPlayerService(QObject *parent = 0);
- ~QGstreamerPlayerService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *control);
-
-private:
- QGstreamerPlayerControl *m_control;
- QGstreamerPlayerSession *m_session;
- QGstreamerMetaDataProvider *m_metaData;
- QGstreamerStreamsControl *m_streamsControl;
-
- QMediaControl *m_videoOutput;
- QMediaControl *m_videoRenderer;
- QMediaControl *m_videoWindow;
- QMediaControl *m_videoWidget;
-};
-
-#endif
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
deleted file mode 100644
index db64ba6..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.cpp
+++ /dev/null
@@ -1,1618 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerplayersession.h"
-#include <private/qgstreamerbushelper_p.h>
-
-#include "qgstreamervideorendererinterface.h"
-#include "gstvideoconnector.h"
-#include <private/qgstutils_p.h>
-
-#include <gst/gstvalue.h>
-#include <gst/base/gstbasesrc.h>
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qsize.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qdir.h>
-#include <QtCore/qstandardpaths.h>
-
-#if defined(Q_WS_MAEMO_6) || (GST_VERSION_MICRO > 20)
-#define USE_PLAYBIN2
-#endif
-
-//#define DEBUG_PLAYBIN
-//#define DEBUG_VO_BIN_DUMP
-
-typedef enum {
- GST_PLAY_FLAG_VIDEO = 0x00000001,
- GST_PLAY_FLAG_AUDIO = 0x00000002,
- GST_PLAY_FLAG_TEXT = 0x00000004,
- GST_PLAY_FLAG_VIS = 0x00000008,
- GST_PLAY_FLAG_SOFT_VOLUME = 0x00000010,
- GST_PLAY_FLAG_NATIVE_AUDIO = 0x00000020,
- GST_PLAY_FLAG_NATIVE_VIDEO = 0x00000040,
- GST_PLAY_FLAG_DOWNLOAD = 0x00000080,
- GST_PLAY_FLAG_BUFFERING = 0x000000100
-} GstPlayFlags;
-
-QGstreamerPlayerSession::QGstreamerPlayerSession(QObject *parent)
- :QObject(parent),
- m_state(QMediaPlayer::StoppedState),
- m_pendingState(QMediaPlayer::StoppedState),
- m_busHelper(0),
- m_playbin(0),
- m_usePlaybin2(false),
- m_usingColorspaceElement(false),
- m_videoSink(0),
- m_pendingVideoSink(0),
- m_nullVideoSink(0),
- m_bus(0),
- m_videoOutput(0),
- m_renderer(0),
- m_haveQueueElement(false),
-#if defined(HAVE_GST_APPSRC)
- m_appSrc(0),
-#endif
- m_volume(100),
- m_playbackRate(1.0),
- m_muted(false),
- m_audioAvailable(false),
- m_videoAvailable(false),
- m_seekable(false),
- m_lastPosition(0),
- m_duration(-1),
- m_durationQueries(0),
- m_displayPrerolledFrame(true),
- m_sourceType(UnknownSrc),
- m_everPlayed(false),
- m_isLiveSource(false)
-{
-#ifdef USE_PLAYBIN2
- m_playbin = gst_element_factory_make("playbin2", NULL);
-#endif
-
- if (m_playbin) {
- m_usePlaybin2 = true;
-
- //GST_PLAY_FLAG_NATIVE_VIDEO omits configuration of ffmpegcolorspace and videoscale,
- //since those elements are included in the video output bin when necessary.
-#ifdef Q_WS_MAEMO_6
- int flags = GST_PLAY_FLAG_VIDEO | GST_PLAY_FLAG_AUDIO |
- GST_PLAY_FLAG_NATIVE_VIDEO | GST_PLAY_FLAG_NATIVE_AUDIO;
-#else
- int flags = 0;
- g_object_get(G_OBJECT(m_playbin), "flags", &flags, NULL);
- flags |= GST_PLAY_FLAG_NATIVE_VIDEO;
-#endif
- g_object_set(G_OBJECT(m_playbin), "flags", flags, NULL);
- } else {
- m_usePlaybin2 = false;
- m_playbin = gst_element_factory_make("playbin", NULL);
- }
-
- m_videoOutputBin = gst_bin_new("video-output-bin");
- gst_object_ref(GST_OBJECT(m_videoOutputBin));
-
- m_videoIdentity = GST_ELEMENT(g_object_new(gst_video_connector_get_type(), 0));
- g_signal_connect(G_OBJECT(m_videoIdentity), "connection-failed", G_CALLBACK(insertColorSpaceElement), (gpointer)this);
- m_colorSpace = gst_element_factory_make("ffmpegcolorspace", "ffmpegcolorspace-vo");
- gst_object_ref(GST_OBJECT(m_colorSpace));
-
- m_nullVideoSink = gst_element_factory_make("fakesink", NULL);
- g_object_set(G_OBJECT(m_nullVideoSink), "sync", true, NULL);
- gst_object_ref(GST_OBJECT(m_nullVideoSink));
- gst_bin_add_many(GST_BIN(m_videoOutputBin), m_videoIdentity, m_nullVideoSink, NULL);
- gst_element_link(m_videoIdentity, m_nullVideoSink);
-
- m_videoSink = m_nullVideoSink;
-
- // add ghostpads
- GstPad *pad = gst_element_get_static_pad(m_videoIdentity,"sink");
- gst_element_add_pad(GST_ELEMENT(m_videoOutputBin), gst_ghost_pad_new("videosink", pad));
- gst_object_unref(GST_OBJECT(pad));
-
- if (m_playbin != 0) {
- // Sort out messages
- m_bus = gst_element_get_bus(m_playbin);
- m_busHelper = new QGstreamerBusHelper(m_bus, this);
- m_busHelper->installMessageFilter(this);
-
- g_object_set(G_OBJECT(m_playbin), "video-sink", m_videoOutputBin, NULL);
-
- g_signal_connect(G_OBJECT(m_playbin), "notify::source", G_CALLBACK(playbinNotifySource), this);
- g_signal_connect(G_OBJECT(m_playbin), "element-added", G_CALLBACK(handleElementAdded), this);
-
- // Initial volume
- double volume = 1.0;
- g_object_get(G_OBJECT(m_playbin), "volume", &volume, NULL);
- m_volume = int(volume*100);
-
- g_signal_connect(G_OBJECT(m_playbin), "notify::volume", G_CALLBACK(handleVolumeChange), this);
- if (m_usePlaybin2)
- g_signal_connect(G_OBJECT(m_playbin), "notify::mute", G_CALLBACK(handleMutedChange), this);
- }
-}
-
-QGstreamerPlayerSession::~QGstreamerPlayerSession()
-{
- if (m_playbin) {
- stop();
-
- delete m_busHelper;
- gst_object_unref(GST_OBJECT(m_bus));
- gst_object_unref(GST_OBJECT(m_playbin));
- gst_object_unref(GST_OBJECT(m_colorSpace));
- gst_object_unref(GST_OBJECT(m_nullVideoSink));
- gst_object_unref(GST_OBJECT(m_videoOutputBin));
- }
-}
-
-GstElement *QGstreamerPlayerSession::playbin() const
-{
- return m_playbin;
-}
-
-#if defined(HAVE_GST_APPSRC)
-void QGstreamerPlayerSession::configureAppSrcElement(GObject* object, GObject *orig, GParamSpec *pspec, QGstreamerPlayerSession* self)
-{
- Q_UNUSED(object);
- Q_UNUSED(pspec);
-
- if (self->appsrc()->isReady())
- return;
-
- GstElement *appsrc;
- g_object_get(orig, "source", &appsrc, NULL);
-
- if (!self->appsrc()->setup(appsrc))
- qWarning()<<"Could not setup appsrc element";
-}
-#endif
-
-void QGstreamerPlayerSession::loadFromStream(const QNetworkRequest &request, QIODevice *appSrcStream)
-{
-#if defined(HAVE_GST_APPSRC)
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- m_request = request;
- m_duration = -1;
- m_lastPosition = 0;
- m_haveQueueElement = false;
-
- if (m_appSrc)
- m_appSrc->deleteLater();
- m_appSrc = new QGstAppSrc(this);
- m_appSrc->setStream(appSrcStream);
-
- if (m_playbin) {
- m_tags.clear();
- emit tagsChanged();
-
- g_signal_connect(G_OBJECT(m_playbin), "deep-notify::source", (GCallback) &QGstreamerPlayerSession::configureAppSrcElement, (gpointer)this);
- g_object_set(G_OBJECT(m_playbin), "uri", "appsrc://", NULL);
-
- if (!m_streamTypes.isEmpty()) {
- m_streamProperties.clear();
- m_streamTypes.clear();
-
- emit streamsChanged();
- }
- }
-#endif
-}
-
-void QGstreamerPlayerSession::loadFromUri(const QNetworkRequest &request)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << request.url();
-#endif
- m_request = request;
- m_duration = -1;
- m_lastPosition = 0;
- m_haveQueueElement = false;
-
- if (m_playbin) {
- m_tags.clear();
- emit tagsChanged();
-
- g_object_set(G_OBJECT(m_playbin), "uri", m_request.url().toEncoded().constData(), NULL);
-
- if (!m_streamTypes.isEmpty()) {
- m_streamProperties.clear();
- m_streamTypes.clear();
-
- emit streamsChanged();
- }
- }
-}
-
-qint64 QGstreamerPlayerSession::duration() const
-{
- return m_duration;
-}
-
-qint64 QGstreamerPlayerSession::position() const
-{
- GstFormat format = GST_FORMAT_TIME;
- gint64 position = 0;
-
- if ( m_playbin && gst_element_query_position(m_playbin, &format, &position))
- m_lastPosition = position / 1000000;
-
- return m_lastPosition;
-}
-
-qreal QGstreamerPlayerSession::playbackRate() const
-{
- return m_playbackRate;
-}
-
-void QGstreamerPlayerSession::setPlaybackRate(qreal rate)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << rate;
-#endif
- if (!qFuzzyCompare(m_playbackRate, rate)) {
- m_playbackRate = rate;
- if (m_playbin) {
- gst_element_seek(m_playbin, rate, GST_FORMAT_TIME,
- GstSeekFlags(GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH),
- GST_SEEK_TYPE_NONE,0,
- GST_SEEK_TYPE_NONE,0 );
- }
- emit playbackRateChanged(m_playbackRate);
- }
-}
-
-QMediaTimeRange QGstreamerPlayerSession::availablePlaybackRanges() const
-{
- QMediaTimeRange ranges;
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 31)
- //GST_FORMAT_TIME would be more appropriate, but unfortunately it's not supported.
- //with GST_FORMAT_PERCENT media is treated as encoded with constant bitrate.
- GstQuery* query = gst_query_new_buffering(GST_FORMAT_PERCENT);
-
- if (gst_element_query(m_playbin, query)) {
- for (guint index = 0; index < gst_query_get_n_buffering_ranges(query); index++) {
- gint64 rangeStart = 0;
- gint64 rangeStop = 0;
-
- //This query should return values in GST_FORMAT_PERCENT_MAX range,
- //but queue2 returns values in 0..100 range instead
- if (gst_query_parse_nth_buffering_range(query, index, &rangeStart, &rangeStop))
- ranges.addInterval(rangeStart * duration() / 100,
- rangeStop * duration() / 100);
- }
- }
-
- gst_query_unref(query);
-#endif
-
- //without queue2 element in pipeline all the media is considered available
- if (ranges.isEmpty() && duration() > 0 && !m_haveQueueElement)
- ranges.addInterval(0, duration());
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << ranges;
-#endif
-
- return ranges;
-}
-
-int QGstreamerPlayerSession::activeStream(QMediaStreamsControl::StreamType streamType) const
-{
- int streamNumber = -1;
- if (m_playbin) {
- switch (streamType) {
- case QMediaStreamsControl::AudioStream:
- g_object_get(G_OBJECT(m_playbin), "current-audio", streamNumber, NULL);
- break;
- case QMediaStreamsControl::VideoStream:
- g_object_get(G_OBJECT(m_playbin), "current-video", streamNumber, NULL);
- break;
- case QMediaStreamsControl::SubPictureStream:
- g_object_get(G_OBJECT(m_playbin), "current-text", streamNumber, NULL);
- break;
- default:
- break;
- }
- }
-
- if (m_usePlaybin2 && streamNumber >= 0)
- streamNumber += m_playbin2StreamOffset.value(streamType,0);
-
- return streamNumber;
-}
-
-void QGstreamerPlayerSession::setActiveStream(QMediaStreamsControl::StreamType streamType, int streamNumber)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << streamType << streamNumber;
-#endif
-
- if (m_usePlaybin2 && streamNumber >= 0)
- streamNumber -= m_playbin2StreamOffset.value(streamType,0);
-
- if (m_playbin) {
- switch (streamType) {
- case QMediaStreamsControl::AudioStream:
- g_object_set(G_OBJECT(m_playbin), "current-audio", &streamNumber, NULL);
- break;
- case QMediaStreamsControl::VideoStream:
- g_object_set(G_OBJECT(m_playbin), "current-video", &streamNumber, NULL);
- break;
- case QMediaStreamsControl::SubPictureStream:
- g_object_set(G_OBJECT(m_playbin), "current-text", &streamNumber, NULL);
- break;
- default:
- break;
- }
- }
-}
-
-
-bool QGstreamerPlayerSession::isBuffering() const
-{
- return false;
-}
-
-int QGstreamerPlayerSession::bufferingProgress() const
-{
- return 0;
-}
-
-int QGstreamerPlayerSession::volume() const
-{
- return m_volume;
-}
-
-bool QGstreamerPlayerSession::isMuted() const
-{
- return m_muted;
-}
-
-bool QGstreamerPlayerSession::isAudioAvailable() const
-{
- return m_audioAvailable;
-}
-
-static void block_pad_cb(GstPad *pad, gboolean blocked, gpointer user_data)
-{
- Q_UNUSED(pad);
-#ifdef DEBUG_PLAYBIN
- qDebug() << "block_pad_cb, blocked:" << blocked;
-#endif
-
- if (blocked && user_data) {
- QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession*>(user_data);
- QMetaObject::invokeMethod(session, "finishVideoOutputChange", Qt::QueuedConnection);
- }
-}
-
-void QGstreamerPlayerSession::updateVideoRenderer()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Video sink has chaged, reload video output";
-#endif
-
- if (m_videoOutput)
- setVideoRenderer(m_videoOutput);
-}
-
-void QGstreamerPlayerSession::setVideoRenderer(QObject *videoOutput)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- if (m_videoOutput != videoOutput) {
- if (m_videoOutput) {
- disconnect(m_videoOutput, SIGNAL(sinkChanged()),
- this, SLOT(updateVideoRenderer()));
- disconnect(m_videoOutput, SIGNAL(readyChanged(bool)),
- this, SLOT(updateVideoRenderer()));
-
- m_busHelper->removeMessageFilter(m_videoOutput);
- }
-
- m_videoOutput = videoOutput;
-
- if (m_videoOutput) {
- connect(m_videoOutput, SIGNAL(sinkChanged()),
- this, SLOT(updateVideoRenderer()));
- connect(m_videoOutput, SIGNAL(readyChanged(bool)),
- this, SLOT(updateVideoRenderer()));
-
- m_busHelper->installMessageFilter(m_videoOutput);
- }
- }
-
- QGstreamerVideoRendererInterface* renderer = qobject_cast<QGstreamerVideoRendererInterface*>(videoOutput);
-
- m_renderer = renderer;
-
-#ifdef DEBUG_VO_BIN_DUMP
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "playbin_set");
-#endif
-
- GstElement *videoSink = 0;
- if (m_renderer && m_renderer->isReady())
- videoSink = m_renderer->videoSink();
-
- if (!videoSink)
- videoSink = m_nullVideoSink;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Set video output:" << videoOutput;
- qDebug() << "Current sink:" << (m_videoSink ? GST_ELEMENT_NAME(m_videoSink) : "") << m_videoSink
- << "pending:" << (m_pendingVideoSink ? GST_ELEMENT_NAME(m_pendingVideoSink) : "") << m_pendingVideoSink
- << "new sink:" << (videoSink ? GST_ELEMENT_NAME(videoSink) : "") << videoSink;
-#endif
-
- if (m_pendingVideoSink == videoSink ||
- (m_pendingVideoSink == 0 && m_videoSink == videoSink)) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Video sink has not changed, skip video output reconfiguration";
-#endif
- return;
- }
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Reconfigure video output";
-#endif
-
- if (m_state == QMediaPlayer::StoppedState) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "The pipeline has not started yet, pending state:" << m_pendingState;
-#endif
- //the pipeline has not started yet
- m_pendingVideoSink = 0;
- gst_element_set_state(m_videoSink, GST_STATE_NULL);
- gst_element_set_state(m_playbin, GST_STATE_NULL);
-
- if (m_usingColorspaceElement) {
- gst_element_unlink(m_colorSpace, m_videoSink);
- gst_bin_remove(GST_BIN(m_videoOutputBin), m_colorSpace);
- } else {
- gst_element_unlink(m_videoIdentity, m_videoSink);
- }
-
- gst_bin_remove(GST_BIN(m_videoOutputBin), m_videoSink);
-
- m_videoSink = videoSink;
-
- gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink);
-
- m_usingColorspaceElement = false;
- bool linked = gst_element_link(m_videoIdentity, m_videoSink);
- if (!linked) {
- m_usingColorspaceElement = true;
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Failed to connect video output, inserting the colorspace element.";
-#endif
- gst_bin_add(GST_BIN(m_videoOutputBin), m_colorSpace);
- linked = gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL);
- }
-
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "show-preroll-frame") != 0) {
- gboolean value = m_displayPrerolledFrame;
- g_object_set(G_OBJECT(m_videoSink), "show-preroll-frame", value, NULL);
- }
-
- switch (m_pendingState) {
- case QMediaPlayer::PausedState:
- gst_element_set_state(m_playbin, GST_STATE_PAUSED);
- break;
- case QMediaPlayer::PlayingState:
- gst_element_set_state(m_playbin, GST_STATE_PLAYING);
- break;
- default:
- break;
- }
- } else {
- if (m_pendingVideoSink) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "already waiting for pad to be blocked, just change the pending sink";
-#endif
- m_pendingVideoSink = videoSink;
- return;
- }
-
- m_pendingVideoSink = videoSink;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Blocking the video output pad...";
-#endif
-
- //block pads, async to avoid locking in paused state
- GstPad *srcPad = gst_element_get_static_pad(m_videoIdentity, "src");
- gst_pad_set_blocked_async(srcPad, true, &block_pad_cb, this);
- gst_object_unref(GST_OBJECT(srcPad));
-
- //Unpause the sink to avoid waiting until the buffer is processed
- //while the sink is paused. The pad will be blocked as soon as the current
- //buffer is processed.
- if (m_state == QMediaPlayer::PausedState) {
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Starting video output to avoid blocking in paused state...";
-#endif
- gst_element_set_state(m_videoSink, GST_STATE_PLAYING);
- }
- }
-}
-
-void QGstreamerPlayerSession::finishVideoOutputChange()
-{
- if (!m_pendingVideoSink)
- return;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "finishVideoOutputChange" << m_pendingVideoSink;
-#endif
-
- GstPad *srcPad = gst_element_get_static_pad(m_videoIdentity, "src");
-
- if (!gst_pad_is_blocked(srcPad)) {
- //pad is not blocked, it's possible to swap outputs only in the null state
- qWarning() << "Pad is not blocked yet, could not switch video sink";
- GstState identityElementState = GST_STATE_NULL;
- gst_element_get_state(m_videoIdentity, &identityElementState, NULL, GST_CLOCK_TIME_NONE);
- if (identityElementState != GST_STATE_NULL) {
- gst_object_unref(GST_OBJECT(srcPad));
- return; //can't change vo yet, received async call from the previous change
- }
- }
-
- if (m_pendingVideoSink == m_videoSink) {
- //video output was change back to the current one,
- //no need to torment the pipeline, just unblock the pad
- if (gst_pad_is_blocked(srcPad))
- gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0);
-
- m_pendingVideoSink = 0;
- gst_object_unref(GST_OBJECT(srcPad));
- return;
- }
-
- if (m_usingColorspaceElement) {
- gst_element_set_state(m_colorSpace, GST_STATE_NULL);
- gst_element_set_state(m_videoSink, GST_STATE_NULL);
-
- gst_element_unlink(m_colorSpace, m_videoSink);
- gst_bin_remove(GST_BIN(m_videoOutputBin), m_colorSpace);
- } else {
- gst_element_set_state(m_videoSink, GST_STATE_NULL);
- gst_element_unlink(m_videoIdentity, m_videoSink);
- }
-
- gst_bin_remove(GST_BIN(m_videoOutputBin), m_videoSink);
-
- m_videoSink = m_pendingVideoSink;
- m_pendingVideoSink = 0;
-
- gst_bin_add(GST_BIN(m_videoOutputBin), m_videoSink);
-
- m_usingColorspaceElement = false;
- bool linked = gst_element_link(m_videoIdentity, m_videoSink);
- if (!linked) {
- m_usingColorspaceElement = true;
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Failed to connect video output, inserting the colorspace element.";
-#endif
- gst_bin_add(GST_BIN(m_videoOutputBin), m_colorSpace);
- linked = gst_element_link_many(m_videoIdentity, m_colorSpace, m_videoSink, NULL);
- }
-
- if (!linked)
- qWarning() << "Linking video output element failed";
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "notify the video connector it has to emit a new segment message...";
-#endif
- //it's necessary to send a new segment event just before
- //the first buffer pushed to the new sink
- g_signal_emit_by_name(m_videoIdentity,
- "resend-new-segment",
- true //emit connection-failed signal
- //to have a chance to insert colorspace element
- );
-
-
- GstState state;
-
- switch (m_pendingState) {
- case QMediaPlayer::StoppedState:
- state = GST_STATE_NULL;
- break;
- case QMediaPlayer::PausedState:
- state = GST_STATE_PAUSED;
- break;
- case QMediaPlayer::PlayingState:
- state = GST_STATE_PLAYING;
- break;
- }
-
- if (m_usingColorspaceElement)
- gst_element_set_state(m_colorSpace, state);
-
- gst_element_set_state(m_videoSink, state);
-
- // Set state change that was deferred due the video output
- // change being pending
- gst_element_set_state(m_playbin, state);
-
- //don't have to wait here, it will unblock eventually
- if (gst_pad_is_blocked(srcPad))
- gst_pad_set_blocked_async(srcPad, false, &block_pad_cb, 0);
- gst_object_unref(GST_OBJECT(srcPad));
-
-#ifdef DEBUG_VO_BIN_DUMP
- _gst_debug_bin_to_dot_file_with_ts(GST_BIN(m_playbin),
- GstDebugGraphDetails(GST_DEBUG_GRAPH_SHOW_ALL /* GST_DEBUG_GRAPH_SHOW_MEDIA_TYPE | GST_DEBUG_GRAPH_SHOW_NON_DEFAULT_PARAMS | GST_DEBUG_GRAPH_SHOW_STATES*/),
- "playbin_finish");
-#endif
-}
-
-void QGstreamerPlayerSession::insertColorSpaceElement(GstElement *element, gpointer data)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- Q_UNUSED(element);
- QGstreamerPlayerSession* session = reinterpret_cast<QGstreamerPlayerSession*>(data);
-
- if (session->m_usingColorspaceElement)
- return;
- session->m_usingColorspaceElement = true;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Failed to connect video output, inserting the colorspace elemnt.";
- qDebug() << "notify the video connector it has to emit a new segment message...";
-#endif
- //it's necessary to send a new segment event just before
- //the first buffer pushed to the new sink
- g_signal_emit_by_name(session->m_videoIdentity,
- "resend-new-segment",
- false // don't emit connection-failed signal
- );
-
- gst_element_unlink(session->m_videoIdentity, session->m_videoSink);
- gst_bin_add(GST_BIN(session->m_videoOutputBin), session->m_colorSpace);
- gst_element_link_many(session->m_videoIdentity, session->m_colorSpace, session->m_videoSink, NULL);
-
- GstState state;
-
- switch (session->m_pendingState) {
- case QMediaPlayer::StoppedState:
- state = GST_STATE_NULL;
- break;
- case QMediaPlayer::PausedState:
- state = GST_STATE_PAUSED;
- break;
- case QMediaPlayer::PlayingState:
- state = GST_STATE_PLAYING;
- break;
- }
-
- gst_element_set_state(session->m_colorSpace, state);
-}
-
-
-bool QGstreamerPlayerSession::isVideoAvailable() const
-{
- return m_videoAvailable;
-}
-
-bool QGstreamerPlayerSession::isSeekable() const
-{
- return m_seekable;
-}
-
-bool QGstreamerPlayerSession::play()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- m_everPlayed = false;
- if (m_playbin) {
- m_pendingState = QMediaPlayer::PlayingState;
- if (gst_element_set_state(m_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE) {
- qWarning() << "GStreamer; Unable to play -" << m_request.url().toString();
- m_pendingState = m_state = QMediaPlayer::StoppedState;
-
- emit stateChanged(m_state);
- } else
- return true;
- }
-
- return false;
-}
-
-bool QGstreamerPlayerSession::pause()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- if (m_playbin) {
- m_pendingState = QMediaPlayer::PausedState;
- if (m_pendingVideoSink != 0)
- return true;
-
- if (gst_element_set_state(m_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_FAILURE) {
- qWarning() << "GStreamer; Unable to pause -" << m_request.url().toString();
- m_pendingState = m_state = QMediaPlayer::StoppedState;
-
- emit stateChanged(m_state);
- } else {
- return true;
- }
- }
-
- return false;
-}
-
-void QGstreamerPlayerSession::stop()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- m_everPlayed = false;
- if (m_playbin) {
- if (m_renderer)
- m_renderer->stopRenderer();
-
- gst_element_set_state(m_playbin, GST_STATE_NULL);
-
- m_lastPosition = 0;
- QMediaPlayer::State oldState = m_state;
- m_pendingState = m_state = QMediaPlayer::StoppedState;
-
- finishVideoOutputChange();
-
- //we have to do it here, since gstreamer will not emit bus messages any more
- setSeekable(false);
- if (oldState != m_state)
- emit stateChanged(m_state);
- }
-}
-
-bool QGstreamerPlayerSession::seek(qint64 ms)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << ms;
-#endif
- //seek locks when the video output sink is changing and pad is blocked
- if (m_playbin && !m_pendingVideoSink && m_state != QMediaPlayer::StoppedState) {
- ms = qMax(ms,qint64(0));
- gint64 position = ms * 1000000;
- bool isSeeking = gst_element_seek(m_playbin,
- m_playbackRate,
- GST_FORMAT_TIME,
- GstSeekFlags(GST_SEEK_FLAG_ACCURATE | GST_SEEK_FLAG_FLUSH),
- GST_SEEK_TYPE_SET,
- position,
- GST_SEEK_TYPE_NONE,
- 0);
- if (isSeeking)
- m_lastPosition = ms;
-
- return isSeeking;
- }
-
- return false;
-}
-
-void QGstreamerPlayerSession::setVolume(int volume)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << volume;
-#endif
-
- if (m_volume != volume) {
- m_volume = volume;
-
- if (m_playbin) {
- //playbin2 allows to set volume and muted independently,
- //with playbin1 it's necessary to keep volume at 0 while muted
- if (!m_muted || m_usePlaybin2)
- g_object_set(G_OBJECT(m_playbin), "volume", m_volume/100.0, NULL);
- }
-
- emit volumeChanged(m_volume);
- }
-}
-
-void QGstreamerPlayerSession::setMuted(bool muted)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << muted;
-#endif
- if (m_muted != muted) {
- m_muted = muted;
-
- if (m_usePlaybin2)
- g_object_set(G_OBJECT(m_playbin), "mute", m_muted, NULL);
- else
- g_object_set(G_OBJECT(m_playbin), "volume", (m_muted ? 0 : m_volume/100.0), NULL);
-
- emit mutedStateChanged(m_muted);
- }
-}
-
-
-void QGstreamerPlayerSession::setSeekable(bool seekable)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << seekable;
-#endif
- if (seekable != m_seekable) {
- m_seekable = seekable;
- emit seekableChanged(m_seekable);
- }
-}
-
-bool QGstreamerPlayerSession::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
- if (gm) {
- //tag message comes from elements inside playbin, not from playbin itself
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_TAG) {
- //qDebug() << "tag message";
- GstTagList *tag_list;
- gst_message_parse_tag(gm, &tag_list);
- m_tags.unite(QGstUtils::gstTagListToMap(tag_list));
-
- //qDebug() << m_tags;
-
- emit tagsChanged();
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_DURATION) {
- updateDuration();
- }
-
-#ifdef DEBUG_PLAYBIN
- if (m_sourceType == MMSSrc && qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0) {
- qDebug() << "Message from MMSSrc: " << GST_MESSAGE_TYPE(gm);
- } else if (m_sourceType == RTSPSrc && qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0) {
- qDebug() << "Message from RTSPSrc: " << GST_MESSAGE_TYPE(gm);
- } else {
- qDebug() << "Message from " << GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)) << ":" << GST_MESSAGE_TYPE(gm);
- }
-#endif
-
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_BUFFERING) {
- int progress = 0;
- gst_message_parse_buffering(gm, &progress);
- emit bufferingProgressChanged(progress);
- }
-
- bool handlePlaybin2 = false;
- if (GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_playbin)) {
- switch (GST_MESSAGE_TYPE(gm)) {
- case GST_MESSAGE_STATE_CHANGED:
- {
- GstState oldState;
- GstState newState;
- GstState pending;
-
- gst_message_parse_state_changed(gm, &oldState, &newState, &pending);
-
-#ifdef DEBUG_PLAYBIN
- QStringList states;
- states << "GST_STATE_VOID_PENDING" << "GST_STATE_NULL" << "GST_STATE_READY" << "GST_STATE_PAUSED" << "GST_STATE_PLAYING";
-
- qDebug() << QString("state changed: old: %1 new: %2 pending: %3") \
- .arg(states[oldState]) \
- .arg(states[newState]) \
- .arg(states[pending]);
-#endif
-
- switch (newState) {
- case GST_STATE_VOID_PENDING:
- case GST_STATE_NULL:
- setSeekable(false);
- finishVideoOutputChange();
- if (m_state != QMediaPlayer::StoppedState)
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- break;
- case GST_STATE_READY:
- setSeekable(false);
- if (m_state != QMediaPlayer::StoppedState)
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- break;
- case GST_STATE_PAUSED:
- {
- QMediaPlayer::State prevState = m_state;
- m_state = QMediaPlayer::PausedState;
-
- //check for seekable
- if (oldState == GST_STATE_READY) {
- if (m_sourceType == SoupHTTPSrc || m_sourceType == MMSSrc) {
- //since udpsrc is a live source, it is not applicable here
- m_everPlayed = true;
- }
-
- getStreamsInfo();
- updateVideoResolutionTag();
-
- //gstreamer doesn't give a reliable indication the duration
- //information is ready, GST_MESSAGE_DURATION is not sent by most elements
- //the duration is queried up to 5 times with increasing delay
- m_durationQueries = 5;
- updateDuration();
-
- /*
- //gst_element_seek_simple doesn't work reliably here, have to find a better solution
-
- GstFormat format = GST_FORMAT_TIME;
- gint64 position = 0;
- bool seekable = false;
- if (gst_element_query_position(m_playbin, &format, &position)) {
- seekable = gst_element_seek_simple(m_playbin, format, GST_SEEK_FLAG_NONE, position);
- }
-
- setSeekable(seekable);
- */
-
- setSeekable(true);
-
- if (!qFuzzyCompare(m_playbackRate, qreal(1.0))) {
- qreal rate = m_playbackRate;
- m_playbackRate = 1.0;
- setPlaybackRate(rate);
- }
- }
-
- if (m_state != prevState)
- emit stateChanged(m_state);
-
- break;
- }
- case GST_STATE_PLAYING:
- m_everPlayed = true;
- if (m_state != QMediaPlayer::PlayingState)
- emit stateChanged(m_state = QMediaPlayer::PlayingState);
-
- break;
- }
- }
- break;
-
- case GST_MESSAGE_EOS:
- emit playbackFinished();
- break;
-
- case GST_MESSAGE_TAG:
- case GST_MESSAGE_STREAM_STATUS:
- case GST_MESSAGE_UNKNOWN:
- break;
- case GST_MESSAGE_ERROR: {
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
- if (err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND)
- processInvalidMedia(QMediaPlayer::FormatError, tr("Cannot play stream of type: <unknown>"));
- else
- processInvalidMedia(QMediaPlayer::ResourceError, QString::fromUtf8(err->message));
- qWarning() << "Error:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- }
- break;
- case GST_MESSAGE_WARNING:
- {
- GError *err;
- gchar *debug;
- gst_message_parse_warning (gm, &err, &debug);
- qWarning() << "Warning:" << QString::fromUtf8(err->message);
- g_error_free (err);
- g_free (debug);
- }
- break;
- case GST_MESSAGE_INFO:
-#ifdef DEBUG_PLAYBIN
- {
- GError *err;
- gchar *debug;
- gst_message_parse_info (gm, &err, &debug);
- qDebug() << "Info:" << QString::fromUtf8(err->message);
- g_error_free (err);
- g_free (debug);
- }
-#endif
- break;
- case GST_MESSAGE_BUFFERING:
- case GST_MESSAGE_STATE_DIRTY:
- case GST_MESSAGE_STEP_DONE:
- case GST_MESSAGE_CLOCK_PROVIDE:
- case GST_MESSAGE_CLOCK_LOST:
- case GST_MESSAGE_NEW_CLOCK:
- case GST_MESSAGE_STRUCTURE_CHANGE:
- case GST_MESSAGE_APPLICATION:
- case GST_MESSAGE_ELEMENT:
- break;
- case GST_MESSAGE_SEGMENT_START:
- {
- const GstStructure *structure = gst_message_get_structure(gm);
- qint64 position = g_value_get_int64(gst_structure_get_value(structure, "position"));
- position /= 1000000;
- m_lastPosition = position;
- emit positionChanged(position);
- }
- break;
- case GST_MESSAGE_SEGMENT_DONE:
- break;
- case GST_MESSAGE_LATENCY:
-#if (GST_VERSION_MAJOR >= 0) && (GST_VERSION_MINOR >= 10) && (GST_VERSION_MICRO >= 13)
- case GST_MESSAGE_ASYNC_START:
- break;
- case GST_MESSAGE_ASYNC_DONE:
- {
- GstFormat format = GST_FORMAT_TIME;
- gint64 position = 0;
- if (gst_element_query_position(m_playbin, &format, &position)) {
- position /= 1000000;
- m_lastPosition = position;
- emit positionChanged(position);
- }
- break;
- }
-#if GST_VERSION_MICRO >= 23
- case GST_MESSAGE_REQUEST_STATE:
-#endif
-#endif
- case GST_MESSAGE_ANY:
- break;
- default:
- break;
- }
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
- // If the source has given up, so do we.
- if (qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0) {
- bool everPlayed = m_everPlayed;
- // Try and differentiate network related resource errors from the others
- if (!m_request.url().isRelative() && m_request.url().scheme().compare(QLatin1String("file"), Qt::CaseInsensitive) != 0 ) {
- if (everPlayed ||
- (err->domain == GST_RESOURCE_ERROR && (
- err->code == GST_RESOURCE_ERROR_BUSY ||
- err->code == GST_RESOURCE_ERROR_OPEN_READ ||
- err->code == GST_RESOURCE_ERROR_READ ||
- err->code == GST_RESOURCE_ERROR_SEEK ||
- err->code == GST_RESOURCE_ERROR_SYNC))) {
- processInvalidMedia(QMediaPlayer::NetworkError, QString::fromUtf8(err->message));
- } else {
- processInvalidMedia(QMediaPlayer::ResourceError, QString::fromUtf8(err->message));
- }
- }
- else
- processInvalidMedia(QMediaPlayer::ResourceError, QString::fromUtf8(err->message));
- } else if (err->domain == GST_STREAM_ERROR
- && (err->code == GST_STREAM_ERROR_DECRYPT || err->code == GST_STREAM_ERROR_DECRYPT_NOKEY)) {
- processInvalidMedia(QMediaPlayer::AccessDeniedError, QString::fromUtf8(err->message));
- } else {
- handlePlaybin2 = m_usePlaybin2;
- }
- if (!handlePlaybin2)
- qWarning() << "Error:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT
- && qstrcmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "source") == 0
- && m_sourceType == UDPSrc
- && gst_structure_has_name(gst_message_get_structure(gm), "GstUDPSrcTimeout")) {
- //since udpsrc will not generate an error for the timeout event,
- //we need to process its element message here and treat it as an error.
- processInvalidMedia(m_everPlayed ? QMediaPlayer::NetworkError : QMediaPlayer::ResourceError,
- tr("UDP source timeout"));
- } else {
- handlePlaybin2 = m_usePlaybin2;
- }
-
- if (handlePlaybin2) {
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_WARNING) {
- GError *err;
- gchar *debug;
- gst_message_parse_warning(gm, &err, &debug);
- if (err->domain == GST_STREAM_ERROR && err->code == GST_STREAM_ERROR_CODEC_NOT_FOUND)
- emit error(int(QMediaPlayer::FormatError), tr("Cannot play stream of type: <unknown>"));
- qWarning() << "Warning:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- } else if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ERROR) {
- GError *err;
- gchar *debug;
- gst_message_parse_error(gm, &err, &debug);
- if (qstrncmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "decodebin2", 10) == 0
- || qstrncmp(GST_OBJECT_NAME(GST_MESSAGE_SRC(gm)), "uridecodebin", 12) == 0) {
- processInvalidMedia(QMediaPlayer::ResourceError, QString::fromUtf8(err->message));
- } else if (err->domain == GST_STREAM_ERROR
- && (err->code == GST_STREAM_ERROR_DECRYPT || err->code == GST_STREAM_ERROR_DECRYPT_NOKEY)) {
- processInvalidMedia(QMediaPlayer::AccessDeniedError, QString::fromUtf8(err->message));
- }
- qWarning() << "Error:" << QString::fromUtf8(err->message);
- g_error_free(err);
- g_free(debug);
- }
- }
- }
-
- return false;
-}
-
-void QGstreamerPlayerSession::getStreamsInfo()
-{
- //check if video is available:
- bool haveAudio = false;
- bool haveVideo = false;
- m_streamProperties.clear();
- m_streamTypes.clear();
-
- if (m_usePlaybin2) {
- gint audioStreamsCount = 0;
- gint videoStreamsCount = 0;
- gint textStreamsCount = 0;
-
- g_object_get(G_OBJECT(m_playbin), "n-audio", &audioStreamsCount, NULL);
- g_object_get(G_OBJECT(m_playbin), "n-video", &videoStreamsCount, NULL);
- g_object_get(G_OBJECT(m_playbin), "n-text", &textStreamsCount, NULL);
-
- haveAudio = audioStreamsCount > 0;
- haveVideo = videoStreamsCount > 0;
-
- m_playbin2StreamOffset[QMediaStreamsControl::AudioStream] = 0;
- m_playbin2StreamOffset[QMediaStreamsControl::VideoStream] = audioStreamsCount;
- m_playbin2StreamOffset[QMediaStreamsControl::SubPictureStream] = audioStreamsCount+videoStreamsCount;
-
- for (int i=0; i<audioStreamsCount; i++)
- m_streamTypes.append(QMediaStreamsControl::AudioStream);
-
- for (int i=0; i<videoStreamsCount; i++)
- m_streamTypes.append(QMediaStreamsControl::VideoStream);
-
- for (int i=0; i<textStreamsCount; i++)
- m_streamTypes.append(QMediaStreamsControl::SubPictureStream);
-
- for (int i=0; i<m_streamTypes.count(); i++) {
- QMediaStreamsControl::StreamType streamType = m_streamTypes[i];
- QMap<QtMultimedia::MetaData, QVariant> streamProperties;
-
- int streamIndex = i - m_playbin2StreamOffset[streamType];
-
- GstTagList *tags = 0;
- switch (streamType) {
- case QMediaStreamsControl::AudioStream:
- g_signal_emit_by_name(G_OBJECT(m_playbin), "get-audio-tags", streamIndex, &tags);
- break;
- case QMediaStreamsControl::VideoStream:
- g_signal_emit_by_name(G_OBJECT(m_playbin), "get-video-tags", streamIndex, &tags);
- break;
- case QMediaStreamsControl::SubPictureStream:
- g_signal_emit_by_name(G_OBJECT(m_playbin), "get-text-tags", streamIndex, &tags);
- break;
- default:
- break;
- }
-
- if (tags && gst_is_tag_list(tags)) {
- gchar *languageCode = 0;
- if (gst_tag_list_get_string(tags, GST_TAG_LANGUAGE_CODE, &languageCode))
- streamProperties[QtMultimedia::Language] = QString::fromUtf8(languageCode);
-
- //qDebug() << "language for setream" << i << QString::fromUtf8(languageCode);
- g_free (languageCode);
- }
-
- m_streamProperties.append(streamProperties);
- }
- } else { // PlayBin 1
- enum {
- GST_STREAM_TYPE_UNKNOWN,
- GST_STREAM_TYPE_AUDIO,
- GST_STREAM_TYPE_VIDEO,
- GST_STREAM_TYPE_TEXT,
- GST_STREAM_TYPE_SUBPICTURE,
- GST_STREAM_TYPE_ELEMENT
- };
-
- GList* streamInfoList;
- g_object_get(G_OBJECT(m_playbin), "stream-info", &streamInfoList, NULL);
-
- for (; streamInfoList != 0; streamInfoList = g_list_next(streamInfoList)) {
- gint type;
- gchar *languageCode = 0;
-
- GObject* streamInfo = G_OBJECT(streamInfoList->data);
-
- g_object_get(streamInfo, "type", &type, NULL);
- g_object_get(streamInfo, "language-code", &languageCode, NULL);
-
- QMediaStreamsControl::StreamType streamType = QMediaStreamsControl::UnknownStream;
-
- switch (type) {
- case GST_STREAM_TYPE_VIDEO:
- streamType = QMediaStreamsControl::VideoStream;
- haveVideo = true;
- break;
- case GST_STREAM_TYPE_AUDIO:
- streamType = QMediaStreamsControl::AudioStream;
- haveAudio = true;
- break;
- case GST_STREAM_TYPE_SUBPICTURE:
- streamType = QMediaStreamsControl::SubPictureStream;
- break;
- case GST_STREAM_TYPE_UNKNOWN: {
- GstCaps *caps = 0;
- g_object_get(streamInfo, "caps", &caps, NULL);
- const GstStructure *structure = gst_caps_get_structure(caps, 0);
- const gchar *media_type = gst_structure_get_name(structure);
- emit error(int(QMediaPlayer::FormatError), QString::fromLatin1("Cannot play stream of type: %1").arg(QString::fromUtf8(media_type)));
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Encountered unknown stream type";
-#endif
- gst_caps_unref(caps);
- }
- default:
- streamType = QMediaStreamsControl::UnknownStream;
- break;
- }
-
- QMap<QtMultimedia::MetaData, QVariant> streamProperties;
- streamProperties[QtMultimedia::Language] = QString::fromUtf8(languageCode);
-
- m_streamProperties.append(streamProperties);
- m_streamTypes.append(streamType);
- }
- }
-
-
- if (haveAudio != m_audioAvailable) {
- m_audioAvailable = haveAudio;
- emit audioAvailableChanged(m_audioAvailable);
- }
- if (haveVideo != m_videoAvailable) {
- m_videoAvailable = haveVideo;
- emit videoAvailableChanged(m_videoAvailable);
- }
-
- emit streamsChanged();
-}
-
-void QGstreamerPlayerSession::updateVideoResolutionTag()
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- QSize size;
- QSize aspectRatio;
-
- GstPad *pad = gst_element_get_static_pad(m_videoIdentity, "src");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
-
- if (caps) {
- const GstStructure *structure = gst_caps_get_structure(caps, 0);
- gst_structure_get_int(structure, "width", &size.rwidth());
- gst_structure_get_int(structure, "height", &size.rheight());
-
- gint aspectNum = 0;
- gint aspectDenum = 0;
- if (!size.isEmpty() && gst_structure_get_fraction(
- structure, "pixel-aspect-ratio", &aspectNum, &aspectDenum)) {
- if (aspectDenum > 0)
- aspectRatio = QSize(aspectNum, aspectDenum);
- }
- gst_caps_unref(caps);
- }
-
- gst_object_unref(GST_OBJECT(pad));
-
- QSize currentSize = m_tags.value("resolution").toSize();
- QSize currentAspectRatio = m_tags.value("pixel-aspect-ratio").toSize();
-
- if (currentSize != size || currentAspectRatio != aspectRatio) {
- if (aspectRatio.isEmpty())
- m_tags.remove("pixel-aspect-ratio");
-
- if (size.isEmpty()) {
- m_tags.remove("resolution");
- } else {
- m_tags.insert("resolution", QVariant(size));
- if (!aspectRatio.isEmpty())
- m_tags.insert("pixel-aspect-ratio", QVariant(aspectRatio));
- }
-
- emit tagsChanged();
- }
-}
-
-void QGstreamerPlayerSession::updateDuration()
-{
- GstFormat format = GST_FORMAT_TIME;
- gint64 gstDuration = 0;
- int duration = -1;
-
- if (m_playbin && gst_element_query_duration(m_playbin, &format, &gstDuration))
- duration = gstDuration / 1000000;
-
- if (m_duration != duration) {
- m_duration = duration;
- emit durationChanged(m_duration);
- }
-
- if (m_duration > 0)
- m_durationQueries = 0;
-
- if (m_durationQueries > 0) {
- //increase delay between duration requests
- int delay = 25 << (5 - m_durationQueries);
- QTimer::singleShot(delay, this, SLOT(updateDuration()));
- m_durationQueries--;
- }
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << m_duration;
-#endif
-}
-
-void QGstreamerPlayerSession::playbinNotifySource(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(p);
-
- GstElement *source = 0;
- g_object_get(o, "source", &source, NULL);
- if (source == 0)
- return;
-
-#ifdef DEBUG_PLAYBIN
- qDebug() << "Playbin source added:" << G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source));
-#endif
-
- // Turn off icecast metadata request, will be re-set if in QNetworkRequest
- // (souphttpsrc docs say is false by default, but header appears in request
- // @version 0.10.21)
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "iradio-mode") != 0)
- g_object_set(G_OBJECT(source), "iradio-mode", FALSE, NULL);
-
-
- // Set Headers
- const QByteArray userAgentString("User-Agent");
-
- QGstreamerPlayerSession *self = reinterpret_cast<QGstreamerPlayerSession *>(d);
-
- // User-Agent - special case, souphhtpsrc will always set something, even if
- // defined in extra-headers
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "user-agent") != 0) {
- g_object_set(G_OBJECT(source), "user-agent",
- self->m_request.rawHeader(userAgentString).constData(), NULL);
- }
-
- // The rest
- if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "extra-headers") != 0) {
- GstStructure *extras = gst_structure_empty_new("extras");
-
- foreach (const QByteArray &rawHeader, self->m_request.rawHeaderList()) {
- if (rawHeader == userAgentString) // Filter User-Agent
- continue;
- else {
- GValue headerValue;
-
- memset(&headerValue, 0, sizeof(GValue));
- g_value_init(&headerValue, G_TYPE_STRING);
-
- g_value_set_string(&headerValue,
- self->m_request.rawHeader(rawHeader).constData());
-
- gst_structure_set_value(extras, rawHeader.constData(), &headerValue);
- }
- }
-
- if (gst_structure_n_fields(extras) > 0)
- g_object_set(G_OBJECT(source), "extra-headers", extras, NULL);
-
- gst_structure_free(extras);
- }
-
- //set timeout property to 30 seconds
- const int timeout = 30;
- if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstUDPSrc") == 0) {
- //udpsrc timeout unit = microsecond
- //The udpsrc is always a live source.
- g_object_set(G_OBJECT(source), "timeout", G_GUINT64_CONSTANT(timeout*1000000), NULL);
- self->m_sourceType = UDPSrc;
- self->m_isLiveSource = true;
- } else if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstSoupHTTPSrc") == 0) {
- //souphttpsrc timeout unit = second
- g_object_set(G_OBJECT(source), "timeout", guint(timeout), NULL);
- self->m_sourceType = SoupHTTPSrc;
- //since gst_base_src_is_live is not reliable, so we check the source property directly
- gboolean isLive = false;
- g_object_get(G_OBJECT(source), "is-live", &isLive, NULL);
- self->m_isLiveSource = isLive;
- } else if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstMMSSrc") == 0) {
- self->m_sourceType = MMSSrc;
- self->m_isLiveSource = gst_base_src_is_live(GST_BASE_SRC(source));
- g_object_set(G_OBJECT(source), "tcp-timeout", G_GUINT64_CONSTANT(timeout*1000000), NULL);
- } else if (qstrcmp(G_OBJECT_CLASS_NAME(G_OBJECT_GET_CLASS(source)), "GstRTSPSrc") == 0) {
- //rtspsrc acts like a live source and will therefore only generate data in the PLAYING state.
- self->m_sourceType = RTSPSrc;
- self->m_isLiveSource = true;
- } else {
- self->m_sourceType = UnknownSrc;
- self->m_isLiveSource = gst_base_src_is_live(GST_BASE_SRC(source));
- }
-
-#ifdef DEBUG_PLAYBIN
- if (self->m_isLiveSource)
- qDebug() << "Current source is a live source";
- else
- qDebug() << "Current source is a non-live source";
-#endif
-
-
- gst_object_unref(source);
-}
-
-bool QGstreamerPlayerSession::isLiveSource() const
-{
- return m_isLiveSource;
-}
-
-void QGstreamerPlayerSession::handleVolumeChange(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(o);
- Q_UNUSED(p);
- QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession *>(d);
- QMetaObject::invokeMethod(session, "updateVolume", Qt::QueuedConnection);
-}
-
-void QGstreamerPlayerSession::updateVolume()
-{
- double volume = 1.0;
- g_object_get(m_playbin, "volume", &volume, NULL);
-
- //special case for playbin1 volume changes in muted state
- //playbin1 has no separate muted state,
- //it's emulated with volume value saved and set to 0
- //this change should not be reported to user
- if (!m_usePlaybin2 && m_muted) {
- if (volume > 0.001) {
- //volume is changed, player in not muted any more
- m_muted = false;
- emit mutedStateChanged(m_muted = false);
- } else {
- //don't emit volume changed to 0 when player is muted
- return;
- }
- }
-
- if (m_volume != int(volume*100)) {
- m_volume = int(volume*100);
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << m_muted;
-#endif
- emit volumeChanged(m_volume);
- }
-}
-
-void QGstreamerPlayerSession::handleMutedChange(GObject *o, GParamSpec *p, gpointer d)
-{
- Q_UNUSED(o);
- Q_UNUSED(p);
- QGstreamerPlayerSession *session = reinterpret_cast<QGstreamerPlayerSession *>(d);
- QMetaObject::invokeMethod(session, "updateMuted", Qt::QueuedConnection);
-}
-
-void QGstreamerPlayerSession::updateMuted()
-{
- gboolean muted = false;
- g_object_get(G_OBJECT(m_playbin), "mute", &muted, NULL);
- if (m_muted != muted) {
- m_muted = muted;
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << m_muted;
-#endif
- emit mutedStateChanged(muted);
- }
-}
-
-
-void QGstreamerPlayerSession::handleElementAdded(GstBin *bin, GstElement *element, QGstreamerPlayerSession *session)
-{
- Q_UNUSED(bin);
- //we have to configure queue2 element to enable media downloading
- //and reporting available ranges,
- //but it's added dynamically to playbin2
-
- gchar *elementName = gst_element_get_name(element);
-
- if (g_str_has_prefix(elementName, "queue2")) {
- session->m_haveQueueElement = true;
-
- if (session->property("mediaDownloadEnabled").toBool()) {
- QDir cacheDir(QStandardPaths::writableLocation(QStandardPaths::CacheLocation));
- QString cacheLocation = cacheDir.absoluteFilePath("gstmedia__XXXXXX");
-#ifdef DEBUG_PLAYBIN
- qDebug() << "set queue2 temp-location" << cacheLocation;
-#endif
- g_object_set(G_OBJECT(element), "temp-template", cacheLocation.toUtf8().constData(), NULL);
- } else {
- g_object_set(G_OBJECT(element), "temp-template", NULL, NULL);
- }
- } else if (g_str_has_prefix(elementName, "uridecodebin") ||
- g_str_has_prefix(elementName, "decodebin2")) {
- //listen for queue2 element added to uridecodebin/decodebin2 as well.
- //Don't touch other bins since they may have unrelated queues
- g_signal_connect(element, "element-added",
- G_CALLBACK(handleElementAdded), session);
- }
-
- g_free(elementName);
-}
-
-//doing proper operations when detecting an invalidMedia: change media status before signal the erorr
-void QGstreamerPlayerSession::processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO;
-#endif
- emit invalidMedia();
- stop();
- emit error(int(errorCode), errorString);
-}
-
-void QGstreamerPlayerSession::showPrerollFrames(bool enabled)
-{
-#ifdef DEBUG_PLAYBIN
- qDebug() << Q_FUNC_INFO << enabled;
-#endif
- if (enabled != m_displayPrerolledFrame && m_videoSink &&
- g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "show-preroll-frame") != 0) {
-
- gboolean value = enabled;
- g_object_set(G_OBJECT(m_videoSink), "show-preroll-frame", value, NULL);
- m_displayPrerolledFrame = enabled;
- }
-}
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h b/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
deleted file mode 100644
index 3380e6e..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerplayersession.h
+++ /dev/null
@@ -1,229 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERPLAYERSESSION_H
-#define QGSTREAMERPLAYERSESSION_H
-
-#include <QObject>
-#include <QtNetwork/qnetworkrequest.h>
-#include "qgstreamerplayercontrol.h"
-#include <private/qgstreamerbushelper_p.h>
-#include <qmediaplayer.h>
-#include <qmediastreamscontrol.h>
-
-#if defined(HAVE_GST_APPSRC)
-#include "qgstappsrc.h"
-#endif
-
-#include <gst/gst.h>
-
-class QGstreamerBusHelper;
-class QGstreamerMessage;
-
-class QGstreamerVideoRendererInterface;
-
-QT_USE_NAMESPACE
-
-class QGstreamerPlayerSession : public QObject,
- public QGstreamerBusMessageFilter
-{
-Q_OBJECT
-Q_INTERFACES(QGstreamerBusMessageFilter)
-
-public:
- QGstreamerPlayerSession(QObject *parent);
- virtual ~QGstreamerPlayerSession();
-
- GstElement *playbin() const;
- QGstreamerBusHelper *bus() const { return m_busHelper; }
-
- QNetworkRequest request() const;
-
- QMediaPlayer::State state() const { return m_state; }
- QMediaPlayer::State pendingState() const { return m_pendingState; }
-
- qint64 duration() const;
- qint64 position() const;
-
- bool isBuffering() const;
-
- int bufferingProgress() const;
-
- int volume() const;
- bool isMuted() const;
-
- bool isAudioAvailable() const;
-
- void setVideoRenderer(QObject *renderer);
- bool isVideoAvailable() const;
-
- bool isSeekable() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
- QMediaTimeRange availablePlaybackRanges() const;
-
- QMap<QByteArray ,QVariant> tags() const { return m_tags; }
- QMap<QtMultimedia::MetaData,QVariant> streamProperties(int streamNumber) const { return m_streamProperties[streamNumber]; }
- int streamCount() const { return m_streamProperties.count(); }
- QMediaStreamsControl::StreamType streamType(int streamNumber) { return m_streamTypes.value(streamNumber, QMediaStreamsControl::UnknownStream); }
-
- int activeStream(QMediaStreamsControl::StreamType streamType) const;
- void setActiveStream(QMediaStreamsControl::StreamType streamType, int streamNumber);
-
- bool processBusMessage(const QGstreamerMessage &message);
-
-#if defined(HAVE_GST_APPSRC)
- QGstAppSrc *appsrc() const { return m_appSrc; }
- static void configureAppSrcElement(GObject*, GObject*, GParamSpec*,QGstreamerPlayerSession* _this);
-#endif
-
- bool isLiveSource() const;
-
-public slots:
- void loadFromUri(const QNetworkRequest &url);
- void loadFromStream(const QNetworkRequest &url, QIODevice *stream);
- bool play();
- bool pause();
- void stop();
-
- bool seek(qint64 pos);
-
- void setVolume(int volume);
- void setMuted(bool muted);
-
- void showPrerollFrames(bool enabled);
-
-signals:
- void durationChanged(qint64 duration);
- void positionChanged(qint64 position);
- void stateChanged(QMediaPlayer::State state);
- void volumeChanged(int volume);
- void mutedStateChanged(bool muted);
- void audioAvailableChanged(bool audioAvailable);
- void videoAvailableChanged(bool videoAvailable);
- void bufferingChanged(bool buffering);
- void bufferingProgressChanged(int percentFilled);
- void playbackFinished();
- void tagsChanged();
- void streamsChanged();
- void seekableChanged(bool);
- void error(int error, const QString &errorString);
- void invalidMedia();
- void playbackRateChanged(qreal);
-
-private slots:
- void getStreamsInfo();
- void setSeekable(bool);
- void finishVideoOutputChange();
- void updateVideoRenderer();
- void updateVideoResolutionTag();
- void updateVolume();
- void updateMuted();
- void updateDuration();
-
-private:
- static void playbinNotifySource(GObject *o, GParamSpec *p, gpointer d);
- static void handleVolumeChange(GObject *o, GParamSpec *p, gpointer d);
- static void handleMutedChange(GObject *o, GParamSpec *p, gpointer d);
- static void insertColorSpaceElement(GstElement *element, gpointer data);
- static void handleElementAdded(GstBin *bin, GstElement *element, QGstreamerPlayerSession *session);
- void processInvalidMedia(QMediaPlayer::Error errorCode, const QString& errorString);
-
- QNetworkRequest m_request;
- QMediaPlayer::State m_state;
- QMediaPlayer::State m_pendingState;
- QGstreamerBusHelper* m_busHelper;
- GstElement* m_playbin;
- bool m_usePlaybin2;
-
- GstElement* m_videoOutputBin;
- GstElement* m_videoIdentity;
- GstElement* m_colorSpace;
- bool m_usingColorspaceElement;
- GstElement* m_videoSink;
- GstElement* m_pendingVideoSink;
- GstElement* m_nullVideoSink;
-
- GstBus* m_bus;
- QObject *m_videoOutput;
- QGstreamerVideoRendererInterface *m_renderer;
-
- bool m_haveQueueElement;
-
-#if defined(HAVE_GST_APPSRC)
- QGstAppSrc *m_appSrc;
-#endif
-
- QMap<QByteArray, QVariant> m_tags;
- QList< QMap<QtMultimedia::MetaData,QVariant> > m_streamProperties;
- QList<QMediaStreamsControl::StreamType> m_streamTypes;
- QMap<QMediaStreamsControl::StreamType, int> m_playbin2StreamOffset;
-
-
- int m_volume;
- qreal m_playbackRate;
- bool m_muted;
- bool m_audioAvailable;
- bool m_videoAvailable;
- bool m_seekable;
-
- mutable qint64 m_lastPosition;
- qint64 m_duration;
- int m_durationQueries;
-
- bool m_displayPrerolledFrame;
-
- enum SourceType
- {
- UnknownSrc,
- SoupHTTPSrc,
- UDPSrc,
- MMSSrc,
- RTSPSrc,
- };
- SourceType m_sourceType;
- bool m_everPlayed;
- bool m_isLiveSource;
-};
-
-#endif // QGSTREAMERPLAYERSESSION_H
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp
deleted file mode 100644
index a5ba871..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamerstreamscontrol.h"
-#include "qgstreamerplayersession.h"
-
-QGstreamerStreamsControl::QGstreamerStreamsControl(QGstreamerPlayerSession *session, QObject *parent)
- :QMediaStreamsControl(parent), m_session(session)
-{
- connect(m_session, SIGNAL(streamsChanged()), SIGNAL(streamsChanged()));
-}
-
-QGstreamerStreamsControl::~QGstreamerStreamsControl()
-{
-}
-
-int QGstreamerStreamsControl::streamCount()
-{
- return m_session->streamCount();
-}
-
-QMediaStreamsControl::StreamType QGstreamerStreamsControl::streamType(int streamNumber)
-{
- return m_session->streamType(streamNumber);
-}
-
-QVariant QGstreamerStreamsControl::metaData(int streamNumber, QtMultimedia::MetaData key)
-{
- return m_session->streamProperties(streamNumber).value(key);
-}
-
-bool QGstreamerStreamsControl::isActive(int streamNumber)
-{
- return streamNumber != -1 && streamNumber == m_session->activeStream(streamType(streamNumber));
-}
-
-void QGstreamerStreamsControl::setActive(int streamNumber, bool state)
-{
- QMediaStreamsControl::StreamType type = m_session->streamType(streamNumber);
- if (type == QMediaStreamsControl::UnknownStream)
- return;
-
- if (state)
- m_session->setActiveStream(type, streamNumber);
- else {
- //only one active stream of certain type is supported
- if (m_session->activeStream(type) == streamNumber)
- m_session->setActiveStream(type, -1);
- }
-}
-
diff --git a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h b/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
deleted file mode 100644
index 77f0f2d..0000000
--- a/src/plugins/gstreamer/mediaplayer/qgstreamerstreamscontrol.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERSTREAMSCONTROL_H
-#define QGSTREAMERSTREAMSCONTROL_H
-
-#include <qmediastreamscontrol.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerPlayerSession;
-
-class QGstreamerStreamsControl : public QMediaStreamsControl
-{
- Q_OBJECT
-public:
- QGstreamerStreamsControl(QGstreamerPlayerSession *session, QObject *parent);
- virtual ~QGstreamerStreamsControl();
-
- virtual int streamCount();
- virtual StreamType streamType(int streamNumber);
-
- virtual QVariant metaData(int streamNumber, QtMultimedia::MetaData key);
-
- virtual bool isActive(int streamNumber);
- virtual void setActive(int streamNumber, bool state);
-
-private:
- QGstreamerPlayerSession *m_session;
-};
-
-#endif // QGSTREAMERSTREAMSCONTROL_H
-
diff --git a/src/plugins/gstreamer/qgstcodecsinfo.cpp b/src/plugins/gstreamer/qgstcodecsinfo.cpp
deleted file mode 100644
index 34c18a1..0000000
--- a/src/plugins/gstreamer/qgstcodecsinfo.cpp
+++ /dev/null
@@ -1,183 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstcodecsinfo.h"
-
-#include <QtCore/qset.h>
-
-#ifdef QMEDIA_GSTREAMER_CAMERABIN
-#include <gst/pbutils/pbutils.h>
-#include <gst/pbutils/encoding-profile.h>
-#endif
-
-
-QGstCodecsInfo::QGstCodecsInfo(QGstCodecsInfo::ElementType elementType)
-{
-
-#if GST_CHECK_VERSION(0,10,31)
-
- GstElementFactoryListType gstElementType = 0;
- switch (elementType) {
- case AudioEncoder:
- gstElementType = GST_ELEMENT_FACTORY_TYPE_AUDIO_ENCODER;
- break;
- case VideoEncoder:
- gstElementType = GST_ELEMENT_FACTORY_TYPE_VIDEO_ENCODER;
- break;
- case Muxer:
- gstElementType = GST_ELEMENT_FACTORY_TYPE_MUXER;
- break;
- }
-
- GstCaps *allCaps = supportedElementCaps(gstElementType);
- GstCaps *caps = gst_caps_new_empty();
-
- uint codecsCount = gst_caps_get_size(allCaps);
- for (uint i=0; i<codecsCount; i++) {
- gst_caps_append_structure(caps, gst_caps_steal_structure(allCaps, 0));
- gchar * capsString = gst_caps_to_string(caps);
-
- QString codec = QLatin1String(capsString);
- m_codecs.append(codec);
-
-#ifdef QMEDIA_GSTREAMER_CAMERABIN
- gchar *description = gst_pb_utils_get_codec_description(caps);
- m_codecDescriptions.insert(codec, QString::fromUtf8(description));
-
- if (description)
- g_free(description);
-#else
- m_codecDescriptions.insert(codec, codec);
-#endif
-
- if (capsString)
- g_free(capsString);
-
- gst_caps_remove_structure(caps, 0);
- }
-#else
- Q_UNUSED(elementType);
-#endif // GST_CHECK_VERSION(0,10,31)
-}
-
-QStringList QGstCodecsInfo::supportedCodecs() const
-{
- return m_codecs;
-}
-
-QString QGstCodecsInfo::codecDescription(const QString &codec) const
-{
- return m_codecDescriptions.value(codec);
-}
-
-#if GST_CHECK_VERSION(0,10,31)
-
-/*!
- List all supported caps for all installed elements of type \a elementType.
-
- Caps are simplified to mime type and a few field necessary to distinguish
- different codecs like mpegversion or layer.
- */
-GstCaps* QGstCodecsInfo::supportedElementCaps(GstElementFactoryListType elementType,
- GstRank minimumRank,
- GstPadDirection padDirection)
-{
- GList *elements = gst_element_factory_list_get_elements(elementType, minimumRank);
- GstCaps *res = gst_caps_new_empty();
-
- QSet<QByteArray> fakeEncoderMimeTypes;
- fakeEncoderMimeTypes << "unknown/unknown"
- << "audio/x-raw-int" << "audio/x-raw-float"
- << "video/x-raw-yuv" << "video/x-raw-rgb";
-
- QSet<QByteArray> fieldsToAdd;
- fieldsToAdd << "mpegversion" << "layer" << "layout" << "raversion"
- << "wmaversion" << "wmvversion" << "variant";
-
- GList *element = elements;
- while (element) {
- GstElementFactory *factory = (GstElementFactory *)element->data;
- element = element->next;
-
- const GList *padTemplates = gst_element_factory_get_static_pad_templates(factory);
- while (padTemplates) {
- GstStaticPadTemplate *padTemplate = (GstStaticPadTemplate *)padTemplates->data;
- padTemplates = padTemplates->next;
-
- if (padTemplate->direction == padDirection) {
- const GstCaps *caps = gst_static_caps_get(&padTemplate->static_caps);
- for (uint i=0; i<gst_caps_get_size(caps); i++) {
- const GstStructure *structure = gst_caps_get_structure(caps, i);
-
- //skip "fake" encoders
- if (fakeEncoderMimeTypes.contains(gst_structure_get_name(structure)))
- continue;
-
- GstStructure *newStructure = gst_structure_new(gst_structure_get_name(structure), NULL);
-
- //add structure fields to distinguish between formats with similar mime types,
- //like audio/mpeg
- for (int j=0; j<gst_structure_n_fields(structure); j++) {
- const gchar* fieldName = gst_structure_nth_field_name(structure, j);
- if (fieldsToAdd.contains(fieldName)) {
- const GValue *value = gst_structure_get_value(structure, fieldName);
- GType valueType = G_VALUE_TYPE(value);
-
- //don't add values of range type,
- //gst_pb_utils_get_codec_description complains about not fixed caps
-
- if (valueType != GST_TYPE_INT_RANGE && valueType != GST_TYPE_DOUBLE_RANGE &&
- valueType != GST_TYPE_FRACTION_RANGE && valueType != GST_TYPE_LIST &&
- valueType != GST_TYPE_ARRAY)
- gst_structure_set_value(newStructure, fieldName, value);
- }
- }
-
- gst_caps_merge_structure(res, newStructure);
- }
- }
- }
- }
- gst_plugin_feature_list_free(elements);
-
- return res;
-}
-#endif //GST_CHECK_VERSION(0,10,31)
diff --git a/src/plugins/gstreamer/qgstcodecsinfo.h b/src/plugins/gstreamer/qgstcodecsinfo.h
deleted file mode 100644
index f5a706d..0000000
--- a/src/plugins/gstreamer/qgstcodecsinfo.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTCODECSINFO_H
-#define QGSTCODECSINFO_H
-
-#include <QtCore/qmap.h>
-#include <QtCore/qstringlist.h>
-
-#include <gst/gst.h>
-
-class QGstCodecsInfo
-{
-public:
- enum ElementType { AudioEncoder, VideoEncoder, Muxer };
-
- QGstCodecsInfo(ElementType elementType);
-
- QStringList supportedCodecs() const;
- QString codecDescription(const QString &codec) const;
-
-#if GST_CHECK_VERSION(0,10,31)
- static GstCaps* supportedElementCaps(GstElementFactoryListType elementType,
- GstRank minimumRank = GST_RANK_MARGINAL,
- GstPadDirection padDirection = GST_PAD_SRC);
-#endif
-
-private:
- QStringList m_codecs;
- QMap<QString,QString> m_codecDescriptions;
-};
-
-
-#endif
diff --git a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp b/src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp
deleted file mode 100644
index 9433850..0000000
--- a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreameraudioinputendpointselector.h"
-
-#include <QtWidgets/QIcon>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include <gst/gst.h>
-
-#ifdef HAVE_ALSA
-#include <alsa/asoundlib.h>
-#endif
-
-QGstreamerAudioInputEndpointSelector::QGstreamerAudioInputEndpointSelector(QObject *parent)
- :QAudioEndpointSelector(parent)
-{
- update();
-}
-
-QGstreamerAudioInputEndpointSelector::~QGstreamerAudioInputEndpointSelector()
-{
-}
-
-QList<QString> QGstreamerAudioInputEndpointSelector::availableEndpoints() const
-{
- return m_names;
-}
-
-QString QGstreamerAudioInputEndpointSelector::endpointDescription(const QString& name) const
-{
- QString desc;
-
- for (int i = 0; i < m_names.size(); i++) {
- if (m_names.at(i).compare(name) == 0) {
- desc = m_descriptions.at(i);
- break;
- }
- }
- return desc;
-}
-
-QString QGstreamerAudioInputEndpointSelector::defaultEndpoint() const
-{
- if (m_names.size() > 0)
- return m_names.at(0);
-
- return QString();
-}
-
-QString QGstreamerAudioInputEndpointSelector::activeEndpoint() const
-{
- return m_audioInput;
-}
-
-void QGstreamerAudioInputEndpointSelector::setActiveEndpoint(const QString& name)
-{
- if (m_audioInput.compare(name) != 0) {
- m_audioInput = name;
- emit activeEndpointChanged(name);
- }
-}
-
-void QGstreamerAudioInputEndpointSelector::update()
-{
- m_names.clear();
- m_descriptions.clear();
- updateAlsaDevices();
- updateOssDevices();
- updatePulseDevices();
- if (m_names.size() > 0)
- m_audioInput = m_names.at(0);
-}
-
-void QGstreamerAudioInputEndpointSelector::updateAlsaDevices()
-{
-#ifdef HAVE_ALSA
- void **hints, **n;
- if (snd_device_name_hint(-1, "pcm", &hints) < 0) {
- qWarning()<<"no alsa devices available";
- return;
- }
- n = hints;
-
- while (*n != NULL) {
- char *name = snd_device_name_get_hint(*n, "NAME");
- char *descr = snd_device_name_get_hint(*n, "DESC");
- char *io = snd_device_name_get_hint(*n, "IOID");
-
- if ((name != NULL) && (descr != NULL)) {
- if ( io == NULL || qstrcmp(io,"Input") == 0 ) {
- m_names.append(QLatin1String("alsa:")+QString::fromUtf8(name));
- m_descriptions.append(QString::fromUtf8(descr));
- }
- }
-
- if (name != NULL)
- free(name);
- if (descr != NULL)
- free(descr);
- if (io != NULL)
- free(io);
- n++;
- }
- snd_device_name_free_hint(hints);
-#endif
-}
-
-void QGstreamerAudioInputEndpointSelector::updateOssDevices()
-{
- QDir devDir("/dev");
- devDir.setFilter(QDir::System);
- QFileInfoList entries = devDir.entryInfoList(QStringList() << "dsp*");
- foreach(const QFileInfo& entryInfo, entries) {
- m_names.append(QLatin1String("oss:")+entryInfo.filePath());
- m_descriptions.append(QString("OSS device %1").arg(entryInfo.fileName()));
- }
-}
-
-void QGstreamerAudioInputEndpointSelector::updatePulseDevices()
-{
- GstElementFactory *factory = gst_element_factory_find("pulsesrc");
- if (factory) {
- m_names.append("pulseaudio:");
- m_descriptions.append("PulseAudio device.");
- gst_object_unref(GST_OBJECT(factory));
- }
-}
diff --git a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.h b/src/plugins/gstreamer/qgstreameraudioinputendpointselector.h
deleted file mode 100644
index c69d25e..0000000
--- a/src/plugins/gstreamer/qgstreameraudioinputendpointselector.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
-#define QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
-
-#include <qaudioendpointselector.h>
-#include <QtCore/qstringlist.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerAudioInputEndpointSelector : public QAudioEndpointSelector
-{
-Q_OBJECT
-public:
- QGstreamerAudioInputEndpointSelector(QObject *parent);
- ~QGstreamerAudioInputEndpointSelector();
-
- QList<QString> availableEndpoints() const;
- QString endpointDescription(const QString& name) const;
- QString defaultEndpoint() const;
- QString activeEndpoint() const;
-
-public Q_SLOTS:
- void setActiveEndpoint(const QString& name);
-
-private:
- void update();
- void updateAlsaDevices();
- void updateOssDevices();
- void updatePulseDevices();
-
- QString m_audioInput;
- QList<QString> m_names;
- QList<QString> m_descriptions;
-};
-
-#endif // QGSTREAMERAUDIOINPUTENDPOINTSELECTOR_H
diff --git a/src/plugins/gstreamer/qgstreamergltexturerenderer.cpp b/src/plugins/gstreamer/qgstreamergltexturerenderer.cpp
deleted file mode 100644
index d9633aa..0000000
--- a/src/plugins/gstreamer/qgstreamergltexturerenderer.cpp
+++ /dev/null
@@ -1,583 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <private/qvideosurfacegstsink_p.h>
-#include <qabstractvideosurface.h>
-#include <private/qgstutils_p.h>
-
-#include <QtGui/qevent.h>
-#include <QtWidgets/qapplication.h>
-#include <QtWidgets/qx11info_x11.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qthread.h>
-
-#include <QtOpenGL/qgl.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/propertyprobe.h>
-#include <gst/interfaces/meegovideotexture.h>
-#include <gst/interfaces/meegovideorenderswitch.h>
-
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "qgstreamergltexturerenderer.h"
-
-//#define GL_TEXTURE_SINK_DEBUG 1
-
-//from extdefs.h
-typedef void *EGLSyncKHR;
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define EGL_SYNC_FENCE_KHR 0x30F9
-
-typedef EGLSyncKHR (EGLAPIENTRYP _PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy,
- EGLenum type, const EGLint * attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP _PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy,
- EGLSyncKHR sync);
-
-
-const QAbstractVideoBuffer::HandleType EGLImageTextureHandle =
- QAbstractVideoBuffer::HandleType(QAbstractVideoBuffer::UserHandle+3434);
-
-// EGLSync functions
-_PFNEGLCREATESYNCKHRPROC eglCreateSyncKHR;
-_PFNEGLDESTROYSYNCKHRPROC eglDestroySyncKHR;
-
-class QGStreamerGLTextureBuffer : public QAbstractVideoBuffer
-{
-public:
- QGStreamerGLTextureBuffer(MeegoGstVideoTexture *textureSink, int frameNumber) :
- QAbstractVideoBuffer(EGLImageTextureHandle),
- m_textureSink(MEEGO_GST_VIDEO_TEXTURE(textureSink)),
- m_frameNumber(frameNumber)
- {
- }
-
- ~QGStreamerGLTextureBuffer()
- {
- }
-
-
- MapMode mapMode() const { return NotMapped; }
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine)
- {
- Q_UNUSED(mode);
- Q_UNUSED(numBytes);
- Q_UNUSED(bytesPerLine);
-
- //acquire_frame should really be called at buffer construction time
- //but it conflicts with id-less implementation of gst texture sink.
-#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1
- qDebug() << "acquire frame" << m_frameNumber;
-#endif
- if (!meego_gst_video_texture_acquire_frame(m_textureSink,m_frameNumber))
- qWarning() << Q_FUNC_INFO << "acquire-frame failed" << m_frameNumber;
-
-
-#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1
- qDebug() << "map frame" << m_frameNumber;
-#endif
-
- gboolean bind_status = meego_gst_video_texture_bind_frame(m_textureSink, GL_TEXTURE_EXTERNAL_OES, m_frameNumber);
- if (!bind_status)
- qWarning() << Q_FUNC_INFO << "bind-frame failed";
-
- return (uchar*)1;
- }
-
- void unmap()
- {
- gboolean bind_status = meego_gst_video_texture_bind_frame(m_textureSink, GL_TEXTURE_EXTERNAL_OES, -1);
-
-#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1
- qDebug() << "unmap frame" << m_frameNumber;
-#endif
-
- if (!bind_status)
- qWarning() << Q_FUNC_INFO << "unbind-frame failed";
-
- //release_frame should really be called in destructor
- //but this conflicts with id-less implementation of gst texture sink.
-#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1
- qDebug() << "release frame" << m_frameNumber;
-#endif
- EGLSyncKHR sync = eglCreateSyncKHR(eglGetDisplay((EGLNativeDisplayType)QX11Info::display()), EGL_SYNC_FENCE_KHR, NULL);
- meego_gst_video_texture_release_frame(m_textureSink, m_frameNumber, sync);
- }
-
- QVariant handle() const
- {
- return m_frameNumber;
- }
-
-private:
- MeegoGstVideoTexture *m_textureSink;
- int m_frameNumber;
-};
-
-
-QGstreamerGLTextureRenderer::QGstreamerGLTextureRenderer(QObject *parent) :
- QVideoRendererControl(parent),
- m_videoSink(0),
- m_surface(0),
- m_context(0),
- m_winId(0),
- m_colorKey(49,0,49),
- m_overlayEnabled(false),
- m_bufferProbeId(-1)
-{
- eglCreateSyncKHR =
- (_PFNEGLCREATESYNCKHRPROC)eglGetProcAddress("eglCreateSyncKHR");
- eglDestroySyncKHR =
- (_PFNEGLDESTROYSYNCKHRPROC)eglGetProcAddress("eglDestroySyncKHR");
-}
-
-QGstreamerGLTextureRenderer::~QGstreamerGLTextureRenderer()
-{
- if (m_surface && m_surface->isActive())
- m_surface->stop();
-
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-}
-
-GstElement *QGstreamerGLTextureRenderer::videoSink()
-{
- if (!m_videoSink && isReady()) {
- if (m_context && !m_surface->supportedPixelFormats(EGLImageTextureHandle).isEmpty()) {
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << ": using gltexture sink";
-#endif
- if (m_context)
- m_context->makeCurrent();
- m_videoSink = gst_element_factory_make("gltexturesink", "egl-texture-sink");
- g_object_set(G_OBJECT(m_videoSink),
- "x-display", QX11Info::display(),
- "egl-display", eglGetDisplay((EGLNativeDisplayType)QX11Info::display()),
- "egl-context", eglGetCurrentContext(),
- "colorkey", m_colorKey.rgb(),
- "autopaint-colorkey", false,
- "use-framebuffer-memory", true,
- "render-mode", m_overlayEnabled ? VIDEO_RENDERSWITCH_XOVERLAY_MODE
- : VIDEO_RENDERSWITCH_TEXTURE_STREAMING_MODE,
- (char*)NULL);
-
- g_signal_connect(G_OBJECT(m_videoSink), "frame-ready", G_CALLBACK(handleFrameReady), (gpointer)this);
- } else {
- qWarning() << Q_FUNC_INFO << ": Fallback to QVideoSurfaceGstSink since EGLImageTextureHandle is not supported";
- m_videoSink = reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface));
- }
-
- if (m_videoSink) {
- gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership
- gst_object_sink(GST_OBJECT(m_videoSink));
-
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);
- }
- }
-
- return m_videoSink;
-}
-
-QAbstractVideoSurface *QGstreamerGLTextureRenderer::surface() const
-{
- return m_surface;
-}
-
-void QGstreamerGLTextureRenderer::setSurface(QAbstractVideoSurface *surface)
-{
- if (m_surface != surface) {
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << surface;
-#endif
-
- bool oldReady = isReady();
-
- m_context = const_cast<QGLContext*>(QGLContext::currentContext());
-
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- m_videoSink = 0;
-
- if (m_surface) {
- disconnect(m_surface, SIGNAL(supportedFormatsChanged()),
- this, SLOT(handleFormatChange()));
- }
-
- m_surface = surface;
-
- if (oldReady != isReady())
- emit readyChanged(!oldReady);
-
- if (m_surface) {
- connect(m_surface, SIGNAL(supportedFormatsChanged()),
- this, SLOT(handleFormatChange()));
- }
-
- emit sinkChanged();
- }
-}
-
-void QGstreamerGLTextureRenderer::handleFormatChange()
-{
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- m_videoSink = 0;
- emit sinkChanged();
-}
-
-void QGstreamerGLTextureRenderer::handleFrameReady(GstElement *sink, gint frame, gpointer data)
-{
- Q_UNUSED(sink);
- QGstreamerGLTextureRenderer* renderer = reinterpret_cast<QGstreamerGLTextureRenderer*>(data);
-
- QMutexLocker locker(&renderer->m_mutex);
- QMetaObject::invokeMethod(renderer, "renderGLFrame",
- Qt::QueuedConnection,
- Q_ARG(int, frame));
-
- //we have to wait to ensure the frame is not reused,
- //timeout is added to avoid deadlocks when the main thread is
- //waiting for rendering to complete, this is possible for example during state chages.
- //If frame is not rendered during 60ms (~1-2 frames interval) it's better to unblock and drop it if necessary
- renderer->m_renderCondition.wait(&renderer->m_mutex, 60);
-}
-
-void QGstreamerGLTextureRenderer::renderGLFrame(int frame)
-{
-#if defined(GL_TEXTURE_SINK_DEBUG) && GL_TEXTURE_SINK_DEBUG > 1
- qDebug() << Q_FUNC_INFO << "frame:" << frame << "surface active:" << m_surface->isActive();
-#endif
- QMutexLocker locker(&m_mutex);
-
- if (!m_surface) {
- m_renderCondition.wakeAll();
- return;
- }
-
- MeegoGstVideoTexture *textureSink = MEEGO_GST_VIDEO_TEXTURE(m_videoSink);
-
- if (m_context)
- m_context->makeCurrent();
-
- //don't try to render the frame if state is changed to NULL or READY
- GstState pendingState = GST_STATE_NULL;
- GstState newState = GST_STATE_NULL;
- GstStateChangeReturn res = gst_element_get_state(m_videoSink,
- &newState,
- &pendingState,
- 0);//don't block and return immediately
-
- if (res == GST_STATE_CHANGE_FAILURE ||
- newState == GST_STATE_NULL ||
- pendingState == GST_STATE_NULL) {
- stopRenderer();
- m_renderCondition.wakeAll();
- return;
- }
-
- if (!m_surface->isActive()) {
- //find the native video size
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
-
- if (caps) {
- QSize newNativeSize = QGstUtils::capsCorrectedResolution(caps);
- if (m_nativeSize != newNativeSize) {
- m_nativeSize = newNativeSize;
- emit nativeSizeChanged();
- }
- gst_caps_unref(caps);
- }
-
- //start the surface...
- QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32, EGLImageTextureHandle);
- if (!m_surface->start(format)) {
- qWarning() << Q_FUNC_INFO << "failed to start video surface" << format;
- m_renderCondition.wakeAll();
- return;
- }
- }
-
- QGStreamerGLTextureBuffer *buffer = new QGStreamerGLTextureBuffer(textureSink, frame);
- QVideoFrame videoFrame(buffer,
- m_surface->surfaceFormat().frameSize(),
- m_surface->surfaceFormat().pixelFormat());
- m_surface->present(videoFrame);
- m_renderCondition.wakeAll();
-}
-
-bool QGstreamerGLTextureRenderer::isReady() const
-{
- if (!m_surface)
- return false;
-
- if (m_winId > 0)
- return true;
-
- //winId is required only for EGLImageTextureHandle compatible surfaces
- return m_surface->supportedPixelFormats(EGLImageTextureHandle).isEmpty();
-}
-
-bool QGstreamerGLTextureRenderer::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << GST_MESSAGE_TYPE_NAME(gm);
-#endif
-
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED &&
- GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSink)) {
- GstState oldState;
- GstState newState;
- gst_message_parse_state_changed(gm, &oldState, &newState, 0);
-
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << "State changed:" << oldState << newState;
-#endif
-
- if (newState == GST_STATE_READY || newState == GST_STATE_NULL) {
- stopRenderer();
- }
-
- if (oldState == GST_STATE_READY && newState == GST_STATE_PAUSED) {
- updateNativeVideoSize();
- }
- }
-
- return false;
-}
-
-bool QGstreamerGLTextureRenderer::processSyncMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
- gst_structure_has_name(gm->structure, "prepare-xwindow-id") &&
- m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO;
-#endif
- GstXOverlay *overlay = GST_X_OVERLAY(m_videoSink);
-
- gst_x_overlay_set_xwindow_id(overlay, m_winId);
-
- if (!m_displayRect.isEmpty()) {
- gst_x_overlay_set_render_rectangle(overlay,
- m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height());
- }
-
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);
-
- return true;
- }
-
- return false;
-}
-
-void QGstreamerGLTextureRenderer::stopRenderer()
-{
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO;
-#endif
-
- if (m_surface && m_surface->isActive())
- m_surface->stop();
-
- if (!m_nativeSize.isEmpty()) {
- m_nativeSize = QSize();
- emit nativeSizeChanged();
- }
-}
-
-bool QGstreamerGLTextureRenderer::overlayEnabled() const
-{
- return m_overlayEnabled;
-}
-
-void QGstreamerGLTextureRenderer::setOverlayEnabled(bool enabled)
-{
-
- if (m_videoSink && (m_overlayEnabled != enabled)) {
- qDebug() << Q_FUNC_INFO << enabled;
- g_object_set(G_OBJECT(m_videoSink),
- "render-mode",
- enabled ? VIDEO_RENDERSWITCH_XOVERLAY_MODE : VIDEO_RENDERSWITCH_TEXTURE_STREAMING_MODE,
- (char *)NULL);
- }
-
- m_overlayEnabled = enabled;
-}
-
-
-WId QGstreamerGLTextureRenderer::winId() const
-{
- return m_winId;
-}
-
-void QGstreamerGLTextureRenderer::setWinId(WId id)
-{
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << id;
-#endif
-
- if (m_winId == id)
- return;
-
- bool oldReady = isReady();
-
- m_winId = id;
-
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- //don't set winId in NULL state,
- //texture sink opens xvideo port on set_xwindow_id,
- //this fails if video resource is not granted by resource policy yet.
- //state is changed to READY/PAUSED/PLAYING only after resource is granted.
- GstState pendingState = GST_STATE_NULL;
- GstState newState = GST_STATE_NULL;
- GstStateChangeReturn res = gst_element_get_state(m_videoSink,
- &newState,
- &pendingState,
- 0);//don't block and return immediately
-
- if (res != GST_STATE_CHANGE_FAILURE &&
- newState != GST_STATE_NULL &&
- pendingState != GST_STATE_NULL)
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_winId);
- }
-
- if (oldReady != isReady())
- emit readyChanged(!oldReady);
-}
-
-QRect QGstreamerGLTextureRenderer::overlayGeometry() const
-{
- return m_displayRect;
-}
-
-void QGstreamerGLTextureRenderer::setOverlayGeometry(const QRect &geometry)
-{
- if (m_displayRect != geometry) {
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << geometry;
-#endif
- m_displayRect = geometry;
-
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- if (m_displayRect.isEmpty())
- gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), -1, -1, -1, -1);
- else
- gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink),
- m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height());
- repaintOverlay();
- }
- }
-}
-
-QColor QGstreamerGLTextureRenderer::colorKey() const
-{
- return m_colorKey;
-}
-
-void QGstreamerGLTextureRenderer::repaintOverlay()
-{
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- //don't call gst_x_overlay_expose if the sink is in null state
- GstState state = GST_STATE_NULL;
- GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000);
- if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) {
- gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
- }
- }
-}
-
-QSize QGstreamerGLTextureRenderer::nativeSize() const
-{
- return m_nativeSize;
-}
-
-gboolean QGstreamerGLTextureRenderer::padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data)
-{
- QGstreamerGLTextureRenderer *control = reinterpret_cast<QGstreamerGLTextureRenderer*>(user_data);
- QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection);
- gst_pad_remove_buffer_probe(pad, control->m_bufferProbeId);
-
- return TRUE;
-}
-
-void QGstreamerGLTextureRenderer::updateNativeVideoSize()
-{
- const QSize oldSize = m_nativeSize;
-
- if (m_videoSink) {
- //find video native size to update video widget size hint
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
-
- if (caps) {
- m_nativeSize = QGstUtils::capsCorrectedResolution(caps);
- gst_caps_unref(caps);
- }
- } else {
- m_nativeSize = QSize();
- }
-#ifdef GL_TEXTURE_SINK_DEBUG
- qDebug() << Q_FUNC_INFO << oldSize << m_nativeSize << m_videoSink;
-#endif
-
- if (m_nativeSize != oldSize)
- emit nativeSizeChanged();
-}
diff --git a/src/plugins/gstreamer/qgstreamergltexturerenderer.h b/src/plugins/gstreamer/qgstreamergltexturerenderer.h
deleted file mode 100644
index 244e07f..0000000
--- a/src/plugins/gstreamer/qgstreamergltexturerenderer.h
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERGLTEXTURERENDERER_H
-#define QGSTREAMERGLTEXTURERENDERER_H
-
-#include <qvideorenderercontrol.h>
-#include <private/qvideosurfacegstsink_p.h>
-#include <private/qgstreamerbushelper_p.h>
-
-#include "qgstreamervideorendererinterface.h"
-#include <QtGui/qcolor.h>
-
-#include <X11/extensions/Xv.h>
-
-QT_USE_NAMESPACE
-
-class QGLContext;
-
-class QGstreamerGLTextureRenderer : public QVideoRendererControl,
- public QGstreamerVideoRendererInterface,
- public QGstreamerSyncMessageFilter,
- public QGstreamerBusMessageFilter
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
-
- Q_PROPERTY(bool overlayEnabled READ overlayEnabled WRITE setOverlayEnabled)
- Q_PROPERTY(qulonglong winId READ winId WRITE setWinId)
- Q_PROPERTY(QRect overlayGeometry READ overlayGeometry WRITE setOverlayGeometry)
- Q_PROPERTY(QColor colorKey READ colorKey)
- Q_PROPERTY(QSize nativeSize READ nativeSize NOTIFY nativeSizeChanged)
-
-public:
- QGstreamerGLTextureRenderer(QObject *parent = 0);
- virtual ~QGstreamerGLTextureRenderer();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- GstElement *videoSink();
-
- bool isReady() const;
- bool processBusMessage(const QGstreamerMessage &message);
- bool processSyncMessage(const QGstreamerMessage &message);
- void stopRenderer();
-
- int framebufferNumber() const;
-
- bool overlayEnabled() const;
- WId winId() const;
- QRect overlayGeometry() const;
- QColor colorKey() const;
- QSize nativeSize() const;
-
-public slots:
- void renderGLFrame(int);
-
- void setOverlayEnabled(bool);
- void setWinId(WId id);
- void setOverlayGeometry(const QRect &geometry);
- void repaintOverlay();
-
-signals:
- void sinkChanged();
- void readyChanged(bool);
- void nativeSizeChanged();
-
-private slots:
- void handleFormatChange();
- void updateNativeVideoSize();
-
-private:
- static void handleFrameReady(GstElement *sink, gint frame, gpointer data);
- static gboolean padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
-
- GstElement *m_videoSink;
- QAbstractVideoSurface *m_surface;
- QGLContext *m_context;
- QSize m_nativeSize;
-
- WId m_winId;
- QColor m_colorKey;
- QRect m_displayRect;
- bool m_overlayEnabled;
- int m_bufferProbeId;
-
- QMutex m_mutex;
- QWaitCondition m_renderCondition;
-};
-
-#endif // QGSTREAMERVIDEORENDRER_H
diff --git a/src/plugins/gstreamer/qgstreamerserviceplugin.cpp b/src/plugins/gstreamer/qgstreamerserviceplugin.cpp
deleted file mode 100644
index 64d71c5..0000000
--- a/src/plugins/gstreamer/qgstreamerserviceplugin.cpp
+++ /dev/null
@@ -1,395 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/QIcon>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include "qgstreamerserviceplugin.h"
-
-//#define QT_SUPPORTEDMIMETYPES_DEBUG
-
-#ifdef QMEDIA_GSTREAMER_PLAYER
-#include "qgstreamerplayerservice.h"
-#endif
-
-#if defined(QMEDIA_GSTREAMER_CAPTURE)
-#include "qgstreamercaptureservice.h"
-#endif
-
-#ifdef QMEDIA_GSTREAMER_CAMERABIN
-#include "camerabinservice.h"
-#endif
-
-#include <qmediaserviceprovider.h>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <linux/videodev2.h>
-
-
-QStringList QGstreamerServicePlugin::keys() const
-{
- return QStringList()
-#ifdef QMEDIA_GSTREAMER_PLAYER
- << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
-#endif
-
-#ifdef QMEDIA_GSTREAMER_CAPTURE
- << QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE)
- << QLatin1String(Q_MEDIASERVICE_CAMERA)
-#elif defined(QMEDIA_GSTREAMER_CAMERABIN)
- << QLatin1String(Q_MEDIASERVICE_CAMERA)
-#endif
- ;
-
-}
-
-QMediaService* QGstreamerServicePlugin::create(const QString &key)
-{
- static bool initialized = false;
- if (!initialized) {
- initialized = true;
- gst_init(NULL, NULL);
- }
-
-#ifdef QMEDIA_GSTREAMER_PLAYER
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new QGstreamerPlayerService;
-#endif
-
-#ifdef QMEDIA_GSTREAMER_CAMERABIN
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA) && CameraBinService::isCameraBinAvailable())
- return new CameraBinService(key);
-#endif
-
-#ifdef QMEDIA_GSTREAMER_CAPTURE
- if (key == QLatin1String(Q_MEDIASERVICE_AUDIOSOURCE))
- return new QGstreamerCaptureService(key);
-
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
- return new QGstreamerCaptureService(key);
-#endif
-
- qWarning() << "Gstreamer service plugin: unsupported key:" << key;
- return 0;
-}
-
-void QGstreamerServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features QGstreamerServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_MEDIAPLAYER)
- return QMediaServiceProviderHint::StreamPlayback | QMediaServiceProviderHint::VideoSurface;
- else if (service == Q_MEDIASERVICE_CAMERA)
- return QMediaServiceProviderHint::VideoSurface;
- else
- return QMediaServiceProviderHint::Features();
-}
-
-QList<QByteArray> QGstreamerServicePlugin::devices(const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_CAMERA) {
- if (m_cameraDevices.isEmpty())
- updateDevices();
-
- return m_cameraDevices;
- }
-
- return QList<QByteArray>();
-}
-
-QString QGstreamerServicePlugin::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();
-}
-
-QVariant QGstreamerServicePlugin::deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property)
-{
- Q_UNUSED(service);
- Q_UNUSED(device);
- Q_UNUSED(property);
- return QVariant();
-}
-
-void QGstreamerServicePlugin::updateDevices() const
-{
- m_cameraDevices.clear();
- m_cameraDescriptions.clear();
-
-#ifdef Q_WS_MAEMO_6
- m_cameraDevices << "primary" << "secondary";
- m_cameraDescriptions << tr("Main camera") << tr("Front camera");
- return;
-#endif
-
- QDir devDir("/dev");
- devDir.setFilter(QDir::System);
-
- QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*");
-
- foreach( const QFileInfo &entryInfo, entries ) {
- //qDebug() << "Try" << entryInfo.filePath();
-
- int fd = ::open(entryInfo.filePath().toLatin1().constData(), O_RDWR );
- if (fd == -1)
- continue;
-
- bool isCamera = false;
-
- v4l2_input input;
- memset(&input, 0, sizeof(input));
- for (; ::ioctl(fd, VIDIOC_ENUMINPUT, &input) >= 0; ++input.index) {
- if(input.type == V4L2_INPUT_TYPE_CAMERA || input.type == 0) {
- isCamera = ::ioctl(fd, VIDIOC_S_INPUT, input.index) != 0;
- break;
- }
- }
-
- if (isCamera) {
- // find out its driver "name"
- QString name;
- struct v4l2_capability vcap;
- memset(&vcap, 0, sizeof(struct v4l2_capability));
-
- if (ioctl(fd, VIDIOC_QUERYCAP, &vcap) != 0)
- name = entryInfo.fileName();
- else
- name = QString((const char*)vcap.card);
- //qDebug() << "found camera: " << name;
-
- m_cameraDevices.append(entryInfo.filePath().toLocal8Bit());
- m_cameraDescriptions.append(name);
- }
- ::close(fd);
- }
-}
-
-namespace {
- const char* getCodecAlias(const QString &codec)
- {
- if (codec.startsWith("avc1."))
- return "video/x-h264";
-
- if (codec.startsWith("mp4a."))
- return "audio/mpeg4";
-
- if (codec.startsWith("mp4v.20."))
- return "video/mpeg4";
-
- if (codec == "samr")
- return "audio/amr";
-
- return 0;
- }
-
- const char* getMimeTypeAlias(const QString &mimeType)
- {
- if (mimeType == "video/mp4")
- return "video/mpeg4";
-
- if (mimeType == "audio/mp4")
- return "audio/mpeg4";
-
- if (mimeType == "video/ogg"
- || mimeType == "audio/ogg")
- return "application/ogg";
-
- return 0;
- }
-}
-
-QtMultimedia::SupportEstimate QGstreamerServicePlugin::hasSupport(const QString &mimeType,
- const QStringList& codecs) const
-{
- if (m_supportedMimeTypeSet.isEmpty())
- updateSupportedMimeTypes();
-
- QString mimeTypeLowcase = mimeType.toLower();
- bool containsMimeType = m_supportedMimeTypeSet.contains(mimeTypeLowcase);
- if (!containsMimeType) {
- const char* mimeTypeAlias = getMimeTypeAlias(mimeTypeLowcase);
- containsMimeType = m_supportedMimeTypeSet.contains(mimeTypeAlias);
- if (!containsMimeType) {
- containsMimeType = m_supportedMimeTypeSet.contains("video/" + mimeTypeLowcase)
- || m_supportedMimeTypeSet.contains("video/x-" + mimeTypeLowcase)
- || m_supportedMimeTypeSet.contains("audio/" + mimeTypeLowcase)
- || m_supportedMimeTypeSet.contains("audio/x-" + mimeTypeLowcase);
- }
- }
-
- int supportedCodecCount = 0;
- foreach(const QString &codec, codecs) {
- QString codecLowcase = codec.toLower();
- const char* codecAlias = getCodecAlias(codecLowcase);
- if (codecAlias) {
- if (m_supportedMimeTypeSet.contains(codecAlias))
- supportedCodecCount++;
- } else if (m_supportedMimeTypeSet.contains("video/" + codecLowcase)
- || m_supportedMimeTypeSet.contains("video/x-" + codecLowcase)
- || m_supportedMimeTypeSet.contains("audio/" + codecLowcase)
- || m_supportedMimeTypeSet.contains("audio/x-" + codecLowcase)) {
- supportedCodecCount++;
- }
- }
- if (supportedCodecCount > 0 && supportedCodecCount == codecs.size())
- return QtMultimedia::ProbablySupported;
-
- if (supportedCodecCount == 0 && !containsMimeType)
- return QtMultimedia::NotSupported;
-
- return QtMultimedia::MaybeSupported;
-}
-
-void QGstreamerServicePlugin::updateSupportedMimeTypes() const
-{
- //enumerate supported mime types
- gst_init(NULL, NULL);
-
- GList *plugins, *orig_plugins;
- orig_plugins = plugins = gst_default_registry_get_plugin_list ();
-
- while (plugins) {
- GList *features, *orig_features;
-
- GstPlugin *plugin = (GstPlugin *) (plugins->data);
- plugins = g_list_next (plugins);
-
- if (plugin->flags & (1<<1)) //GST_PLUGIN_FLAG_BLACKLISTED
- continue;
-
- orig_features = features = gst_registry_get_feature_list_by_plugin(gst_registry_get_default (),
- plugin->desc.name);
- while (features) {
- if (!G_UNLIKELY(features->data == NULL)) {
- GstPluginFeature *feature = GST_PLUGIN_FEATURE(features->data);
- if (GST_IS_ELEMENT_FACTORY (feature)) {
- GstElementFactory *factory = GST_ELEMENT_FACTORY(gst_plugin_feature_load(feature));
- if (factory
- && factory->numpadtemplates > 0
- && (qstrcmp(factory->details.klass, "Codec/Decoder/Audio") == 0
- || qstrcmp(factory->details.klass, "Codec/Decoder/Video") == 0
- || qstrcmp(factory->details.klass, "Codec/Demux") == 0 )) {
- const GList *pads = factory->staticpadtemplates;
- while (pads) {
- GstStaticPadTemplate *padtemplate = (GstStaticPadTemplate*)(pads->data);
- pads = g_list_next (pads);
- if (padtemplate->direction != GST_PAD_SINK)
- continue;
- if (padtemplate->static_caps.string) {
- GstCaps *caps = gst_static_caps_get(&padtemplate->static_caps);
- if (!gst_caps_is_any (caps) && ! gst_caps_is_empty (caps)) {
- for (guint i = 0; i < gst_caps_get_size(caps); i++) {
- GstStructure *structure = gst_caps_get_structure(caps, i);
- QString nameLowcase = QString(gst_structure_get_name (structure)).toLower();
-
- m_supportedMimeTypeSet.insert(nameLowcase);
- if (nameLowcase.contains("mpeg")) {
- //Because mpeg version number is only included in the detail
- //description, it is necessary to manually extract this information
- //in order to match the mime type of mpeg4.
- const GValue *value = gst_structure_get_value(structure, "mpegversion");
- if (value) {
- gchar *str = gst_value_serialize (value);
- QString versions(str);
- QStringList elements = versions.split(QRegExp("\\D+"), QString::SkipEmptyParts);
- foreach(const QString &e, elements)
- m_supportedMimeTypeSet.insert(nameLowcase + e);
- g_free (str);
- }
- }
- }
- }
- }
- }
- gst_object_unref (factory);
- }
- } else if (GST_IS_TYPE_FIND_FACTORY(feature)) {
- QString name(gst_plugin_feature_get_name(feature));
- if (name.contains('/')) //filter out any string without '/' which is obviously not a mime type
- m_supportedMimeTypeSet.insert(name.toLower());
- }
- }
- features = g_list_next (features);
- }
- gst_plugin_feature_list_free (orig_features);
- }
- gst_plugin_list_free (orig_plugins);
-
-#if defined QT_SUPPORTEDMIMETYPES_DEBUG
- QStringList list = m_supportedMimeTypeSet.toList();
- list.sort();
- if (qgetenv("QT_DEBUG_PLUGINS").toInt() > 0) {
- foreach(const QString &type, list)
- qDebug() << type;
- }
-#endif
-}
-
-QStringList QGstreamerServicePlugin::supportedMimeTypes() const
-{
- return QStringList();
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_gstengine, QGstreamerServicePlugin);
diff --git a/src/plugins/gstreamer/qgstreamerserviceplugin.h b/src/plugins/gstreamer/qgstreamerserviceplugin.h
deleted file mode 100644
index ddb5dc1..0000000
--- a/src/plugins/gstreamer/qgstreamerserviceplugin.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QGSTREAMERSERVICEPLUGIN_H
-#define QGSTREAMERSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include <QtCore/qset.h>
-
-QT_USE_NAMESPACE
-
-
-class QGstreamerServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedDevicesInterface
- , public QMediaServiceFeaturesInterface
- , public QMediaServiceSupportedFormatsInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
- Q_INTERFACES(QMediaServiceSupportedFormatsInterface)
-public:
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
-
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
- QVariant deviceProperty(const QByteArray &service, const QByteArray &device, const QByteArray &property);
-
- QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const;
- QStringList supportedMimeTypes() const;
-
-private:
- void updateDevices() const;
-
- mutable QList<QByteArray> m_cameraDevices;
- mutable QStringList m_cameraDescriptions;
- mutable QSet<QString> m_supportedMimeTypeSet; //for fast access
-
- void updateSupportedMimeTypes() const;
-};
-
-#endif // QGSTREAMERSERVICEPLUGIN_H
diff --git a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp b/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp
deleted file mode 100644
index ec9e9ba..0000000
--- a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideoinputdevicecontrol.h"
-
-#include <QtWidgets/QIcon>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <sys/poll.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-#include <sys/mman.h>
-#include <linux/videodev2.h>
-
-QGstreamerVideoInputDeviceControl::QGstreamerVideoInputDeviceControl(QObject *parent)
- :QVideoDeviceControl(parent), m_selectedDevice(0)
-{
- update();
-}
-
-QGstreamerVideoInputDeviceControl::~QGstreamerVideoInputDeviceControl()
-{
-}
-
-int QGstreamerVideoInputDeviceControl::deviceCount() const
-{
- return m_names.size();
-}
-
-QString QGstreamerVideoInputDeviceControl::deviceName(int index) const
-{
- return m_names[index];
-}
-
-QString QGstreamerVideoInputDeviceControl::deviceDescription(int index) const
-{
- return m_descriptions[index];
-}
-
-QIcon QGstreamerVideoInputDeviceControl::deviceIcon(int index) const
-{
- Q_UNUSED(index);
- return QIcon();
-}
-
-int QGstreamerVideoInputDeviceControl::defaultDevice() const
-{
- return 0;
-}
-
-int QGstreamerVideoInputDeviceControl::selectedDevice() const
-{
- return m_selectedDevice;
-}
-
-
-void QGstreamerVideoInputDeviceControl::setSelectedDevice(int index)
-{
- if (index != m_selectedDevice) {
- m_selectedDevice = index;
- emit selectedDeviceChanged(index);
- emit selectedDeviceChanged(deviceName(index));
- }
-}
-
-
-void QGstreamerVideoInputDeviceControl::update()
-{
- m_names.clear();
- m_descriptions.clear();
-
-#ifdef Q_WS_MAEMO_6
- m_names << QLatin1String("primary") << QLatin1String("secondary");
- m_descriptions << tr("Main camera") << tr("Front camera");
-#else
- QDir devDir("/dev");
- devDir.setFilter(QDir::System);
-
- QFileInfoList entries = devDir.entryInfoList(QStringList() << "video*");
-
- foreach( const QFileInfo &entryInfo, entries ) {
- //qDebug() << "Try" << entryInfo.filePath();
-
- int fd = ::open(entryInfo.filePath().toLatin1().constData(), O_RDWR );
- if (fd == -1)
- continue;
-
- bool isCamera = false;
-
- v4l2_input input;
- memset(&input, 0, sizeof(input));
- for (; ::ioctl(fd, VIDIOC_ENUMINPUT, &input) >= 0; ++input.index) {
- if(input.type == V4L2_INPUT_TYPE_CAMERA || input.type == 0) {
- isCamera = ::ioctl(fd, VIDIOC_S_INPUT, input.index) != 0;
- break;
- }
- }
-
- if (isCamera) {
- // find out its driver "name"
- QString name;
- struct v4l2_capability vcap;
- memset(&vcap, 0, sizeof(struct v4l2_capability));
-
- if (ioctl(fd, VIDIOC_QUERYCAP, &vcap) != 0)
- name = entryInfo.fileName();
- else
- name = QString((const char*)vcap.card);
- //qDebug() << "found camera: " << name;
-
- m_names.append(entryInfo.filePath());
- m_descriptions.append(name);
- }
- ::close(fd);
- }
-#endif
-}
diff --git a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h b/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h
deleted file mode 100644
index cc8129e..0000000
--- a/src/plugins/gstreamer/qgstreamervideoinputdevicecontrol.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOINPUTDEVICECONTROL_H
-#define QGSTREAMERVIDEOINPUTDEVICECONTROL_H
-
-#include <qvideodevicecontrol.h>
-#include <QtCore/qstringlist.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoInputDeviceControl : public QVideoDeviceControl
-{
-Q_OBJECT
-public:
- QGstreamerVideoInputDeviceControl(QObject *parent);
- ~QGstreamerVideoInputDeviceControl();
-
- int deviceCount() const;
-
- QString deviceName(int index) const;
- QString deviceDescription(int index) const;
- QIcon deviceIcon(int index) const;
-
- int defaultDevice() const;
- int selectedDevice() const;
-
-public Q_SLOTS:
- void setSelectedDevice(int index);
-
-private:
- void update();
-
- int m_selectedDevice;
- QStringList m_names;
- QStringList m_descriptions;
-};
-
-#endif // QGSTREAMERAUDIOINPUTDEVICECONTROL_H
diff --git a/src/plugins/gstreamer/qgstreamervideooverlay.cpp b/src/plugins/gstreamer/qgstreamervideooverlay.cpp
deleted file mode 100644
index f19ef6a..0000000
--- a/src/plugins/gstreamer/qgstreamervideooverlay.cpp
+++ /dev/null
@@ -1,232 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideooverlay.h"
-#include <private/qvideosurfacegstsink_p.h>
-
-#include <qvideosurfaceformat.h>
-
-#include <private/qx11videosurface_p.h>
-
-#ifndef QT_NO_XVIDEO
-
-QGstreamerVideoOverlay::QGstreamerVideoOverlay(QObject *parent)
- : QVideoWindowControl(parent)
- , m_surface(new QX11VideoSurface)
- , m_videoSink(reinterpret_cast<GstElement*>(QVideoSurfaceGstSink::createSink(m_surface)))
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(false)
-{
- if (m_videoSink) {
- gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership
- gst_object_sink(GST_OBJECT(m_videoSink));
- }
-
- connect(m_surface, SIGNAL(surfaceFormatChanged(QVideoSurfaceFormat)),
- this, SLOT(surfaceFormatChanged()));
-}
-
-QGstreamerVideoOverlay::~QGstreamerVideoOverlay()
-{
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- delete m_surface;
-}
-
-WId QGstreamerVideoOverlay::winId() const
-{
- return m_surface->winId();
-}
-
-void QGstreamerVideoOverlay::setWinId(WId id)
-{
- bool wasReady = isReady();
- m_surface->setWinId(id);
-
- if (isReady() != wasReady)
- emit readyChanged(!wasReady);
-}
-
-QRect QGstreamerVideoOverlay::displayRect() const
-{
- return m_displayRect;
-}
-
-void QGstreamerVideoOverlay::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-
- setScaledDisplayRect();
-}
-
-Qt::AspectRatioMode QGstreamerVideoOverlay::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QGstreamerVideoOverlay::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
-
- setScaledDisplayRect();
-}
-
-void QGstreamerVideoOverlay::repaint()
-{
-}
-
-int QGstreamerVideoOverlay::brightness() const
-{
- return m_surface->brightness();
-}
-
-void QGstreamerVideoOverlay::setBrightness(int brightness)
-{
- m_surface->setBrightness(brightness);
-
- emit brightnessChanged(m_surface->brightness());
-}
-
-int QGstreamerVideoOverlay::contrast() const
-{
- return m_surface->contrast();
-}
-
-void QGstreamerVideoOverlay::setContrast(int contrast)
-{
- m_surface->setContrast(contrast);
-
- emit contrastChanged(m_surface->contrast());
-}
-
-int QGstreamerVideoOverlay::hue() const
-{
- return m_surface->hue();
-}
-
-void QGstreamerVideoOverlay::setHue(int hue)
-{
- m_surface->setHue(hue);
-
- emit hueChanged(m_surface->hue());
-}
-
-int QGstreamerVideoOverlay::saturation() const
-{
- return m_surface->saturation();
-}
-
-void QGstreamerVideoOverlay::setSaturation(int saturation)
-{
- m_surface->setSaturation(saturation);
-
- emit saturationChanged(m_surface->saturation());
-}
-
-bool QGstreamerVideoOverlay::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void QGstreamerVideoOverlay::setFullScreen(bool fullScreen)
-{
- emit fullScreenChanged(m_fullScreen = fullScreen);
-}
-
-QSize QGstreamerVideoOverlay::nativeSize() const
-{
- return m_surface->surfaceFormat().sizeHint();
-}
-
-QAbstractVideoSurface *QGstreamerVideoOverlay::surface() const
-{
- return m_surface;
-}
-
-GstElement *QGstreamerVideoOverlay::videoSink()
-{
- return m_videoSink;
-}
-
-void QGstreamerVideoOverlay::surfaceFormatChanged()
-{
- setScaledDisplayRect();
-
- emit nativeSizeChanged();
-}
-
-void QGstreamerVideoOverlay::setScaledDisplayRect()
-{
- QRect formatViewport = m_surface->surfaceFormat().viewport();
-
- switch (m_aspectRatioMode) {
- case Qt::KeepAspectRatio:
- {
- QSize size = m_surface->surfaceFormat().sizeHint();
- size.scale(m_displayRect.size(), Qt::KeepAspectRatio);
-
- QRect rect(QPoint(0, 0), size);
- rect.moveCenter(m_displayRect.center());
-
- m_surface->setDisplayRect(rect);
- m_surface->setViewport(formatViewport);
- }
- break;
- case Qt::IgnoreAspectRatio:
- m_surface->setDisplayRect(m_displayRect);
- m_surface->setViewport(formatViewport);
- break;
- case Qt::KeepAspectRatioByExpanding:
- {
- QSize size = m_displayRect.size();
- size.scale(m_surface->surfaceFormat().sizeHint(), Qt::KeepAspectRatio);
-
- QRect viewport(QPoint(0, 0), size);
- viewport.moveCenter(formatViewport.center());
- m_surface->setDisplayRect(m_displayRect);
- m_surface->setViewport(viewport);
- }
- break;
- };
-}
-
-#endif //QT_NO_XVIDEO
diff --git a/src/plugins/gstreamer/qgstreamervideooverlay.h b/src/plugins/gstreamer/qgstreamervideooverlay.h
deleted file mode 100644
index d8c252f..0000000
--- a/src/plugins/gstreamer/qgstreamervideooverlay.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOOVERLAY_H
-#define QGSTREAMERVIDEOOVERLAY_H
-
-#include <qvideowindowcontrol.h>
-
-#include "qgstreamervideorendererinterface.h"
-
-QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-class QX11VideoSurface;
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoOverlay : public QVideoWindowControl, public QGstreamerVideoRendererInterface
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerVideoRendererInterface)
-public:
- QGstreamerVideoOverlay(QObject *parent = 0);
- ~QGstreamerVideoOverlay();
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- void repaint();
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- QAbstractVideoSurface *surface() const;
-
- GstElement *videoSink();
-
- bool isReady() const { return winId() != 0; }
-
-signals:
- void sinkChanged();
- void readyChanged(bool);
-
-private slots:
- void surfaceFormatChanged();
-
-private:
- void setScaledDisplayRect();
-
- QX11VideoSurface *m_surface;
- GstElement *m_videoSink;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- bool m_fullScreen;
-};
-
-#endif //QT_NO_XVIDEO
-
-#endif
diff --git a/src/plugins/gstreamer/qgstreamervideorenderer.cpp b/src/plugins/gstreamer/qgstreamervideorenderer.cpp
deleted file mode 100644
index ead0bdc..0000000
--- a/src/plugins/gstreamer/qgstreamervideorenderer.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideorenderer.h"
-#include <private/qvideosurfacegstsink_p.h>
-#include <qabstractvideosurface.h>
-
-#include <QEvent>
-#include <QtWidgets/QApplication>
-#include <QDebug>
-
-#include <gst/gst.h>
-
-QGstreamerVideoRenderer::QGstreamerVideoRenderer(QObject *parent)
- :QVideoRendererControl(parent),m_videoSink(0), m_surface(0)
-{
-}
-
-QGstreamerVideoRenderer::~QGstreamerVideoRenderer()
-{
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-}
-
-GstElement *QGstreamerVideoRenderer::videoSink()
-{
- if (!m_videoSink && m_surface) {
- m_videoSink = QVideoSurfaceGstSink::createSink(m_surface);
- gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership
- gst_object_sink(GST_OBJECT(m_videoSink));
- }
-
- return reinterpret_cast<GstElement*>(m_videoSink);
-}
-
-
-QAbstractVideoSurface *QGstreamerVideoRenderer::surface() const
-{
- return m_surface;
-}
-
-void QGstreamerVideoRenderer::setSurface(QAbstractVideoSurface *surface)
-{
- if (m_surface != surface) {
- //qDebug() << Q_FUNC_INFO << surface;
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- m_videoSink = 0;
-
- if (m_surface) {
- disconnect(m_surface, SIGNAL(supportedFormatsChanged()),
- this, SLOT(handleFormatChange()));
- }
-
- m_surface = surface;
-
- if (surface && !m_surface)
- emit readyChanged(true);
-
- if (!surface && m_surface)
- emit readyChanged(false);
-
- if (m_surface) {
- connect(m_surface, SIGNAL(supportedFormatsChanged()),
- this, SLOT(handleFormatChange()));
- }
-
- emit sinkChanged();
- }
-}
-
-void QGstreamerVideoRenderer::handleFormatChange()
-{
- //qDebug() << "Supported formats list has changed, reload video output";
-
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- m_videoSink = 0;
- emit sinkChanged();
-}
diff --git a/src/plugins/gstreamer/qgstreamervideorenderer.h b/src/plugins/gstreamer/qgstreamervideorenderer.h
deleted file mode 100644
index fbd76f6..0000000
--- a/src/plugins/gstreamer/qgstreamervideorenderer.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEORENDERER_H
-#define QGSTREAMERVIDEORENDERER_H
-
-#include <qvideorenderercontrol.h>
-#include <private/qvideosurfacegstsink_p.h>
-
-#include "qgstreamervideorendererinterface.h"
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoRenderer : public QVideoRendererControl, public QGstreamerVideoRendererInterface
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerVideoRendererInterface)
-public:
- QGstreamerVideoRenderer(QObject *parent = 0);
- virtual ~QGstreamerVideoRenderer();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- GstElement *videoSink();
-
- bool isReady() const { return m_surface != 0; }
-
-signals:
- void sinkChanged();
- void readyChanged(bool);
-
-private slots:
- void handleFormatChange();
-
-private:
- QVideoSurfaceGstSink *m_videoSink;
- QAbstractVideoSurface *m_surface;
-};
-
-#endif // QGSTREAMERVIDEORENDRER_H
diff --git a/src/plugins/gstreamer/qgstreamervideorendererinterface.cpp b/src/plugins/gstreamer/qgstreamervideorendererinterface.cpp
deleted file mode 100644
index 20ff2ce..0000000
--- a/src/plugins/gstreamer/qgstreamervideorendererinterface.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideorendererinterface.h"
-
-QGstreamerVideoRendererInterface::~QGstreamerVideoRendererInterface()
-{
-}
diff --git a/src/plugins/gstreamer/qgstreamervideorendererinterface.h b/src/plugins/gstreamer/qgstreamervideorendererinterface.h
deleted file mode 100644
index da5107e..0000000
--- a/src/plugins/gstreamer/qgstreamervideorendererinterface.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOOUTPUTCONTROL_H
-#define QGSTREAMERVIDEOOUTPUTCONTROL_H
-
-#include <gst/gst.h>
-
-#include <QtCore/qobject.h>
-
-class QGstreamerVideoRendererInterface
-{
-public:
- virtual ~QGstreamerVideoRendererInterface();
- virtual GstElement *videoSink() = 0;
-
- //stopRenderer() is called when the renderer element is stopped.
- //it can be reimplemented when video renderer can't detect
- //changes to NULL state but has to free video resources.
- virtual void stopRenderer() {}
-
- //the video output is configured, usually after the first paint event
- //(winId is known,
- virtual bool isReady() const { return true; }
-
- //signals:
- //void sinkChanged();
- //void readyChanged(bool);
-};
-
-#define QGstreamerVideoRendererInterface_iid "com.nokia.Qt.QGstreamerVideoRendererInterface/1.0"
-QT_BEGIN_NAMESPACE
-Q_DECLARE_INTERFACE(QGstreamerVideoRendererInterface, QGstreamerVideoRendererInterface_iid)
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/gstreamer/qgstreamervideowidget.cpp b/src/plugins/gstreamer/qgstreamervideowidget.cpp
deleted file mode 100644
index a0fdab7..0000000
--- a/src/plugins/gstreamer/qgstreamervideowidget.cpp
+++ /dev/null
@@ -1,352 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideowidget.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/qapplication.h>
-#include <QtGui/qpainter.h>
-
-#ifdef Q_WS_X11
-# include <X11/Xlib.h>
-#endif
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/propertyprobe.h>
-
-class QGstreamerVideoWidget : public QWidget
-{
-public:
- QGstreamerVideoWidget(QWidget *parent = 0)
- :QWidget(parent)
- {
- setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
- QPalette palette;
- palette.setColor(QPalette::Background, Qt::black);
- setPalette(palette);
- }
-
- virtual ~QGstreamerVideoWidget() {}
-
- QSize sizeHint() const
- {
- return m_nativeSize;
- }
-
- void setNativeSize( const QSize &size)
- {
- if (size != m_nativeSize) {
- m_nativeSize = size;
- if (size.isEmpty())
- setMinimumSize(0,0);
- else
- setMinimumSize(160,120);
-
- updateGeometry();
- }
- }
-
-protected:
- void paintEvent(QPaintEvent *)
- {
- QPainter painter(this);
- painter.fillRect(rect(), palette().background());
- }
-
- QSize m_nativeSize;
-};
-
-QGstreamerVideoWidgetControl::QGstreamerVideoWidgetControl(QObject *parent)
- : QVideoWidgetControl(parent)
- , m_videoSink(0)
- , m_widget(0)
- , m_fullScreen(false)
-{
-}
-
-QGstreamerVideoWidgetControl::~QGstreamerVideoWidgetControl()
-{
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-
- delete m_widget;
-}
-
-void QGstreamerVideoWidgetControl::createVideoWidget()
-{
- if (m_widget)
- return;
-
- m_widget = new QGstreamerVideoWidget;
-
- m_widget->installEventFilter(this);
- m_windowId = m_widget->winId();
-
- m_videoSink = gst_element_factory_make ("xvimagesink", NULL);
- if (m_videoSink) {
- // Check if the xv sink is usable
- if (gst_element_set_state(m_videoSink, GST_STATE_READY) != GST_STATE_CHANGE_SUCCESS) {
- gst_object_unref(GST_OBJECT(m_videoSink));
- m_videoSink = 0;
- } else {
- gst_element_set_state(m_videoSink, GST_STATE_NULL);
-
- g_object_set(G_OBJECT(m_videoSink), "force-aspect-ratio", 1, (const char*)NULL);
- }
- }
-
- if (!m_videoSink)
- m_videoSink = gst_element_factory_make ("ximagesink", NULL);
-
- gst_object_ref (GST_OBJECT (m_videoSink)); //Take ownership
- gst_object_sink (GST_OBJECT (m_videoSink));
-
-
-}
-
-GstElement *QGstreamerVideoWidgetControl::videoSink()
-{
- createVideoWidget();
- return m_videoSink;
-}
-
-bool QGstreamerVideoWidgetControl::eventFilter(QObject *object, QEvent *e)
-{
- if (m_widget && object == m_widget) {
- if (e->type() == QEvent::ParentChange || e->type() == QEvent::Show) {
- WId newWId = m_widget->winId();
- if (newWId != m_windowId) {
- m_windowId = newWId;
- // Even if we have created a winId at this point, other X applications
- // need to be aware of it.
- QApplication::syncX();
- setOverlay();
- }
- }
-
- if (e->type() == QEvent::Show) {
- // Setting these values ensures smooth resizing since it
- // will prevent the system from clearing the background
- m_widget->setAttribute(Qt::WA_NoSystemBackground, true);
- m_widget->setAttribute(Qt::WA_PaintOnScreen, true);
- } else if (e->type() == QEvent::Resize) {
- // This is a workaround for missing background repaints
- // when reducing window size
- windowExposed();
- }
- }
-
- return false;
-}
-
-bool QGstreamerVideoWidgetControl::processSyncMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (gm && (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
- gst_structure_has_name(gm->structure, "prepare-xwindow-id")) {
-
- setOverlay();
- QMetaObject::invokeMethod(this, "updateNativeVideoSize", Qt::QueuedConnection);
- return true;
- }
-
- return false;
-}
-
-bool QGstreamerVideoWidgetControl::processBusMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if (GST_MESSAGE_TYPE(gm) == GST_MESSAGE_STATE_CHANGED &&
- GST_MESSAGE_SRC(gm) == GST_OBJECT_CAST(m_videoSink)) {
- GstState oldState;
- GstState newState;
- gst_message_parse_state_changed(gm, &oldState, &newState, 0);
-
- if (oldState == GST_STATE_READY && newState == GST_STATE_PAUSED)
- updateNativeVideoSize();
- }
-
- return false;
-}
-
-void QGstreamerVideoWidgetControl::setOverlay()
-{
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
- }
-}
-
-void QGstreamerVideoWidgetControl::updateNativeVideoSize()
-{
- if (m_videoSink) {
- //find video native size to update video widget size hint
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
-
- if (caps) {
- m_widget->setNativeSize(QGstUtils::capsCorrectedResolution(caps));
- gst_caps_unref(caps);
- }
- } else {
- if (m_widget)
- m_widget->setNativeSize(QSize());
- }
-}
-
-
-void QGstreamerVideoWidgetControl::windowExposed()
-{
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink))
- gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
-}
-
-QWidget *QGstreamerVideoWidgetControl::videoWidget()
-{
- createVideoWidget();
- return m_widget;
-}
-
-Qt::AspectRatioMode QGstreamerVideoWidgetControl::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QGstreamerVideoWidgetControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- if (m_videoSink) {
- g_object_set(G_OBJECT(m_videoSink),
- "force-aspect-ratio",
- (mode == Qt::KeepAspectRatio),
- (const char*)NULL);
- }
-
- m_aspectRatioMode = mode;
-}
-
-bool QGstreamerVideoWidgetControl::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void QGstreamerVideoWidgetControl::setFullScreen(bool fullScreen)
-{
- emit fullScreenChanged(m_fullScreen = fullScreen);
-}
-
-int QGstreamerVideoWidgetControl::brightness() const
-{
- int brightness = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness"))
- g_object_get(G_OBJECT(m_videoSink), "brightness", &brightness, NULL);
-
- return brightness / 10;
-}
-
-void QGstreamerVideoWidgetControl::setBrightness(int brightness)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness")) {
- g_object_set(G_OBJECT(m_videoSink), "brightness", brightness * 10, NULL);
-
- emit brightnessChanged(brightness);
- }
-}
-
-int QGstreamerVideoWidgetControl::contrast() const
-{
- int contrast = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast"))
- g_object_get(G_OBJECT(m_videoSink), "contrast", &contrast, NULL);
-
- return contrast / 10;
-}
-
-void QGstreamerVideoWidgetControl::setContrast(int contrast)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast")) {
- g_object_set(G_OBJECT(m_videoSink), "contrast", contrast * 10, NULL);
-
- emit contrastChanged(contrast);
- }
-}
-
-int QGstreamerVideoWidgetControl::hue() const
-{
- int hue = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue"))
- g_object_get(G_OBJECT(m_videoSink), "hue", &hue, NULL);
-
- return hue / 10;
-}
-
-void QGstreamerVideoWidgetControl::setHue(int hue)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue")) {
- g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);
-
- emit hueChanged(hue);
- }
-}
-
-int QGstreamerVideoWidgetControl::saturation() const
-{
- int saturation = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation"))
- g_object_get(G_OBJECT(m_videoSink), "saturation", &saturation, NULL);
-
- return saturation / 10;
-}
-
-void QGstreamerVideoWidgetControl::setSaturation(int saturation)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation")) {
- g_object_set(G_OBJECT(m_videoSink), "saturation", saturation * 10, NULL);
-
- emit saturationChanged(saturation);
- }
-}
diff --git a/src/plugins/gstreamer/qgstreamervideowidget.h b/src/plugins/gstreamer/qgstreamervideowidget.h
deleted file mode 100644
index 53069fa..0000000
--- a/src/plugins/gstreamer/qgstreamervideowidget.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOWIDGET_H
-#define QGSTREAMERVIDEOWIDGET_H
-
-#include <qvideowidgetcontrol.h>
-
-#include "qgstreamervideorendererinterface.h"
-#include <private/qgstreamerbushelper_p.h>
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoWidget;
-
-class QGstreamerVideoWidgetControl
- : public QVideoWidgetControl
- , public QGstreamerVideoRendererInterface
- , public QGstreamerSyncMessageFilter
- , public QGstreamerBusMessageFilter
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter QGstreamerBusMessageFilter)
-public:
- QGstreamerVideoWidgetControl(QObject *parent = 0);
- virtual ~QGstreamerVideoWidgetControl();
-
- GstElement *videoSink();
-
- QWidget *videoWidget();
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- void setOverlay();
-
- bool eventFilter(QObject *object, QEvent *event);
- bool processSyncMessage(const QGstreamerMessage &message);
- bool processBusMessage(const QGstreamerMessage &message);
-
-public slots:
- void updateNativeVideoSize();
-
-signals:
- void sinkChanged();
- void readyChanged(bool);
-
-private:
- void createVideoWidget();
- void windowExposed();
-
- GstElement *m_videoSink;
- QGstreamerVideoWidget *m_widget;
- WId m_windowId;
- Qt::AspectRatioMode m_aspectRatioMode;
- bool m_fullScreen;
-};
-
-#endif // QGSTREAMERVIDEOWIDGET_H
diff --git a/src/plugins/gstreamer/qgstreamervideowindow.cpp b/src/plugins/gstreamer/qgstreamervideowindow.cpp
deleted file mode 100644
index 1c475bd..0000000
--- a/src/plugins/gstreamer/qgstreamervideowindow.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qgstreamervideowindow.h"
-#include <private/qgstutils_p.h>
-
-#include <QtCore/qdebug.h>
-
-#include <gst/gst.h>
-#include <gst/interfaces/xoverlay.h>
-#include <gst/interfaces/propertyprobe.h>
-
-
-#ifndef QT_NO_XVIDEO
-
-/*
- QGstreamerVideoWindow is similar to QGstreamerVideoOverlay,
- but uses xvimagesink like gstreamer element instead of QX11VideoSurface.
-
- This allows to use the accelerated elements if available on the target platform,
- but requires at least 0.10.29 gstreamer version
- with gst_x_overlay_set_render_rectangle to set display rect.
-*/
-
-QGstreamerVideoWindow::QGstreamerVideoWindow(QObject *parent, const char *elementName)
- : QVideoWindowControl(parent)
- , m_videoSink(0)
- , m_windowId(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_fullScreen(false)
- , m_colorKey(QColor::Invalid)
-{
- if (elementName)
- m_videoSink = gst_element_factory_make(elementName, NULL);
- else
- m_videoSink = gst_element_factory_make("xvimagesink", NULL);
-
- if (m_videoSink) {
- gst_object_ref(GST_OBJECT(m_videoSink)); //Take ownership
- gst_object_sink(GST_OBJECT(m_videoSink));
-
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);
- }
-}
-
-QGstreamerVideoWindow::~QGstreamerVideoWindow()
-{
- if (m_videoSink)
- gst_object_unref(GST_OBJECT(m_videoSink));
-}
-
-WId QGstreamerVideoWindow::winId() const
-{
- return m_windowId;
-}
-
-void QGstreamerVideoWindow::setWinId(WId id)
-{
- if (m_windowId == id)
- return;
-
- qDebug() << Q_FUNC_INFO << id;
-
- WId oldId = m_windowId;
-
- m_windowId = id;
-
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
- }
-
- if (!oldId)
- emit readyChanged(true);
-
- if (!id)
- emit readyChanged(false);
-}
-
-bool QGstreamerVideoWindow::processSyncMessage(const QGstreamerMessage &message)
-{
- GstMessage* gm = message.rawMessage();
-
- if ((GST_MESSAGE_TYPE(gm) == GST_MESSAGE_ELEMENT) &&
- gst_structure_has_name(gm->structure, "prepare-xwindow-id") &&
- m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
-
- gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(m_videoSink), m_windowId);
-
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- m_bufferProbeId = gst_pad_add_buffer_probe(pad, G_CALLBACK(padBufferProbe), this);
-
- return true;
- }
-
- return false;
-}
-
-QRect QGstreamerVideoWindow::displayRect() const
-{
- return m_displayRect;
-}
-
-void QGstreamerVideoWindow::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
-#if GST_VERSION_MICRO >= 29
- if (m_displayRect.isEmpty())
- gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink), -1, -1, -1, -1);
- else
- gst_x_overlay_set_render_rectangle(GST_X_OVERLAY(m_videoSink),
- m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height());
- repaint();
-#endif
- }
-}
-
-Qt::AspectRatioMode QGstreamerVideoWindow::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QGstreamerVideoWindow::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
-
- if (m_videoSink) {
- g_object_set(G_OBJECT(m_videoSink),
- "force-aspect-ratio",
- (m_aspectRatioMode == Qt::KeepAspectRatio),
- (const char*)NULL);
- }
-}
-
-void QGstreamerVideoWindow::repaint()
-{
- if (m_videoSink && GST_IS_X_OVERLAY(m_videoSink)) {
- //don't call gst_x_overlay_expose if the sink is in null state
- GstState state = GST_STATE_NULL;
- GstStateChangeReturn res = gst_element_get_state(m_videoSink, &state, NULL, 1000000);
- if (res != GST_STATE_CHANGE_FAILURE && state != GST_STATE_NULL) {
- gst_x_overlay_expose(GST_X_OVERLAY(m_videoSink));
- }
- }
-}
-
-QColor QGstreamerVideoWindow::colorKey() const
-{
- if (!m_colorKey.isValid()) {
- gint colorkey = 0;
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "colorkey"))
- g_object_get(G_OBJECT(m_videoSink), "colorkey", &colorkey, NULL);
-
- if (colorkey > 0)
- m_colorKey.setRgb(colorkey);
- }
-
- return m_colorKey;
-}
-
-void QGstreamerVideoWindow::setColorKey(const QColor &color)
-{
- m_colorKey = color;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "colorkey"))
- g_object_set(G_OBJECT(m_videoSink), "colorkey", color.rgba(), NULL);
-}
-
-bool QGstreamerVideoWindow::autopaintColorKey() const
-{
- bool enabled = true;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "autopaint-colorkey"))
- g_object_get(G_OBJECT(m_videoSink), "autopaint-colorkey", &enabled, NULL);
-
- return enabled;
-}
-
-void QGstreamerVideoWindow::setAutopaintColorKey(bool enabled)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "autopaint-colorkey"))
- g_object_set(G_OBJECT(m_videoSink), "autopaint-colorkey", enabled, NULL);
-}
-
-int QGstreamerVideoWindow::brightness() const
-{
- int brightness = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness"))
- g_object_get(G_OBJECT(m_videoSink), "brightness", &brightness, NULL);
-
- return brightness / 10;
-}
-
-void QGstreamerVideoWindow::setBrightness(int brightness)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "brightness")) {
- g_object_set(G_OBJECT(m_videoSink), "brightness", brightness * 10, NULL);
-
- emit brightnessChanged(brightness);
- }
-}
-
-int QGstreamerVideoWindow::contrast() const
-{
- int contrast = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast"))
- g_object_get(G_OBJECT(m_videoSink), "contrast", &contrast, NULL);
-
- return contrast / 10;
-}
-
-void QGstreamerVideoWindow::setContrast(int contrast)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "contrast")) {
- g_object_set(G_OBJECT(m_videoSink), "contrast", contrast * 10, NULL);
-
- emit contrastChanged(contrast);
- }
-}
-
-int QGstreamerVideoWindow::hue() const
-{
- int hue = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue"))
- g_object_get(G_OBJECT(m_videoSink), "hue", &hue, NULL);
-
- return hue / 10;
-}
-
-void QGstreamerVideoWindow::setHue(int hue)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "hue")) {
- g_object_set(G_OBJECT(m_videoSink), "hue", hue * 10, NULL);
-
- emit hueChanged(hue);
- }
-}
-
-int QGstreamerVideoWindow::saturation() const
-{
- int saturation = 0;
-
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation"))
- g_object_get(G_OBJECT(m_videoSink), "saturation", &saturation, NULL);
-
- return saturation / 10;
-}
-
-void QGstreamerVideoWindow::setSaturation(int saturation)
-{
- if (m_videoSink && g_object_class_find_property(G_OBJECT_GET_CLASS(m_videoSink), "saturation")) {
- g_object_set(G_OBJECT(m_videoSink), "saturation", saturation * 10, NULL);
-
- emit saturationChanged(saturation);
- }
-}
-
-bool QGstreamerVideoWindow::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void QGstreamerVideoWindow::setFullScreen(bool fullScreen)
-{
- emit fullScreenChanged(m_fullScreen = fullScreen);
-}
-
-QSize QGstreamerVideoWindow::nativeSize() const
-{
- return m_nativeSize;
-}
-
-void QGstreamerVideoWindow::padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data)
-{
- QGstreamerVideoWindow *control = reinterpret_cast<QGstreamerVideoWindow*>(user_data);
- QMetaObject::invokeMethod(control, "updateNativeVideoSize", Qt::QueuedConnection);
- gst_pad_remove_buffer_probe(pad, control->m_bufferProbeId);
-}
-
-void QGstreamerVideoWindow::updateNativeVideoSize()
-{
- const QSize oldSize = m_nativeSize;
- m_nativeSize = QSize();
-
- if (m_videoSink) {
- //find video native size to update video widget size hint
- GstPad *pad = gst_element_get_static_pad(m_videoSink,"sink");
- GstCaps *caps = gst_pad_get_negotiated_caps(pad);
-
- if (caps) {
- m_nativeSize = QGstUtils::capsCorrectedResolution(caps);
- gst_caps_unref(caps);
- }
- }
-
- if (m_nativeSize != oldSize)
- emit nativeSizeChanged();
-}
-
-GstElement *QGstreamerVideoWindow::videoSink()
-{
- return m_videoSink;
-}
-
-#endif //QT_NO_XVIDEO
diff --git a/src/plugins/gstreamer/qgstreamervideowindow.h b/src/plugins/gstreamer/qgstreamervideowindow.h
deleted file mode 100644
index 2182148..0000000
--- a/src/plugins/gstreamer/qgstreamervideowindow.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QGSTREAMERVIDEOWINDOW_H
-#define QGSTREAMERVIDEOWINDOW_H
-
-#include <qvideowindowcontrol.h>
-
-#include "qgstreamervideorendererinterface.h"
-#include <private/qgstreamerbushelper_p.h>
-
-QT_BEGIN_NAMESPACE
-class QAbstractVideoSurface;
-QT_END_NAMESPACE
-class QX11VideoSurface;
-
-#if defined(Q_WS_X11) && !defined(QT_NO_XVIDEO)
-
-QT_USE_NAMESPACE
-
-class QGstreamerVideoWindow : public QVideoWindowControl,
- public QGstreamerVideoRendererInterface,
- public QGstreamerSyncMessageFilter
-{
- Q_OBJECT
- Q_INTERFACES(QGstreamerVideoRendererInterface QGstreamerSyncMessageFilter)
- Q_PROPERTY(QColor colorKey READ colorKey WRITE setColorKey)
- Q_PROPERTY(bool autopaintColorKey READ autopaintColorKey WRITE setAutopaintColorKey)
-public:
- QGstreamerVideoWindow(QObject *parent = 0, const char *elementName = 0);
- ~QGstreamerVideoWindow();
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- QColor colorKey() const;
- void setColorKey(const QColor &);
-
- bool autopaintColorKey() const;
- void setAutopaintColorKey(bool);
-
- void repaint();
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- QAbstractVideoSurface *surface() const;
-
- GstElement *videoSink();
-
- bool processSyncMessage(const QGstreamerMessage &message);
- bool isReady() const { return m_windowId != 0; }
-
-signals:
- void sinkChanged();
- void readyChanged(bool);
-
-private slots:
- void updateNativeVideoSize();
-
-private:
- static void padBufferProbe(GstPad *pad, GstBuffer *buffer, gpointer user_data);
-
- GstElement *m_videoSink;
- WId m_windowId;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- bool m_fullScreen;
- QSize m_nativeSize;
- mutable QColor m_colorKey;
- int m_bufferProbeId;
-};
-
-#endif //QT_NO_XVIDEO
-
-#endif
diff --git a/src/plugins/gstreamer/qx11videosurface.cpp b/src/plugins/gstreamer/qx11videosurface.cpp
deleted file mode 100644
index f12be3e..0000000
--- a/src/plugins/gstreamer/qx11videosurface.cpp
+++ /dev/null
@@ -1,529 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/qx11info_x11.h>
-#include <qvideosurfaceformat.h>
-
-#ifndef QT_NO_XVIDEO
-
-#include "qx11videosurface.h"
-
-Q_DECLARE_METATYPE(XvImage*);
-
-struct XvFormatRgb
-{
- QVideoFrame::PixelFormat pixelFormat;
- int bits_per_pixel;
- int format;
- int num_planes;
-
- int depth;
- unsigned int red_mask;
- unsigned int green_mask;
- unsigned int blue_mask;
-
-};
-
-bool operator ==(const XvImageFormatValues &format, const XvFormatRgb &rgb)
-{
- return format.type == XvRGB
- && format.bits_per_pixel == rgb.bits_per_pixel
- && format.format == rgb.format
- && format.num_planes == rgb.num_planes
- && format.depth == rgb.depth
- && format.red_mask == rgb.red_mask
- && format.blue_mask == rgb.blue_mask;
-}
-
-static const XvFormatRgb qt_xvRgbLookup[] =
-{
- { QVideoFrame::Format_ARGB32, 32, XvPacked, 1, 32, 0x00FF0000, 0x0000FF00, 0x000000FF },
- { QVideoFrame::Format_RGB32 , 32, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
- { QVideoFrame::Format_RGB24 , 24, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
- { QVideoFrame::Format_RGB565, 16, XvPacked, 1, 16, 0x0000F800, 0x000007E0, 0x0000001F },
- { QVideoFrame::Format_BGRA32, 32, XvPacked, 1, 32, 0xFF000000, 0x00FF0000, 0x0000FF00 },
- { QVideoFrame::Format_BGR32 , 32, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
- { QVideoFrame::Format_BGR24 , 24, XvPacked, 1, 24, 0x00FF0000, 0x0000FF00, 0x000000FF },
- { QVideoFrame::Format_BGR565, 16, XvPacked, 1, 16, 0x0000F800, 0x000007E0, 0x0000001F }
-};
-
-struct XvFormatYuv
-{
- QVideoFrame::PixelFormat pixelFormat;
- int bits_per_pixel;
- int format;
- int num_planes;
-
- unsigned int y_sample_bits;
- unsigned int u_sample_bits;
- unsigned int v_sample_bits;
- unsigned int horz_y_period;
- unsigned int horz_u_period;
- unsigned int horz_v_period;
- unsigned int vert_y_period;
- unsigned int vert_u_period;
- unsigned int vert_v_period;
- char component_order[32];
-};
-
-bool operator ==(const XvImageFormatValues &format, const XvFormatYuv &yuv)
-{
- return format.type == XvYUV
- && format.bits_per_pixel == yuv.bits_per_pixel
- && format.format == yuv.format
- && format.num_planes == yuv.num_planes
- && format.y_sample_bits == yuv.y_sample_bits
- && format.u_sample_bits == yuv.u_sample_bits
- && format.v_sample_bits == yuv.v_sample_bits
- && format.horz_y_period == yuv.horz_y_period
- && format.horz_u_period == yuv.horz_u_period
- && format.horz_v_period == yuv.horz_v_period
- && format.horz_y_period == yuv.vert_y_period
- && format.vert_u_period == yuv.vert_u_period
- && format.vert_v_period == yuv.vert_v_period
- && qstrncmp(format.component_order, yuv.component_order, 32) == 0;
-}
-
-static const XvFormatYuv qt_xvYuvLookup[] =
-{
- { QVideoFrame::Format_YUV444 , 24, XvPacked, 1, 8, 8, 8, 1, 1, 1, 1, 1, 1, "YUV" },
- { QVideoFrame::Format_YUV420P, 12, XvPlanar, 3, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YUV" },
- { QVideoFrame::Format_YV12 , 12, XvPlanar, 3, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU" },
- { QVideoFrame::Format_UYVY , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "UYVY" },
- { QVideoFrame::Format_YUYV , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUY2" },
- { QVideoFrame::Format_YUYV , 16, XvPacked, 1, 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUYV" },
- { QVideoFrame::Format_NV12 , 12, XvPlanar, 2, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YUV" },
- { QVideoFrame::Format_NV12 , 12, XvPlanar, 2, 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU" },
- { QVideoFrame::Format_Y8 , 8 , XvPlanar, 1, 8, 0, 0, 1, 0, 0, 1, 0, 0, "Y" }
-};
-
-QX11VideoSurface::QX11VideoSurface(QObject *parent)
- : QAbstractVideoSurface(parent)
- , m_winId(0)
- , m_portId(0)
- , m_gc(0)
- , m_image(0)
-{
-}
-
-QX11VideoSurface::~QX11VideoSurface()
-{
- if (m_gc)
- XFreeGC(QX11Info::display(), m_gc);
-
- if (m_portId != 0)
- XvUngrabPort(QX11Info::display(), m_portId, 0);
-}
-
-WId QX11VideoSurface::winId() const
-{
- return m_winId;
-}
-
-void QX11VideoSurface::setWinId(WId id)
-{
- //qDebug() << "setWinID:" << id;
-
- if (id == m_winId)
- return;
-
- if (m_image)
- XFree(m_image);
-
- if (m_gc) {
- XFreeGC(QX11Info::display(), m_gc);
- m_gc = 0;
- }
-
- if (m_portId != 0)
- XvUngrabPort(QX11Info::display(), m_portId, 0);
-
- m_supportedPixelFormats.clear();
- m_formatIds.clear();
-
- m_winId = id;
-
- if (m_winId && findPort()) {
- querySupportedFormats();
-
- m_gc = XCreateGC(QX11Info::display(), m_winId, 0, 0);
-
- if (m_image) {
- m_image = 0;
-
- if (!start(surfaceFormat())) {
- QAbstractVideoSurface::stop();
- qWarning() << "Failed to start video surface with format" << surfaceFormat();
- }
- }
- } else {
- qWarning() << "Failed to find XVideo port";
- if (m_image) {
- m_image = 0;
-
- QAbstractVideoSurface::stop();
- }
- }
-
- emit supportedFormatsChanged();
-}
-
-QRect QX11VideoSurface::displayRect() const
-{
- return m_displayRect;
-}
-
-void QX11VideoSurface::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-}
-
-QRect QX11VideoSurface::viewport() const
-{
- return m_viewport;
-}
-
-void QX11VideoSurface::setViewport(const QRect &rect)
-{
- m_viewport = rect;
-}
-
-int QX11VideoSurface::brightness() const
-{
- return getAttribute("XV_BRIGHTNESS", m_brightnessRange.first, m_brightnessRange.second);
-}
-
-void QX11VideoSurface::setBrightness(int brightness)
-{
- setAttribute("XV_BRIGHTNESS", brightness, m_brightnessRange.first, m_brightnessRange.second);
-}
-
-int QX11VideoSurface::contrast() const
-{
- return getAttribute("XV_CONTRAST", m_contrastRange.first, m_contrastRange.second);
-}
-
-void QX11VideoSurface::setContrast(int contrast)
-{
- setAttribute("XV_CONTRAST", contrast, m_contrastRange.first, m_contrastRange.second);
-}
-
-int QX11VideoSurface::hue() const
-{
- return getAttribute("XV_HUE", m_hueRange.first, m_hueRange.second);
-}
-
-void QX11VideoSurface::setHue(int hue)
-{
- setAttribute("XV_HUE", hue, m_hueRange.first, m_hueRange.second);
-}
-
-int QX11VideoSurface::saturation() const
-{
- return getAttribute("XV_SATURATION", m_saturationRange.first, m_saturationRange.second);
-}
-
-void QX11VideoSurface::setSaturation(int saturation)
-{
- setAttribute("XV_SATURATION", saturation, m_saturationRange.first, m_saturationRange.second);
-}
-
-int QX11VideoSurface::getAttribute(const char *attribute, int minimum, int maximum) const
-{
- if (m_portId != 0) {
- Display *display = QX11Info::display();
-
- Atom atom = XInternAtom(display, attribute, True);
-
- int value = 0;
-
- XvGetPortAttribute(display, m_portId, atom, &value);
-
- return redistribute(value, minimum, maximum, -100, 100);
- } else {
- return 0;
- }
-}
-
-void QX11VideoSurface::setAttribute(const char *attribute, int value, int minimum, int maximum)
-{
- if (m_portId != 0) {
- Display *display = QX11Info::display();
-
- Atom atom = XInternAtom(display, attribute, True);
-
- XvSetPortAttribute(
- display, m_portId, atom, redistribute(value, -100, 100, minimum, maximum));
- }
-}
-
-int QX11VideoSurface::redistribute(
- int value, int fromLower, int fromUpper, int toLower, int toUpper)
-{
- return fromUpper != fromLower
- ? ((value - fromLower) * (toUpper - toLower) / (fromUpper - fromLower)) + toLower
- : 0;
-}
-
-QList<QVideoFrame::PixelFormat> QX11VideoSurface::supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType) const
-{
- return handleType == QAbstractVideoBuffer::NoHandle || handleType == QAbstractVideoBuffer::XvShmImageHandle
- ? m_supportedPixelFormats
- : QList<QVideoFrame::PixelFormat>();
-}
-
-bool QX11VideoSurface::start(const QVideoSurfaceFormat &format)
-{
- if (m_image)
- XFree(m_image);
-
- int xvFormatId = 0;
- for (int i = 0; i < m_supportedPixelFormats.count(); ++i) {
- if (m_supportedPixelFormats.at(i) == format.pixelFormat()) {
- xvFormatId = m_formatIds.at(i);
- break;
- }
- }
-
- if (xvFormatId == 0) {
- setError(UnsupportedFormatError);
- } else {
- XvImage *image = XvCreateImage(
- QX11Info::display(),
- m_portId,
- xvFormatId,
- 0,
- format.frameWidth(),
- format.frameHeight());
-
- if (!image) {
- setError(ResourceError);
- } else {
- m_viewport = format.viewport();
- m_image = image;
-
- QVideoSurfaceFormat newFormat = format;
- newFormat.setProperty("portId", QVariant(quint64(m_portId)));
- newFormat.setProperty("xvFormatId", xvFormatId);
- newFormat.setProperty("dataSize", image->data_size);
-
- return QAbstractVideoSurface::start(newFormat);
- }
- }
-
- if (m_image) {
- m_image = 0;
-
- QAbstractVideoSurface::stop();
- }
-
- return false;
-}
-
-void QX11VideoSurface::stop()
-{
- if (m_image) {
- XFree(m_image);
- m_image = 0;
-
- QAbstractVideoSurface::stop();
- }
-}
-
-bool QX11VideoSurface::present(const QVideoFrame &frame)
-{
- if (!m_image) {
- setError(StoppedError);
- return false;
- } else if (m_image->width != frame.width() || m_image->height != frame.height()) {
- setError(IncorrectFormatError);
- return false;
- } else {
- QVideoFrame frameCopy(frame);
-
- if (!frameCopy.map(QAbstractVideoBuffer::ReadOnly)) {
- setError(IncorrectFormatError);
- return false;
- } else {
- bool presented = false;
-
- if (frame.handleType() != QAbstractVideoBuffer::XvShmImageHandle &&
- m_image->data_size > frame.mappedBytes()) {
- qWarning("Insufficient frame buffer size");
- setError(IncorrectFormatError);
- } else if (frame.handleType() != QAbstractVideoBuffer::XvShmImageHandle &&
- m_image->num_planes > 0 &&
- m_image->pitches[0] != frame.bytesPerLine()) {
- qWarning("Incompatible frame pitches");
- setError(IncorrectFormatError);
- } else {
- if (frame.handleType() != QAbstractVideoBuffer::XvShmImageHandle) {
- m_image->data = reinterpret_cast<char *>(frameCopy.bits());
-
- //qDebug() << "copy frame";
- XvPutImage(
- QX11Info::display(),
- m_portId,
- m_winId,
- m_gc,
- m_image,
- m_viewport.x(),
- m_viewport.y(),
- m_viewport.width(),
- m_viewport.height(),
- m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height());
-
- m_image->data = 0;
- } else {
- XvImage *img = frame.handle().value<XvImage*>();
-
- //qDebug() << "render directly";
- if (img)
- XvShmPutImage(
- QX11Info::display(),
- m_portId,
- m_winId,
- m_gc,
- img,
- m_viewport.x(),
- m_viewport.y(),
- m_viewport.width(),
- m_viewport.height(),
- m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height(),
- false);
- }
-
- presented = true;
- }
-
- frameCopy.unmap();
-
- return presented;
- }
- }
-}
-
-bool QX11VideoSurface::findPort()
-{
- unsigned int count = 0;
- XvAdaptorInfo *adaptors = 0;
- bool portFound = false;
-
- if (XvQueryAdaptors(QX11Info::display(), m_winId, &count, &adaptors) == Success) {
- for (unsigned int i = 0; i < count && !portFound; ++i) {
- if (adaptors[i].type & XvImageMask) {
- m_portId = adaptors[i].base_id;
-
- for (unsigned int j = 0; j < adaptors[i].num_ports && !portFound; ++j, ++m_portId)
- portFound = XvGrabPort(QX11Info::display(), m_portId, 0) == Success;
- }
- }
- XvFreeAdaptorInfo(adaptors);
- }
-
- return portFound;
-}
-
-void QX11VideoSurface::querySupportedFormats()
-{
- int count = 0;
- if (XvImageFormatValues *imageFormats = XvListImageFormats(
- QX11Info::display(), m_portId, &count)) {
- const int rgbCount = sizeof(qt_xvRgbLookup) / sizeof(XvFormatRgb);
- const int yuvCount = sizeof(qt_xvYuvLookup) / sizeof(XvFormatYuv);
-
- for (int i = 0; i < count; ++i) {
- switch (imageFormats[i].type) {
- case XvRGB:
- for (int j = 0; j < rgbCount; ++j) {
- if (imageFormats[i] == qt_xvRgbLookup[j]) {
- m_supportedPixelFormats.append(qt_xvRgbLookup[j].pixelFormat);
- m_formatIds.append(imageFormats[i].id);
- break;
- }
- }
- break;
- case XvYUV:
- for (int j = 0; j < yuvCount; ++j) {
- if (imageFormats[i] == qt_xvYuvLookup[j]) {
- m_supportedPixelFormats.append(qt_xvYuvLookup[j].pixelFormat);
- m_formatIds.append(imageFormats[i].id);
- break;
- }
- }
- break;
- }
- }
- XFree(imageFormats);
- }
-
- m_brightnessRange = qMakePair(0, 0);
- m_contrastRange = qMakePair(0, 0);
- m_hueRange = qMakePair(0, 0);
- m_saturationRange = qMakePair(0, 0);
-
- if (XvAttribute *attributes = XvQueryPortAttributes(QX11Info::display(), m_portId, &count)) {
- for (int i = 0; i < count; ++i) {
- if (qstrcmp(attributes[i].name, "XV_BRIGHTNESS") == 0)
- m_brightnessRange = qMakePair(attributes[i].min_value, attributes[i].max_value);
- else if (qstrcmp(attributes[i].name, "XV_CONTRAST") == 0)
- m_contrastRange = qMakePair(attributes[i].min_value, attributes[i].max_value);
- else if (qstrcmp(attributes[i].name, "XV_HUE") == 0)
- m_hueRange = qMakePair(attributes[i].min_value, attributes[i].max_value);
- else if (qstrcmp(attributes[i].name, "XV_SATURATION") == 0)
- m_saturationRange = qMakePair(attributes[i].min_value, attributes[i].max_value);
- }
-
- XFree(attributes);
- }
-}
-
-#endif //QT_NO_XVIDEO
-
diff --git a/src/plugins/gstreamer/qx11videosurface.h b/src/plugins/gstreamer/qx11videosurface.h
deleted file mode 100644
index ecc84e3..0000000
--- a/src/plugins/gstreamer/qx11videosurface.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QX11VIDEOSURFACE_H
-#define QX11VIDEOSURFACE_H
-
-#include <QtWidgets/qwidget.h>
-#include <qabstractvideosurface.h>
-
-#ifndef QT_NO_XVIDEO
-
-#include <X11/Xlib.h>
-#include <X11/extensions/Xv.h>
-#include <X11/extensions/Xvlib.h>
-
-QT_USE_NAMESPACE
-
-class QX11VideoSurface : public QAbstractVideoSurface
-{
- Q_OBJECT
-public:
- QX11VideoSurface(QObject *parent = 0);
- ~QX11VideoSurface();
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- QRect viewport() const;
- void setViewport(const QRect &rect);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- QList<QVideoFrame::PixelFormat> supportedPixelFormats(
- QAbstractVideoBuffer::HandleType handleType = QAbstractVideoBuffer::NoHandle) const;
-
- bool start(const QVideoSurfaceFormat &format);
- void stop();
-
- bool present(const QVideoFrame &frame);
-
-private:
- WId m_winId;
- XvPortID m_portId;
- GC m_gc;
- XvImage *m_image;
- QList<QVideoFrame::PixelFormat> m_supportedPixelFormats;
- QVector<int> m_formatIds;
- QRect m_viewport;
- QRect m_displayRect;
- QPair<int, int> m_brightnessRange;
- QPair<int, int> m_contrastRange;
- QPair<int, int> m_hueRange;
- QPair<int, int> m_saturationRange;
-
- bool findPort();
- void querySupportedFormats();
-
- int getAttribute(const char *attribute, int minimum, int maximum) const;
- void setAttribute(const char *attribute, int value, int minimum, int maximum);
-
- static int redistribute(int value, int fromLower, int fromUpper, int toLower, int toUpper);
-};
-
-#endif //QT_NO_XVIDEO
-
-#endif
diff --git a/src/plugins/m3u/m3u.pro b/src/plugins/m3u/m3u.pro
deleted file mode 100644
index cd73b14..0000000
--- a/src/plugins/m3u/m3u.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-load(qt_module)
-
-TARGET = qtmultimedia_m3u
-QT += multimedia-private
-PLUGIN_TYPE=playlistformats
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-
-HEADERS += qm3uhandler.h
-SOURCES += main.cpp \
- qm3uhandler.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/m3u/main.cpp b/src/plugins/m3u/main.cpp
deleted file mode 100644
index f322001..0000000
--- a/src/plugins/m3u/main.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qm3uhandler.h"
-#include <qstringlist.h>
-
-
-Q_EXPORT_STATIC_PLUGIN(QM3uPlaylistPlugin)
-Q_EXPORT_PLUGIN2(qtmultimedia_m3u, QM3uPlaylistPlugin)
diff --git a/src/plugins/m3u/qm3uhandler.cpp b/src/plugins/m3u/qm3uhandler.cpp
deleted file mode 100644
index f8308cf..0000000
--- a/src/plugins/m3u/qm3uhandler.cpp
+++ /dev/null
@@ -1,237 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qm3uhandler.h"
-#include <qmediaresource.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qfileinfo.h>
-#include <QtCore/qtextstream.h>
-#include <QFile>
-#include <QUrl>
-
-
-class QM3uPlaylistReader : public QMediaPlaylistReader
-{
-public:
- QM3uPlaylistReader(QIODevice *device)
- :m_ownDevice(false), m_device(device), m_textStream(new QTextStream(m_device))
- {
- readItem();
- }
-
- QM3uPlaylistReader(const QUrl& location)
- :m_location(location), m_ownDevice(true)
- {
- QFile *f = new QFile(location.toLocalFile());
- if (f->open(QIODevice::ReadOnly | QIODevice::Text)) {
- m_device = f;
- m_textStream = new QTextStream(m_device);
- readItem();
- } else {
- delete f;
- m_device = 0;
- m_textStream = 0;
- }
- }
-
- virtual ~QM3uPlaylistReader()
- {
- if (m_ownDevice) {
- delete m_device;
- }
- delete m_textStream;
- }
-
- virtual bool atEnd() const
- {
- //we can't just use m_textStream->atEnd(),
- //for files with empty lines/comments at end
- return nextResource.isNull();
- }
-
- virtual QMediaContent readItem()
- {
- QMediaContent item;
- if (!nextResource.isNull())
- item = QMediaContent(nextResource);
-
- nextResource = QMediaContent();
-
- while (m_textStream && !m_textStream->atEnd()) {
- QString line = m_textStream->readLine().trimmed();
- if (line.isEmpty() || line[0] == '#' || line.size() > 4096)
- continue;
-
- QUrl fileUrl = QUrl::fromLocalFile(line);
- QUrl url(line);
-
- //m3u may contain url encoded entries or absolute/relative file names
- //prefer existing file if any
- QList<QUrl> candidates;
- if (!m_location.isEmpty()) {
- candidates << m_location.resolved(fileUrl);
- candidates << m_location.resolved(url);
- }
- candidates << fileUrl;
- candidates << url;
-
- foreach (const QUrl &candidate, candidates) {
- if (QFile::exists(candidate.toLocalFile())) {
- nextResource = candidate;
- break;
- }
- }
-
- if (nextResource.isNull()) {
- //assume the relative urls are file names, not encoded urls if m3u is local file
- if (!m_location.isEmpty() && url.isRelative()) {
- if (m_location.scheme() == QLatin1String("file"))
- nextResource = m_location.resolved(fileUrl);
- else
- nextResource = m_location.resolved(url);
- } else {
- nextResource = QMediaContent(QUrl::fromUserInput(line));
- }
- }
-
- break;
- }
-
- return item;
- }
-
- virtual void close()
- {
- }
-
-private:
- QUrl m_location;
- bool m_ownDevice;
- QIODevice *m_device;
- QTextStream *m_textStream;
- QMediaContent nextResource;
-};
-
-class QM3uPlaylistWriter : public QMediaPlaylistWriter
-{
-public:
- QM3uPlaylistWriter(QIODevice *device)
- :m_device(device), m_textStream(new QTextStream(m_device))
- {
- }
-
- virtual ~QM3uPlaylistWriter()
- {
- delete m_textStream;
- }
-
- virtual bool writeItem(const QMediaContent& item)
- {
- *m_textStream << item.canonicalUrl().toString() << endl;
- return true;
- }
-
- virtual void close()
- {
- }
-
-private:
- QIODevice *m_device;
- QTextStream *m_textStream;
-};
-
-
-QM3uPlaylistPlugin::QM3uPlaylistPlugin(QObject *parent)
- :QMediaPlaylistIOPlugin(parent)
-{
-}
-
-QM3uPlaylistPlugin::~QM3uPlaylistPlugin()
-{
-}
-
-bool QM3uPlaylistPlugin::canRead(QIODevice *device, const QByteArray &format) const
-{
- return device->isReadable() && (format == "m3u" || format.isEmpty());
-}
-
-bool QM3uPlaylistPlugin::canRead(const QUrl& location, const QByteArray &format) const
-{
- if (!QFileInfo(location.toLocalFile()).isReadable())
- return false;
-
- if (format == "m3u")
- return true;
-
- if (!format.isEmpty())
- return false;
- else
- return location.toLocalFile().toLower().endsWith(QLatin1String("m3u"));
-}
-
-bool QM3uPlaylistPlugin::canWrite(QIODevice *device, const QByteArray &format) const
-{
- return device->isOpen() && device->isWritable() && format == "m3u";
-}
-
-QStringList QM3uPlaylistPlugin::keys() const
-{
- return QStringList() << QLatin1String("m3u");
-}
-
-QMediaPlaylistReader *QM3uPlaylistPlugin::createReader(QIODevice *device, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistReader(device);
-}
-
-QMediaPlaylistReader *QM3uPlaylistPlugin::createReader(const QUrl& location, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistReader(location);
-}
-
-QMediaPlaylistWriter *QM3uPlaylistPlugin::createWriter(QIODevice *device, const QByteArray &format)
-{
- Q_UNUSED(format);
- return new QM3uPlaylistWriter(device);
-}
-
diff --git a/src/plugins/m3u/qm3uhandler.h b/src/plugins/m3u/qm3uhandler.h
deleted file mode 100644
index 5e9f0dd..0000000
--- a/src/plugins/m3u/qm3uhandler.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QM3UHANDLER_H
-#define QM3UHANDLER_H
-
-#include "qmediaplaylistioplugin.h"
-#include <QObject>
-
-QT_USE_NAMESPACE
-
-class QM3uPlaylistPlugin : public QMediaPlaylistIOPlugin
-{
-Q_OBJECT
-public:
- explicit QM3uPlaylistPlugin(QObject *parent = 0);
- virtual ~QM3uPlaylistPlugin();
-
- virtual bool canRead(QIODevice *device, const QByteArray &format = QByteArray() ) const;
- virtual bool canRead(const QUrl& location, const QByteArray &format = QByteArray()) const;
-
- virtual bool canWrite(QIODevice *device, const QByteArray &format) const;
-
- virtual QStringList keys() const;
-
- virtual QMediaPlaylistReader *createReader(QIODevice *device, const QByteArray &format = QByteArray());
- virtual QMediaPlaylistReader *createReader(const QUrl& location, const QByteArray &format = QByteArray());
-
- virtual QMediaPlaylistWriter *createWriter(QIODevice *device, const QByteArray &format);
-};
-
-#endif // QM3UHANDLER_H
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
deleted file mode 100644
index 8f12a13..0000000
--- a/src/plugins/plugins.pro
+++ /dev/null
@@ -1,41 +0,0 @@
-######################################################################
-#
-# QtMultimedia
-#
-######################################################################
-
-TEMPLATE = subdirs
-
-SUBDIRS += m3u
-
-win32 {
- SUBDIRS += audiocapture
-}
-
-win32 {
- contains(config_test_directshow, yes): SUBDIRS += directshow
- contains(config_test_wmf, yes) : SUBDIRS += wmf
-}
-
-simulator: SUBDIRS += simulator
-
-unix:!mac {
- contains(config_test_gstreamer, yes) {
- SUBDIRS += gstreamer
- } else {
- SUBDIRS += audiocapture
- }
-
- # v4l is turned off because it is not supported in Qt 5
- # !maemo*:SUBDIRS += v4l
-
- contains(config_test_pulseaudio, yes) {
- SUBDIRS += pulseaudio
- }
-}
-
-mac:!simulator {
- SUBDIRS += audiocapture
- SUBDIRS += qt7
-}
-
diff --git a/src/plugins/pulseaudio/pulseaudio.pro b/src/plugins/pulseaudio/pulseaudio.pro
deleted file mode 100644
index 9b786b4..0000000
--- a/src/plugins/pulseaudio/pulseaudio.pro
+++ /dev/null
@@ -1,29 +0,0 @@
-load(qt_module)
-
-TARGET = qtmedia_pulse
-QT += multimedia-private
-PLUGIN_TYPE = audio
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-CONFIG += link_pkgconfig
-PKGCONFIG += libpulse
-
-# Input
-HEADERS += qpulseaudioplugin.h \
- qaudiodeviceinfo_pulse.h \
- qaudiooutput_pulse.h \
- qaudioinput_pulse.h \
- qpulseaudioengine.h \
- qpulsehelpers.h
-
-SOURCES += qpulseaudioplugin.cpp \
- qaudiodeviceinfo_pulse.cpp \
- qaudiooutput_pulse.cpp \
- qaudioinput_pulse.cpp \
- qpulseaudioengine.cpp \
- qpulsehelpers.cpp
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.cpp b/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.cpp
deleted file mode 100644
index 129bbde..0000000
--- a/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qaudiodeviceinfo_pulse.h"
-#include "qpulseaudioengine.h"
-#include "qpulsehelpers.h"
-
-QT_BEGIN_NAMESPACE
-
-QPulseAudioDeviceInfo::QPulseAudioDeviceInfo(const QByteArray &device, QAudio::Mode mode)
- : m_device(device)
- , m_mode(mode)
-{
-}
-
-bool QPulseAudioDeviceInfo::isFormatSupported(const QAudioFormat &format) const
-{
- pa_sample_spec spec = QPulseAudioInternal::audioFormatToSampleSpec(format);
- if (!pa_sample_spec_valid(&spec))
- return false;
-
- return true;
-}
-
-QAudioFormat QPulseAudioDeviceInfo::preferredFormat() const
-{
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- QAudioFormat format = pulseEngine->m_preferredFormats.value(m_device);
- return format;
-}
-
-QString QPulseAudioDeviceInfo::deviceName() const
-{
- return m_device;
-}
-
-QStringList QPulseAudioDeviceInfo::supportedCodecs()
-{
- return QStringList() << "audio/pcm";
-}
-
-QList<int> QPulseAudioDeviceInfo::supportedSampleRates()
-{
- return QList<int>() << 8000 << 11025 << 22050 << 44100 << 48000;
-}
-
-QList<int> QPulseAudioDeviceInfo::supportedChannelCounts()
-{
- return QList<int>() << 1 << 2 << 4 << 6 << 8;
-}
-
-QList<int> QPulseAudioDeviceInfo::supportedSampleSizes()
-{
- return QList<int>() << 8 << 16 << 24 << 32;
-}
-
-QList<QAudioFormat::Endian> QPulseAudioDeviceInfo::supportedByteOrders()
-{
- return QList<QAudioFormat::Endian>() << QAudioFormat::BigEndian << QAudioFormat::LittleEndian;
-}
-
-QList<QAudioFormat::SampleType> QPulseAudioDeviceInfo::supportedSampleTypes()
-{
- return QList<QAudioFormat::SampleType>() << QAudioFormat::SignedInt << QAudioFormat::UnSignedInt << QAudioFormat::Float;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.h b/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.h
deleted file mode 100644
index 4e3f310..0000000
--- a/src/plugins/pulseaudio/qaudiodeviceinfo_pulse.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIODEVICEINFOPULSE_H
-#define QAUDIODEVICEINFOPULSE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qbytearray.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qlist.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-QT_BEGIN_NAMESPACE
-
-class QPulseAudioDeviceInfo : public QAbstractAudioDeviceInfo
-{
- Q_OBJECT
-
-public:
- QPulseAudioDeviceInfo(const QByteArray &device, QAudio::Mode mode);
- ~QPulseAudioDeviceInfo() {}
-
- QAudioFormat preferredFormat() const;
- bool isFormatSupported(const QAudioFormat &format) const;
- QString deviceName() const;
- QStringList supportedCodecs();
- QList<int> supportedSampleRates();
- QList<int> supportedChannelCounts();
- QList<int> supportedSampleSizes();
- QList<QAudioFormat::Endian> supportedByteOrders();
- QList<QAudioFormat::SampleType> supportedSampleTypes();
-
-private:
- QByteArray m_device;
- QAudio::Mode m_mode;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/plugins/pulseaudio/qaudioinput_pulse.cpp b/src/plugins/pulseaudio/qaudioinput_pulse.cpp
deleted file mode 100644
index d2ee316..0000000
--- a/src/plugins/pulseaudio/qaudioinput_pulse.cpp
+++ /dev/null
@@ -1,600 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qdebug.h>
-
-#include "qaudioinput_pulse.h"
-#include "qaudiodeviceinfo_pulse.h"
-#include "qpulseaudioengine.h"
-#include "qpulsehelpers.h"
-
-QT_BEGIN_NAMESPACE
-
-const int PeriodTimeMs = 50;
-
-static void inputStreamReadCallback(pa_stream *stream, size_t length, void *userdata)
-{
- Q_UNUSED(userdata);
- Q_UNUSED(length);
- Q_UNUSED(stream);
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-static void inputStreamStateCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(userdata);
- pa_stream_state_t state = pa_stream_get_state(stream);
-#ifdef DEBUG_PULSE
- qDebug() << "Stream state: " << QPulseAudioInternal::stateToQString(state);
-#endif
- switch (state) {
- case PA_STREAM_CREATING:
- break;
- case PA_STREAM_READY: {
-#ifdef DEBUG_PULSE
- QPulseAudioInput *audioInput = static_cast<QPulseAudioInput*>(userdata);
- const pa_buffer_attr *buffer_attr = pa_stream_get_buffer_attr(stream);
- qDebug() << "*** maxlength: " << buffer_attr->maxlength;
- qDebug() << "*** prebuf: " << buffer_attr->prebuf;
- qDebug() << "*** fragsize: " << buffer_attr->fragsize;
- qDebug() << "*** minreq: " << buffer_attr->minreq;
- qDebug() << "*** tlength: " << buffer_attr->tlength;
-
- pa_sample_spec spec = QPulseAudioInternal::audioFormatToSampleSpec(audioInput->format());
- qDebug() << "*** bytes_to_usec: " << pa_bytes_to_usec(buffer_attr->fragsize, &spec);
-#endif
- }
- break;
- case PA_STREAM_TERMINATED:
- break;
- case PA_STREAM_FAILED:
- default:
- qWarning() << QString("Stream error: %1").arg(pa_strerror(pa_context_errno(pa_stream_get_context(stream))));
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
- break;
- }
-}
-
-static void inputStreamUnderflowCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(userdata)
- Q_UNUSED(stream)
- qWarning() << "Got a buffer underflow!";
-}
-
-static void inputStreamOverflowCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(stream)
- Q_UNUSED(userdata)
- qWarning() << "Got a buffer overflow!";
-}
-
-static void inputStreamSuccessCallback(pa_stream *stream, int success, void *userdata)
-{
- Q_UNUSED(stream);
- Q_UNUSED(userdata);
- Q_UNUSED(success);
-
- //if (!success)
- //TODO: Is cork success? i->operation_success = success;
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-QPulseAudioInput::QPulseAudioInput(const QByteArray &device)
- : m_totalTimeValue(0)
- , m_audioSource(0)
- , m_errorState(QAudio::NoError)
- , m_deviceState(QAudio::StoppedState)
- , m_pullMode(true)
- , m_opened(false)
- , m_bytesAvailable(0)
- , m_bufferSize(0)
- , m_periodSize(0)
- , m_intervalTime(1000)
- , m_stream(0)
- , m_device(device)
-{
- m_timer = new QTimer(this);
- connect(m_timer, SIGNAL(timeout()), SLOT(userFeed()));
-}
-
-QPulseAudioInput::~QPulseAudioInput()
-{
- close();
- disconnect(m_timer, SIGNAL(timeout()));
- QCoreApplication::processEvents();
- delete m_timer;
-}
-
-QAudio::Error QPulseAudioInput::error() const
-{
- return m_errorState;
-}
-
-QAudio::State QPulseAudioInput::state() const
-{
- return m_deviceState;
-}
-
-void QPulseAudioInput::setFormat(const QAudioFormat &format)
-{
- if (m_deviceState == QAudio::StoppedState)
- m_format = format;
-}
-
-QAudioFormat QPulseAudioInput::format() const
-{
- return m_format;
-}
-
-void QPulseAudioInput::start(QIODevice *device)
-{
- if (m_deviceState != QAudio::StoppedState)
- close();
-
- if (!m_pullMode && m_audioSource)
- delete m_audioSource;
-
- m_pullMode = true;
- m_audioSource = device;
-
- m_deviceState = QAudio::ActiveState;
-
- if (!open())
- return;
-
- emit stateChanged(m_deviceState);
-}
-
-QIODevice *QPulseAudioInput::start()
-{
- if (m_deviceState != 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);
-
- m_deviceState = QAudio::IdleState;
-
- if (!open())
- return 0;
-
- emit stateChanged(m_deviceState);
-
- return m_audioSource;
-}
-
-void QPulseAudioInput::stop()
-{
- if (m_deviceState == QAudio::StoppedState)
- return;
-
- m_errorState = QAudio::NoError;
- m_deviceState = QAudio::StoppedState;
-
- close();
- emit stateChanged(m_deviceState);
-}
-
-bool QPulseAudioInput::open()
-{
- if (m_opened)
- return false;
-
-#ifdef DEBUG_PULSE
-// QTime now(QTime::currentTime());
-// qDebug()<<now.second()<<"s "<<now.msec()<<"ms :open()";
-#endif
- m_clockStamp.restart();
- m_timeStamp.restart();
- m_elapsedTimeOffset = 0;
-
- if (m_streamName.isNull())
- m_streamName = QString(QLatin1String("QtmPulseStream-%1-%2")).arg(::getpid()).arg(quintptr(this)).toUtf8();
-
- pa_sample_spec spec = QPulseAudioInternal::audioFormatToSampleSpec(m_format);
-
- if (!pa_sample_spec_valid(&spec)) {
- m_errorState = QAudio::OpenError;
- m_deviceState = QAudio::StoppedState;
- emit stateChanged(m_deviceState);
- return false;
- }
-
-#ifdef DEBUG_PULSE
- qDebug() << "Format: " << QPulseAudioInternal::sampleFormatToQString(spec.format);
- qDebug() << "Rate: " << spec.rate;
- qDebug() << "Channels: " << spec.channels;
- qDebug() << "Frame size: " << pa_frame_size(&spec);
-#endif
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- pa_channel_map channel_map;
-
- pa_channel_map_init_extend(&channel_map, spec.channels, PA_CHANNEL_MAP_DEFAULT);
-
- if (!pa_channel_map_compatible(&channel_map, &spec)) {
- qWarning() << "Channel map doesn't match sample specification!";
- }
-
- m_stream = pa_stream_new(pulseEngine->context(), m_streamName.constData(), &spec, &channel_map);
-
- pa_stream_set_state_callback(m_stream, inputStreamStateCallback, this);
- pa_stream_set_read_callback(m_stream, inputStreamReadCallback, this);
-
- pa_stream_set_underflow_callback(m_stream, inputStreamUnderflowCallback, this);
- pa_stream_set_overflow_callback(m_stream, inputStreamOverflowCallback, this);
-
- m_periodSize = pa_usec_to_bytes(PeriodTimeMs*1000, &spec);
-
- int flags = 0;
- pa_buffer_attr buffer_attr;
- buffer_attr.maxlength = (uint32_t) -1;
- buffer_attr.prebuf = (uint32_t) -1;
- buffer_attr.tlength = (uint32_t) -1;
- buffer_attr.minreq = (uint32_t) -1;
- flags |= PA_STREAM_ADJUST_LATENCY;
-
- if (m_bufferSize > 0)
- buffer_attr.fragsize = (uint32_t) m_bufferSize;
- else
- buffer_attr.fragsize = (uint32_t) m_periodSize;
-
- if (pa_stream_connect_record(m_stream, m_device.data(), &buffer_attr, (pa_stream_flags_t)flags) < 0) {
- qWarning() << "pa_stream_connect_record() failed!";
- m_errorState = QAudio::FatalError;
- return false;
- }
-
- while (pa_stream_get_state(m_stream) != PA_STREAM_READY) {
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
- }
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
- m_opened = true;
- m_periodSize = pa_usec_to_bytes(PeriodTimeMs*1000, &spec);
- m_timer->start(PeriodTimeMs);
- m_errorState = QAudio::NoError;
-
- m_totalTimeValue = 0;
-
- return true;
-}
-
-void QPulseAudioInput::close()
-{
- m_timer->stop();
-
- if (m_stream) {
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
-
- pa_stream_set_read_callback(m_stream, 0, 0);
-
- pa_stream_disconnect(m_stream);
- pa_stream_unref(m_stream);
- m_stream = 0;
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- }
-
- if (!m_pullMode && m_audioSource) {
- delete m_audioSource;
- m_audioSource = 0;
- }
- m_opened = false;
-}
-
-int QPulseAudioInput::checkBytesReady()
-{
- if (m_deviceState != QAudio::ActiveState && m_deviceState != QAudio::IdleState) {
- m_bytesAvailable = 0;
- } else {
- m_bytesAvailable = pa_stream_readable_size(m_stream);
- }
-
- return m_bytesAvailable;
-}
-
-int QPulseAudioInput::bytesReady() const
-{
- return qMax(m_bytesAvailable, 0);
-}
-
-qint64 QPulseAudioInput::read(char *data, qint64 len)
-{
- m_bytesAvailable = checkBytesReady();
-
- if (m_deviceState != QAudio::ActiveState) {
- m_errorState = QAudio::NoError;
- m_deviceState = QAudio::ActiveState;
- emit stateChanged(m_deviceState);
- }
-
- int readBytes = 0;
-
- if (!m_pullMode && !m_tempBuffer.isEmpty()) {
- readBytes = qMin(static_cast<int>(len), m_tempBuffer.size());
- memcpy(data, m_tempBuffer.constData(), readBytes);
- m_totalTimeValue += readBytes;
-
- if (readBytes < m_tempBuffer.size()) {
- m_tempBuffer.remove(0, readBytes);
- return readBytes;
- }
-
- m_tempBuffer.clear();
- }
-
- while (pa_stream_readable_size(m_stream) > 0) {
- size_t readLength = 0;
-
-#ifdef DEBUG_PULSE
- qDebug() << "QPulseAudioInput::read -- " << pa_stream_readable_size(m_stream) << " bytes available from pulse audio";
-#endif
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- const void *audioBuffer;
-
- // Second and third parameters (audioBuffer and length) to pa_stream_peek are output parameters,
- // the audioBuffer pointer is set to point to the actual pulse audio data,
- // and the length is set to the length of this data.
- if (pa_stream_peek(m_stream, &audioBuffer, &readLength) < 0) {
- qWarning() << QString("pa_stream_peek() failed: %1").arg(pa_strerror(pa_context_errno(pa_stream_get_context(m_stream))));
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- return 0;
- }
-
- qint64 actualLength = 0;
- if (m_pullMode) {
- actualLength = m_audioSource->write(static_cast<const char *>(audioBuffer), readLength);
-
- if (actualLength < readLength) {
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
- m_errorState = QAudio::UnderrunError;
- m_deviceState = QAudio::IdleState;
- emit stateChanged(m_deviceState);
-
- return actualLength;
- }
- } else {
- actualLength = qMin(static_cast<int>(len - readBytes), static_cast<int>(readLength));
- memcpy(data + readBytes, audioBuffer, actualLength);
- }
-
-#ifdef DEBUG_PULSE
- qDebug() << "QPulseAudioInput::read -- wrote " << actualLength << " to client";
-#endif
-
- if (actualLength < readLength) {
-#ifdef DEBUG_PULSE
- qDebug() << "QPulseAudioInput::read -- appending " << readLength - actualLength << " bytes of data to temp buffer";
-#endif
- m_tempBuffer.append(static_cast<const char *>(audioBuffer) + actualLength, readLength - actualLength);
- QMetaObject::invokeMethod(this, "userFeed", Qt::QueuedConnection);
- }
-
- m_totalTimeValue += actualLength;
- readBytes += actualLength;
-
- pa_stream_drop(m_stream);
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
- if (!m_pullMode && readBytes >= len)
- break;
- }
-
-#ifdef DEBUG_PULSE
- qDebug() << "QPulseAudioInput::read -- returning after reading " << readBytes << " bytes";
-#endif
-
- return readBytes;
-}
-
-void QPulseAudioInput::resume()
-{
- if (m_deviceState == QAudio::SuspendedState || m_deviceState == QAudio::IdleState) {
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
-
- operation = pa_stream_cork(m_stream, 0, inputStreamSuccessCallback, 0);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
- m_timer->start(PeriodTimeMs);
-
- m_deviceState = QAudio::ActiveState;
-
- emit stateChanged(m_deviceState);
- }
-}
-
-void QPulseAudioInput::setBufferSize(int value)
-{
- m_bufferSize = value;
-}
-
-int QPulseAudioInput::bufferSize() const
-{
- return m_bufferSize;
-}
-
-int QPulseAudioInput::periodSize() const
-{
- return m_periodSize;
-}
-
-void QPulseAudioInput::setNotifyInterval(int ms)
-{
- m_intervalTime = qMax(0, ms);
-}
-
-int QPulseAudioInput::notifyInterval() const
-{
- return m_intervalTime;
-}
-
-qint64 QPulseAudioInput::processedUSecs() const
-{
- pa_sample_spec spec = QPulseAudioInternal::audioFormatToSampleSpec(m_format);
- qint64 result = pa_bytes_to_usec(m_totalTimeValue, &spec);
-
- return result;
-}
-
-void QPulseAudioInput::suspend()
-{
- if (m_deviceState == QAudio::ActiveState) {
- m_timer->stop();
- m_deviceState = QAudio::SuspendedState;
- emit stateChanged(m_deviceState);
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
-
- operation = pa_stream_cork(m_stream, 1, inputStreamSuccessCallback, 0);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- }
-}
-
-void QPulseAudioInput::userFeed()
-{
- if (m_deviceState == QAudio::StoppedState || m_deviceState == QAudio::SuspendedState)
- return;
-#ifdef DEBUG_PULSE
-// QTime now(QTime::currentTime());
-// qDebug()<< now.second() << "s " << now.msec() << "ms :userFeed() IN";
-#endif
- deviceReady();
-}
-
-bool QPulseAudioInput::deviceReady()
-{
- if (m_pullMode) {
- // reads some audio data and writes it to QIODevice
- read(0,0);
- } else {
- // emits readyRead() so user will call read() on QIODevice to get some audio data
- if (m_audioSource != 0) {
- InputPrivate *a = qobject_cast<InputPrivate*>(m_audioSource);
- a->trigger();
- }
- }
- m_bytesAvailable = checkBytesReady();
-
- if (m_deviceState != 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;
-}
-
-qint64 QPulseAudioInput::elapsedUSecs() const
-{
- if (m_deviceState == QAudio::StoppedState)
- return 0;
-
- return m_clockStamp.elapsed() * 1000;
-}
-
-void QPulseAudioInput::reset()
-{
- stop();
- m_bytesAvailable = 0;
-}
-
-InputPrivate::InputPrivate(QPulseAudioInput *audio)
-{
- m_audioDevice = qobject_cast<QPulseAudioInput*>(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
-
-#include "moc_qaudioinput_pulse.cpp"
diff --git a/src/plugins/pulseaudio/qaudioinput_pulse.h b/src/plugins/pulseaudio/qaudioinput_pulse.h
deleted file mode 100644
index f03e419..0000000
--- a/src/plugins/pulseaudio/qaudioinput_pulse.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists for the convenience
-// of other Qt classes. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#ifndef QAUDIOINPUTPULSE_H
-#define QAUDIOINPUTPULSE_H
-
-#include <QtCore/qfile.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-#include <pulse/pulseaudio.h>
-
-QT_BEGIN_NAMESPACE
-
-class InputPrivate;
-
-class QPulseAudioInput : public QAbstractAudioInput
-{
- Q_OBJECT
-
-public:
- QPulseAudioInput(const QByteArray &device);
- ~QPulseAudioInput();
-
- qint64 read(char *data, qint64 len);
-
- void start(QIODevice *device);
- QIODevice *start();
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesReady() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- void setFormat(const QAudioFormat &format);
- QAudioFormat format() const;
-
- qint64 m_totalTimeValue;
- QIODevice *m_audioSource;
- QAudioFormat m_format;
- QAudio::Error m_errorState;
- QAudio::State m_deviceState;
-
-private slots:
- void userFeed();
- bool deviceReady();
-
-private:
- int checkBytesReady();
- bool open();
- void close();
-
- bool m_pullMode;
- bool m_opened;
- int m_bytesAvailable;
- int m_bufferSize;
- int m_periodSize;
- int m_intervalTime;
- unsigned int m_bufferTime;
- unsigned int m_periodTime;
- QTimer *m_timer;
- qint64 m_elapsedTimeOffset;
- char *audioBuffer;
- pa_stream *m_stream;
- QTime m_timeStamp;
- QTime m_clockStamp;
- QByteArray m_streamName;
- QByteArray m_device;
- QByteArray m_tempBuffer;
-};
-
-class InputPrivate : public QIODevice
-{
- Q_OBJECT
-public:
- InputPrivate(QPulseAudioInput *audio);
- ~InputPrivate() {};
-
- qint64 readData(char *data, qint64 len);
- qint64 writeData(const char *data, qint64 len);
-
- void trigger();
-
-private:
- QPulseAudioInput *m_audioDevice;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/pulseaudio/qaudiooutput_pulse.cpp b/src/plugins/pulseaudio/qaudiooutput_pulse.cpp
deleted file mode 100644
index b638d07..0000000
--- a/src/plugins/pulseaudio/qaudiooutput_pulse.cpp
+++ /dev/null
@@ -1,621 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qmath.h>
-
-#include "qaudiooutput_pulse.h"
-#include "qaudiodeviceinfo_pulse.h"
-#include "qpulseaudioengine.h"
-#include "qpulsehelpers.h"
-
-QT_BEGIN_NAMESPACE
-
-const int PeriodTimeMs = 20;
-
-static void outputStreamWriteCallback(pa_stream *stream, size_t length, void *userdata)
-{
- Q_UNUSED(stream);
- Q_UNUSED(length);
- Q_UNUSED(userdata);
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-static void outputStreamStateCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(userdata)
- pa_stream_state_t state = pa_stream_get_state(stream);
-#ifdef DEBUG_PULSE
- qDebug() << "Stream state: " << QPulseAudioInternal::stateToQString(state);
-#endif
- switch (state) {
- case PA_STREAM_CREATING:
- case PA_STREAM_READY:
- case PA_STREAM_TERMINATED:
- break;
-
- case PA_STREAM_FAILED:
- default:
- qWarning() << QString("Stream error: %1").arg(pa_strerror(pa_context_errno(pa_stream_get_context(stream))));
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
- break;
- }
-}
-
-static void outputStreamUnderflowCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(stream)
- ((QPulseAudioOutput*)userdata)->streamUnderflowCallback();
- qWarning() << "Got a buffer underflow!";
-}
-
-static void outputStreamOverflowCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(stream)
- Q_UNUSED(userdata)
- qWarning() << "Got a buffer overflow!";
-}
-
-static void outputStreamLatencyCallback(pa_stream *stream, void *userdata)
-{
- Q_UNUSED(stream)
- Q_UNUSED(userdata)
-
-#ifdef DEBUG_PULSE
- const pa_timing_info *info = pa_stream_get_timing_info(stream);
-
- qDebug() << "Write index corrupt: " << info->write_index_corrupt;
- qDebug() << "Write index: " << info->write_index;
- qDebug() << "Read index corrupt: " << info->read_index_corrupt;
- qDebug() << "Read index: " << info->read_index;
- qDebug() << "Sink usec: " << info->sink_usec;
- qDebug() << "Configured sink usec: " << info->configured_sink_usec;
-#endif
-}
-
-static void outputStreamSuccessCallback(pa_stream *stream, int success, void *userdata)
-{
- Q_UNUSED(stream);
- Q_UNUSED(success);
- Q_UNUSED(userdata);
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-static void outputStreamDrainComplete(pa_stream *stream, int success, void *userdata)
-{
- Q_UNUSED(stream);
- Q_UNUSED(success);
- Q_UNUSED(userdata);
-
-#ifdef DEBUG_PULSE
- qDebug() << "Draining completed successfully: " << (bool)success;
-#endif
-}
-
-QPulseAudioOutput::QPulseAudioOutput(const QByteArray &device)
- : m_device(device)
- , m_errorState(QAudio::NoError)
- , m_deviceState(QAudio::StoppedState)
- , m_pullMode(true)
- , m_opened(false)
- , m_audioSource(0)
- , m_bytesAvailable(0)
- , m_stream(0)
- , m_notifyInterval(1000)
- , m_periodSize(0)
- , m_bufferSize(0)
- , m_totalTimeValue(0)
- , m_tickTimer(new QTimer(this))
- , m_audioBuffer(0)
- , m_resuming(false)
- , m_volume(1.0)
-{
- connect(m_tickTimer, SIGNAL(timeout()), SLOT(userFeed()));
-}
-
-QPulseAudioOutput::~QPulseAudioOutput()
-{
- close();
- disconnect(m_tickTimer, SIGNAL(timeout()));
- QCoreApplication::processEvents();
-}
-
-QAudio::Error QPulseAudioOutput::error() const
-{
- return m_errorState;
-}
-
-QAudio::State QPulseAudioOutput::state() const
-{
- return m_deviceState;
-}
-
-void QPulseAudioOutput::streamUnderflowCallback()
-{
- if (m_deviceState != QAudio::IdleState && !m_resuming) {
- m_errorState = QAudio::UnderrunError;
- emit errorChanged(m_errorState);
- m_deviceState = QAudio::IdleState;
- emit stateChanged(m_deviceState);
- }
-}
-
-void QPulseAudioOutput::start(QIODevice *device)
-{
- if (m_deviceState != QAudio::StoppedState)
- m_deviceState = QAudio::StoppedState;
-
- m_errorState = QAudio::NoError;
-
- // Handle change of mode
- if (m_audioSource && !m_pullMode) {
- delete m_audioSource;
- m_audioSource = 0;
- }
-
- close();
-
- m_pullMode = true;
- m_audioSource = device;
-
- m_deviceState = QAudio::ActiveState;
-
- open();
-
- emit stateChanged(m_deviceState);
-}
-
-QIODevice *QPulseAudioOutput::start()
-{
- if (m_deviceState != QAudio::StoppedState)
- m_deviceState = QAudio::StoppedState;
-
- m_errorState = QAudio::NoError;
-
- // Handle change of mode
- if (m_audioSource && !m_pullMode) {
- delete m_audioSource;
- m_audioSource = 0;
- }
-
- close();
-
- m_audioSource = new OutputPrivate(this);
- m_audioSource->open(QIODevice::WriteOnly|QIODevice::Unbuffered);
- m_pullMode = false;
-
- m_deviceState = QAudio::IdleState;
-
- open();
-
- emit stateChanged(m_deviceState);
-
- return m_audioSource;
-}
-
-bool QPulseAudioOutput::open()
-{
- if (m_opened)
- return false;
-
- pa_sample_spec spec = QPulseAudioInternal::audioFormatToSampleSpec(m_format);
-
- if (!pa_sample_spec_valid(&spec)) {
- m_errorState = QAudio::OpenError;
- m_deviceState = QAudio::StoppedState;
- return false;
- }
-
- m_spec = spec;
- m_totalTimeValue = 0;
- m_elapsedTimeOffset = 0;
- m_timeStamp.restart();
-
- if (m_streamName.isNull())
- m_streamName = QString(QLatin1String("QtmPulseStream-%1-%2")).arg(::getpid()).arg(quintptr(this)).toUtf8();
-
-#ifdef DEBUG_PULSE
- qDebug() << "Format: " << QPulseAudioInternal::sampleFormatToQString(spec.format);
- qDebug() << "Rate: " << spec.rate;
- qDebug() << "Channels: " << spec.channels;
- qDebug() << "Frame size: " << pa_frame_size(&spec);
-#endif
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- m_stream = pa_stream_new(pulseEngine->context(), m_streamName.constData(), &spec, 0);
-
- pa_stream_set_state_callback(m_stream, outputStreamStateCallback, this);
- pa_stream_set_write_callback(m_stream, outputStreamWriteCallback, this);
-
- pa_stream_set_underflow_callback(m_stream, outputStreamUnderflowCallback, this);
- pa_stream_set_overflow_callback(m_stream, outputStreamOverflowCallback, this);
- pa_stream_set_latency_update_callback(m_stream, outputStreamLatencyCallback, this);
-
- pa_volume_t paVolume;
- if (qFuzzyCompare(m_volume, 0.0)) {
- paVolume = PA_VOLUME_MUTED;
- m_volume = 0.0;
- } else {
- paVolume = qFloor(m_volume * PA_VOLUME_NORM + 0.5);
- }
- pa_cvolume_set(&m_chVolume, m_spec.channels, paVolume);
-
- if (pa_stream_connect_playback(m_stream, m_device.data(), NULL, (pa_stream_flags_t)0, &m_chVolume, NULL) < 0) {
- qWarning() << "pa_stream_connect_playback() failed!";
- return false;
- }
-
- while (pa_stream_get_state(m_stream) != PA_STREAM_READY) {
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
- }
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
-#ifdef DEBUG_PULSE
- const pa_buffer_attr *buffer = pa_stream_get_buffer_attr(m_stream);
-
- qDebug() << "Buffering info:";
- qDebug() << "\tMax length: " << buffer->maxlength;
- qDebug() << "\tTarget length: " << buffer->tlength;
- qDebug() << "\tPre-buffering: " << buffer->prebuf;
- qDebug() << "\tMinimum request: " << buffer->minreq;
- qDebug() << "\tFragment size: " << buffer->fragsize;
-#endif
-
- m_periodSize = pa_usec_to_bytes(PeriodTimeMs*1000, &spec);
- m_opened = true;
- m_tickTimer->start(PeriodTimeMs);
-
- m_elapsedTimeOffset = 0;
- m_timeStamp.restart();
- m_clockStamp.restart();
-
- return true;
-}
-
-void QPulseAudioOutput::userFeed()
-{
- if (m_deviceState == QAudio::StoppedState || m_deviceState == QAudio::SuspendedState)
- return;
-
- if (m_deviceState == QAudio::IdleState)
- m_bytesAvailable = bytesFree();
-
- deviceReady();
-}
-
-void QPulseAudioOutput::close()
-{
- m_tickTimer->stop();
-
- if (m_stream) {
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- pa_operation *o;
-
- pa_stream_set_write_callback(m_stream, NULL, NULL);
-
- if (!(o = pa_stream_drain(m_stream, outputStreamDrainComplete, NULL))) {
- qWarning() << QString("pa_stream_drain(): %1").arg(pa_strerror(pa_context_errno(pa_stream_get_context(m_stream))));
- return;
- }
- pa_operation_unref(o);
-
- pa_stream_disconnect(m_stream);
- pa_stream_unref(m_stream);
- m_stream = NULL;
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- }
-
- if (!m_pullMode && m_audioSource) {
- delete m_audioSource;
- m_audioSource = 0;
- }
- m_opened = false;
-}
-
-bool QPulseAudioOutput::deviceReady()
-{
- m_resuming = false;
-
- if (m_pullMode) {
- int l = 0;
- int chunks = m_bytesAvailable/m_periodSize;
- if (chunks==0) {
- m_bytesAvailable = bytesFree();
- return false;
- }
-
- char buffer[m_periodSize];
-
- l = m_audioSource->read(buffer, m_periodSize);
- if (l > 0) {
- if (m_deviceState != QAudio::ActiveState)
- return true;
-
- qint64 bytesWritten = write(buffer, l);
- Q_UNUSED(bytesWritten);
- }
- }
-
- if (m_deviceState != QAudio::ActiveState)
- return true;
-
- if (m_notifyInterval && (m_timeStamp.elapsed() + m_elapsedTimeOffset) > m_notifyInterval) {
- emit notify();
- m_elapsedTimeOffset = m_timeStamp.elapsed() + m_elapsedTimeOffset - m_notifyInterval;
- m_timeStamp.restart();
- }
-
- return true;
-}
-
-qint64 QPulseAudioOutput::write(const char *data, qint64 len)
-{
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
-
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- len = qMin(len, static_cast<qint64>(pa_stream_writable_size(m_stream)));
- pa_stream_write(m_stream, data, len, 0, 0, PA_SEEK_RELATIVE);
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- m_totalTimeValue += len;
-
- m_errorState = QAudio::NoError;
- if (m_deviceState != QAudio::ActiveState) {
- m_deviceState = QAudio::ActiveState;
- emit stateChanged(m_deviceState);
- }
-
- return len;
-}
-
-void QPulseAudioOutput::stop()
-{
- if (m_deviceState == QAudio::StoppedState)
- return;
-
- m_errorState = QAudio::NoError;
- m_deviceState = QAudio::StoppedState;
- close();
- emit stateChanged(m_deviceState);
-}
-
-int QPulseAudioOutput::bytesFree() const
-{
- if (m_deviceState != QAudio::ActiveState && m_deviceState != QAudio::IdleState)
- return 0;
-
- return pa_stream_writable_size(m_stream);
-}
-
-int QPulseAudioOutput::periodSize() const
-{
- return m_periodSize;
-}
-
-void QPulseAudioOutput::setBufferSize(int value)
-{
- m_bufferSize = value;
-}
-
-int QPulseAudioOutput::bufferSize() const
-{
- return m_bufferSize;
-}
-
-void QPulseAudioOutput::setNotifyInterval(int ms)
-{
- m_notifyInterval = qMax(0, ms);
-}
-
-int QPulseAudioOutput::notifyInterval() const
-{
- return m_notifyInterval;
-}
-
-qint64 QPulseAudioOutput::processedUSecs() const
-{
- qint64 result = qint64(1000000) * m_totalTimeValue /
- (m_format.channels() * (m_format.sampleSize() / 8)) /
- m_format.frequency();
-
- return result;
-}
-
-void QPulseAudioOutput::resume()
-{
- if (m_deviceState == QAudio::SuspendedState) {
- m_resuming = true;
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
-
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
-
- pa_operation *operation = pa_stream_cork(m_stream, 0, outputStreamSuccessCallback, NULL);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
-
- pa_operation_unref(operation);
-
- operation = pa_stream_trigger(m_stream, outputStreamSuccessCallback, NULL);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
-
- m_deviceState = QAudio::ActiveState;
-
- m_errorState = QAudio::NoError;
- m_tickTimer->start(PeriodTimeMs);
-
- emit stateChanged(m_deviceState);
- }
-}
-
-void QPulseAudioOutput::setFormat(const QAudioFormat &format)
-{
- m_format = format;
-}
-
-QAudioFormat QPulseAudioOutput::format() const
-{
- return m_format;
-}
-
-void QPulseAudioOutput::suspend()
-{
- if (m_deviceState == QAudio::ActiveState || m_deviceState == QAudio::IdleState) {
- m_tickTimer->stop();
- m_deviceState = QAudio::SuspendedState;
- m_errorState = QAudio::NoError;
- emit stateChanged(m_deviceState);
-
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
-
- operation = pa_stream_cork(m_stream, 1, outputStreamSuccessCallback, NULL);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(pulseEngine->mainloop());
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- }
-}
-
-qint64 QPulseAudioOutput::elapsedUSecs() const
-{
- if (m_deviceState == QAudio::StoppedState)
- return 0;
-
- return m_clockStamp.elapsed() * 1000;
-}
-
-void QPulseAudioOutput::reset()
-{
- stop();
-}
-
-OutputPrivate::OutputPrivate(QPulseAudioOutput *audio)
-{
- m_audioDevice = qobject_cast<QPulseAudioOutput*>(audio);
-}
-
-qint64 OutputPrivate::readData(char *data, qint64 len)
-{
- Q_UNUSED(data)
- Q_UNUSED(len)
-
- return 0;
-}
-
-qint64 OutputPrivate::writeData(const char *data, qint64 len)
-{
- int retry = 0;
- qint64 written = 0;
-
- if ((m_audioDevice->m_deviceState == QAudio::ActiveState)
- ||(m_audioDevice->m_deviceState == QAudio::IdleState)) {
- while(written < len) {
- int chunk = m_audioDevice->write(data+written, (len-written));
- if (chunk <= 0)
- retry++;
- written+=chunk;
- if (retry > 10)
- return written;
- }
- }
-
- return written;
-}
-
-void QPulseAudioOutput::setVolume(qreal vol)
-{
- if (vol >= 0.0 && vol <= 1.0) {
- if (!qFuzzyCompare(m_volume, vol)) {
- m_volume = vol;
- if (m_opened) {
- QPulseAudioEngine *pulseEngine = QPulseAudioEngine::instance();
- pa_threaded_mainloop_lock(pulseEngine->mainloop());
- pa_volume_t paVolume;
- if (qFuzzyCompare(vol, 0.0)) {
- pa_cvolume_mute(&m_chVolume, m_spec.channels);
- m_volume = 0.0;
- } else {
- paVolume = qFloor(m_volume * PA_VOLUME_NORM + 0.5);
- pa_cvolume_set(&m_chVolume, m_spec.channels, paVolume);
- }
- pa_operation *op = pa_context_set_sink_input_volume(pulseEngine->context(),
- pa_stream_get_index(m_stream),
- &m_chVolume,
- NULL,
- NULL);
- if (op == NULL)
- qWarning()<<"QAudioOutput: Failed to set volume";
- else
- pa_operation_unref(op);
- pa_threaded_mainloop_unlock(pulseEngine->mainloop());
- }
- }
- }
-}
-
-qreal QPulseAudioOutput::volume() const
-{
- return m_volume;
-}
-
-QT_END_NAMESPACE
-
-#include "moc_qaudiooutput_pulse.cpp"
diff --git a/src/plugins/pulseaudio/qaudiooutput_pulse.h b/src/plugins/pulseaudio/qaudiooutput_pulse.h
deleted file mode 100644
index 884164e..0000000
--- a/src/plugins/pulseaudio/qaudiooutput_pulse.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QAUDIOOUTPUTPULSE_H
-#define QAUDIOOUTPUTPULSE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qfile.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qstringlist.h>
-#include <QtCore/qdatetime.h>
-
-#include "qaudio.h"
-#include "qaudiodeviceinfo.h"
-#include "qaudiosystem.h"
-
-#include <pulse/pulseaudio.h>
-
-QT_BEGIN_NAMESPACE
-
-class QPulseAudioOutput : public QAbstractAudioOutput
-{
- friend class OutputPrivate;
- Q_OBJECT
-
-public:
- QPulseAudioOutput(const QByteArray &device);
- ~QPulseAudioOutput();
-
- void start(QIODevice *device);
- QIODevice *start();
- void stop();
- void reset();
- void suspend();
- void resume();
- int bytesFree() const;
- int periodSize() const;
- void setBufferSize(int value);
- int bufferSize() const;
- void setNotifyInterval(int milliSeconds);
- int notifyInterval() const;
- qint64 processedUSecs() const;
- qint64 elapsedUSecs() const;
- QAudio::Error error() const;
- QAudio::State state() const;
- void setFormat(const QAudioFormat &format);
- QAudioFormat format() const;
-
- void setVolume(qreal volume);
- qreal volume() const;
-
-public:
- void streamUnderflowCallback();
-
-private:
- bool open();
- void close();
- qint64 write(const char *data, qint64 len);
-
-private Q_SLOTS:
- bool deviceReady();
- void userFeed();
-
-private:
- QByteArray m_device;
- QByteArray m_streamName;
- QAudioFormat m_format;
- QAudio::Error m_errorState;
- QAudio::State m_deviceState;
- bool m_pullMode;
- bool m_opened;
- QIODevice *m_audioSource;
- int m_bytesAvailable;
- QTimer m_periodTimer;
- pa_stream *m_stream;
- int m_notifyInterval;
- int m_periodSize;
- int m_bufferSize;
- QTime m_clockStamp;
- qint64 m_totalTimeValue;
- QTimer *m_tickTimer;
- char *m_audioBuffer;
- QTime m_timeStamp;
- qint64 m_elapsedTimeOffset;
- bool m_resuming;
-
- qreal m_volume;
- pa_cvolume m_chVolume;
- pa_sample_spec m_spec;
-};
-
-class OutputPrivate : public QIODevice
-{
- friend class QPulseAudioOutput;
- Q_OBJECT
-
-public:
- OutputPrivate(QPulseAudioOutput *audio);
- virtual ~OutputPrivate() {}
-
-protected:
- qint64 readData(char *data, qint64 len);
- qint64 writeData(const char *data, qint64 len);
-
-private:
- QPulseAudioOutput *m_audioDevice;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/pulseaudio/qpulseaudioengine.cpp b/src/plugins/pulseaudio/qpulseaudioengine.cpp
deleted file mode 100644
index 06afa5b..0000000
--- a/src/plugins/pulseaudio/qpulseaudioengine.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qdebug.h>
-
-#include <qaudiodeviceinfo.h>
-#include "qpulseaudioengine.h"
-#include "qaudiodeviceinfo_pulse.h"
-#include "qaudiooutput_pulse.h"
-#include "qpulsehelpers.h"
-
-QT_BEGIN_NAMESPACE
-
-static void serverInfoCallback(pa_context *context, const pa_server_info *info, void *userdata)
-{
- if (!info) {
- qWarning() << QString("Failed to get server information: %s").arg(pa_strerror(pa_context_errno(context)));
- return;
- }
-
-#ifdef DEBUG_PULSE
- char ss[PA_SAMPLE_SPEC_SNPRINT_MAX], cm[PA_CHANNEL_MAP_SNPRINT_MAX];
-
- pa_sample_spec_snprint(ss, sizeof(ss), &info->sample_spec);
- pa_channel_map_snprint(cm, sizeof(cm), &info->channel_map);
-
- qDebug() << QString("User name: %1\n"
- "Host Name: %2\n"
- "Server Name: %3\n"
- "Server Version: %4\n"
- "Default Sample Specification: %5\n"
- "Default Channel Map: %6\n"
- "Default Sink: %7\n"
- "Default Source: %8\n").arg(
- info->user_name,
- info->host_name,
- info->server_name,
- info->server_version,
- ss,
- cm,
- info->default_sink_name,
- info->default_source_name);
-#endif
-
- QPulseAudioEngine *pulseEngine = static_cast<QPulseAudioEngine*>(userdata);
- pulseEngine->m_defaultSink = info->default_sink_name;
- pulseEngine->m_defaultSource = info->default_source_name;
-
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-static void sinkInfoCallback(pa_context *context, const pa_sink_info *info, int isLast, void *userdata)
-{
- QPulseAudioEngine *pulseEngine = static_cast<QPulseAudioEngine*>(userdata);
- QMap<pa_sink_state, QString> stateMap;
- stateMap[PA_SINK_INVALID_STATE] = "n/a";
- stateMap[PA_SINK_RUNNING] = "RUNNING";
- stateMap[PA_SINK_IDLE] = "IDLE";
- stateMap[PA_SINK_SUSPENDED] = "SUSPENDED";
-
- if (isLast < 0) {
- qWarning() << QString("Failed to get sink information: %s").arg(pa_strerror(pa_context_errno(context)));
- return;
- }
-
- if (isLast) {
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
- return;
- }
-
- Q_ASSERT(info);
-
-#ifdef DEBUG_PULSE
- qDebug() << QString("Sink #%1\n"
- "\tState: %2\n"
- "\tName: %3\n"
- "\tDescription: %4\n"
- ).arg(QString::number(info->index),
- stateMap.value(info->state),
- info->name,
- info->description);
-#endif
-
- QAudioFormat format = QPulseAudioInternal::sampleSpecToAudioFormat(info->sample_spec);
- pulseEngine->m_preferredFormats.insert(info->name, format);
- pulseEngine->m_sinks.append(info->name);
-}
-
-static void sourceInfoCallback(pa_context *context, const pa_source_info *info, int isLast, void *userdata)
-{
- Q_UNUSED(context)
- QPulseAudioEngine *pulseEngine = static_cast<QPulseAudioEngine*>(userdata);
-
- QMap<pa_source_state, QString> stateMap;
- stateMap[PA_SOURCE_INVALID_STATE] = "n/a";
- stateMap[PA_SOURCE_RUNNING] = "RUNNING";
- stateMap[PA_SOURCE_IDLE] = "IDLE";
- stateMap[PA_SOURCE_SUSPENDED] = "SUSPENDED";
-
- if (isLast) {
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
- return;
- }
-
- Q_ASSERT(info);
-
-#ifdef DEBUG_PULSE
- qDebug() << QString("Source #%1\n"
- "\tState: %2\n"
- "\tName: %3\n"
- "\tDescription: %4\n"
- ).arg(QString::number(info->index),
- stateMap.value(info->state),
- info->name,
- info->description);
-#endif
-
- QAudioFormat format = QPulseAudioInternal::sampleSpecToAudioFormat(info->sample_spec);
- pulseEngine->m_preferredFormats.insert(info->name, format);
- pulseEngine->m_sources.append(info->name);
-}
-
-static void contextStateCallbackInit(pa_context *context, void *userdata)
-{
- Q_UNUSED(context);
-#ifdef DEBUG_PULSE
- qDebug() << QPulseAudioInternal::stateToQString(pa_context_get_state(context));
-#endif
- QPulseAudioEngine *pulseEngine = reinterpret_cast<QPulseAudioEngine*>(userdata);
- pa_threaded_mainloop_signal(pulseEngine->mainloop(), 0);
-}
-
-static void contextStateCallback(pa_context *context, void *userdata)
-{
- Q_UNUSED(userdata);
- Q_UNUSED(context);
-
-#ifdef DEBUG_PULSE
- pa_context_state_t state = pa_context_get_state(context);
- qDebug() << QPulseAudioInternal::stateToQString(state);
-#endif
-}
-
-Q_GLOBAL_STATIC(QPulseAudioEngine, pulseEngine);
-
-QPulseAudioEngine::QPulseAudioEngine(QObject *parent)
- : QObject(parent)
-{
- bool keepGoing = true;
- bool ok = true;
-
- m_mainLoop = pa_threaded_mainloop_new();
- if (m_mainLoop == 0) {
- qWarning("Unable to create pulseaudio mainloop");
- return;
- }
-
- if (pa_threaded_mainloop_start(m_mainLoop) != 0) {
- qWarning("Unable to start pulseaudio mainloop");
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
-
- m_mainLoopApi = pa_threaded_mainloop_get_api(m_mainLoop);
-
- pa_threaded_mainloop_lock(m_mainLoop);
-
- m_context = pa_context_new(m_mainLoopApi, QString(QLatin1String("QtmPulseContext:%1")).arg(::getpid()).toAscii().constData());
- pa_context_set_state_callback(m_context, contextStateCallbackInit, this);
-
- if (!m_context) {
- qWarning("Unable to create new pulseaudio context");
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
-
- if (pa_context_connect(m_context, NULL, (pa_context_flags_t)0, NULL) < 0) {
- qWarning("Unable to create a connection to the pulseaudio context");
- pa_context_unref(m_context);
- pa_threaded_mainloop_free(m_mainLoop);
- return;
- }
-
- pa_threaded_mainloop_wait(m_mainLoop);
-
- while (keepGoing) {
- switch (pa_context_get_state(m_context)) {
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
- break;
-
- case PA_CONTEXT_READY:
-#ifdef DEBUG_PULSE
- qDebug("Connection established.");
-#endif
- keepGoing = false;
- break;
-
- case PA_CONTEXT_TERMINATED:
- qCritical("Context terminated.");
- keepGoing = false;
- ok = false;
- break;
-
- case PA_CONTEXT_FAILED:
- default:
- qCritical() << QString("Connection failure: %1").arg(pa_strerror(pa_context_errno(m_context)));
- keepGoing = false;
- ok = false;
- }
-
- if (keepGoing) {
- pa_threaded_mainloop_wait(m_mainLoop);
- }
- }
-
- if (ok) {
- pa_context_set_state_callback(m_context, contextStateCallback, this);
- } else {
- if (m_context) {
- pa_context_unref(m_context);
- m_context = 0;
- }
- }
-
- pa_threaded_mainloop_unlock(m_mainLoop);
-
- serverInfo();
- sinks();
- sources();
-}
-
-QPulseAudioEngine::~QPulseAudioEngine()
-{
- if (m_context) {
- pa_threaded_mainloop_lock(m_mainLoop);
- pa_context_disconnect(m_context);
- pa_threaded_mainloop_unlock(m_mainLoop);
- m_context = 0;
- }
-
- if (m_mainLoop) {
- pa_threaded_mainloop_stop(m_mainLoop);
- pa_threaded_mainloop_free(m_mainLoop);
- m_mainLoop = 0;
- }
-}
-
-void QPulseAudioEngine::serverInfo()
-{
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(m_mainLoop);
-
- operation = pa_context_get_server_info(m_context, serverInfoCallback, this);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(m_mainLoop);
-}
-
-void QPulseAudioEngine::sinks()
-{
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(m_mainLoop);
-
- operation = pa_context_get_sink_info_list(m_context, sinkInfoCallback, this);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(m_mainLoop);
-
- // Swap the default sink to index 0
- m_sinks.removeOne(m_defaultSink);
- m_sinks.prepend(m_defaultSink);
-}
-
-void QPulseAudioEngine::sources()
-{
- pa_operation *operation;
-
- pa_threaded_mainloop_lock(m_mainLoop);
-
- operation = pa_context_get_source_info_list(m_context, sourceInfoCallback, this);
-
- while (pa_operation_get_state(operation) == PA_OPERATION_RUNNING)
- pa_threaded_mainloop_wait(m_mainLoop);
-
- pa_operation_unref(operation);
-
- pa_threaded_mainloop_unlock(m_mainLoop);
-
- // Swap the default source to index 0
- m_sources.removeOne(m_defaultSource);
- m_sources.prepend(m_defaultSource);
-}
-
-QPulseAudioEngine *QPulseAudioEngine::instance()
-{
- return pulseEngine();
-}
-
-QList<QByteArray> QPulseAudioEngine::availableDevices(QAudio::Mode mode) const
-{
- return mode == QAudio::AudioOutput ? m_sinks : m_sources;
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/pulseaudio/qpulseaudioengine.h b/src/plugins/pulseaudio/qpulseaudioengine.h
deleted file mode 100644
index 63495ce..0000000
--- a/src/plugins/pulseaudio/qpulseaudioengine.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPULSEAUDIOENGINE_H
-#define QPULSEAUDIOENGINE_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include <QtCore/qmap.h>
-#include <QtCore/qbytearray.h>
-#include <qaudiosystemplugin.h>
-#include <pulse/pulseaudio.h>
-#include "qpulsehelpers.h"
-#include <qaudioformat.h>
-
-QT_BEGIN_NAMESPACE
-
-class QPulseAudioEngine : public QObject
-{
- Q_OBJECT
-
-public:
- QPulseAudioEngine(QObject *parent = 0);
- ~QPulseAudioEngine();
-
- static QPulseAudioEngine *instance();
- pa_threaded_mainloop *mainloop() { return m_mainLoop; }
- pa_context *context() { return m_context; }
-
- QList<QByteArray> availableDevices(QAudio::Mode mode) const;
-
-private:
- void serverInfo();
- void sinks();
- void sources();
-
-public:
- QList<QByteArray> m_sinks;
- QList<QByteArray> m_sources;
- QMap<QByteArray, QAudioFormat> m_preferredFormats;
-
- QByteArray m_defaultSink;
- QByteArray m_defaultSource;
-
-private:
- pa_mainloop_api *m_mainLoopApi;
- pa_threaded_mainloop *m_mainLoop;
- pa_context *m_context;
- };
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/pulseaudio/qpulseaudioplugin.cpp b/src/plugins/pulseaudio/qpulseaudioplugin.cpp
deleted file mode 100644
index 2544ebb..0000000
--- a/src/plugins/pulseaudio/qpulseaudioplugin.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <qaudiodeviceinfo.h>
-
-#include "qpulseaudioplugin.h"
-#include "qaudiodeviceinfo_pulse.h"
-#include "qaudiooutput_pulse.h"
-#include "qaudioinput_pulse.h"
-#include "qpulseaudioengine.h"
-
-QT_BEGIN_NAMESPACE
-
-QPulseAudioPlugin::QPulseAudioPlugin(QObject *parent)
- : QAudioSystemPlugin(parent)
- , m_pulseEngine(QPulseAudioEngine::instance())
-{
-}
-
-QStringList QPulseAudioPlugin::keys() const
-{
- return QStringList() << "default";
-}
-
-QList<QByteArray> QPulseAudioPlugin::availableDevices(QAudio::Mode mode) const
-{
- return m_pulseEngine->availableDevices(mode);
-}
-
-QAbstractAudioInput *QPulseAudioPlugin::createInput(const QByteArray &device)
-{
- QPulseAudioInput *input = new QPulseAudioInput(device);
- return input;
-}
-
-QAbstractAudioOutput *QPulseAudioPlugin::createOutput(const QByteArray &device)
-{
-
- QPulseAudioOutput *output = new QPulseAudioOutput(device);
- return output;
-}
-
-QAbstractAudioDeviceInfo *QPulseAudioPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode)
-{
- QPulseAudioDeviceInfo *deviceInfo = new QPulseAudioDeviceInfo(device, mode);
- return deviceInfo;
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_pulse, QPulseAudioPlugin);
-
-QT_END_NAMESPACE
diff --git a/src/plugins/pulseaudio/qpulseaudioplugin.h b/src/plugins/pulseaudio/qpulseaudioplugin.h
deleted file mode 100644
index 7bb6e8b..0000000
--- a/src/plugins/pulseaudio/qpulseaudioplugin.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPULSEAUDIOPLUGIN_H
-#define QPULSEAUDIOPLUGIN_H
-
-#include <qaudiosystemplugin.h>
-
-QT_BEGIN_NAMESPACE
-
-class QPulseAudioEngine;
-
-class QPulseAudioPlugin : public QAudioSystemPlugin
-{
- Q_OBJECT
-
-public:
- QPulseAudioPlugin(QObject *parent = 0);
- ~QPulseAudioPlugin() {}
-
- QStringList keys() const;
- QList<QByteArray> availableDevices(QAudio::Mode mode) const;
- QAbstractAudioInput *createInput(const QByteArray &device);
- QAbstractAudioOutput *createOutput(const QByteArray &device);
- QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode);
-
-private:
- QPulseAudioEngine *m_pulseEngine;
-};
-
-QT_BEGIN_NAMESPACE
-
-#endif
diff --git a/src/plugins/pulseaudio/qpulsehelpers.cpp b/src/plugins/pulseaudio/qpulsehelpers.cpp
deleted file mode 100644
index 10d54ed..0000000
--- a/src/plugins/pulseaudio/qpulsehelpers.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qpulsehelpers.h"
-
-QT_BEGIN_NAMESPACE
-
-namespace QPulseAudioInternal
-{
-pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format)
-{
- pa_sample_spec spec;
-
- spec.rate = format.frequency();
- spec.channels = format.channels();
-
- if (format.sampleSize() == 8) {
- spec.format = PA_SAMPLE_U8;
- } else if (format.sampleSize() == 16) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S16BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S16LE; break;
- }
- } else if (format.sampleSize() == 24) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian: spec.format = PA_SAMPLE_S24BE; break;
- case QAudioFormat::LittleEndian: spec.format = PA_SAMPLE_S24LE; break;
- }
- } else if (format.sampleSize() == 32) {
- switch (format.byteOrder()) {
- case QAudioFormat::BigEndian:
- format.sampleType() == QAudioFormat::Float ? spec.format = PA_SAMPLE_FLOAT32BE : spec.format = PA_SAMPLE_S32BE;
- break;
- case QAudioFormat::LittleEndian:
- format.sampleType() == QAudioFormat::Float ? spec.format = PA_SAMPLE_FLOAT32LE : spec.format = PA_SAMPLE_S32LE;
- break;
- }
- } else {
- spec.format = PA_SAMPLE_INVALID;
- }
-
- return spec;
-}
-
-#ifdef DEBUG_PULSE
-QString stateToQString(pa_stream_state_t state)
-{
- switch (state)
- {
- case PA_STREAM_UNCONNECTED: return "Unconnected";
- case PA_STREAM_CREATING: return "Creating";
- case PA_STREAM_READY: return "Ready";
- case PA_STREAM_FAILED: return "Failed";
- case PA_STREAM_TERMINATED: return "Terminated";
- }
-
- return QString("Unknown state: %0").arg(state);
-}
-
-QString sampleFormatToQString(pa_sample_format format)
-{
- switch (format)
- {
- case PA_SAMPLE_U8: return "Unsigned 8 Bit PCM.";
- case PA_SAMPLE_ALAW: return "8 Bit a-Law ";
- case PA_SAMPLE_ULAW: return "8 Bit mu-Law";
- case PA_SAMPLE_S16LE: return "Signed 16 Bit PCM, little endian (PC).";
- case PA_SAMPLE_S16BE: return "Signed 16 Bit PCM, big endian.";
- case PA_SAMPLE_FLOAT32LE: return "32 Bit IEEE floating point, little endian (PC), range -1.0 to 1.0";
- case PA_SAMPLE_FLOAT32BE: return "32 Bit IEEE floating point, big endian, range -1.0 to 1.0";
- case PA_SAMPLE_S32LE: return "Signed 32 Bit PCM, little endian (PC).";
- case PA_SAMPLE_S32BE: return "Signed 32 Bit PCM, big endian.";
- case PA_SAMPLE_S24LE: return "Signed 24 Bit PCM packed, little endian (PC).";
- case PA_SAMPLE_S24BE: return "Signed 24 Bit PCM packed, big endian.";
- case PA_SAMPLE_S24_32LE: return "Signed 24 Bit PCM in LSB of 32 Bit words, little endian (PC).";
- case PA_SAMPLE_S24_32BE: return "Signed 24 Bit PCM in LSB of 32 Bit words, big endian.";
- case PA_SAMPLE_MAX: return "Upper limit of valid sample types.";
- case PA_SAMPLE_INVALID: return "Invalid sample format";
- }
-
- return QString("Invalid value: %0").arg(format);
-}
-
-QString stateToQString(pa_context_state_t state)
-{
- switch (state)
- {
- case PA_CONTEXT_UNCONNECTED: return "Unconnected";
- case PA_CONTEXT_CONNECTING: return "Connecting";
- case PA_CONTEXT_AUTHORIZING: return "Authorizing";
- case PA_CONTEXT_SETTING_NAME: return "Setting Name";
- case PA_CONTEXT_READY: return "Ready";
- case PA_CONTEXT_FAILED: return "Failed";
- case PA_CONTEXT_TERMINATED: return "Terminated";
- }
-
- return QString("Unknown state: %0").arg(state);
-}
-#endif
-
-QAudioFormat sampleSpecToAudioFormat(pa_sample_spec spec)
-{
- QAudioFormat format;
- format.setFrequency(spec.rate);
- format.setChannelCount(spec.channels);
- format.setCodec("audio/pcm");
-
- switch (spec.format) {
- case PA_SAMPLE_U8:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::UnSignedInt);
- format.setSampleSize(8);
- break;
- case PA_SAMPLE_ALAW:
- // TODO:
- break;
- case PA_SAMPLE_ULAW:
- // TODO:
- break;
- case PA_SAMPLE_S16LE:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(16);
- break;
- case PA_SAMPLE_S16BE:
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(16);
- break;
- case PA_SAMPLE_FLOAT32LE:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::Float);
- format.setSampleSize(32);
- break;
- case PA_SAMPLE_FLOAT32BE:
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setSampleType(QAudioFormat::Float);
- format.setSampleSize(32);
- break;
- case PA_SAMPLE_S32LE:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(32);
- break;
- case PA_SAMPLE_S32BE:
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(32);
- break;
- case PA_SAMPLE_S24LE:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(24);
- break;
- case PA_SAMPLE_S24BE:
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(24);
- break;
- case PA_SAMPLE_S24_32LE:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(24);
- break;
- case PA_SAMPLE_S24_32BE:
- format.setByteOrder(QAudioFormat::BigEndian);
- format.setSampleType(QAudioFormat::SignedInt);
- format.setSampleSize(24);
- break;
- case PA_SAMPLE_MAX:
- case PA_SAMPLE_INVALID:
- default:
- format.setByteOrder(QAudioFormat::LittleEndian);
- format.setSampleType(QAudioFormat::Unknown);
- format.setSampleSize(0);
- }
-
- return format;
-}
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/pulseaudio/qpulsehelpers.h b/src/plugins/pulseaudio/qpulsehelpers.h
deleted file mode 100644
index 035e92e..0000000
--- a/src/plugins/pulseaudio/qpulsehelpers.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QPULSEHELPER_H
-#define QPULSEHELPER_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qaudiodeviceinfo.h"
-#include <qaudioformat.h>
-#include <pulse/pulseaudio.h>
-
-QT_BEGIN_NAMESPACE
-
-namespace QPulseAudioInternal
-{
-pa_sample_spec audioFormatToSampleSpec(const QAudioFormat &format);
-QString stateToQString(pa_stream_state_t state);
-QString stateToQString(pa_context_state_t state);
-QString sampleFormatToQString(pa_sample_format format);
-QAudioFormat sampleSpecToAudioFormat(pa_sample_spec spec);
-}
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/mediaplayer/mediaplayer.pri b/src/plugins/qt7/mediaplayer/mediaplayer.pri
deleted file mode 100644
index 2edb1d2..0000000
--- a/src/plugins/qt7/mediaplayer/mediaplayer.pri
+++ /dev/null
@@ -1,16 +0,0 @@
-INCLUDEPATH += $$PWD
-
-DEFINES += QMEDIA_QT7_PLAYER
-
-HEADERS += \
- $$PWD/qt7playercontrol.h \
- $$PWD/qt7playermetadata.h \
- $$PWD/qt7playerservice.h \
- $$PWD/qt7playersession.h
-
-OBJECTIVE_SOURCES += \
- $$PWD/qt7playercontrol.mm \
- $$PWD/qt7playermetadata.mm \
- $$PWD/qt7playerservice.mm \
- $$PWD/qt7playersession.mm
-
diff --git a/src/plugins/qt7/mediaplayer/qt7playercontrol.h b/src/plugins/qt7/mediaplayer/qt7playercontrol.h
deleted file mode 100644
index 54b9f4e..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playercontrol.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7PLAYERCONTROL_H
-#define QT7PLAYERCONTROL_H
-
-#include <QtCore/qobject.h>
-
-#include <qmediaplayercontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class QT7PlayerSession;
-class QT7PlayerService;
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-
-class QT7PlayerControl : public QMediaPlayerControl
-{
-Q_OBJECT
-public:
- QT7PlayerControl(QObject *parent = 0);
- ~QT7PlayerControl();
-
- void setSession(QT7PlayerSession *session);
-
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent &content, QIODevice *stream);
-
- qint64 position() const;
- qint64 duration() const;
-
- int bufferStatus() const;
-
- int volume() const;
- bool isMuted() const;
-
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
-
- bool isSeekable() const;
- QMediaTimeRange availablePlaybackRanges() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
-public Q_SLOTS:
- void setPosition(qint64 pos);
-
- void play();
- void pause();
- void stop();
-
- void setVolume(int volume);
- void setMuted(bool muted);
-
-private:
- QT7PlayerSession *m_session;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/mediaplayer/qt7playercontrol.mm b/src/plugins/qt7/mediaplayer/qt7playercontrol.mm
deleted file mode 100644
index 56a6a61..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playercontrol.mm
+++ /dev/null
@@ -1,191 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7playercontrol.h"
-#include "qt7playersession.h"
-
-#include <qmediaplaylistnavigator.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qdebug.h>
-
-QT_USE_NAMESPACE
-
-QT7PlayerControl::QT7PlayerControl(QObject *parent)
- : QMediaPlayerControl(parent)
-{
-}
-
-QT7PlayerControl::~QT7PlayerControl()
-{
-}
-
-void QT7PlayerControl::setSession(QT7PlayerSession *session)
-{
- m_session = session;
-
- connect(m_session, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
- connect(m_session, SIGNAL(durationChanged(qint64)), this, SIGNAL(durationChanged(qint64)));
- connect(m_session, SIGNAL(stateChanged(QMediaPlayer::State)),
- this, SIGNAL(stateChanged(QMediaPlayer::State)));
- connect(m_session, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)),
- this, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)));
- connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int)));
- connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool)));
- connect(m_session, SIGNAL(audioAvailableChanged(bool)), this, SIGNAL(audioAvailableChanged(bool)));
- connect(m_session, SIGNAL(videoAvailableChanged(bool)), this, SIGNAL(videoAvailableChanged(bool)));
- connect(m_session, SIGNAL(error(int,QString)), this, SIGNAL(error(int,QString)));
-}
-
-qint64 QT7PlayerControl::position() const
-{
- return m_session->position();
-}
-
-qint64 QT7PlayerControl::duration() const
-{
- return m_session->duration();
-}
-
-QMediaPlayer::State QT7PlayerControl::state() const
-{
- return m_session->state();
-}
-
-QMediaPlayer::MediaStatus QT7PlayerControl::mediaStatus() const
-{
- return m_session->mediaStatus();
-}
-
-int QT7PlayerControl::bufferStatus() const
-{
- return m_session->bufferStatus();
-}
-
-int QT7PlayerControl::volume() const
-{
- return m_session->volume();
-}
-
-bool QT7PlayerControl::isMuted() const
-{
- return m_session->isMuted();
-}
-
-bool QT7PlayerControl::isSeekable() const
-{
- return m_session->isSeekable();
-}
-
-QMediaTimeRange QT7PlayerControl::availablePlaybackRanges() const
-{
- return m_session->availablePlaybackRanges();
-}
-
-qreal QT7PlayerControl::playbackRate() const
-{
- return m_session->playbackRate();
-}
-
-void QT7PlayerControl::setPlaybackRate(qreal rate)
-{
- m_session->setPlaybackRate(rate);
-}
-
-void QT7PlayerControl::setPosition(qint64 pos)
-{
- m_session->setPosition(pos);
-}
-
-void QT7PlayerControl::play()
-{
- m_session->play();
-}
-
-void QT7PlayerControl::pause()
-{
- m_session->pause();
-}
-
-void QT7PlayerControl::stop()
-{
- m_session->stop();
-}
-
-void QT7PlayerControl::setVolume(int volume)
-{
- m_session->setVolume(volume);
-}
-
-void QT7PlayerControl::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-QMediaContent QT7PlayerControl::media() const
-{
- return m_session->media();
-}
-
-const QIODevice *QT7PlayerControl::mediaStream() const
-{
- return m_session->mediaStream();
-}
-
-void QT7PlayerControl::setMedia(const QMediaContent &content, QIODevice *stream)
-{
- m_session->setMedia(content, stream);
-
- emit mediaChanged(content);
-}
-
-bool QT7PlayerControl::isAudioAvailable() const
-{
- return m_session->isAudioAvailable();
-}
-
-bool QT7PlayerControl::isVideoAvailable() const
-{
- return m_session->isVideoAvailable();
-}
-
-
-#include "moc_qt7playercontrol.cpp"
diff --git a/src/plugins/qt7/mediaplayer/qt7playermetadata.h b/src/plugins/qt7/mediaplayer/qt7playermetadata.h
deleted file mode 100644
index c5984a4..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playermetadata.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7PLAYERMETADATACONTROL_H
-#define QT7PLAYERMETADATACONTROL_H
-
-#include <qmetadatareadercontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class QT7PlayerSession;
-
-class QT7PlayerMetaDataControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- QT7PlayerMetaDataControl(QT7PlayerSession *session, QObject *parent);
- virtual ~QT7PlayerMetaDataControl();
-
- bool isMetaDataAvailable() const;
- bool isWritable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const ;
- QStringList availableExtendedMetaData() const;
-
-private slots:
- void updateTags();
-
-private:
- QT7PlayerSession *m_session;
- QMap<QtMultimedia::MetaData, QVariant> m_tags;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/mediaplayer/qt7playermetadata.mm b/src/plugins/qt7/mediaplayer/qt7playermetadata.mm
deleted file mode 100644
index 7432431..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playermetadata.mm
+++ /dev/null
@@ -1,260 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7backend.h"
-#include "qt7playermetadata.h"
-#include "qt7playersession.h"
-#include <QtCore/qvarlengtharray.h>
-
-#import <QTKit/QTMovie.h>
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- #include <QuickTime/QuickTime.h>
- #undef check // avoid name clash;
-#endif
-
-QT_USE_NAMESPACE
-
-QT7PlayerMetaDataControl::QT7PlayerMetaDataControl(QT7PlayerSession *session, QObject *parent)
- :QMetaDataReaderControl(parent), m_session(session)
-{
-}
-
-QT7PlayerMetaDataControl::~QT7PlayerMetaDataControl()
-{
-}
-
-bool QT7PlayerMetaDataControl::isMetaDataAvailable() const
-{
- return !m_tags.isEmpty();
-}
-
-bool QT7PlayerMetaDataControl::isWritable() const
-{
- return false;
-}
-
-QVariant QT7PlayerMetaDataControl::metaData(QtMultimedia::MetaData key) const
-{
- return m_tags.value(key);
-}
-
-QList<QtMultimedia::MetaData> QT7PlayerMetaDataControl::availableMetaData() const
-{
- return m_tags.keys();
-}
-
-QVariant QT7PlayerMetaDataControl::extendedMetaData(const QString &key) const
-{
- Q_UNUSED(key);
- return QVariant();
-}
-
-QStringList QT7PlayerMetaDataControl::availableExtendedMetaData() const
-{
- return QStringList();
-}
-
-#ifdef QUICKTIME_C_API_AVAILABLE
-
-static QString stripCopyRightSymbol(const QString &key)
-{
- return key.right(key.length()-1);
-}
-
-static QString convertQuickTimeKeyToUserKey(const QString &key)
-{
- if (key == QLatin1String("com.apple.quicktime.displayname"))
- return QLatin1String("nam");
- else if (key == QLatin1String("com.apple.quicktime.album"))
- return QLatin1String("alb");
- else if (key == QLatin1String("com.apple.quicktime.artist"))
- return QLatin1String("ART");
- else
- return QLatin1String("???");
-}
-
-static OSStatus readMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, QTPropertyClass propClass,
- QTPropertyID id, QTPropertyValuePtr *value, ByteCount *size)
-{
- QTPropertyValueType type;
- ByteCount propSize;
- UInt32 propFlags;
- OSStatus err = QTMetaDataGetItemPropertyInfo(metaDataRef, item, propClass, id, &type, &propSize, &propFlags);
-
- if (err == noErr) {
- *value = malloc(propSize);
- if (*value != 0) {
- err = QTMetaDataGetItemProperty(metaDataRef, item, propClass, id, propSize, *value, size);
-
- if (err == noErr && (type == 'code' || type == 'itsk' || type == 'itlk')) {
- // convert from native endian to big endian
- OSTypePtr pType = (OSTypePtr)*value;
- *pType = EndianU32_NtoB(*pType);
- }
- }
- else
- return -1;
- }
-
- return err;
-}
-
-static UInt32 getMetaType(QTMetaDataRef metaDataRef, QTMetaDataItem item)
-{
- QTPropertyValuePtr value = 0;
- ByteCount ignore = 0;
- OSStatus err = readMetaValue(
- metaDataRef, item, kPropertyClass_MetaDataItem, kQTMetaDataItemPropertyID_DataType, &value, &ignore);
-
- if (err == noErr) {
- UInt32 type = *((UInt32 *) value);
- if (value)
- free(value);
- return type;
- }
-
- return 0;
-}
-
-static QString cFStringToQString(CFStringRef str)
-{
- if(!str)
- return QString();
- CFIndex length = CFStringGetLength(str);
- const UniChar *chars = CFStringGetCharactersPtr(str);
- if (chars)
- return QString(reinterpret_cast<const QChar *>(chars), length);
-
- QVarLengthArray<UniChar> buffer(length);
- CFStringGetCharacters(str, CFRangeMake(0, length), buffer.data());
- return QString(reinterpret_cast<const QChar *>(buffer.constData()), length);
-}
-
-
-static QString getMetaValue(QTMetaDataRef metaDataRef, QTMetaDataItem item, SInt32 id)
-{
- QTPropertyValuePtr value = 0;
- ByteCount size = 0;
- OSStatus err = readMetaValue(metaDataRef, item, kPropertyClass_MetaDataItem, id, &value, &size);
- QString string;
-
- if (err == noErr) {
- UInt32 dataType = getMetaType(metaDataRef, item);
- switch (dataType){
- case kQTMetaDataTypeUTF8:
- case kQTMetaDataTypeMacEncodedText:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF8, false));
- break;
- case kQTMetaDataTypeUTF16BE:
- string = cFStringToQString(CFStringCreateWithBytes(0, (UInt8*)value, size, kCFStringEncodingUTF16BE, false));
- break;
- default:
- break;
- }
-
- if (value)
- free(value);
- }
-
- return string;
-}
-
-
-static void readFormattedData(QTMetaDataRef metaDataRef, OSType format, QMultiMap<QString, QString> &result)
-{
- QTMetaDataItem item = kQTMetaDataItemUninitialized;
- OSStatus err = QTMetaDataGetNextItem(metaDataRef, format, item, kQTMetaDataKeyFormatWildcard, 0, 0, &item);
- while (err == noErr){
- QString key = getMetaValue(metaDataRef, item, kQTMetaDataItemPropertyID_Key);
- if (format == kQTMetaDataStorageFormatQuickTime)
- key = convertQuickTimeKeyToUserKey(key);
- else
- key = stripCopyRightSymbol(key);
-
- if (!result.contains(key)){
- QString val = getMetaValue(metaDataRef, item, kQTMetaDataItemPropertyID_Value);
- result.insert(key, val);
- }
- err = QTMetaDataGetNextItem(metaDataRef, format, item, kQTMetaDataKeyFormatWildcard, 0, 0, &item);
- }
-}
-#endif
-
-
-void QT7PlayerMetaDataControl::updateTags()
-{
- bool wasEmpty = m_tags.isEmpty();
- m_tags.clear();
-
- QTMovie *movie = (QTMovie*)m_session->movie();
-
- if (movie) {
- QMultiMap<QString, QString> metaMap;
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- QTMetaDataRef metaDataRef;
- OSStatus err = QTCopyMovieMetaData([movie quickTimeMovie], &metaDataRef);
- if (err == noErr) {
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatUserData, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatQuickTime, metaMap);
- readFormattedData(metaDataRef, kQTMetaDataStorageFormatiTunes, metaMap);
- }
-#else
- AutoReleasePool pool;
- NSString *name = [movie attributeForKey:@"QTMovieDisplayNameAttribute"];
- metaMap.insert(QLatin1String("nam"), QString::fromUtf8([name UTF8String]));
-#endif // QUICKTIME_C_API_AVAILABLE
-
- m_tags.insert(QtMultimedia::AlbumArtist, metaMap.value(QLatin1String("ART")));
- m_tags.insert(QtMultimedia::AlbumTitle, metaMap.value(QLatin1String("alb")));
- m_tags.insert(QtMultimedia::Title, metaMap.value(QLatin1String("nam")));
- m_tags.insert(QtMultimedia::Date, metaMap.value(QLatin1String("day")));
- m_tags.insert(QtMultimedia::Genre, metaMap.value(QLatin1String("gnre")));
- m_tags.insert(QtMultimedia::TrackNumber, metaMap.value(QLatin1String("trk")));
- m_tags.insert(QtMultimedia::Description, metaMap.value(QLatin1String("des")));
- }
-
- if (!wasEmpty || !m_tags.isEmpty())
- emit metaDataChanged();
-}
-
-#include "moc_qt7playermetadata.cpp"
diff --git a/src/plugins/qt7/mediaplayer/qt7playerservice.h b/src/plugins/qt7/mediaplayer/qt7playerservice.h
deleted file mode 100644
index b71eaf4..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playerservice.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7PLAYERSERVICE_H
-#define QT7PLAYERSERVICE_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qset.h>
-#include <qmediaservice.h>
-
-
-QT_BEGIN_NAMESPACE
-class QMediaMetaData;
-class QMediaPlayerControl;
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-class QT7PlayerControl;
-class QT7PlayerMetaDataControl;
-class QT7VideoWindowControl;
-class QT7VideoWidgetControl;
-class QT7VideoRendererControl;
-class QT7VideoOutput;
-class QT7PlayerSession;
-
-class QT7PlayerService : public QMediaService
-{
-Q_OBJECT
-public:
- QT7PlayerService(QObject *parent = 0);
- ~QT7PlayerService();
-
- QMediaControl* requestControl(const char *name);
- void releaseControl(QMediaControl *control);
-
-private:
- QT7PlayerSession *m_session;
- QT7PlayerControl *m_control;
- QMediaControl * m_videoOutput;
- QT7PlayerMetaDataControl *m_playerMetaDataControl;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/mediaplayer/qt7playerservice.mm b/src/plugins/qt7/mediaplayer/qt7playerservice.mm
deleted file mode 100644
index f868fd5..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playerservice.mm
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/qwidget.h>
-
-#include "qt7backend.h"
-#include "qt7playerservice.h"
-#include "qt7playercontrol.h"
-#include "qt7playersession.h"
-#include "qt7videooutput.h"
-#include "qt7movieviewoutput.h"
-#include "qt7movieviewrenderer.h"
-#include "qt7movierenderer.h"
-#include "qt7movievideowidget.h"
-#include "qt7playermetadata.h"
-
-#include <qmediaplaylistnavigator.h>
-#include <qmediaplaylist.h>
-
-QT_USE_NAMESPACE
-
-QT7PlayerService::QT7PlayerService(QObject *parent):
- QMediaService(parent),
- m_videoOutput(0)
-{
- m_session = new QT7PlayerSession(this);
-
- m_control = new QT7PlayerControl(this);
- m_control->setSession(m_session);
-
- m_playerMetaDataControl = new QT7PlayerMetaDataControl(m_session, this);
- connect(m_control, SIGNAL(mediaChanged(QMediaContent)), m_playerMetaDataControl, SLOT(updateTags()));
-}
-
-QT7PlayerService::~QT7PlayerService()
-{
-}
-
-QMediaControl *QT7PlayerService::requestControl(const char *name)
-{
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0)
- return m_control;
-
- if (qstrcmp(name, QMetaDataReaderControl_iid) == 0)
- return m_playerMetaDataControl;
-
-#ifndef QT_NO_OPENGL
- if (!m_videoOutput) {
- if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
-#if defined(QT_MAC_USE_COCOA)
- m_videoOutput = new QT7MovieViewOutput(this);
-#endif
- }
-
- if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
-#ifdef QUICKTIME_C_API_AVAILABLE
- m_videoOutput = new QT7MovieRenderer(this);
-#else
- m_videoOutput = new QT7MovieViewRenderer(this);
-#endif
- }
-
- if (qstrcmp(name, QVideoWidgetControl_iid) == 0) {
-#ifdef QUICKTIME_C_API_AVAILABLE
- m_videoOutput = new QT7MovieVideoWidget(this);
-#endif
- }
-
- if (m_videoOutput) {
- QT7VideoOutput *videoOutput = qobject_cast<QT7VideoOutput*>(m_videoOutput);
- m_session->setVideoOutput(videoOutput);
- return m_videoOutput;
- }
- }
-#endif // !defined(QT_NO_OPENGL)
-
- return 0;
-}
-
-void QT7PlayerService::releaseControl(QMediaControl *control)
-{
- if (m_videoOutput == control) {
- m_videoOutput = 0;
- m_session->setVideoOutput(0);
- delete control;
- }
-}
-
-#include "moc_qt7playerservice.cpp"
diff --git a/src/plugins/qt7/mediaplayer/qt7playersession.h b/src/plugins/qt7/mediaplayer/qt7playersession.h
deleted file mode 100644
index c6e0115..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playersession.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7PLAYERSESSION_H
-#define QT7PLAYERSESSION_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qbytearray.h>
-#include <QtCore/qset.h>
-#include <QtCore/qresource.h>
-
-#include <qmediaplayercontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class QT7PlayerControl;
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-class QT7VideoOutput;
-class QT7PlayerSession;
-class QT7PlayerService;
-
-
-class QT7PlayerSession : public QObject
-{
- Q_OBJECT
-public:
- QT7PlayerSession(QObject *parent = 0);
- ~QT7PlayerSession();
-
- void *movie() const;
-
- void setControl(QT7PlayerControl *control);
-
- void setVideoOutput(QT7VideoOutput *output);
-
- QMediaPlayer::State state() const;
- QMediaPlayer::MediaStatus mediaStatus() const;
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent &content, QIODevice *stream);
-
- qint64 position() const;
- qint64 duration() const;
-
- int bufferStatus() const;
-
- int volume() const;
- bool isMuted() const;
-
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
-
- bool isSeekable() const;
- QMediaTimeRange availablePlaybackRanges() const;
-
- qreal playbackRate() const;
-
-public slots:
- void setPlaybackRate(qreal rate);
-
- void setPosition(qint64 pos);
-
- void play();
- void pause();
- void stop();
-
- void setVolume(int volume);
- void setMuted(bool muted);
-
- void processEOS();
- void processLoadStateChange();
- void processVolumeChange();
- void processNaturalSizeChange();
- void processPositionChange();
-
-signals:
- void positionChanged(qint64 position);
- void durationChanged(qint64 duration);
- void stateChanged(QMediaPlayer::State newState);
- void mediaStatusChanged(QMediaPlayer::MediaStatus status);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void audioAvailableChanged(bool audioAvailable);
- void videoAvailableChanged(bool videoAvailable);
- void error(int error, const QString &errorString);
-
-private:
- class ResourceHandler {
- public:
- ResourceHandler():resource(0) {}
- ~ResourceHandler() { clear(); }
- void setResourceFile(const QString &file) {
- if (resource) {
- if (resource->fileName() == file)
- return;
- delete resource;
- rawData.clear();
- }
- resource = new QResource(file);
- }
- bool isValid() const { return resource && resource->isValid() && resource->data() != 0; }
- const uchar *data() {
- if (!isValid())
- return 0;
- if (resource->isCompressed()) {
- if (rawData.size() == 0)
- rawData = qUncompress(resource->data(), resource->size());
- return (const uchar *)rawData.constData();
- }
- return resource->data();
- }
- qint64 size() {
- if (data() == 0)
- return 0;
- return resource->isCompressed() ? rawData.size() : resource->size();
- }
- void clear() {
- delete resource;
- rawData.clear();
- }
- QResource *resource;
- QByteArray rawData;
- };
-
- void openMovie(bool tryAsync);
-
- void *m_QTMovie;
- void *m_movieObserver;
-
- QMediaPlayer::State m_state;
- QMediaPlayer::MediaStatus m_mediaStatus;
- QIODevice *m_mediaStream;
- QMediaContent m_resources;
- ResourceHandler m_resourceHandler;
-
- QT7VideoOutput * m_videoOutput;
-
- bool m_muted;
- bool m_tryingAsync;
- int m_volume;
- qreal m_rate;
-
- qint64 m_duration;
- bool m_videoAvailable;
- bool m_audioAvailable;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/mediaplayer/qt7playersession.mm b/src/plugins/qt7/mediaplayer/qt7playersession.mm
deleted file mode 100644
index 1c1277a..0000000
--- a/src/plugins/qt7/mediaplayer/qt7playersession.mm
+++ /dev/null
@@ -1,751 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#import <QTKit/QTDataReference.h>
-#import <QTKit/QTMovie.h>
-
-#include "qt7backend.h"
-
-#include "qt7playersession.h"
-#include "qt7playercontrol.h"
-#include "qt7videooutput.h"
-
-#include <QtNetwork/qnetworkcookie.h>
-#include <qmediaplaylistnavigator.h>
-
-#include <CoreFoundation/CoreFoundation.h>
-#include <Foundation/Foundation.h>
-
-#include <QtCore/qdatetime.h>
-#include <QtCore/qurl.h>
-
-#include <QtCore/qdebug.h>
-
-QT_USE_NAMESPACE
-
-//#define QT_DEBUG_QT7
-
-@interface QTMovieObserver : NSObject
-{
-@private
- QT7PlayerSession *m_session;
- QTMovie *m_movie;
-}
-
-- (QTMovieObserver *) initWithPlayerSession:(QT7PlayerSession*)session;
-- (void) setMovie:(QTMovie *)movie;
-- (void) processEOS:(NSNotification *)notification;
-- (void) processLoadStateChange:(NSNotification *)notification;
-- (void) processVolumeChange:(NSNotification *)notification;
-- (void) processNaturalSizeChange :(NSNotification *)notification;
-- (void) processPositionChange :(NSNotification *)notification;
-@end
-
-@implementation QTMovieObserver
-
-- (QTMovieObserver *) initWithPlayerSession:(QT7PlayerSession*)session
-{
- if (!(self = [super init]))
- return nil;
-
- self->m_session = session;
- return self;
-}
-
-- (void) setMovie:(QTMovie *)movie
-{
- if (m_movie == movie)
- return;
-
- if (m_movie) {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- [m_movie release];
- }
-
- m_movie = movie;
-
- if (movie) {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processEOS:)
- name:QTMovieDidEndNotification
- object:m_movie];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processLoadStateChange:)
- name:QTMovieLoadStateDidChangeNotification
- object:m_movie];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processVolumeChange:)
- name:QTMovieVolumeDidChangeNotification
- object:m_movie];
-
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processPositionChange:)
- name:QTMovieTimeDidChangeNotification
- object:m_movie];
-
- if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processNaturalSizeChange:)
- name:@"QTMovieNaturalSizeDidChangeNotification"
- object:m_movie];
-
- }
- else {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(processNaturalSizeChange:)
- name:QTMovieEditedNotification
- object:m_movie];
- }
-
- [movie retain];
- }
-}
-
-- (void) processEOS:(NSNotification *)notification
-{
- Q_UNUSED(notification);
- QMetaObject::invokeMethod(m_session, "processEOS", Qt::AutoConnection);
-}
-
-- (void) processLoadStateChange:(NSNotification *)notification
-{
- Q_UNUSED(notification);
- QMetaObject::invokeMethod(m_session, "processLoadStateChange", Qt::AutoConnection);
-}
-
-- (void) processVolumeChange:(NSNotification *)notification
-{
- Q_UNUSED(notification);
- QMetaObject::invokeMethod(m_session, "processVolumeChange", Qt::AutoConnection);
-}
-
-- (void) processNaturalSizeChange :(NSNotification *)notification
-{
- Q_UNUSED(notification);
- QMetaObject::invokeMethod(m_session, "processNaturalSizeChange", Qt::AutoConnection);
-}
-
-- (void) processPositionChange :(NSNotification *)notification
-{
- Q_UNUSED(notification);
- QMetaObject::invokeMethod(m_session, "processPositionChange", Qt::AutoConnection);
-}
-
-@end
-
-static inline NSString *qString2CFStringRef(const QString &string)
-{
- return [NSString stringWithCharacters:reinterpret_cast<const UniChar *>(string.unicode()) length:string.length()];
-}
-
-QT7PlayerSession::QT7PlayerSession(QObject *parent)
- : QObject(parent)
- , m_QTMovie(0)
- , m_state(QMediaPlayer::StoppedState)
- , m_mediaStatus(QMediaPlayer::NoMedia)
- , m_mediaStream(0)
- , m_videoOutput(0)
- , m_muted(false)
- , m_tryingAsync(false)
- , m_volume(100)
- , m_rate(1.0)
- , m_duration(0)
- , m_videoAvailable(false)
- , m_audioAvailable(false)
-{
- m_movieObserver = [[QTMovieObserver alloc] initWithPlayerSession:this];
-}
-
-QT7PlayerSession::~QT7PlayerSession()
-{
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
-
- [(QTMovieObserver*)m_movieObserver setMovie:nil];
- [(QTMovieObserver*)m_movieObserver release];
- [(QTMovie*)m_QTMovie release];
-}
-
-void *QT7PlayerSession::movie() const
-{
- return m_QTMovie;
-}
-
-void QT7PlayerSession::setVideoOutput(QT7VideoOutput *output)
-{
- if (m_videoOutput == output)
- return;
-
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
-
- m_videoOutput = output;
-
- if (m_videoOutput && m_state != QMediaPlayer::StoppedState)
- m_videoOutput->setMovie(m_QTMovie);
-}
-
-qint64 QT7PlayerSession::position() const
-{
- if (!m_QTMovie)
- return 0;
-
- QTTime qtTime = [(QTMovie*)m_QTMovie currentTime];
-
- return static_cast<quint64>(float(qtTime.timeValue) / float(qtTime.timeScale) * 1000.0f);
-}
-
-qint64 QT7PlayerSession::duration() const
-{
- if (!m_QTMovie)
- return 0;
-
- QTTime qtTime = [(QTMovie*)m_QTMovie duration];
-
- return static_cast<quint64>(float(qtTime.timeValue) / float(qtTime.timeScale) * 1000.0f);
-}
-
-QMediaPlayer::State QT7PlayerSession::state() const
-{
- return m_state;
-}
-
-QMediaPlayer::MediaStatus QT7PlayerSession::mediaStatus() const
-{
- return m_mediaStatus;
-}
-
-int QT7PlayerSession::bufferStatus() const
-{
- return 100;
-}
-
-int QT7PlayerSession::volume() const
-{
- return m_volume;
-}
-
-bool QT7PlayerSession::isMuted() const
-{
- return m_muted;
-}
-
-bool QT7PlayerSession::isSeekable() const
-{
- return true;
-}
-
-#ifndef QUICKTIME_C_API_AVAILABLE
-@interface QTMovie(QtExtensions)
-- (NSArray*)loadedRanges;
-- (QTTime)maxTimeLoaded;
-@end
-#endif
-
-QMediaTimeRange QT7PlayerSession::availablePlaybackRanges() const
-{
- QTMovie *movie = (QTMovie*)m_QTMovie;
-#ifndef QUICKTIME_C_API_AVAILABLE
- AutoReleasePool pool;
- if ([movie respondsToSelector:@selector(loadedRanges)]) {
- QMediaTimeRange rc;
- NSArray *r = [movie loadedRanges];
- for (NSValue *tr in r) {
- QTTimeRange timeRange = [tr QTTimeRangeValue];
- qint64 startTime = qint64(float(timeRange.time.timeValue) / timeRange.time.timeScale * 1000.0);
- rc.addInterval(startTime, startTime + qint64(float(timeRange.duration.timeValue) / timeRange.duration.timeScale * 1000.0));
- }
- return rc;
- }
- else if ([movie respondsToSelector:@selector(maxTimeLoaded)]) {
- QTTime loadedTime = [movie maxTimeLoaded];
- return QMediaTimeRange(0, qint64(float(loadedTime.timeValue) / loadedTime.timeScale * 1000.0));
- }
-#else
- TimeValue loadedTime;
- TimeScale scale;
- Movie m = [movie quickTimeMovie];
- if (GetMaxLoadedTimeInMovie(m, &loadedTime) == noErr) {
- scale = GetMovieTimeScale(m);
- return QMediaTimeRange(0, qint64(float(loadedTime) / scale * 1000.0f));
- }
-#endif
- return QMediaTimeRange(0, duration());
-}
-
-qreal QT7PlayerSession::playbackRate() const
-{
- return m_rate;
-}
-
-void QT7PlayerSession::setPlaybackRate(qreal rate)
-{
- if (qFuzzyCompare(m_rate, rate))
- return;
-
- m_rate = rate;
-
- if (m_QTMovie != 0 && m_state == QMediaPlayer::PlayingState) {
- AutoReleasePool pool;
- float preferredRate = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMoviePreferredRateAttribute"] floatValue];
- [(QTMovie*)m_QTMovie setRate:preferredRate * m_rate];
- }
-}
-
-void QT7PlayerSession::setPosition(qint64 pos)
-{
- if ( !isSeekable() || pos == position())
- return;
-
- if (duration() > 0)
- pos = qMin(pos, duration());
-
- QTTime newQTTime = [(QTMovie*)m_QTMovie currentTime];
- newQTTime.timeValue = (pos / 1000.0f) * newQTTime.timeScale;
- [(QTMovie*)m_QTMovie setCurrentTime:newQTTime];
-
- //reset the EndOfMedia status position is changed after playback is finished
- if (m_mediaStatus == QMediaPlayer::EndOfMedia)
- processLoadStateChange();
-}
-
-void QT7PlayerSession::play()
-{
- if (m_state == QMediaPlayer::PlayingState)
- return;
-
- m_state = QMediaPlayer::PlayingState;
-
- if (m_videoOutput)
- m_videoOutput->setMovie(m_QTMovie);
-
- //reset the EndOfMedia status if the same file is played again
- if (m_mediaStatus == QMediaPlayer::EndOfMedia)
- processLoadStateChange();
-
- AutoReleasePool pool;
- float preferredRate = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMoviePreferredRateAttribute"] floatValue];
- [(QTMovie*)m_QTMovie setRate:preferredRate * m_rate];
-
- processLoadStateChange();
- emit stateChanged(m_state);
-}
-
-void QT7PlayerSession::pause()
-{
- if (m_state == QMediaPlayer::PausedState)
- return;
-
- m_state = QMediaPlayer::PausedState;
-
- if (m_videoOutput)
- m_videoOutput->setMovie(m_QTMovie);
-
- //reset the EndOfMedia status if the same file is played again
- if (m_mediaStatus == QMediaPlayer::EndOfMedia)
- processLoadStateChange();
-
- [(QTMovie*)m_QTMovie setRate:0];
-
- processLoadStateChange();
- emit stateChanged(m_state);
-}
-
-void QT7PlayerSession::stop()
-{
- if (m_state == QMediaPlayer::StoppedState)
- return;
-
- m_state = QMediaPlayer::StoppedState;
-
- [(QTMovie*)m_QTMovie setRate:0];
- setPosition(0);
-
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
-
- processLoadStateChange();
- emit stateChanged(m_state);
- emit positionChanged(position());
-}
-
-void QT7PlayerSession::setVolume(int volume)
-{
- if (m_volume == volume)
- return;
-
- m_volume = volume;
-
- if (m_QTMovie != 0)
- [(QTMovie*)m_QTMovie setVolume:m_volume / 100.0f];
-
- emit volumeChanged(m_volume);
-}
-
-void QT7PlayerSession::setMuted(bool muted)
-{
- if (m_muted == muted)
- return;
-
- m_muted = muted;
-
- if (m_QTMovie != 0)
- [(QTMovie*)m_QTMovie setMuted:m_muted];
-
- emit mutedChanged(muted);
-}
-
-QMediaContent QT7PlayerSession::media() const
-{
- return m_resources;
-}
-
-const QIODevice *QT7PlayerSession::mediaStream() const
-{
- return m_mediaStream;
-}
-
-void QT7PlayerSession::setMedia(const QMediaContent &content, QIODevice *stream)
-{
- AutoReleasePool pool;
-
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO << content.canonicalUrl();
-#endif
-
- if (m_QTMovie) {
- [(QTMovieObserver*)m_movieObserver setMovie:nil];
-
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
-
- [(QTMovie*)m_QTMovie release];
- m_QTMovie = 0;
- m_resourceHandler.clear();
- }
-
- m_resources = content;
- m_mediaStream = stream;
- QMediaPlayer::MediaStatus oldMediaStatus = m_mediaStatus;
-
- if (content.isNull()) {
- m_mediaStatus = QMediaPlayer::NoMedia;
- if (m_state != QMediaPlayer::StoppedState)
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
-
- if (m_mediaStatus != oldMediaStatus)
- emit mediaStatusChanged(m_mediaStatus);
- emit positionChanged(position());
- return;
- }
-
- m_mediaStatus = QMediaPlayer::LoadingMedia;
- if (m_mediaStatus != oldMediaStatus)
- emit mediaStatusChanged(m_mediaStatus);
-
- QNetworkRequest request = content.canonicalResource().request();
-
- QVariant cookies = request.header(QNetworkRequest::CookieHeader);
- if (cookies.isValid()) {
- NSHTTPCookieStorage *store = [NSHTTPCookieStorage sharedHTTPCookieStorage];
- QList<QNetworkCookie> cookieList = cookies.value<QList<QNetworkCookie> >();
-
- foreach (const QNetworkCookie &requestCookie, cookieList) {
- NSMutableDictionary *p = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- qString2CFStringRef(requestCookie.name()), NSHTTPCookieName,
- qString2CFStringRef(requestCookie.value()), NSHTTPCookieValue,
- qString2CFStringRef(requestCookie.domain()), NSHTTPCookieDomain,
- qString2CFStringRef(requestCookie.path()), NSHTTPCookiePath,
- nil
- ];
- if (requestCookie.isSessionCookie())
- [p setObject:[NSString stringWithUTF8String:"TRUE"] forKey:NSHTTPCookieDiscard];
- else
- [p setObject:[NSDate dateWithTimeIntervalSince1970:requestCookie.expirationDate().toTime_t()] forKey:NSHTTPCookieExpires];
-
- [store setCookie:[NSHTTPCookie cookieWithProperties:p]];
- }
- }
-
- // Attempt multiple times to open the movie.
- // First try - attempt open in async mode
- openMovie(true);
-
- emit positionChanged(position());
-}
-
-void QT7PlayerSession::openMovie(bool tryAsync)
-{
- QUrl requestUrl = m_resources.canonicalResource().request().url();
- if (requestUrl.scheme().isEmpty())
- requestUrl.setScheme(QLatin1String("file"));
-
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO << requestUrl;
-#endif
-
- NSError *err = 0;
- NSString *urlString = [NSString stringWithUTF8String:requestUrl.toEncoded().constData()];
-
- NSMutableDictionary *attr = [NSMutableDictionary dictionaryWithObjectsAndKeys:
- [NSNumber numberWithBool:YES], QTMovieOpenAsyncOKAttribute,
- [NSNumber numberWithBool:YES], QTMovieIsActiveAttribute,
- [NSNumber numberWithBool:YES], QTMovieResolveDataRefsAttribute,
- [NSNumber numberWithBool:YES], QTMovieDontInteractWithUserAttribute,
- nil];
-
-
- if (requestUrl.scheme() == QLatin1String("qrc")) {
- // Load from Qt resource
- m_resourceHandler.setResourceFile(QLatin1Char(':') + requestUrl.path());
- if (!m_resourceHandler.isValid()) {
- emit error(QMediaPlayer::FormatError, tr("Attempting to play invalid Qt resource"));
- return;
- }
-
- CFDataRef resourceData =
- CFDataCreateWithBytesNoCopy(0, m_resourceHandler.data(), m_resourceHandler.size(), kCFAllocatorNull);
-
- QTDataReference *dataReference =
- [QTDataReference dataReferenceWithReferenceToData:(NSData*)resourceData
- name:qString2CFStringRef(requestUrl.path())
- MIMEType:nil];
-
- [attr setObject:dataReference forKey:QTMovieDataReferenceAttribute];
-
- CFRelease(resourceData);
- } else {
- [attr setObject:[NSURL URLWithString:urlString] forKey:QTMovieURLAttribute];
- }
-
- if (tryAsync && QSysInfo::MacintoshVersion >= QSysInfo::MV_10_6) {
- [attr setObject:[NSNumber numberWithBool:YES] forKey:@"QTMovieOpenAsyncRequiredAttribute"];
-// XXX: This is disabled for now. causes some problems with video playback for some formats
-// [attr setObject:[NSNumber numberWithBool:YES] forKey:@"QTMovieOpenForPlaybackAttribute"];
- m_tryingAsync = true;
- }
- else
- m_tryingAsync = false;
-
- m_QTMovie = [QTMovie movieWithAttributes:attr error:&err];
- if (err != nil) {
- // First attempt to test for inability to perform async
-// if ([err code] == QTErrorMovieOpeningCannotBeAsynchronous) { XXX: error code unknown!
- if (m_tryingAsync) {
- m_tryingAsync = false;
- err = nil;
- [attr removeObjectForKey:@"QTMovieOpenAsyncRequiredAttribute"];
- m_QTMovie = [QTMovie movieWithAttributes:attr error:&err];
- }
- }
-
- if (err != nil) {
- m_QTMovie = 0;
- QString description = QString::fromUtf8([[err localizedDescription] UTF8String]);
- emit error(QMediaPlayer::FormatError, description);
-
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO << description;
-#endif
- }
- else {
- [(QTMovie*)m_QTMovie retain];
-
- [(QTMovieObserver*)m_movieObserver setMovie:(QTMovie*)m_QTMovie];
-
- if (m_state != QMediaPlayer::StoppedState && m_videoOutput)
- m_videoOutput->setMovie(m_QTMovie);
-
- processLoadStateChange();
-
- [(QTMovie*)m_QTMovie setMuted:m_muted];
- [(QTMovie*)m_QTMovie setVolume:m_volume / 100.0f];
- }
-}
-
-bool QT7PlayerSession::isAudioAvailable() const
-{
- if (!m_QTMovie)
- return false;
-
- AutoReleasePool pool;
- return [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieHasAudioAttribute"] boolValue] == YES;
-}
-
-bool QT7PlayerSession::isVideoAvailable() const
-{
- if (!m_QTMovie)
- return false;
-
- AutoReleasePool pool;
- return [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieHasVideoAttribute"] boolValue] == YES;
-}
-
-void QT7PlayerSession::processEOS()
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO;
-#endif
- emit positionChanged(position());
- m_mediaStatus = QMediaPlayer::EndOfMedia;
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- emit mediaStatusChanged(m_mediaStatus);
-}
-
-void QT7PlayerSession::processLoadStateChange()
-{
- if (!m_QTMovie)
- return;
-
- AutoReleasePool pool;
-
- long state = [[(QTMovie*)m_QTMovie attributeForKey:QTMovieLoadStateAttribute] longValue];
-
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO << state;
-#endif
-
-#ifndef QUICKTIME_C_API_AVAILABLE
- enum {
- kMovieLoadStateError = -1L,
- kMovieLoadStateLoading = 1000,
- kMovieLoadStateLoaded = 2000,
- kMovieLoadStatePlayable = 10000,
- kMovieLoadStatePlaythroughOK = 20000,
- kMovieLoadStateComplete = 100000
- };
-#endif
-
- if (state == kMovieLoadStateError) {
- if (m_tryingAsync) {
- NSError *error = [(QTMovie*)m_QTMovie attributeForKey:@"QTMovieLoadStateErrorAttribute"];
- if ([error code] == componentNotThreadSafeErr) {
- // Last Async check, try again with no such flag
- openMovie(false);
- }
- }
- else {
- if (m_videoOutput)
- m_videoOutput->setMovie(0);
-
- emit error(QMediaPlayer::FormatError, tr("Failed to load media"));
- emit mediaStatusChanged(m_mediaStatus = QMediaPlayer::InvalidMedia);
- emit stateChanged(m_state = QMediaPlayer::StoppedState);
- }
-
- return;
- }
-
- QMediaPlayer::MediaStatus newStatus = QMediaPlayer::NoMedia;
- bool isPlaying = (m_state != QMediaPlayer::StoppedState);
-
- if (state >= kMovieLoadStatePlaythroughOK) {
- newStatus = isPlaying ? QMediaPlayer::BufferedMedia : QMediaPlayer::LoadedMedia;
- } else if (state >= kMovieLoadStatePlayable)
- newStatus = isPlaying ? QMediaPlayer::BufferingMedia : QMediaPlayer::LoadingMedia;
- else if (state >= kMovieLoadStateLoading) {
- if (!isPlaying)
- newStatus = QMediaPlayer::LoadingMedia;
- else if (m_mediaStatus >= QMediaPlayer::LoadedMedia)
- newStatus = QMediaPlayer::StalledMedia;
- else
- newStatus = QMediaPlayer::LoadingMedia;
- }
-
- if (state >= kMovieLoadStatePlayable &&
- m_state == QMediaPlayer::PlayingState &&
- [(QTMovie*)m_QTMovie rate] == 0) {
-
- float preferredRate = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMoviePreferredRateAttribute"] floatValue];
-
- [(QTMovie*)m_QTMovie setRate:preferredRate * m_rate];
- }
-
- if (state >= kMovieLoadStateLoaded) {
- qint64 currentDuration = duration();
- if (m_duration != currentDuration)
- emit durationChanged(m_duration = currentDuration);
-
- if (m_audioAvailable != isAudioAvailable())
- emit audioAvailableChanged(m_audioAvailable = !m_audioAvailable);
-
- if (m_videoAvailable != isVideoAvailable())
- emit videoAvailableChanged(m_videoAvailable = !m_videoAvailable);
- }
-
- if (newStatus != m_mediaStatus)
- emit mediaStatusChanged(m_mediaStatus = newStatus);
-}
-
-void QT7PlayerSession::processVolumeChange()
-{
- if (!m_QTMovie)
- return;
-
- int newVolume = qRound(100.0f * [((QTMovie*)m_QTMovie) volume]);
-
- if (newVolume != m_volume) {
- emit volumeChanged(m_volume = newVolume);
- }
-}
-
-void QT7PlayerSession::processNaturalSizeChange()
-{
- AutoReleasePool pool;
- NSSize size = [[(QTMovie*)m_QTMovie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue];
-#ifdef QT_DEBUG_QT7
- qDebug() << Q_FUNC_INFO << QSize(size.width, size.height);
-#endif
-
- if (m_videoOutput)
- m_videoOutput->updateNaturalSize(QSize(size.width, size.height));
-}
-
-void QT7PlayerSession::processPositionChange()
-{
- emit positionChanged(position());
-}
-
-#include "moc_qt7playersession.cpp"
diff --git a/src/plugins/qt7/qcvdisplaylink.h b/src/plugins/qt7/qcvdisplaylink.h
deleted file mode 100644
index 46462ec..0000000
--- a/src/plugins/qt7/qcvdisplaylink.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QCVDISPLAYLINK_H
-#define QCVDISPLAYLINK_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-
-#include <qtmultimediadefs.h>
-
-#include <QuartzCore/CVDisplayLink.h>
-
-QT_BEGIN_NAMESPACE
-
-class QCvDisplayLink : public QObject
-{
-Q_OBJECT
-public:
- QCvDisplayLink(QObject *parent = 0);
- virtual ~QCvDisplayLink();
-
- bool isValid();
- bool isActive() const;
-
-public slots:
- void start();
- void stop();
-
-signals:
- void tick(const CVTimeStamp &ts);
-
-public:
- void displayLinkEvent(const CVTimeStamp *);
-
-protected:
- virtual bool event(QEvent *);
-
-private:
- CVDisplayLinkRef m_displayLink;
- QMutex m_displayLinkMutex;
- bool m_pendingDisplayLinkEvent;
- bool m_isActive;
- CVTimeStamp m_frameTimeStamp;
-};
-
-QT_END_NAMESPACE
-
-#endif
-
diff --git a/src/plugins/qt7/qcvdisplaylink.mm b/src/plugins/qt7/qcvdisplaylink.mm
deleted file mode 100644
index ea1b84b..0000000
--- a/src/plugins/qt7/qcvdisplaylink.mm
+++ /dev/null
@@ -1,156 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qcvdisplaylink.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qdebug.h>
-
-QT_USE_NAMESPACE
-
-static CVReturn CVDisplayLinkCallback(CVDisplayLinkRef displayLink,
- const CVTimeStamp *inNow,
- const CVTimeStamp *inOutputTime,
- CVOptionFlags flagsIn,
- CVOptionFlags *flagsOut,
- void *displayLinkContext)
-{
- Q_UNUSED(displayLink);
- Q_UNUSED(inNow);
- Q_UNUSED(flagsIn);
- Q_UNUSED(flagsOut);
-
- QCvDisplayLink *link = (QCvDisplayLink *)displayLinkContext;
-
- link->displayLinkEvent(inOutputTime);
- return kCVReturnSuccess;
-}
-
-
-QCvDisplayLink::QCvDisplayLink(QObject *parent)
- :QObject(parent),
- m_pendingDisplayLinkEvent(false),
- m_isActive(false)
-{
- // create display link for the main display
- CVDisplayLinkCreateWithCGDisplay(kCGDirectMainDisplay, &m_displayLink);
- if (m_displayLink) {
- // set the current display of a display link.
- CVDisplayLinkSetCurrentCGDisplay(m_displayLink, kCGDirectMainDisplay);
-
- // set the renderer output callback function
- CVDisplayLinkSetOutputCallback(m_displayLink, &CVDisplayLinkCallback, this);
- }
-}
-
-QCvDisplayLink::~QCvDisplayLink()
-{
- if (m_displayLink) {
- CVDisplayLinkStop(m_displayLink);
- CVDisplayLinkRelease(m_displayLink);
- m_displayLink = NULL;
- }
-}
-
-bool QCvDisplayLink::isValid()
-{
- return m_displayLink != 0;
-}
-
-bool QCvDisplayLink::isActive() const
-{
- return m_isActive;
-}
-
-void QCvDisplayLink::start()
-{
- if (m_displayLink && !m_isActive) {
- CVDisplayLinkStart(m_displayLink);
- m_isActive = true;
- }
-}
-
-void QCvDisplayLink::stop()
-{
- if (m_displayLink && m_isActive) {
- CVDisplayLinkStop(m_displayLink);
- m_isActive = false;
- }
-}
-
-void QCvDisplayLink::displayLinkEvent(const CVTimeStamp *ts)
-{
- // This function is called from a
- // thread != gui thread. So we post the event.
- // But we need to make sure that we don't post faster
- // than the event loop can eat:
- m_displayLinkMutex.lock();
- bool pending = m_pendingDisplayLinkEvent;
- m_pendingDisplayLinkEvent = true;
- m_frameTimeStamp = *ts;
- m_displayLinkMutex.unlock();
-
- if (!pending)
- qApp->postEvent(this, new QEvent(QEvent::User), Qt::HighEventPriority);
-}
-
-bool QCvDisplayLink::event(QEvent *event)
-{
- switch (event->type()){
- case QEvent::User: {
- m_displayLinkMutex.lock();
- m_pendingDisplayLinkEvent = false;
- CVTimeStamp ts = m_frameTimeStamp;
- m_displayLinkMutex.unlock();
-
- emit tick(ts);
-
- return false;
- }
- break;
- default:
- break;
- }
- return QObject::event(event);
-}
-
-#include "moc_qcvdisplaylink.cpp"
-
diff --git a/src/plugins/qt7/qt7.pro b/src/plugins/qt7/qt7.pro
deleted file mode 100644
index e58b199..0000000
--- a/src/plugins/qt7/qt7.pro
+++ /dev/null
@@ -1,61 +0,0 @@
-load(qt_module)
-
-TARGET = qqt7engine
-QT += multimedia-private multimediawidgets-private network widgets
-PLUGIN_TYPE = mediaservice
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-!simulator {
-QT += opengl
-}
-
-#DEFINES += QT_DEBUG_QT7
-
-LIBS += -framework AppKit -framework AudioUnit \
- -framework AudioToolbox -framework CoreAudio \
- -framework QuartzCore -framework QTKit
-
-# The Quicktime framework is only awailable for 32-bit builds, so we
-# need to check for this before linking against it.
-# QMAKE_MAC_XARCH is not awailable on Tiger, but at the same time,
-# we never build for 64-bit architechtures on Tiger either:
-contains(QMAKE_MAC_XARCH, no) {
- LIBS += -framework QuickTime
-} else {
- LIBS += -Xarch_i386 -framework QuickTime -Xarch_ppc -framework QuickTime
-}
-
-HEADERS += \
- qt7backend.h \
- qt7videooutput.h \
- qt7serviceplugin.h
-
-OBJECTIVE_SOURCES += \
- qt7backend.mm \
- qt7serviceplugin.mm
-
-!simulator {
- HEADERS += \
- qt7movieviewoutput.h \
- qt7movievideowidget.h \
- qt7movieviewrenderer.h \
- qt7movierenderer.h \
- qt7ciimagevideobuffer.h \
- qcvdisplaylink.h
-
- OBJECTIVE_SOURCES += \
- qt7movieviewoutput.mm \
- qt7movievideowidget.mm \
- qt7movieviewrenderer.mm \
- qt7movierenderer.mm \
- qt7videooutput.mm \
- qt7ciimagevideobuffer.mm \
- qcvdisplaylink.mm
-}
-
-include(mediaplayer/mediaplayer.pri)
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/qt7/qt7backend.h b/src/plugins/qt7/qt7backend.h
deleted file mode 100644
index 92c56ed..0000000
--- a/src/plugins/qt7/qt7backend.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7BACKEND_H
-#define QT7BACKEND_H
-
-#include "qtmultimediadefs.h"
-
-#include <QtCore/QString>
-
-#ifndef Q_OS_SIMULATOR
-#ifndef Q_OS_MAC64
-#define QUICKTIME_C_API_AVAILABLE
-#endif
-#endif // !defined(Q_WS_SIMULATOR)
-
-QT_BEGIN_NAMESPACE
-
-class AutoReleasePool
-{
-private:
- void *pool;
-public:
- AutoReleasePool();
- ~AutoReleasePool();
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7backend.mm b/src/plugins/qt7/qt7backend.mm
deleted file mode 100644
index 9332b5f..0000000
--- a/src/plugins/qt7/qt7backend.mm
+++ /dev/null
@@ -1,60 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7backend.h"
-
-#import <Foundation/NSAutoreleasePool.h>
-#include <CoreFoundation/CFBase.h>
-
-
-QT_BEGIN_NAMESPACE
-
-AutoReleasePool::AutoReleasePool()
-{
- pool = (void*)[[NSAutoreleasePool alloc] init];
-}
-
-AutoReleasePool::~AutoReleasePool()
-{
- [(NSAutoreleasePool*)pool release];
-}
-
-QT_END_NAMESPACE
diff --git a/src/plugins/qt7/qt7ciimagevideobuffer.h b/src/plugins/qt7/qt7ciimagevideobuffer.h
deleted file mode 100644
index 95d404a..0000000
--- a/src/plugins/qt7/qt7ciimagevideobuffer.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7CIIMAGEVIDEOBUFFER_H
-#define QT7CIIMAGEVIDEOBUFFER_H
-
-#include "qt7backend.h"
-#import <QTKit/QTKit.h>
-
-#include <QtCore/qvariant.h>
-#include <qabstractvideobuffer.h>
-
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-QT_BEGIN_NAMESPACE
-
-class QT7CIImageVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- QT7CIImageVideoBuffer(CIImage *image);
-
- virtual ~QT7CIImageVideoBuffer();
-
- MapMode mapMode() const;
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine);
- void unmap();
- QVariant handle() const;
-
-private:
- CIImage *m_image;
- NSBitmapImageRep *m_buffer;
- MapMode m_mode;
-};
-
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7ciimagevideobuffer.mm b/src/plugins/qt7/qt7ciimagevideobuffer.mm
deleted file mode 100644
index cf85372..0000000
--- a/src/plugins/qt7/qt7ciimagevideobuffer.mm
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7ciimagevideobuffer.h"
-
-#include <QuartzCore/CIFilter.h>
-#include <QuartzCore/CIVector.h>
-
-QT7CIImageVideoBuffer::QT7CIImageVideoBuffer(CIImage *image)
- : QAbstractVideoBuffer(CoreImageHandle)
- , m_image(image)
- , m_buffer(0)
- , m_mode(NotMapped)
-{
- [m_image retain];
-}
-
-QT7CIImageVideoBuffer::~QT7CIImageVideoBuffer()
-{
- [m_image release];
- [m_buffer release];
-}
-
-QAbstractVideoBuffer::MapMode QT7CIImageVideoBuffer::mapMode() const
-{
- return m_mode;
-}
-
-uchar *QT7CIImageVideoBuffer::map(QAbstractVideoBuffer::MapMode mode, int *numBytes, int *bytesPerLine)
-{
- if (mode == NotMapped || m_mode != NotMapped || !m_image)
- return 0;
-
- if (!m_buffer) {
- //swap R and B channels
- CIFilter *colorSwapFilter = [CIFilter filterWithName: @"CIColorMatrix" keysAndValues:
- @"inputImage", m_image,
- @"inputRVector", [CIVector vectorWithX: 0 Y: 0 Z: 1 W: 0],
- @"inputGVector", [CIVector vectorWithX: 0 Y: 1 Z: 0 W: 0],
- @"inputBVector", [CIVector vectorWithX: 1 Y: 0 Z: 0 W: 0],
- @"inputAVector", [CIVector vectorWithX: 0 Y: 0 Z: 0 W: 1],
- @"inputBiasVector", [CIVector vectorWithX: 0 Y: 0 Z: 0 W: 0],
- nil];
- CIImage *img = [colorSwapFilter valueForKey: @"outputImage"];
-
- m_buffer = [[NSBitmapImageRep alloc] initWithCIImage:img];
- }
-
- if (numBytes)
- *numBytes = [m_buffer bytesPerPlane];
-
- if (bytesPerLine)
- *bytesPerLine = [m_buffer bytesPerRow];
-
- m_mode = mode;
-
- return [m_buffer bitmapData];
-}
-
-void QT7CIImageVideoBuffer::unmap()
-{
- m_mode = NotMapped;
-}
-
-QVariant QT7CIImageVideoBuffer::handle() const
-{
- return QVariant::fromValue<void*>(m_image);
-}
-
diff --git a/src/plugins/qt7/qt7movierenderer.h b/src/plugins/qt7/qt7movierenderer.h
deleted file mode 100644
index 7055158..0000000
--- a/src/plugins/qt7/qt7movierenderer.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7MOVIERENDERER_H
-#define QT7MOVIERENDERER_H
-
-#include "qt7backend.h"
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-
-#include <qvideorenderercontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-#include "qt7videooutput.h"
-
-#include <QuartzCore/CVOpenGLTexture.h>
-#include <QuickTime/QuickTime.h>
-
-QT_BEGIN_NAMESPACE
-
-class QGLContext;
-
-class QCvDisplayLink;
-class QT7PlayerSession;
-class QT7PlayerService;
-
-class QT7MovieRenderer : public QT7VideoRendererControl
-{
-Q_OBJECT
-public:
- QT7MovieRenderer(QObject *parent = 0);
- virtual ~QT7MovieRenderer();
-
- void setMovie(void *movie);
- void updateNaturalSize(const QSize &newSize);
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- QSize nativeSize() const;
-
-private slots:
- void updateVideoFrame(const CVTimeStamp &ts);
-
-private:
- void setupVideoOutput();
- bool createPixelBufferVisualContext();
- bool createGLVisualContext();
-
- void *m_movie;
-
- QMutex m_mutex;
-
- QCvDisplayLink *m_displayLink;
-#ifdef QUICKTIME_C_API_AVAILABLE
- QTVisualContextRef m_visualContext;
- bool m_usingGLContext;
- const QGLContext *m_currentGLContext;
- QSize m_pixelBufferContextGeometry;
-#endif
- QAbstractVideoSurface *m_surface;
- QSize m_nativeSize;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7movierenderer.mm b/src/plugins/qt7/qt7movierenderer.mm
deleted file mode 100644
index b020f4c..0000000
--- a/src/plugins/qt7/qt7movierenderer.mm
+++ /dev/null
@@ -1,479 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#import <QTKit/QTKit.h>
-
-#include "qt7backend.h"
-
-#include "qt7playercontrol.h"
-#include "qt7movierenderer.h"
-#include "qt7playersession.h"
-#include "qt7ciimagevideobuffer.h"
-#include "qcvdisplaylink.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <QGLWidget>
-
-#include <qabstractvideobuffer.h>
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-QT_USE_NAMESPACE
-
-//#define USE_MAIN_MONITOR_COLOR_SPACE 1
-
-class CVGLTextureVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- CVGLTextureVideoBuffer(CVOpenGLTextureRef buffer)
- : QAbstractVideoBuffer(GLTextureHandle)
- , m_buffer(buffer)
- , m_mode(NotMapped)
- {
- CVOpenGLTextureRetain(m_buffer);
- }
-
- virtual ~CVGLTextureVideoBuffer()
- {
- CVOpenGLTextureRelease(m_buffer);
- }
-
- QVariant handle() const
- {
- GLuint id = CVOpenGLTextureGetName(m_buffer);
- return QVariant(int(id));
- }
-
- MapMode mapMode() const { return m_mode; }
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine)
- {
- if (numBytes)
- *numBytes = 0;
-
- if (bytesPerLine)
- *bytesPerLine = 0;
-
- m_mode = mode;
- return 0;
- }
-
- void unmap() { m_mode = NotMapped; }
-
-private:
- CVOpenGLTextureRef m_buffer;
- MapMode m_mode;
-};
-
-
-class CVPixelBufferVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- CVPixelBufferVideoBuffer(CVPixelBufferRef buffer)
- : QAbstractVideoBuffer(NoHandle)
- , m_buffer(buffer)
- , m_mode(NotMapped)
- {
- CVPixelBufferRetain(m_buffer);
- }
-
- virtual ~CVPixelBufferVideoBuffer()
- {
- CVPixelBufferRelease(m_buffer);
- }
-
- MapMode mapMode() const { return m_mode; }
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine)
- {
- if (mode != NotMapped && m_mode == NotMapped) {
- CVPixelBufferLockBaseAddress(m_buffer, 0);
-
- if (numBytes)
- *numBytes = CVPixelBufferGetDataSize(m_buffer);
-
- if (bytesPerLine)
- *bytesPerLine = CVPixelBufferGetBytesPerRow(m_buffer);
-
- m_mode = mode;
-
- return (uchar*)CVPixelBufferGetBaseAddress(m_buffer);
- } else {
- return 0;
- }
- }
-
- void unmap()
- {
- if (m_mode != NotMapped) {
- m_mode = NotMapped;
- CVPixelBufferUnlockBaseAddress(m_buffer, 0);
- }
- }
-
-private:
- CVPixelBufferRef m_buffer;
- MapMode m_mode;
-};
-
-
-
-QT7MovieRenderer::QT7MovieRenderer(QObject *parent)
- :QT7VideoRendererControl(parent),
- m_movie(0),
-#ifdef QUICKTIME_C_API_AVAILABLE
- m_visualContext(0),
- m_usingGLContext(false),
- m_currentGLContext(0),
-#endif
- m_surface(0)
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieRenderer";
-#endif
- m_displayLink = new QCvDisplayLink(this);
- connect(m_displayLink, SIGNAL(tick(CVTimeStamp)), SLOT(updateVideoFrame(CVTimeStamp)));
-}
-
-
-bool QT7MovieRenderer::createGLVisualContext()
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
- AutoReleasePool pool;
- CGLContextObj cglContext = CGLGetCurrentContext();
- NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat];
- CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]);
-
- OSStatus err = QTOpenGLTextureContextCreate(kCFAllocatorDefault, cglContext,
- cglPixelFormat, NULL, &m_visualContext);
- if (err != noErr)
- qWarning() << "Could not create visual context (OpenGL)";
-
- return (err == noErr);
-#endif // QUICKTIME_C_API_AVAILABLE
-
- return false;
-}
-
-#ifdef QUICKTIME_C_API_AVAILABLE
-static bool DictionarySetValue(CFMutableDictionaryRef dict, CFStringRef key, SInt32 value)
-{
- CFNumberRef number = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &value);
-
- if (number) {
- CFDictionarySetValue( dict, key, number );
- CFRelease( number );
- return true;
- }
- return false;
-}
-#endif // QUICKTIME_C_API_AVAILABLE
-
-bool QT7MovieRenderer::createPixelBufferVisualContext()
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
- if (m_visualContext) {
- QTVisualContextRelease(m_visualContext);
- m_visualContext = 0;
- }
-
- m_pixelBufferContextGeometry = m_nativeSize;
-
- CFMutableDictionaryRef pixelBufferOptions = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- //DictionarySetValue(pixelBufferOptions, kCVPixelBufferPixelFormatTypeKey, k32ARGBPixelFormat );
- DictionarySetValue(pixelBufferOptions, kCVPixelBufferPixelFormatTypeKey, k32BGRAPixelFormat );
- DictionarySetValue(pixelBufferOptions, kCVPixelBufferWidthKey, m_nativeSize.width() );
- DictionarySetValue(pixelBufferOptions, kCVPixelBufferHeightKey, m_nativeSize.height() );
- DictionarySetValue(pixelBufferOptions, kCVPixelBufferBytesPerRowAlignmentKey, 16);
- //CFDictionarySetValue(pixelBufferOptions, kCVPixelBufferOpenGLCompatibilityKey, kCFBooleanTrue);
-
- CFMutableDictionaryRef visualContextOptions = CFDictionaryCreateMutable(kCFAllocatorDefault, 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
- CFDictionarySetValue(visualContextOptions, kQTVisualContextPixelBufferAttributesKey, pixelBufferOptions);
-
- CGColorSpaceRef colorSpace = NULL;
-
-#if USE_MAIN_MONITOR_COLOR_SPACE
- CMProfileRef sysprof = NULL;
-
- // Get the Systems Profile for the main display
- if (CMGetSystemProfile(&sysprof) == noErr) {
- // Create a colorspace with the systems profile
- colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
- CMCloseProfile(sysprof);
- }
-#endif
-
- if (!colorSpace)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- CFDictionarySetValue(visualContextOptions, kQTVisualContextOutputColorSpaceKey, colorSpace);
-
- OSStatus err = QTPixelBufferContextCreate(kCFAllocatorDefault,
- visualContextOptions,
- &m_visualContext);
- CFRelease(pixelBufferOptions);
- CFRelease(visualContextOptions);
-
- if (err != noErr) {
- qWarning() << "Could not create visual context (PixelBuffer)";
- return false;
- }
-
- return true;
-#endif // QUICKTIME_C_API_AVAILABLE
-
- return false;
-}
-
-
-QT7MovieRenderer::~QT7MovieRenderer()
-{
- m_displayLink->stop();
-}
-
-void QT7MovieRenderer::setupVideoOutput()
-{
- AutoReleasePool pool;
-
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieRenderer::setupVideoOutput" << m_movie;
-#endif
-
- if (m_movie == 0 || m_surface == 0) {
- m_displayLink->stop();
- return;
- }
-
- NSSize size = [[(QTMovie*)m_movie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue];
- m_nativeSize = QSize(size.width, size.height);
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- bool usedGLContext = m_usingGLContext;
-
- if (!m_nativeSize.isEmpty()) {
-
- bool glSupported = !m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).isEmpty();
-
- //Try rendering using opengl textures first:
- if (glSupported) {
- QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32, QAbstractVideoBuffer::GLTextureHandle);
-
- if (m_surface->isActive())
- m_surface->stop();
-
- if (!m_surface->start(format)) {
- qWarning() << "failed to start video surface" << m_surface->error();
- qWarning() << "Surface format:" << format;
- glSupported = false;
- } else {
- m_usingGLContext = true;
- }
-
- }
-
- if (!glSupported) {
- m_usingGLContext = false;
- QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32);
-
- if (m_surface->isActive() && m_surface->surfaceFormat() != format) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Surface format was changed, stop the surface.";
-#endif
- m_surface->stop();
- }
-
- if (!m_surface->isActive()) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Starting the surface with format" << format;
-#endif
- if (!m_surface->start(format)) {
- qWarning() << "failed to start video surface" << m_surface->error();
- qWarning() << "Surface format:" << format;
- }
- }
- }
- }
-
-
- if (m_visualContext) {
- //check if the visual context still can be reused
- if (usedGLContext != m_usingGLContext ||
- (m_usingGLContext && (m_currentGLContext != QGLContext::currentContext())) ||
- (!m_usingGLContext && (m_pixelBufferContextGeometry != m_nativeSize))) {
- QTVisualContextRelease(m_visualContext);
- m_pixelBufferContextGeometry = QSize();
- m_visualContext = 0;
- }
- }
-
- if (!m_nativeSize.isEmpty()) {
- if (!m_visualContext) {
- if (m_usingGLContext) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Building OpenGL visual context" << m_nativeSize;
-#endif
- m_currentGLContext = QGLContext::currentContext();
- if (!createGLVisualContext()) {
- qWarning() << "QT7MovieRenderer: failed to create visual context";
- return;
- }
- } else {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Building Pixel Buffer visual context" << m_nativeSize;
-#endif
- if (!createPixelBufferVisualContext()) {
- qWarning() << "QT7MovieRenderer: failed to create visual context";
- return;
- }
- }
- }
-
- // targets a Movie to render into a visual context
- SetMovieVisualContext([(QTMovie*)m_movie quickTimeMovie], m_visualContext);
-
- m_displayLink->start();
- }
-#endif
-
-}
-
-void QT7MovieRenderer::setMovie(void *movie)
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieRenderer::setMovie" << movie;
-#endif
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- QMutexLocker locker(&m_mutex);
-
- if (m_movie != movie) {
- if (m_movie) {
- //ensure the old movie doesn't hold the visual context, otherwise it can't be reused
- SetMovieVisualContext([(QTMovie*)m_movie quickTimeMovie], nil);
- [(QTMovie*)m_movie release];
- }
-
- m_movie = movie;
- [(QTMovie*)m_movie retain];
-
- setupVideoOutput();
- }
-#endif
-}
-
-void QT7MovieRenderer::updateNaturalSize(const QSize &newSize)
-{
- if (m_nativeSize != newSize) {
- m_nativeSize = newSize;
- setupVideoOutput();
- }
-}
-
-QAbstractVideoSurface *QT7MovieRenderer::surface() const
-{
- return m_surface;
-}
-
-void QT7MovieRenderer::setSurface(QAbstractVideoSurface *surface)
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << "Set video surface" << surface;
-#endif
-
- if (surface == m_surface)
- return;
-
- QMutexLocker locker(&m_mutex);
-
- if (m_surface && m_surface->isActive())
- m_surface->stop();
-
- m_surface = surface;
- setupVideoOutput();
-}
-
-
-QSize QT7MovieRenderer::nativeSize() const
-{
- return m_nativeSize;
-}
-
-void QT7MovieRenderer::updateVideoFrame(const CVTimeStamp &ts)
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
-
- QMutexLocker locker(&m_mutex);
-
- if (m_surface && m_surface->isActive() &&
- m_visualContext && QTVisualContextIsNewImageAvailable(m_visualContext, &ts)) {
-
- CVImageBufferRef imageBuffer = NULL;
-
- OSStatus status = QTVisualContextCopyImageForTime(m_visualContext, NULL, &ts, &imageBuffer);
-
- if (status == noErr && imageBuffer) {
- QAbstractVideoBuffer *buffer = 0;
-
- if (m_usingGLContext) {
- buffer = new QT7CIImageVideoBuffer([CIImage imageWithCVImageBuffer:imageBuffer]);
- CVOpenGLTextureRelease((CVOpenGLTextureRef)imageBuffer);
- } else {
- buffer = new CVPixelBufferVideoBuffer((CVPixelBufferRef)imageBuffer);
- //buffer = new QT7CIImageVideoBuffer( [CIImage imageWithCVImageBuffer:imageBuffer] );
- CVPixelBufferRelease((CVPixelBufferRef)imageBuffer);
- }
-
- QVideoFrame frame(buffer, m_nativeSize, QVideoFrame::Format_RGB32);
- m_surface->present(frame);
- QTVisualContextTask(m_visualContext);
- }
- }
-#else
- Q_UNUSED(ts);
-#endif
-}
-
-#include "moc_qt7movierenderer.cpp"
diff --git a/src/plugins/qt7/qt7movievideowidget.h b/src/plugins/qt7/qt7movievideowidget.h
deleted file mode 100644
index d3e6078..0000000
--- a/src/plugins/qt7/qt7movievideowidget.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7MOVIEVIDEOWIDGET_H
-#define QT7MOVIEVIDEOWIDGET_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-
-#include <qvideowindowcontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-#include "qt7videooutput.h"
-
-#include <QuartzCore/CVOpenGLTexture.h>
-#include <QuickTime/QuickTime.h>
-
-class GLVideoWidget;
-
-QT_BEGIN_NAMESPACE
-
-class QCvDisplayLink;
-class QT7PlayerSession;
-class QT7PlayerService;
-
-class QT7MovieVideoWidget : public QT7VideoWidgetControl
-{
-Q_OBJECT
-public:
- QT7MovieVideoWidget(QObject *parent = 0);
- virtual ~QT7MovieVideoWidget();
-
- void setMovie(void *movie);
- void updateNaturalSize(const QSize &newSize);
-
- QWidget *videoWidget();
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
-private slots:
- void updateVideoFrame(const CVTimeStamp &ts);
-
-private:
- void setupVideoOutput();
- bool createVisualContext();
-
- void updateColors();
-
- void *m_movie;
- GLVideoWidget *m_videoWidget;
-
- QCvDisplayLink *m_displayLink;
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- QTVisualContextRef m_visualContext;
-#endif
-
- bool m_fullscreen;
- QSize m_nativeSize;
- Qt::AspectRatioMode m_aspectRatioMode;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7movievideowidget.mm b/src/plugins/qt7/qt7movievideowidget.mm
deleted file mode 100644
index 5d9ea21..0000000
--- a/src/plugins/qt7/qt7movievideowidget.mm
+++ /dev/null
@@ -1,437 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7backend.h"
-
-#import <QTKit/QTDataReference.h>
-#import <QTKit/QTMovie.h>
-#import <QTKit/QTMovieView.h>
-#import <QTKit/QTMovieLayer.h>
-#import <AppKit/NSImage.h>
-#import <OpenGL/glu.h>
-
-
-#include "qt7playercontrol.h"
-#include "qt7movievideowidget.h"
-#include "qt7playersession.h"
-#include "qcvdisplaylink.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <QGLWidget>
-
-#include <CoreFoundation/CoreFoundation.h>
-
-#import <QuartzCore/QuartzCore.h>
-
-#include "math.h"
-
-QT_USE_NAMESPACE
-
-class GLVideoWidget : public QGLWidget
-{
-public:
-
- GLVideoWidget(QWidget *parent, const QGLFormat &format)
- : QGLWidget(format, parent),
- m_texRef(0),
- m_nativeSize(640,480),
- m_aspectRatioMode(Qt::KeepAspectRatio)
- {
- setAutoFillBackground(false);
- }
-
- void initializeGL()
- {
- QColor bgColor = palette().color(QPalette::Background);
- glClearColor(bgColor.redF(), bgColor.greenF(), bgColor.blueF(), bgColor.alphaF());
- }
-
- void resizeGL(int w, int h)
- {
- glMatrixMode(GL_MODELVIEW);
- glLoadIdentity();
- glMatrixMode(GL_PROJECTION);
- glLoadIdentity();
- glViewport(0, 0, GLsizei(w), GLsizei(h));
- gluOrtho2D(0, GLsizei(w), 0, GLsizei(h));
- updateGL();
- }
-
- void paintGL()
- {
- glClear(GL_COLOR_BUFFER_BIT);
- if (!m_texRef)
- return;
-
- glPushMatrix();
- glDisable(GL_CULL_FACE);
- GLenum target = CVOpenGLTextureGetTarget(m_texRef);
- glEnable(target);
-
- glBindTexture(target, CVOpenGLTextureGetName(m_texRef));
- glTexParameterf(target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- GLfloat lowerLeft[2], lowerRight[2], upperRight[2], upperLeft[2];
- CVOpenGLTextureGetCleanTexCoords(m_texRef, lowerLeft, lowerRight, upperRight, upperLeft);
-
- glBegin(GL_QUADS);
- QRect rect = displayRect();
- glTexCoord2f(lowerLeft[0], lowerLeft[1]);
- glVertex2i(rect.topLeft().x(), rect.topLeft().y());
- glTexCoord2f(lowerRight[0], lowerRight[1]);
- glVertex2i(rect.topRight().x() + 1, rect.topRight().y());
- glTexCoord2f(upperRight[0], upperRight[1]);
- glVertex2i(rect.bottomRight().x() + 1, rect.bottomRight().y() + 1);
- glTexCoord2f(upperLeft[0], upperLeft[1]);
- glVertex2i(rect.bottomLeft().x(), rect.bottomLeft().y() + 1);
- glEnd();
- glPopMatrix();
- }
-
- void setCVTexture(CVOpenGLTextureRef texRef)
- {
- if (m_texRef)
- CVOpenGLTextureRelease(m_texRef);
-
- m_texRef = texRef;
-
- if (m_texRef)
- CVOpenGLTextureRetain(m_texRef);
-
- if (isVisible()) {
- makeCurrent();
- paintGL();
- swapBuffers();
- }
- }
-
- QSize sizeHint() const
- {
- return m_nativeSize;
- }
-
- void setNativeSize(const QSize &size)
- {
- m_nativeSize = size;
- }
-
- void setAspectRatioMode(Qt::AspectRatioMode mode)
- {
- if (m_aspectRatioMode != mode) {
- m_aspectRatioMode = mode;
- update();
- }
- }
-
-private:
- QRect displayRect() const
- {
- QRect displayRect = rect();
-
- if (m_aspectRatioMode == Qt::KeepAspectRatio) {
- QSize size = m_nativeSize;
- size.scale(displayRect.size(), Qt::KeepAspectRatio);
-
- displayRect = QRect(QPoint(0, 0), size);
- displayRect.moveCenter(rect().center());
- }
- return displayRect;
- }
-
- CVOpenGLTextureRef m_texRef;
- QSize m_nativeSize;
- Qt::AspectRatioMode m_aspectRatioMode;
-};
-
-QT7MovieVideoWidget::QT7MovieVideoWidget(QObject *parent)
- :QT7VideoWidgetControl(parent),
- m_movie(0),
- m_videoWidget(0),
- m_fullscreen(false),
- m_aspectRatioMode(Qt::KeepAspectRatio),
- m_brightness(0),
- m_contrast(0),
- m_hue(0),
- m_saturation(0)
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieVideoWidget";
-#endif
-
- QGLFormat format = QGLFormat::defaultFormat();
- format.setSwapInterval(1); // Vertical sync (avoid tearing)
- m_videoWidget = new GLVideoWidget(0, format);
-
- m_displayLink = new QCvDisplayLink(this);
-
- connect(m_displayLink, SIGNAL(tick(CVTimeStamp)), SLOT(updateVideoFrame(CVTimeStamp)));
-
- if (!createVisualContext()) {
- qWarning() << "QT7MovieVideoWidget: failed to create visual context";
- }
-}
-
-bool QT7MovieVideoWidget::createVisualContext()
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
- m_videoWidget->makeCurrent();
-
- AutoReleasePool pool;
- CGLContextObj cglContext = CGLGetCurrentContext();
- NSOpenGLPixelFormat *nsglPixelFormat = [NSOpenGLView defaultPixelFormat];
- CGLPixelFormatObj cglPixelFormat = static_cast<CGLPixelFormatObj>([nsglPixelFormat CGLPixelFormatObj]);
-
- CFTypeRef keys[] = { kQTVisualContextOutputColorSpaceKey };
- CGColorSpaceRef colorSpace = NULL;
- CMProfileRef sysprof = NULL;
-
- // Get the Systems Profile for the main display
- if (CMGetSystemProfile(&sysprof) == noErr) {
- // Create a colorspace with the systems profile
- colorSpace = CGColorSpaceCreateWithPlatformColorSpace(sysprof);
- CMCloseProfile(sysprof);
- }
-
- if (!colorSpace)
- colorSpace = CGColorSpaceCreateDeviceRGB();
-
- CFDictionaryRef textureContextAttributes = CFDictionaryCreate(kCFAllocatorDefault,
- (const void **)keys,
- (const void **)&colorSpace, 1,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks);
-
- OSStatus err = QTOpenGLTextureContextCreate(kCFAllocatorDefault,
- cglContext,
- cglPixelFormat,
- textureContextAttributes,
- &m_visualContext);
- if (err != noErr)
- qWarning() << "Could not create visual context (OpenGL)";
-
-
- return (err == noErr);
-#endif // QUICKTIME_C_API_AVAILABLE
-
- return false;
-}
-
-QT7MovieVideoWidget::~QT7MovieVideoWidget()
-{
- m_displayLink->stop();
- [(QTMovie*)m_movie release];
- delete m_videoWidget;
-}
-
-QWidget *QT7MovieVideoWidget::videoWidget()
-{
- return m_videoWidget;
-}
-
-void QT7MovieVideoWidget::setupVideoOutput()
-{
- AutoReleasePool pool;
-
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieVideoWidget::setupVideoOutput" << m_movie;
-#endif
-
- if (m_movie == 0) {
- m_displayLink->stop();
- return;
- }
-
- NSSize size = [[(QTMovie*)m_movie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue];
- m_nativeSize = QSize(size.width, size.height);
- m_videoWidget->setNativeSize(m_nativeSize);
-
-#ifdef QUICKTIME_C_API_AVAILABLE
- // targets a Movie to render into a visual context
- SetMovieVisualContext([(QTMovie*)m_movie quickTimeMovie], m_visualContext);
-#endif
-
- m_displayLink->start();
-}
-
-void QT7MovieVideoWidget::setMovie(void *movie)
-{
- if (m_movie == movie)
- return;
-
- if (m_movie) {
-#ifdef QUICKTIME_C_API_AVAILABLE
- SetMovieVisualContext([(QTMovie*)m_movie quickTimeMovie], nil);
-#endif
- [(QTMovie*)m_movie release];
- }
-
- m_movie = movie;
- [(QTMovie*)m_movie retain];
-
- setupVideoOutput();
-}
-
-void QT7MovieVideoWidget::updateNaturalSize(const QSize &newSize)
-{
- if (m_nativeSize != newSize) {
- m_nativeSize = newSize;
- setupVideoOutput();
- }
-}
-
-bool QT7MovieVideoWidget::isFullScreen() const
-{
- return m_fullscreen;
-}
-
-void QT7MovieVideoWidget::setFullScreen(bool fullScreen)
-{
- m_fullscreen = fullScreen;
-}
-
-QSize QT7MovieVideoWidget::nativeSize() const
-{
- return m_nativeSize;
-}
-
-Qt::AspectRatioMode QT7MovieVideoWidget::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QT7MovieVideoWidget::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
- m_videoWidget->setAspectRatioMode(mode);
-}
-
-int QT7MovieVideoWidget::brightness() const
-{
- return m_brightness;
-}
-
-void QT7MovieVideoWidget::setBrightness(int brightness)
-{
- m_brightness = brightness;
- updateColors();
-}
-
-int QT7MovieVideoWidget::contrast() const
-{
- return m_contrast;
-}
-
-void QT7MovieVideoWidget::setContrast(int contrast)
-{
- m_contrast = contrast;
- updateColors();
-}
-
-int QT7MovieVideoWidget::hue() const
-{
- return m_hue;
-}
-
-void QT7MovieVideoWidget::setHue(int hue)
-{
- m_hue = hue;
- updateColors();
-}
-
-int QT7MovieVideoWidget::saturation() const
-{
- return m_saturation;
-}
-
-void QT7MovieVideoWidget::setSaturation(int saturation)
-{
- m_saturation = saturation;
- updateColors();
-}
-
-void QT7MovieVideoWidget::updateColors()
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
- if (m_movie) {
- QTMovie *movie = (QTMovie*)m_movie;
-
- Float32 value;
- value = m_brightness/100.0;
- SetMovieVisualBrightness([movie quickTimeMovie], value, 0);
- value = pow(2, m_contrast/50.0);
- SetMovieVisualContrast([movie quickTimeMovie], value, 0);
- value = m_hue/100.0;
- SetMovieVisualHue([movie quickTimeMovie], value, 0);
- value = 1.0+m_saturation/100.0;
- SetMovieVisualSaturation([movie quickTimeMovie], value, 0);
- }
-#endif
-}
-
-void QT7MovieVideoWidget::updateVideoFrame(const CVTimeStamp &ts)
-{
-#ifdef QUICKTIME_C_API_AVAILABLE
- AutoReleasePool pool;
- // check for new frame
- if (m_visualContext && QTVisualContextIsNewImageAvailable(m_visualContext, &ts)) {
- CVOpenGLTextureRef currentFrame = NULL;
-
- // get a "frame" (image buffer) from the Visual Context, indexed by the provided time
- OSStatus status = QTVisualContextCopyImageForTime(m_visualContext, NULL, &ts, &currentFrame);
-
- // the above call may produce a null frame so check for this first
- // if we have a frame, then draw it
- if (status == noErr && currentFrame) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "render video frame";
-#endif
- m_videoWidget->setCVTexture(currentFrame);
- CVOpenGLTextureRelease(currentFrame);
- }
- QTVisualContextTask(m_visualContext);
- }
-#else
- Q_UNUSED(ts);
-#endif
-}
-
-#include "moc_qt7movievideowidget.cpp"
diff --git a/src/plugins/qt7/qt7movieviewoutput.h b/src/plugins/qt7/qt7movieviewoutput.h
deleted file mode 100644
index d48255d..0000000
--- a/src/plugins/qt7/qt7movieviewoutput.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7MOVIEVIEWOUTPUT_H
-#define QT7MOVIEVIEWOUTPUT_H
-
-#include <QtCore/qobject.h>
-
-#include <qvideowindowcontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-#include "qt7videooutput.h"
-
-
-QT_BEGIN_NAMESPACE
-
-class QT7PlayerSession;
-class QT7PlayerService;
-
-class QT7MovieViewOutput : public QT7VideoWindowControl
-{
-public:
- QT7MovieViewOutput(QObject *parent = 0);
- ~QT7MovieViewOutput();
-
- void setMovie(void *movie);
- void updateNaturalSize(const QSize &newSize);
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- void repaint();
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
-private:
- void setupVideoOutput();
-
- void *m_movie;
- void *m_movieView;
- bool m_layouted;
-
- WId m_winId;
- QRect m_displayRect;
- bool m_fullscreen;
- QSize m_nativeSize;
- Qt::AspectRatioMode m_aspectRatioMode;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7movieviewoutput.mm b/src/plugins/qt7/qt7movieviewoutput.mm
deleted file mode 100644
index eebb32f..0000000
--- a/src/plugins/qt7/qt7movieviewoutput.mm
+++ /dev/null
@@ -1,339 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#import <QTKit/QTkit.h>
-
-#include "qt7backend.h"
-
-#include "qt7playercontrol.h"
-#include "qt7movieviewoutput.h"
-#include "qt7playersession.h"
-#include <QtCore/qdebug.h>
-
-#include <QuartzCore/CIFilter.h>
-#include <QuartzCore/CIVector.h>
-
-QT_USE_NAMESPACE
-
-#define VIDEO_TRANSPARENT(m) -(void)m:(NSEvent *)e{[[self superview] m:e];}
-
-@interface TransparentQTMovieView : QTMovieView
-{
-@private
- QRect *m_drawRect;
- qreal m_brightness, m_contrast, m_saturation, m_hue;
-}
-
-- (TransparentQTMovieView *) init;
-- (void) setDrawRect:(QRect &)rect;
-- (CIImage *) view:(QTMovieView *)view willDisplayImage:(CIImage *)img;
-- (void) setContrast:(qreal) contrast;
-@end
-
-@implementation TransparentQTMovieView
-
-- (TransparentQTMovieView *) init
-{
- self = [super initWithFrame:NSZeroRect];
- if (self) {
- [self setControllerVisible:NO];
- [self setContrast:1.0];
- [self setDelegate:self];
- }
- return self;
-}
-
-- (void) dealloc
-{
- [super dealloc];
-}
-
-- (void) setContrast:(qreal) contrast
-{
- m_hue = 0.0;
- m_brightness = 0.0;
- m_contrast = contrast;
- m_saturation = 1.0;
-}
-
-
-- (void) setDrawRect:(QRect &)rect
-{
- *m_drawRect = rect;
-
- NSRect nsrect;
- nsrect.origin.x = m_drawRect->x();
- nsrect.origin.y = m_drawRect->y();
- nsrect.size.width = m_drawRect->width();
- nsrect.size.height = m_drawRect->height();
- [self setFrame:nsrect];
-}
-
-- (CIImage *) view:(QTMovieView *)view willDisplayImage:(CIImage *)img
-{
- // This method is called from QTMovieView just
- // before the image will be drawn.
- Q_UNUSED(view);
-
- if ( !qFuzzyCompare(m_brightness, 0.0) ||
- !qFuzzyCompare(m_contrast, 1.0) ||
- !qFuzzyCompare(m_saturation, 1.0)){
- CIFilter *colorFilter = [CIFilter filterWithName:@"CIColorControls"];
- [colorFilter setValue:[NSNumber numberWithFloat:m_brightness] forKey:@"inputBrightness"];
- [colorFilter setValue:[NSNumber numberWithFloat:(m_contrast < 1) ? m_contrast : 1 + ((m_contrast-1)*3)] forKey:@"inputContrast"];
- [colorFilter setValue:[NSNumber numberWithFloat:m_saturation] forKey:@"inputSaturation"];
- [colorFilter setValue:img forKey:@"inputImage"];
- img = [colorFilter valueForKey:@"outputImage"];
- }
-
- /*if (m_hue){
- CIFilter *colorFilter = [CIFilter filterWithName:@"CIHueAdjust"];
- [colorFilter setValue:[NSNumber numberWithFloat:(m_hue * 3.14)] forKey:@"inputAngle"];
- [colorFilter setValue:img forKey:@"inputImage"];
- img = [colorFilter valueForKey:@"outputImage"];
- }*/
-
- return img;
-}
-
-
-VIDEO_TRANSPARENT(mouseDown);
-VIDEO_TRANSPARENT(mouseDragged);
-VIDEO_TRANSPARENT(mouseUp);
-VIDEO_TRANSPARENT(mouseMoved);
-VIDEO_TRANSPARENT(mouseEntered);
-VIDEO_TRANSPARENT(mouseExited);
-VIDEO_TRANSPARENT(rightMouseDown);
-VIDEO_TRANSPARENT(rightMouseDragged);
-VIDEO_TRANSPARENT(rightMouseUp);
-VIDEO_TRANSPARENT(otherMouseDown);
-VIDEO_TRANSPARENT(otherMouseDragged);
-VIDEO_TRANSPARENT(otherMouseUp);
-VIDEO_TRANSPARENT(keyDown);
-VIDEO_TRANSPARENT(keyUp);
-VIDEO_TRANSPARENT(scrollWheel)
-
-@end
-
-
-QT7MovieViewOutput::QT7MovieViewOutput(QObject *parent)
- :QT7VideoWindowControl(parent),
- m_movie(0),
- m_movieView(0),
- m_layouted(false),
- m_winId(0),
- m_fullscreen(false),
- m_aspectRatioMode(Qt::KeepAspectRatio),
- m_brightness(0),
- m_contrast(0),
- m_hue(0),
- m_saturation(0)
-{
-}
-
-QT7MovieViewOutput::~QT7MovieViewOutput()
-{
- [(QTMovieView*)m_movieView release];
- [(QTMovie*)m_movie release];
-}
-
-void QT7MovieViewOutput::setupVideoOutput()
-{
- AutoReleasePool pool;
-
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieViewOutput::setupVideoOutput" << m_movie << m_winId;
-#endif
- if (m_movie == 0 || m_winId <= 0)
- return;
-
- NSSize size = [[(QTMovie*)m_movie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue];
- m_nativeSize = QSize(size.width, size.height);
-
- if (!m_movieView)
- m_movieView = [[TransparentQTMovieView alloc] init];
-
- [(QTMovieView*)m_movieView setControllerVisible:NO];
- [(QTMovieView*)m_movieView setMovie:(QTMovie*)m_movie];
-
- [(NSView *)m_winId addSubview:(QTMovieView*)m_movieView];
- m_layouted = true;
-
- setDisplayRect(m_displayRect);
-}
-
-void QT7MovieViewOutput::setMovie(void *movie)
-{
- if (m_movie != movie) {
- if (m_movie) {
- if (m_movieView)
- [(QTMovieView*)m_movieView setMovie:nil];
-
- [(QTMovie*)m_movie release];
- }
-
- m_movie = movie;
-
- if (m_movie)
- [(QTMovie*)m_movie retain];
-
- setupVideoOutput();
- }
-}
-
-void QT7MovieViewOutput::updateNaturalSize(const QSize &newSize)
-{
- if (m_nativeSize != newSize) {
- m_nativeSize = newSize;
- emit nativeSizeChanged();
- }
-}
-
-WId QT7MovieViewOutput::winId() const
-{
- return m_winId;
-}
-
-void QT7MovieViewOutput::setWinId(WId id)
-{
- if (m_winId != id) {
- if (m_movieView && m_layouted) {
- [(QTMovieView*)m_movieView removeFromSuperview];
- m_layouted = false;
- }
-
- m_winId = id;
- setupVideoOutput();
- }
-}
-
-QRect QT7MovieViewOutput::displayRect() const
-{
- return m_displayRect;
-}
-
-void QT7MovieViewOutput::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-
- if (m_movieView) {
- AutoReleasePool pool;
- [(QTMovieView*)m_movieView setPreservesAspectRatio:(m_aspectRatioMode == Qt::KeepAspectRatio ? YES : NO)];
- [(QTMovieView*)m_movieView setFrame:NSMakeRect(m_displayRect.x(),
- m_displayRect.y(),
- m_displayRect.width(),
- m_displayRect.height())];
- }
-
-}
-
-bool QT7MovieViewOutput::isFullScreen() const
-{
- return m_fullscreen;
-}
-
-void QT7MovieViewOutput::setFullScreen(bool fullScreen)
-{
- m_fullscreen = fullScreen;
- setDisplayRect(m_displayRect);
-}
-
-void QT7MovieViewOutput::repaint()
-{
-}
-
-QSize QT7MovieViewOutput::nativeSize() const
-{
- return m_nativeSize;
-}
-
-Qt::AspectRatioMode QT7MovieViewOutput::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void QT7MovieViewOutput::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
- setDisplayRect(m_displayRect);
-}
-
-int QT7MovieViewOutput::brightness() const
-{
- return m_brightness;
-}
-
-void QT7MovieViewOutput::setBrightness(int brightness)
-{
- m_brightness = brightness;
-}
-
-int QT7MovieViewOutput::contrast() const
-{
- return m_contrast;
-}
-
-void QT7MovieViewOutput::setContrast(int contrast)
-{
- m_contrast = contrast;
- [(TransparentQTMovieView*)m_movieView setContrast:(contrast/100.0+1.0)];
-}
-
-int QT7MovieViewOutput::hue() const
-{
- return m_hue;
-}
-
-void QT7MovieViewOutput::setHue(int hue)
-{
- m_hue = hue;
-}
-
-int QT7MovieViewOutput::saturation() const
-{
- return m_saturation;
-}
-
-void QT7MovieViewOutput::setSaturation(int saturation)
-{
- m_saturation = saturation;
-}
-
diff --git a/src/plugins/qt7/qt7movieviewrenderer.h b/src/plugins/qt7/qt7movieviewrenderer.h
deleted file mode 100644
index 6d5cef7..0000000
--- a/src/plugins/qt7/qt7movieviewrenderer.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7MOVIEVIEWRENDERER_H
-#define QT7MOVIEVIEWRENDERER_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qmutex.h>
-
-#include <qvideowindowcontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-#include "qt7videooutput.h"
-#include <qvideoframe.h>
-
-QT_BEGIN_NAMESPACE
-
-class QVideoFrame;
-
-class QT7PlayerSession;
-class QT7PlayerService;
-
-class QT7MovieViewRenderer : public QT7VideoRendererControl
-{
-public:
- QT7MovieViewRenderer(QObject *parent = 0);
- ~QT7MovieViewRenderer();
-
- void setMovie(void *movie);
- void updateNaturalSize(const QSize &newSize);
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void renderFrame(const QVideoFrame &);
-
-protected:
- bool event(QEvent *event);
-
-private:
- void setupVideoOutput();
-
- void *m_movie;
- void *m_movieView;
- QSize m_nativeSize;
- QAbstractVideoSurface *m_surface;
- QVideoFrame m_currentFrame;
- bool m_pendingRenderEvent;
- QMutex m_mutex;
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7movieviewrenderer.mm b/src/plugins/qt7/qt7movieviewrenderer.mm
deleted file mode 100644
index dbc17d2..0000000
--- a/src/plugins/qt7/qt7movieviewrenderer.mm
+++ /dev/null
@@ -1,373 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#import <QTKit/QTKit.h>
-
-#include "qt7backend.h"
-
-#include "qt7playercontrol.h"
-#include "qt7movieviewrenderer.h"
-#include "qt7playersession.h"
-#include "qt7ciimagevideobuffer.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qcoreapplication.h>
-
-#include <QtCore/qreadwritelock.h>
-
-#include <qabstractvideobuffer.h>
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-
-#include <QuartzCore/CIFilter.h>
-#include <QuartzCore/CIVector.h>
-
-QT_USE_NAMESPACE
-
-class NSBitmapVideoBuffer : public QAbstractVideoBuffer
-{
-public:
- NSBitmapVideoBuffer(NSBitmapImageRep *buffer)
- : QAbstractVideoBuffer(NoHandle)
- , m_buffer(buffer)
- , m_mode(NotMapped)
- {
- [m_buffer retain];
- }
-
- virtual ~NSBitmapVideoBuffer()
- {
- [m_buffer release];
- }
-
- MapMode mapMode() const { return m_mode; }
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine)
- {
- if (mode != NotMapped && m_mode == NotMapped) {
- if (numBytes)
- *numBytes = [m_buffer bytesPerPlane];
-
- if (bytesPerLine)
- *bytesPerLine = [m_buffer bytesPerRow];
-
- m_mode = mode;
-
- return [m_buffer bitmapData];
- } else {
- return 0;
- }
- }
-
- void unmap() { m_mode = NotMapped; }
-
-private:
- NSBitmapImageRep *m_buffer;
- MapMode m_mode;
-};
-
-
-#define VIDEO_TRANSPARENT(m) -(void)m:(NSEvent *)e{[[self superview] m:e];}
-
-@interface HiddenQTMovieView : QTMovieView
-{
-@private
- QWidget *m_window;
- QT7MovieViewRenderer *m_renderer;
- QReadWriteLock m_rendererLock;
-}
-
-- (HiddenQTMovieView *) initWithRenderer:(QT7MovieViewRenderer *)renderer;
-- (void) setRenderer:(QT7MovieViewRenderer *)renderer;
-- (void) setDrawRect:(const QRect &)rect;
-- (CIImage *) view:(QTMovieView *)view willDisplayImage:(CIImage *)img;
-@end
-
-@implementation HiddenQTMovieView
-
-- (HiddenQTMovieView *) initWithRenderer:(QT7MovieViewRenderer *)renderer
-{
- self = [super initWithFrame:NSZeroRect];
- if (self) {
- [self setControllerVisible:NO];
- [self setDelegate:self];
-
- QWriteLocker lock(&self->m_rendererLock);
- self->m_renderer = renderer;
-
- self->m_window = new QWidget;
- self->m_window->setWindowOpacity(0.0);
- self->m_window->show();
- self->m_window->hide();
-
- [(NSView *)(self->m_window->winId()) addSubview:self];
- [self setDrawRect:QRect(0,0,1,1)];
- }
- return self;
-}
-
-- (void) dealloc
-{
- [super dealloc];
-}
-
-- (void) setRenderer:(QT7MovieViewRenderer *)renderer
-{
- QWriteLocker lock(&m_rendererLock);
- m_renderer = renderer;
-}
-
-- (void) setDrawRect:(const QRect &)rect
-{
- NSRect nsrect;
- nsrect.origin.x = rect.x();
- nsrect.origin.y = rect.y();
- nsrect.size.width = rect.width();
- nsrect.size.height = rect.height();
- [self setFrame:nsrect];
-}
-
-- (CIImage *) view:(QTMovieView *)view willDisplayImage:(CIImage *)img
-{
- // This method is called from QTMovieView just
- // before the image will be drawn.
- Q_UNUSED(view);
- QReadLocker lock(&m_rendererLock);
-
- if (m_renderer) {
- CGRect bounds = [img extent];
- int w = bounds.size.width;
- int h = bounds.size.height;
-
- QVideoFrame frame;
-
- QAbstractVideoSurface *surface = m_renderer->surface();
- if (!surface || !surface->isActive())
- return img;
-
- if (surface->surfaceFormat().handleType() == QAbstractVideoBuffer::CoreImageHandle) {
- //surface supports rendering of opengl based CIImage
- frame = QVideoFrame(new QT7CIImageVideoBuffer(img), QSize(w,h), QVideoFrame::Format_RGB32 );
- } else {
- //Swap R and B colors
- CIFilter *colorSwapFilter = [CIFilter filterWithName: @"CIColorMatrix" keysAndValues:
- @"inputImage", img,
- @"inputRVector", [CIVector vectorWithX: 0 Y: 0 Z: 1 W: 0],
- @"inputGVector", [CIVector vectorWithX: 0 Y: 1 Z: 0 W: 0],
- @"inputBVector", [CIVector vectorWithX: 1 Y: 0 Z: 0 W: 0],
- @"inputAVector", [CIVector vectorWithX: 0 Y: 0 Z: 0 W: 1],
- @"inputBiasVector", [CIVector vectorWithX: 0 Y: 0 Z: 0 W: 0],
- nil];
- CIImage *img = [colorSwapFilter valueForKey: @"outputImage"];
- NSBitmapImageRep *bitmap =[[NSBitmapImageRep alloc] initWithCIImage:img];
- //requesting the bitmap data is slow,
- //but it's better to do it here to avoid blocking the main thread for a long.
- [bitmap bitmapData];
- frame = QVideoFrame(new NSBitmapVideoBuffer(bitmap), QSize(w,h), QVideoFrame::Format_RGB32 );
- [bitmap release];
- }
-
- m_renderer->renderFrame(frame);
- }
-
- return img;
-}
-
-// Override this method so that the movie doesn't stop if
-// the window becomes invisible
-- (void)viewWillMoveToWindow:(NSWindow *)newWindow
-{
- Q_UNUSED(newWindow);
-}
-
-
-VIDEO_TRANSPARENT(mouseDown);
-VIDEO_TRANSPARENT(mouseDragged);
-VIDEO_TRANSPARENT(mouseUp);
-VIDEO_TRANSPARENT(mouseMoved);
-VIDEO_TRANSPARENT(mouseEntered);
-VIDEO_TRANSPARENT(mouseExited);
-VIDEO_TRANSPARENT(rightMouseDown);
-VIDEO_TRANSPARENT(rightMouseDragged);
-VIDEO_TRANSPARENT(rightMouseUp);
-VIDEO_TRANSPARENT(otherMouseDown);
-VIDEO_TRANSPARENT(otherMouseDragged);
-VIDEO_TRANSPARENT(otherMouseUp);
-VIDEO_TRANSPARENT(keyDown);
-VIDEO_TRANSPARENT(keyUp);
-VIDEO_TRANSPARENT(scrollWheel)
-
-@end
-
-
-QT7MovieViewRenderer::QT7MovieViewRenderer(QObject *parent)
- :QT7VideoRendererControl(parent),
- m_movie(0),
- m_movieView(0),
- m_surface(0),
- m_pendingRenderEvent(false)
-{
-}
-
-QT7MovieViewRenderer::~QT7MovieViewRenderer()
-{
- [(HiddenQTMovieView*)m_movieView setRenderer:0];
-
- QMutexLocker locker(&m_mutex);
- m_currentFrame = QVideoFrame();
- [(HiddenQTMovieView*)m_movieView release];
-}
-
-void QT7MovieViewRenderer::setupVideoOutput()
-{
- AutoReleasePool pool;
-
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7MovieViewRenderer::setupVideoOutput" << m_movie << m_surface;
-#endif
-
- HiddenQTMovieView *movieView = (HiddenQTMovieView*)m_movieView;
-
- if (movieView && !m_movie) {
- [movieView setMovie:nil];
- }
-
- if (m_movie) {
- NSSize size = [[(QTMovie*)m_movie attributeForKey:@"QTMovieNaturalSizeAttribute"] sizeValue];
-
- m_nativeSize = QSize(size.width, size.height);
-
- if (!movieView) {
- movieView = [[HiddenQTMovieView alloc] initWithRenderer:this];
- m_movieView = movieView;
- [movieView setControllerVisible:NO];
- }
-
- [movieView setMovie:(QTMovie*)m_movie];
- [movieView setDrawRect:QRect(QPoint(0,0), m_nativeSize)];
- } else {
- m_nativeSize = QSize();
- }
-
- if (m_surface && !m_nativeSize.isEmpty()) {
- bool coreImageFrameSupported = !m_surface->supportedPixelFormats(QAbstractVideoBuffer::CoreImageHandle).isEmpty() &&
- !m_surface->supportedPixelFormats(QAbstractVideoBuffer::GLTextureHandle).isEmpty();
-
- QVideoSurfaceFormat format(m_nativeSize, QVideoFrame::Format_RGB32,
- coreImageFrameSupported ? QAbstractVideoBuffer::CoreImageHandle : QAbstractVideoBuffer::NoHandle);
-
- if (m_surface->isActive() && m_surface->surfaceFormat() != format) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Surface format was changed, stop the surface.";
-#endif
- m_surface->stop();
- }
-
- if (!m_surface->isActive()) {
-#ifdef QT_DEBUG_QT7
- qDebug() << "Starting the surface with format" << format;
-#endif
- if (!m_surface->start(format))
- qWarning() << "failed to start video surface" << m_surface->error();
- }
- }
-}
-
-void QT7MovieViewRenderer::setMovie(void *movie)
-{
- if (movie == m_movie)
- return;
-
- QMutexLocker locker(&m_mutex);
- m_movie = movie;
- setupVideoOutput();
-}
-
-void QT7MovieViewRenderer::updateNaturalSize(const QSize &newSize)
-{
- if (m_nativeSize != newSize) {
- m_nativeSize = newSize;
- setupVideoOutput();
- }
-}
-
-QAbstractVideoSurface *QT7MovieViewRenderer::surface() const
-{
- return m_surface;
-}
-
-void QT7MovieViewRenderer::setSurface(QAbstractVideoSurface *surface)
-{
- if (surface == m_surface)
- return;
-
- QMutexLocker locker(&m_mutex);
-
- if (m_surface && m_surface->isActive())
- m_surface->stop();
-
- m_surface = surface;
- setupVideoOutput();
-}
-
-void QT7MovieViewRenderer::renderFrame(const QVideoFrame &frame)
-{
-
- QMutexLocker locker(&m_mutex);
- m_currentFrame = frame;
-
- if (!m_pendingRenderEvent)
- qApp->postEvent(this, new QEvent(QEvent::User), Qt::HighEventPriority);
-
- m_pendingRenderEvent = true;
-}
-
-bool QT7MovieViewRenderer::event(QEvent *event)
-{
- if (event->type() == QEvent::User) {
- QMutexLocker locker(&m_mutex);
- m_pendingRenderEvent = false;
- if (m_surface->isActive())
- m_surface->present(m_currentFrame);
- }
-
- return QT7VideoRendererControl::event(event);
-}
diff --git a/src/plugins/qt7/qt7serviceplugin.h b/src/plugins/qt7/qt7serviceplugin.h
deleted file mode 100644
index 7ff1249..0000000
--- a/src/plugins/qt7/qt7serviceplugin.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QT7SERVICEPLUGIN_H
-#define QT7SERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-
-QT_BEGIN_NAMESPACE
-
-class QT7ServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedFormatsInterface
- , public QMediaServiceFeaturesInterface
-{
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QT7ServicePlugin();
-
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
- QtMultimedia::SupportEstimate hasSupport(const QString &mimeType, const QStringList& codecs) const;
- QStringList supportedMimeTypes() const;
-
-private:
- void buildSupportedTypes();
-
- QStringList m_supportedMimeTypes;
-};
-
-QT_END_NAMESPACE
-
-#endif // QGSTREAMERSERVICEPLUGIN_H
diff --git a/src/plugins/qt7/qt7serviceplugin.mm b/src/plugins/qt7/qt7serviceplugin.mm
deleted file mode 100644
index 843ab41..0000000
--- a/src/plugins/qt7/qt7serviceplugin.mm
+++ /dev/null
@@ -1,129 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#import <Foundation/Foundation.h>
-#import <QTKit/QTKit.h>
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-
-#include "qt7backend.h"
-#include "qt7serviceplugin.h"
-#include "qt7playerservice.h"
-
-#include <qmediaserviceprovider.h>
-
-QT_BEGIN_NAMESPACE
-
-
-QT7ServicePlugin::QT7ServicePlugin()
-{
- buildSupportedTypes();
-}
-
-QStringList QT7ServicePlugin::keys() const
-{
- return QStringList()
-#ifdef QMEDIA_QT7_PLAYER
- << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
-#endif
- ;
-}
-
-QMediaService* QT7ServicePlugin::create(QString const& key)
-{
-#ifdef QT_DEBUG_QT7
- qDebug() << "QT7ServicePlugin::create" << key;
-#endif
-#ifdef QMEDIA_QT7_PLAYER
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new QT7PlayerService;
-#endif
- qWarning() << "unsupported key:" << key;
-
- return 0;
-}
-
-void QT7ServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features QT7ServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_MEDIAPLAYER)
- return QMediaServiceProviderHint::VideoSurface;
- else
- return QMediaServiceProviderHint::Features();
-}
-
-QtMultimedia::SupportEstimate QT7ServicePlugin::hasSupport(const QString &mimeType, const QStringList& codecs) const
-{
- Q_UNUSED(codecs);
-
- if (m_supportedMimeTypes.contains(mimeType))
- return QtMultimedia::ProbablySupported;
-
- return QtMultimedia::MaybeSupported;
-}
-
-QStringList QT7ServicePlugin::supportedMimeTypes() const
-{
- return m_supportedMimeTypes;
-}
-
-void QT7ServicePlugin::buildSupportedTypes()
-{
- AutoReleasePool pool;
- NSArray *utis = [QTMovie movieTypesWithOptions:QTIncludeCommonTypes];
- for (NSString *uti in utis) {
- NSString* mimeType = (NSString*)UTTypeCopyPreferredTagWithClass((CFStringRef)uti, kUTTagClassMIMEType);
- if (mimeType != 0) {
- m_supportedMimeTypes.append(QString::fromUtf8([mimeType UTF8String]));
- [mimeType release];
- }
- }
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_qt7engine, QT7ServicePlugin);
-
-QT_END_NAMESPACE
diff --git a/src/plugins/qt7/qt7videooutput.h b/src/plugins/qt7/qt7videooutput.h
deleted file mode 100644
index 15b93c9..0000000
--- a/src/plugins/qt7/qt7videooutput.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QT7VIDEOOUTPUTCONTROL_H
-#define QT7VIDEOOUTPUTCONTROL_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qsize.h>
-
-#include <qvideowindowcontrol.h>
-#include <qvideowidgetcontrol.h>
-#include <qvideorenderercontrol.h>
-#include <qmediaplayer.h>
-
-#include <QtWidgets/qmacdefines_mac.h>
-
-
-QT_BEGIN_NAMESPACE
-
-class QMediaPlaylist;
-class QMediaPlaylistNavigator;
-class QT7PlayerSession;
-class QT7PlayerService;
-
-
-class QT7VideoOutput {
-public:
- virtual ~QT7VideoOutput() {}
- virtual void setMovie(void *movie) = 0;
- virtual void updateNaturalSize(const QSize &newSize) = 0;
-};
-
-#define QT7VideoOutput_iid \
- "com.nokia.Qt.QT7VideoOutput/1.0"
-Q_DECLARE_INTERFACE(QT7VideoOutput, QT7VideoOutput_iid)
-
-class QT7VideoWindowControl : public QVideoWindowControl, public QT7VideoOutput
-{
-Q_OBJECT
-Q_INTERFACES(QT7VideoOutput)
-public:
- virtual ~QT7VideoWindowControl() {}
-
-protected:
- QT7VideoWindowControl(QObject *parent)
- :QVideoWindowControl(parent)
- {}
-};
-
-class QT7VideoRendererControl : public QVideoRendererControl, public QT7VideoOutput
-{
-Q_OBJECT
-Q_INTERFACES(QT7VideoOutput)
-public:
- virtual ~QT7VideoRendererControl() {}
-
-protected:
- QT7VideoRendererControl(QObject *parent)
- :QVideoRendererControl(parent)
- {}
-};
-
-class QT7VideoWidgetControl : public QVideoWidgetControl, public QT7VideoOutput
-{
-Q_OBJECT
-Q_INTERFACES(QT7VideoOutput)
-public:
- virtual ~QT7VideoWidgetControl() {}
-
-protected:
- QT7VideoWidgetControl(QObject *parent)
- :QVideoWidgetControl(parent)
- {}
-};
-
-QT_END_NAMESPACE
-
-#endif
diff --git a/src/plugins/qt7/qt7videooutput.mm b/src/plugins/qt7/qt7videooutput.mm
deleted file mode 100644
index cf629a6..0000000
--- a/src/plugins/qt7/qt7videooutput.mm
+++ /dev/null
@@ -1,91 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qt7playercontrol.h"
-#include "qt7playersession.h"
-#include <QtCore/qdebug.h>
-
-QT_USE_NAMESPACE
-
-/*
-QT7VideoOutputControl::QT7VideoOutputControl(QObject *parent)
- :QVideoOutputControl(parent),
- m_session(0),
- m_output(QVideoOutputControl::NoOutput)
-{
-}
-
-QT7VideoOutputControl::~QT7VideoOutputControl()
-{
-}
-
-void QT7VideoOutputControl::setSession(QT7PlayerSession *session)
-{
- m_session = session;
-}
-
-QList<QVideoOutputControl::Output> QT7VideoOutputControl::availableOutputs() const
-{
- return m_outputs;
-}
-
-void QT7VideoOutputControl::enableOutput(QVideoOutputControl::Output output)
-{
- if (!m_outputs.contains(output))
- m_outputs.append(output);
-}
-
-QVideoOutputControl::Output QT7VideoOutputControl::output() const
-{
- return m_output;
-}
-
-void QT7VideoOutputControl::setOutput(Output output)
-{
- if (m_output != output) {
- m_output = output;
- emit videoOutputChanged(m_output);
- }
-}
-
-#include "moc_qt7videooutputcontrol.cpp"
-
-*/
diff --git a/src/plugins/simulator/camera/simulatorcamera.pri b/src/plugins/simulator/camera/simulatorcamera.pri
deleted file mode 100644
index 867fc4b..0000000
--- a/src/plugins/simulator/camera/simulatorcamera.pri
+++ /dev/null
@@ -1,25 +0,0 @@
-INCLUDEPATH += $$PWD \
- $${SOURCE_DIR}/src/multimedia
-
-INCLUDEPATH += camera
-
-HEADERS += \
- $$PWD/simulatorcameraservice.h \
- $$PWD/simulatorcamerasession.h \
- $$PWD/simulatorcameracontrol.h \
- $$PWD/simulatorvideorenderercontrol.h \
- $$PWD/simulatorvideoinputdevicecontrol.h \
- $$PWD/simulatorcameraimagecapturecontrol.h \
- $$PWD/simulatorcameraexposurecontrol.h \
- $$PWD/simulatorcamerasettings.h
-
-SOURCES += \
- $$PWD/simulatorcameraservice.cpp \
- $$PWD/simulatorcamerasession.cpp \
- $$PWD/simulatorcameracontrol.cpp \
- $$PWD/simulatorvideorenderercontrol.cpp \
- $$PWD/simulatorvideoinputdevicecontrol.cpp \
- $$PWD/simulatorcameraimagecapturecontrol.cpp \
- $$PWD/simulatorcameraexposurecontrol.cpp \
- $$PWD/simulatorcamerasettings.cpp
-
diff --git a/src/plugins/simulator/camera/simulatorcameracontrol.cpp b/src/plugins/simulator/camera/simulatorcameracontrol.cpp
deleted file mode 100644
index cf2db58..0000000
--- a/src/plugins/simulator/camera/simulatorcameracontrol.cpp
+++ /dev/null
@@ -1,179 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorcameracontrol.h"
-
-#include <QtCore/qfile.h>
-
-SimulatorCameraControl::SimulatorCameraControl(SimulatorCameraSession *session)
- :QCameraControl(session),
- m_session(session),
- mState(QCamera::UnloadedState),
- mStatus(QCamera::UnloadedStatus)
-{
-}
-
-SimulatorCameraControl::~SimulatorCameraControl()
-{
-}
-
-QCamera::CaptureMode SimulatorCameraControl::captureMode() const
-{
- return m_session->captureMode();
-}
-
-void SimulatorCameraControl::setCaptureMode(QCamera::CaptureMode mode)
-{
- if (m_session->captureMode() != mode) {
- m_session->setCaptureMode(mode);
- emit captureModeChanged(mode);
- }
-}
-
-void SimulatorCameraControl::setState(QCamera::State state)
-{
- if (mState == state) {
- return;
- }
-
- // Simulator only supports these status
- Q_ASSERT(mStatus == QCamera::UnloadedStatus || mStatus == QCamera::LoadedStatus
- || mStatus == QCamera::ActiveStatus);
-
- switch (state) {
- case QCamera::UnloadedState: // To UnloadedState - Release resources
- switch (mStatus) {
- case QCamera::LoadedStatus:
- // Unload
- break;
- case QCamera::ActiveStatus:
- // Stop and Unload
- emit stopCamera();
- break;
- default:
- // Unrecognized internal state (Status)
- return;
- }
- mStatus = QCamera::UnloadedStatus;
- emit statusChanged(mStatus);
- break;
-
- case QCamera::LoadedState: // To LoadedState - Reserve resources OR Stop ViewFinder and Cancel Capture
- switch (mStatus) {
- case QCamera::UnloadedStatus:
- // Load
- mStatus = QCamera::LoadingStatus;
- emit statusChanged(mStatus);
- break;
- case QCamera::ActiveStatus:
- // Stop
- emit stopCamera();
- break;
-
- default:
- // Unregocnized internal state (Status)
- return;
- }
- mStatus = QCamera::LoadedStatus;
- emit statusChanged(mStatus);
- break;
-
- case QCamera::ActiveState: // To ActiveState - (Reserve Resources and) Start ViewFinder
- switch (mStatus) {
- case QCamera::UnloadedStatus:
- // Load and Start (setting state handles starting)
- mStatus = QCamera::LoadingStatus;
- emit statusChanged(mStatus);
- mStatus = QCamera::LoadedStatus;
- emit statusChanged(mStatus);
- mStatus = QCamera::StartingStatus;
- emit statusChanged(mStatus);
- emit startCamera();
- break;
- case QCamera::LoadedStatus:
- // Start
- mStatus = QCamera::StartingStatus;
- emit statusChanged(mStatus);
- emit startCamera();
- break;
- default:
- // Unregocnized internal state (Status)
- return;
- }
- mStatus = QCamera::ActiveStatus;
- emit statusChanged(mStatus);
- break;
-
- default:
- return;
- }
-
- mState = state;
- emit stateChanged(mState);
-}
-
-QCamera::State SimulatorCameraControl::state() const
-{
- return mState;
-}
-
-bool SimulatorCameraControl::canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const
-{
- Q_UNUSED(status);
-
- switch (changeType) {
- case QCameraControl::CaptureMode:
- case QCameraControl::Viewfinder:
- return true;
- default:
- return false;
- }
-}
-
-bool SimulatorCameraControl::isCaptureModeSupported(QCamera::CaptureMode mode) const
-{
- return mode == QCamera::CaptureStillImage;
-}
-
-QCamera::Status SimulatorCameraControl::status() const
-{
- return mStatus;
-}
diff --git a/src/plugins/simulator/camera/simulatorcameracontrol.h b/src/plugins/simulator/camera/simulatorcameracontrol.h
deleted file mode 100644
index e2f2408..0000000
--- a/src/plugins/simulator/camera/simulatorcameracontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef SIMULATORCAMERACONTROL_H
-#define SIMULATORCAMERACONTROL_H
-
-#include <QHash>
-#include <qcameracontrol.h>
-#include "simulatorcamerasession.h"
-
-QT_USE_NAMESPACE
-QT_USE_NAMESPACE
-
-class SimulatorCameraControl : public QCameraControl
-{
- Q_OBJECT
-public:
- SimulatorCameraControl(SimulatorCameraSession *session );
- virtual ~SimulatorCameraControl();
-
- bool isValid() const { return true; }
-
- QCamera::State state() const;
- void setState(QCamera::State state);
-
- QCamera::Status status() const;
-
- QCamera::CaptureMode captureMode() const;
- void setCaptureMode(QCamera::CaptureMode mode);
-
- bool isCaptureModeSupported(QCamera::CaptureMode mode) const;
-
- bool canChangeProperty(PropertyChangeType changeType, QCamera::Status status) const;
-
-signals:
- void startCamera();
- void stopCamera();
-
-private:
- void updateSupportedResolutions(const QString &device);
-
- SimulatorCameraSession *m_session;
- QCamera::State mState;
- QCamera::Status mStatus;
- bool m_reloadPending;
-};
-
-#endif // CAMERACONTROL_H
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
deleted file mode 100644
index 1ee820d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.cpp
+++ /dev/null
@@ -1,502 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-
-#include "simulatorcameraexposurecontrol.h"
-#include "simulatorcamerasession.h"
-
-SimulatorCameraExposureControl::SimulatorCameraExposureControl(SimulatorCameraSession *session, QObject *parent) :
- QCameraExposureControl(parent),
- mExposureMode(QCameraExposure::ExposureAuto),
- mMeteringMode(QCameraExposure::MeteringAverage),
- mSession(session),
- mSettings(0)
-{
- mSettings = mSession->settings();
-
- connect(mSettings, SIGNAL(apertureChanged()), this, SLOT(apertureChanged()));
- connect(mSettings, SIGNAL(apertureRangeChanged()), this, SLOT(apertureRangeChanged()));
- connect(mSettings, SIGNAL(shutterSpeedChanged()), this, SLOT(shutterSpeedChanged()));
- connect(mSettings, SIGNAL(isoSensitivityChanged()), this, SLOT(isoSensitivityChanged()));
-}
-
-SimulatorCameraExposureControl::~SimulatorCameraExposureControl()
-{
-}
-
-void SimulatorCameraExposureControl::apertureChanged()
-{
- emit exposureParameterChanged(QCameraExposureControl::Aperture);
-}
-
-void SimulatorCameraExposureControl::apertureRangeChanged()
-{
- emit exposureParameterRangeChanged(QCameraExposureControl::Aperture);
-}
-
-void SimulatorCameraExposureControl::shutterSpeedChanged()
-{
- emit exposureParameterChanged(QCameraExposureControl::ShutterSpeed);
-}
-
-void SimulatorCameraExposureControl::isoSensitivityChanged()
-{
- emit exposureParameterChanged(QCameraExposureControl::ISO);
-}
-
-QCameraExposure::ExposureMode SimulatorCameraExposureControl::exposureMode() const
-{
- return mExposureMode;
-}
-
-void SimulatorCameraExposureControl::setExposureMode(QCameraExposure::ExposureMode mode)
-{
- if (isExposureModeSupported(mode))
- mExposureMode = mode;
-}
-
-bool SimulatorCameraExposureControl::isExposureModeSupported(QCameraExposure::ExposureMode mode) const
-{
- switch (mode) {
- case QCameraExposure::ExposureAuto:
- case QCameraExposure::ExposureManual:
- return true;
- default:
- return false;
- }
-
- return false;
-}
-
-QCameraExposure::MeteringMode SimulatorCameraExposureControl::meteringMode() const
-{
- return mMeteringMode;
-}
-
-void SimulatorCameraExposureControl::setMeteringMode(QCameraExposure::MeteringMode mode)
-{
- if (isMeteringModeSupported(mode))
- mMeteringMode = mode;
-}
-
-bool SimulatorCameraExposureControl::isMeteringModeSupported(QCameraExposure::MeteringMode mode) const
-{
- switch (mode) {
- case QCameraExposure::MeteringAverage:
- case QCameraExposure::MeteringSpot:
- case QCameraExposure::MeteringMatrix:
- return true;
- default:
- return false;
- }
- return false;
-}
-
-bool SimulatorCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ISO:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- case QCameraExposureControl::ExposureCompensation:
- return true;
- case QCameraExposureControl::FlashPower:
- case QCameraExposureControl::FlashCompensation:
- return false;
-
- default:
- return false;
- }
-
- return false;
-}
-
-QVariant SimulatorCameraExposureControl::exposureParameter(ExposureParameter parameter) const
-{
- switch (parameter) {
- case QCameraExposureControl::ISO:
- return QVariant(isoSensitivity());
- case QCameraExposureControl::Aperture:
- return QVariant(aperture());
- case QCameraExposureControl::ShutterSpeed:
- return QVariant(shutterSpeed());
- case QCameraExposureControl::ExposureCompensation:
- return QVariant(exposureCompensation());
- case QCameraExposureControl::FlashPower:
- case QCameraExposureControl::FlashCompensation:
- // Not supported
- return QVariant();
-
- default:
- // Not supported
- return QVariant();
- }
-}
-
-QCameraExposureControl::ParameterFlags SimulatorCameraExposureControl::exposureParameterFlags(ExposureParameter parameter) const
-{
- QCameraExposureControl::ParameterFlags flags;
-
- /*
- * ISO, Aperture, ShutterSpeed:
- * - Automatic/Manual
- * - Read/Write
- * - Discrete range
- *
- * ExposureCompensation:
- * - Automatic/Manual
- * - Read/Write
- * - Continuous range
- *
- * FlashPower, FlashCompensation:
- * - Not supported
- */
- switch (parameter) {
- case QCameraExposureControl::ISO:
- case QCameraExposureControl::Aperture:
- case QCameraExposureControl::ShutterSpeed:
- flags |= QCameraExposureControl::AutomaticValue;
- break;
- case QCameraExposureControl::ExposureCompensation:
- flags |= QCameraExposureControl::AutomaticValue;
- flags |= QCameraExposureControl::ContinuousRange;
- break;
- case QCameraExposureControl::FlashPower:
- case QCameraExposureControl::FlashCompensation:
- // Do nothing - no flags
- break;
-
- default:
- // Do nothing - no flags
- break;
- }
-
- return flags;
-}
-
-QVariantList SimulatorCameraExposureControl::supportedParameterRange(ExposureParameter parameter) const
-{
- QVariantList valueList;
- switch (parameter) {
- case QCameraExposureControl::ISO: {
- QList<int> exposureValues = mSettings->supportedIsoSensitivities();
- for (int i = 0; i < exposureValues.count(); ++i) {
- valueList.append(QVariant(exposureValues[i]));
- }
- break;
- }
- case QCameraExposureControl::Aperture: {
- QList<qreal> apertureValues = mSettings->supportedApertures();
- for (int i = 0; i < apertureValues.count(); ++i) {
- valueList.append(QVariant(apertureValues[i]));
- }
- break;
- }
- case QCameraExposureControl::ShutterSpeed: {
- QList<qreal> shutterSpeedValues = mSettings->supportedShutterSpeeds();
- for (int i = 0; i < shutterSpeedValues.count(); ++i) {
- valueList.append(QVariant(shutterSpeedValues[i]));
- }
- break;
- }
- case QCameraExposureControl::ExposureCompensation: {
- QList<qreal> evValues = mSettings->supportedExposureCompensationValues();
- for (int i = 0; i < evValues.count(); ++i) {
- valueList.append(QVariant(evValues[i]));
- }
- break;
- }
- case QCameraExposureControl::FlashPower:
- case QCameraExposureControl::FlashCompensation:
- // Not supported
- break;
-
- default:
- // Not supported
- return QVariantList();
- }
-
- return valueList;
-}
-
-bool SimulatorCameraExposureControl::setExposureParameter(ExposureParameter parameter, const QVariant& value)
-{
- bool useDefaultValue = false;
-
- if (value.isNull())
- useDefaultValue = true;
-
- switch (parameter) {
- case QCameraExposureControl::ISO:
- if (useDefaultValue) {
- setAutoIsoSensitivity();
- return false;
- }
- else
- return setManualIsoSensitivity(value.toInt());
-
- case QCameraExposureControl::Aperture:
- if (useDefaultValue) {
- setAutoAperture();
- return false;
- }
- else
- return setManualAperture(value.toReal());
-
- case QCameraExposureControl::ShutterSpeed:
- if (useDefaultValue) {
- setAutoShutterSpeed();
- return false;
- }
- else
- return setManualShutterSpeed(value.toReal());
-
- case QCameraExposureControl::ExposureCompensation:
- if (useDefaultValue) {
- setAutoExposureCompensation();
- return false;
- }
- else
- return setManualExposureCompensation(value.toReal());
-
- case QCameraExposureControl::FlashPower:
- return false;
- case QCameraExposureControl::FlashCompensation:
- return false;
-
- default:
- // Not supported
- return false;
- }
-}
-
-QString SimulatorCameraExposureControl::extendedParameterName(ExposureParameter parameter)
-{
- switch (parameter) {
- case QCameraExposureControl::ISO:
- return QString("ISO Sensitivity");
- case QCameraExposureControl::Aperture:
- return QString("Aperture");
- case QCameraExposureControl::ShutterSpeed:
- return QString("Shutter Speed");
- case QCameraExposureControl::ExposureCompensation:
- return QString("Exposure Compensation");
- case QCameraExposureControl::FlashPower:
- return QString("Flash Power");
- case QCameraExposureControl::FlashCompensation:
- return QString("Flash Compensation");
-
- default:
- return QString();
- }
-}
-
-int SimulatorCameraExposureControl::isoSensitivity() const
-{
- return mSettings->isoSensitivity();
-}
-
-bool SimulatorCameraExposureControl::isIsoSensitivitySupported(const int iso) const
-{
- return mSettings->supportedIsoSensitivities().contains(iso);
-}
-
-bool SimulatorCameraExposureControl::setManualIsoSensitivity(int iso)
-{
- if (isIsoSensitivitySupported(iso)) {
- mSettings->setManualIsoSensitivity(iso);
- return true;
- } else {
- QList<int> supportedIsoValues = mSettings->supportedIsoSensitivities();
- int minIso = supportedIsoValues.first();
- int maxIso = supportedIsoValues.last();
-
- if (iso < minIso) { // Smaller than minimum
- iso = minIso;
- } else if (iso > maxIso) { // Bigger than maximum
- iso = maxIso;
- } else { // Find closest
- int indexOfClosest = 0;
- int smallestDiff = 10000000; // Sensible max diff
- for(int i = 0; i < supportedIsoValues.count(); ++i) {
- int currentDiff = qAbs(iso - supportedIsoValues[i]);
- if(currentDiff < smallestDiff) {
- smallestDiff = currentDiff;
- indexOfClosest = i;
- }
- }
- iso = supportedIsoValues[indexOfClosest];
- }
- mSettings->setManualIsoSensitivity(iso);
- }
-
- return false;
-}
-
-void SimulatorCameraExposureControl::setAutoIsoSensitivity()
-{
- mSettings->setAutoIsoSensitivity();
-}
-
-
-qreal SimulatorCameraExposureControl::aperture() const
-{
- return mSettings->aperture();
-}
-
-bool SimulatorCameraExposureControl::isApertureSupported(const qreal aperture) const
-{
- return mSettings->supportedApertures().contains(aperture);
-}
-
-bool SimulatorCameraExposureControl::setManualAperture(qreal aperture)
-{
- if (isApertureSupported(aperture)) {
- mSettings->setManualAperture(aperture);
- return true;
- } else {
- QList<qreal> supportedApertureValues = mSettings->supportedApertures();
- qreal minAperture = supportedApertureValues.first();
- qreal maxAperture = supportedApertureValues.last();
-
- if (aperture < minAperture) { // Smaller than minimum
- aperture = minAperture;
- } else if (aperture > maxAperture) { // Bigger than maximum
- aperture = maxAperture;
- } else { // Find closest
- int indexOfClosest = 0;
- qreal smallestDiff = 100000000; // Sensible max diff
- for(int i = 0; i < supportedApertureValues.count(); ++i) {
- qreal currentDiff = qAbs(aperture - supportedApertureValues[i]);
- if(currentDiff < smallestDiff) {
- smallestDiff = currentDiff;
- indexOfClosest = i;
- }
- }
- aperture = supportedApertureValues[indexOfClosest];
- }
- mSettings->setManualAperture(aperture);
- }
-
- return false;
-}
-
-void SimulatorCameraExposureControl::setAutoAperture()
-{
- mSettings->setAutoAperture();
-}
-
-qreal SimulatorCameraExposureControl::shutterSpeed() const
-{
- return mSettings->shutterSpeed();
-}
-
-bool SimulatorCameraExposureControl::isShutterSpeedSupported(const qreal seconds) const
-{
- return mSettings->supportedShutterSpeeds().contains(seconds);
-}
-
-bool SimulatorCameraExposureControl::setManualShutterSpeed(qreal seconds)
-{
- if (isShutterSpeedSupported(seconds)) {
- mSettings->setManualShutterSpeed(seconds);
- return true;
- } else {
- QList<qreal> supportedShutterSpeeds = mSettings->supportedShutterSpeeds();
-
- qreal minShutterSpeed = supportedShutterSpeeds.first();
- qreal maxShutterSpeed = supportedShutterSpeeds.last();
-
- if (seconds < minShutterSpeed) { // Smaller than minimum
- seconds = minShutterSpeed;
- } else if (seconds > maxShutterSpeed) { // Bigger than maximum
- seconds = maxShutterSpeed;
- } else { // Find closest
- int indexOfClosest = 0;
- qreal smallestDiff = 100000000; // Sensible max diff
- for(int i = 0; i < supportedShutterSpeeds.count(); ++i) {
- qreal currentDiff = qAbs(seconds - supportedShutterSpeeds[i]);
- if(currentDiff < smallestDiff) {
- smallestDiff = currentDiff;
- indexOfClosest = i;
- }
- }
- seconds = supportedShutterSpeeds[indexOfClosest];
- }
- mSettings->setManualShutterSpeed(seconds);
- }
-
- return false;
-}
-
-void SimulatorCameraExposureControl::setAutoShutterSpeed()
-{
- mSettings->setAutoShutterSpeed();
-}
-
-qreal SimulatorCameraExposureControl::exposureCompensation() const
-{
- return mSettings->exposureCompensation();
-}
-
-bool SimulatorCameraExposureControl::isExposureCompensationSupported(const qreal ev) const
-{
- QList<qreal> supportedValues = mSettings->supportedExposureCompensationValues();
- return (ev >= supportedValues.first() && ev <= supportedValues.last());
-}
-
-bool SimulatorCameraExposureControl::setManualExposureCompensation(qreal ev)
-{
- if (isExposureCompensationSupported(ev)) {
- mSettings->setExposureCompensation(ev);
- return true;
- }
-
- return false;
-}
-
-void SimulatorCameraExposureControl::setAutoExposureCompensation()
-{
- mSettings->setAutoExposureCompensation();
-}
-
-// End of file
diff --git a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h b/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
deleted file mode 100644
index 5e00a6d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraexposurecontrol.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORCAMERAEXPOSURECONTROL_H
-#define SIMULATORCAMERAEXPOSURECONTROL_H
-
-#include <qcameraexposurecontrol.h>
-
-#include "simulatorcamerasettings.h"
-
-QT_BEGIN_NAMESPACE
-
-class SimulatorCameraSession;
-
-/*
- * Control for exposure related camera operation.
- */
-class SimulatorCameraExposureControl : public QCameraExposureControl
-{
- Q_OBJECT
-
-public:
-
- SimulatorCameraExposureControl(SimulatorCameraSession *session, QObject *parent = 0);
- ~SimulatorCameraExposureControl();
-
- // QCameraExposureControl
- // Exposure Mode
- QCameraExposure::ExposureMode exposureMode() const;
- void setExposureMode(QCameraExposure::ExposureMode mode);
- bool isExposureModeSupported(QCameraExposure::ExposureMode mode) const;
-
- // Metering Mode
- QCameraExposure::MeteringMode meteringMode() const;
- void setMeteringMode(QCameraExposure::MeteringMode mode);
- bool isMeteringModeSupported(QCameraExposure::MeteringMode mode) const;
-
- // Exposure Parameter
- bool isParameterSupported(ExposureParameter parameter) const;
- QVariant exposureParameter(ExposureParameter parameter) const;
- QCameraExposureControl::ParameterFlags exposureParameterFlags(ExposureParameter parameter) const;
- QVariantList supportedParameterRange(ExposureParameter parameter) const;
- bool setExposureParameter(ExposureParameter parameter, const QVariant& value);
-
- QString extendedParameterName(ExposureParameter parameter);
-
-private Q_SLOTS: // Internal Slots
- void apertureChanged();
- void apertureRangeChanged();
- void shutterSpeedChanged();
- void isoSensitivityChanged();
-
-private: // Internal - Implementing ExposureParameter
- // ISO Sensitivity
- int isoSensitivity() const;
- bool setManualIsoSensitivity(int iso);
- void setAutoIsoSensitivity();
- bool isIsoSensitivitySupported(const int iso) const;
-
- // Aperture
- qreal aperture() const;
- bool setManualAperture(qreal aperture);
- void setAutoAperture();
- bool isApertureSupported(const qreal aperture) const;
-
- // Shutter Speed
- qreal shutterSpeed() const;
- bool setManualShutterSpeed(qreal seconds);
- void setAutoShutterSpeed();
- bool isShutterSpeedSupported(const qreal seconds) const;
-
- // Exposure Compensation
- qreal exposureCompensation() const;
- bool setManualExposureCompensation(qreal ev);
- void setAutoExposureCompensation();
- bool isExposureCompensationSupported(const qreal ev) const;
-
-private: // Data
- QCameraExposure::ExposureMode mExposureMode;
- QCameraExposure::MeteringMode mMeteringMode;
- SimulatorCameraSession *mSession;
- SimulatorCameraSettings *mSettings;
-};
-
-QT_END_NAMESPACE
-
-#endif // SIMULATORCAMERAEXPOSURECONTROL_H
diff --git a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp b/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp
deleted file mode 100644
index 2fe5070..0000000
--- a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-
-#include "simulatorcameraimagecapturecontrol.h"
-#include "simulatorcameraservice.h"
-#include "simulatorcamerasession.h"
-#include "simulatorcameracontrol.h"
-
-SimulatorCameraImageCaptureControl::SimulatorCameraImageCaptureControl(SimulatorCameraSession *session, SimulatorCameraService *service) :
- QCameraImageCaptureControl(service),
- mReadyForCapture(true),
- m_driveMode(QCameraImageCapture::SingleImageCapture) // Default DriveMode
-{
- m_session = session;
-
- m_service = service;
- m_cameraControl = qobject_cast<SimulatorCameraControl *>(m_service->requestControl(QCameraControl_iid));
-
- // Chain these signals from session class
- connect(m_session, SIGNAL(imageCaptured(const int, QImage)),
- this, SIGNAL(imageCaptured(const int, QImage)));
- connect(m_session, SIGNAL(imageSaved(const int, const QString&)),
- this, SIGNAL(imageSaved(const int, const QString&)));
- connect(m_session, SIGNAL(imageExposed(int)),
- this, SIGNAL(imageExposed(int)));
- connect(m_session, SIGNAL(captureError(int, int, const QString&)),
- this, SIGNAL(error(int, int, const QString&)));
-}
-
-SimulatorCameraImageCaptureControl::~SimulatorCameraImageCaptureControl()
-{
-}
-
-bool SimulatorCameraImageCaptureControl::isReadyForCapture() const
-{
- if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
- return false;
- }
-
- return mReadyForCapture;
-}
-
-QCameraImageCapture::DriveMode SimulatorCameraImageCaptureControl::driveMode() const
-{
- return m_driveMode;
-}
-
-void SimulatorCameraImageCaptureControl::setDriveMode(QCameraImageCapture::DriveMode mode)
-{
- if (mode != QCameraImageCapture::SingleImageCapture) {
- emit error(0, QCamera::NotSupportedFeatureError, tr("DriveMode not supported."));
- return;
- }
-
- m_driveMode = mode;
-}
-
-int SimulatorCameraImageCaptureControl::capture(const QString &fileName)
-{
- if (m_cameraControl && m_cameraControl->captureMode() != QCamera::CaptureStillImage) {
- emit error(0, QCameraImageCapture::NotReadyError, tr("Incorrect CaptureMode."));
- return 0;
- }
- updateReadyForCapture(false);
- int imageId = m_session->captureImage(fileName);
- updateReadyForCapture(true);
- return imageId;
-}
-
-void SimulatorCameraImageCaptureControl::cancelCapture()
-{
-}
-
-void SimulatorCameraImageCaptureControl::updateReadyForCapture(bool ready)
-{
- mReadyForCapture = ready;
- emit readyForCaptureChanged(mReadyForCapture);
-}
-
-// End of file
diff --git a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h b/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h
deleted file mode 100644
index f300c5d..0000000
--- a/src/plugins/simulator/camera/simulatorcameraimagecapturecontrol.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORCAMERAIMAGECAPTURECONTROL_H
-#define SIMULATORCAMERAIMAGECAPTURECONTROL_H
-
-#include "qcameraimagecapturecontrol.h"
-
-QT_USE_NAMESPACE
-
-class SimulatorCameraService;
-class SimulatorCameraSession;
-class SimulatorCameraControl;
-
-/*
- * Control for image capture operations.
- */
-class SimulatorCameraImageCaptureControl : public QCameraImageCaptureControl
-{
- Q_OBJECT
-
-public: // Contructors & Destrcutor
-
- SimulatorCameraImageCaptureControl(SimulatorCameraSession *session, SimulatorCameraService *service);
- ~SimulatorCameraImageCaptureControl();
-
-public: // QCameraImageCaptureControl
-
- bool isReadyForCapture() const;
-
- // Drive Mode
- QCameraImageCapture::DriveMode driveMode() const;
- void setDriveMode(QCameraImageCapture::DriveMode mode);
-
- // Capture
- int capture(const QString &fileName);
- void cancelCapture();
-
-private:
- void updateReadyForCapture(bool ready);
-
- bool mReadyForCapture;
- SimulatorCameraSession *m_session;
- SimulatorCameraService *m_service;
- SimulatorCameraControl *m_cameraControl;
- QCameraImageCapture::DriveMode m_driveMode;
-};
-
-#endif // SIMULATORCAMERAIMAGECAPTURECONTROL_H
diff --git a/src/plugins/simulator/camera/simulatorcameraservice.cpp b/src/plugins/simulator/camera/simulatorcameraservice.cpp
deleted file mode 100644
index 5348fa5..0000000
--- a/src/plugins/simulator/camera/simulatorcameraservice.cpp
+++ /dev/null
@@ -1,161 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorcameraservice.h"
-#include "simulatorcamerasession.h"
-#include "simulatorcameracontrol.h"
-#include "simulatorcameraimagecapturecontrol.h"
-#include "simulatorcameraexposurecontrol.h"
-
-#include "simulatorvideoinputdevicecontrol.h"
-#include "simulatorvideorenderercontrol.h"
-#include "../qsimulatormultimediaconnection_p.h"
-
-#include <qmediaserviceprovider.h>
-#include <QtCore/QDebug>
-
-QTM_USE_NAMESPACE;
-using namespace Simulator;
-
-SimulatorCameraService::SimulatorCameraService(const QString &service, MultimediaConnection *multimediaConnection,
- QObject *parent):
- QMediaService(parent)
-{
- Q_UNUSED(service)
- mCaptureSession = new SimulatorCameraSession(this);
- mCameraControl = new SimulatorCameraControl(mCaptureSession);
- mVideoInputDeviceControl = new QSimulatorVideoInputDeviceControl(mCaptureSession);
- mVideoInputDeviceControl->updateDeviceList(get_qtCameraData());
- mVideoRendererControl = new SimulatorVideoRendererControl(mCaptureSession, this);
- mImageCaptureControl = new SimulatorCameraImageCaptureControl(mCaptureSession, this);
- mExposureControl = new SimulatorCameraExposureControl(mCaptureSession, this);
-
- connect(multimediaConnection, SIGNAL(cameraDataChanged(QtMobility::QCameraData)),
- SLOT(updateCameraData(QtMobility::QCameraData)));
- connect(multimediaConnection, SIGNAL(cameraAdded(QString,QtMobility::QCameraData::QCameraDetails)),
- mVideoInputDeviceControl, SLOT(addDevice(QString,QtMobility::QCameraData::QCameraDetails)));
- connect(multimediaConnection, SIGNAL(cameraRemoved(QString)),
- mVideoInputDeviceControl, SLOT(removeDevice(QString)));
- connect(multimediaConnection, SIGNAL(cameraChanged(QString,QtMobility::QCameraData::QCameraDetails)),
- mVideoInputDeviceControl, SLOT(changeDevice(QString,QtMobility::QCameraData::QCameraDetails)));
- connect(multimediaConnection, SIGNAL(cameraChanged(QString,QtMobility::QCameraData::QCameraDetails)),
- SLOT(changeCamera(QString,QtMobility::QCameraData::QCameraDetails)));
- connect(mCameraControl, SIGNAL(startCamera()),
- mVideoRendererControl, SLOT(showImage()));
- connect(mCameraControl, SIGNAL(stopCamera()),
- mVideoRendererControl, SLOT(stop()));
- connect(mVideoInputDeviceControl, SIGNAL(selectedDeviceChanged(QString)),
- SLOT(updateCameraPicture(QString)));
- connect(mCaptureSession->settings(), SIGNAL(isoSensitivityChanged()), mVideoRendererControl, SLOT(showImage()));
- connect(mCaptureSession->settings(), SIGNAL(apertureChanged()), mVideoRendererControl, SLOT(showImage()));
- connect(mCaptureSession->settings(), SIGNAL(shutterSpeedChanged()), mVideoRendererControl, SLOT(showImage()));
- connect(mCaptureSession->settings(), SIGNAL(exposureCompensationChanged()), mVideoRendererControl, SLOT(showImage()));
- mCaptureSession->setImage(mVideoRendererControl->image());
- mVideoInputDeviceControl->setSelectedDevice(mVideoInputDeviceControl->defaultDevice());
-}
-
-SimulatorCameraService::~SimulatorCameraService()
-{
-}
-
-QMediaControl *SimulatorCameraService::requestControl(const char *name)
-{
- if (!mCaptureSession)
- return 0;
-
- if (qstrcmp(name,QCameraControl_iid) == 0)
- return mCameraControl;
-
- if (qstrcmp(name,QVideoDeviceControl_iid) == 0)
- return mVideoInputDeviceControl;
-
- if (qstrcmp(name, QVideoRendererControl_iid) == 0)
- return mVideoRendererControl;
-
- if (qstrcmp(name, QCameraImageCaptureControl_iid) == 0)
- return mImageCaptureControl;
-
- if (qstrcmp(name, QCameraExposureControl_iid) == 0)
- return mExposureControl;
-
- return 0;
-}
-
-void SimulatorCameraService::releaseControl(QMediaControl *control)
-{
- Q_UNUSED(control)
-}
-
-void SimulatorCameraService::updateCameraData(const QtMobility::QCameraData &data)
-{
- mVideoInputDeviceControl->updateDeviceList(data);
- QString currentDevice = mVideoInputDeviceControl->deviceName(mVideoInputDeviceControl->selectedDevice());
- if (!data.cameras.contains(currentDevice))
- return;
-
- updateCurrentDeviceImage(data.cameras.value(currentDevice).imagePath);
-}
-
-void SimulatorCameraService::changeCamera(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
-{
- QString currentDevice = mVideoInputDeviceControl->deviceName(mVideoInputDeviceControl->selectedDevice());
- if (currentDevice != name)
- return;
-
- updateCurrentDeviceImage(details.imagePath);
-}
-
-void SimulatorCameraService::updateCameraPicture(const QString &name)
-{
- QtMobility::QCameraData data = QtMobility::get_qtCameraData();
- if (!data.cameras.contains(name))
- return;
-
- updateCurrentDeviceImage(data.cameras.value(name).imagePath);
-}
-
-void SimulatorCameraService::updateCurrentDeviceImage(const QString &imagePath)
-{
- mVideoRendererControl->setImagePath(imagePath);
- mCaptureSession->setImage(mVideoRendererControl->image());
-}
-
-#include "moc_simulatorcameraservice.cpp"
diff --git a/src/plugins/simulator/camera/simulatorcameraservice.h b/src/plugins/simulator/camera/simulatorcameraservice.h
deleted file mode 100644
index d2ad037..0000000
--- a/src/plugins/simulator/camera/simulatorcameraservice.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORCAMERACAPTURESERVICE_H
-#define SIMULATORCAMERACAPTURESERVICE_H
-
-#include <qmediaservice.h>
-
-#include "../qsimulatormultimediaconnection_p.h"
-
-QTM_BEGIN_NAMESPACE
-namespace Simulator {
-class MultimediaConnection;
-}
-QTM_END_NAMESPACE
-class SimulatorCameraSession;
-class SimulatorCameraControl;
-class SimulatorCameraImageCaptureControl;
-class SimulatorCameraExposureControl;
-class SimulatorVideoRendererControl;
-class QSimulatorVideoInputDeviceControl;
-
-class SimulatorCameraService : public QMediaService
-{
- Q_OBJECT
-
-public:
- SimulatorCameraService(const QString &service, QTM_PREPEND_NAMESPACE(Simulator::MultimediaConnection) *cameraConnection,
- QObject *parent = 0);
- virtual ~SimulatorCameraService();
-
- QMediaControl *requestControl(const char *name);
- void releaseControl(QMediaControl *);
-
-private slots:
- void updateCameraData(const QtMobility::QCameraData &data);
- void changeCamera(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
- void updateCameraPicture(const QString &name);
-
-private:
- void updateCurrentDeviceImage(const QString &imagePath);
- SimulatorCameraSession *mCaptureSession;
- SimulatorCameraControl *mCameraControl;
- SimulatorCameraImageCaptureControl *mImageCaptureControl;
- SimulatorCameraExposureControl *mExposureControl;
-
- QSimulatorVideoInputDeviceControl *mVideoInputDeviceControl;
-
- QMediaControl *mVideoOutput;
-
- SimulatorVideoRendererControl *mVideoRendererControl;
-};
-
-#endif // CAMERACAPTURESERVICE_H
diff --git a/src/plugins/simulator/camera/simulatorcamerasession.cpp b/src/plugins/simulator/camera/simulatorcamerasession.cpp
deleted file mode 100644
index d40582b..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasession.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-#include "simulatorcamerasession.h"
-#include "simulatorcamerasettings.h"
-#include "../qsimulatormultimediaconnection_p.h"
-#include <qmediarecorder.h>
-#include <qcameraimagecapture.h>
-
-#include <QtCore/qdebug.h>
-#include <QCoreApplication>
-#include <QtCore/qmetaobject.h>
-
-#include <QtGui/qimage.h>
-
-//#define CAMERA_DEBUG 1
-
-SimulatorCameraSession::SimulatorCameraSession(QObject *parent)
- :QObject(parent),
- mViewfinder(0),
- mImage(0),
- mRequestId(0)
-{
- mSettings = new SimulatorCameraSettings(this);
-}
-
-SimulatorCameraSession::~SimulatorCameraSession()
-{
-}
-
-int SimulatorCameraSession::captureImage(const QString &fileName)
-{
- QTM_USE_NAMESPACE;
- ++mRequestId;
- emit imageExposed(mRequestId);
-
- QString actualFileName = fileName;
- if (actualFileName.isEmpty()) {
- actualFileName = generateFileName("img_", defaultDir(QCamera::CaptureStillImage), "jpg");
- }
-
- emit imageCaptured(mRequestId, *mImage);
-
- if (!mImage->save(actualFileName)) {
- emit captureError(mRequestId, QCameraImageCapture::ResourceError, "Could not save file");
- return mRequestId;
- }
- emit imageSaved(mRequestId, actualFileName);
- return mRequestId;
-}
-
-void SimulatorCameraSession::setCaptureMode(QCamera::CaptureMode mode)
-{
- mCaptureMode = mode;
-}
-
-QDir SimulatorCameraSession::defaultDir(QCamera::CaptureMode) const
-{
- const QString temp = QDir::tempPath();
- if (QFileInfo(temp).isWritable())
- return QDir(temp);
-
- return QDir();
-}
-
-QString SimulatorCameraSession::generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const
-{
- int lastClip = 0;
- foreach(QString fileName, dir.entryList(QStringList() << QString("%1*.%2").arg(prefix).arg(ext))) {
- int imgNumber = fileName.mid(prefix.length(), fileName.size()-prefix.length()-ext.length()-1).toInt();
- lastClip = qMax(lastClip, imgNumber);
- }
-
- QString name = QString("%1%2.%3").arg(prefix)
- .arg(lastClip+1,
- 4, //fieldWidth
- 10,
- QLatin1Char('0'))
- .arg(ext);
-
- return dir.absoluteFilePath(name);
-}
-
-void SimulatorCameraSession::setViewfinder(QObject *viewfinder)
-{
- if (mViewfinder != viewfinder) {
- mViewfinder = viewfinder;
- emit viewfinderChanged();
- }
-}
-
-QCamera::CaptureMode SimulatorCameraSession::captureMode()
-{
- return mCaptureMode;
-}
-
-void SimulatorCameraSession::setImage(const QImage *image)
-{
- mImage = image;
-}
-
-QObject *SimulatorCameraSession::viewfinder() const
-{
- return mViewfinder;
-}
-
-SimulatorCameraSettings *SimulatorCameraSession::settings() const
-{
- return mSettings;
-}
diff --git a/src/plugins/simulator/camera/simulatorcamerasession.h b/src/plugins/simulator/camera/simulatorcamerasession.h
deleted file mode 100644
index d081d0c..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasession.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORCAMERACAPTURESESSION_H
-#define SIMULATORCAMERACAPTURESESSION_H
-
-#include <qmediarecordercontrol.h>
-
-#include <QtCore/qurl.h>
-#include <QtCore/qdir.h>
-
-#include "qcamera.h"
-
-class SimulatorCameraSettings;
-
-class SimulatorCameraSession : public QObject
-{
- Q_OBJECT
-public:
- SimulatorCameraSession(QObject *parent);
- ~SimulatorCameraSession();
-
- QCamera::CaptureMode captureMode();
- void setCaptureMode(QCamera::CaptureMode mode);
-
- QDir defaultDir(QCamera::CaptureMode mode) const;
- QString generateFileName(const QString &prefix, const QDir &dir, const QString &ext) const;
-
- void setImage(const QImage *image);
- QObject *viewfinder() const;
- void setViewfinder(QObject *viewfinder);
-
- int captureImage(const QString &fileName);
-
- SimulatorCameraSettings *settings() const;
-
-signals:
- void stateChanged(QCamera::State state);
- void captureError(int id, int error, const QString &errorString);
- void error(int error, const QString &errorString);
- void imageExposed(int requestId);
- void imageCaptured(int requestId, const QImage &img);
- void imageSaved(int requestId, const QString &fileName);
- void viewfinderChanged();
-
-private:
- QCamera::CaptureMode mCaptureMode;
-
- QObject *mViewfinder;
- const QImage *mImage;
-
- SimulatorCameraSettings *mSettings;
-
-public:
- int mRequestId;
-};
-
-#endif // SIMULATORCAMERACAPTURESESSION_H
diff --git a/src/plugins/simulator/camera/simulatorcamerasettings.cpp b/src/plugins/simulator/camera/simulatorcamerasettings.cpp
deleted file mode 100644
index 592aa84..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasettings.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorcamerasettings.h"
-
-SimulatorCameraSettings::SimulatorCameraSettings(QObject *parent)
- : QObject(parent)
- , mIsoSensitivity(400)
- , mAperture(4)
- , mShutterSpeed(0.008)
- , mExposureCompensation(0)
-{
- mSupportedIsoSensitivities << 50 << 100 << 200 << 400 << 800;
- mSupportedApertures << 1.8 << 2.8 << 4 << 5.6 << 8;
- mSupportedShutterSpeeds << 0.002 << 0.004 << 0.008 << 1./60 << 1./30;
- mSupportedExposureCompensations << -2 << 2;
-}
-
-SimulatorCameraSettings::~SimulatorCameraSettings()
-{
-}
-
-int SimulatorCameraSettings::isoSensitivity() const
-{
- return mIsoSensitivity;
-}
-
-QList<int> SimulatorCameraSettings::supportedIsoSensitivities() const
-{
- return mSupportedIsoSensitivities;
-}
-
-void SimulatorCameraSettings::setManualIsoSensitivity(int iso)
-{
- if (iso != mIsoSensitivity && supportedIsoSensitivities().contains(iso)) {
- mIsoSensitivity = iso;
- emit isoSensitivityChanged();
- }
-}
-
-void SimulatorCameraSettings::setAutoIsoSensitivity()
-{
- setManualIsoSensitivity(defaultIsoSensitivity());
-}
-
-qreal SimulatorCameraSettings::aperture() const
-{
- return mAperture;
-}
-
-QList<qreal> SimulatorCameraSettings::supportedApertures() const
-{
- return mSupportedApertures;
-}
-
-void SimulatorCameraSettings::setManualAperture(qreal aperture)
-{
- if (aperture != mAperture && supportedApertures().contains(aperture)) {
- mAperture = aperture;
- emit apertureChanged();
- }
-}
-
-void SimulatorCameraSettings::setAutoAperture()
-{
- setManualAperture(defaultAperture());
-}
-
-qreal SimulatorCameraSettings::shutterSpeed() const
-{
- return mShutterSpeed;
-}
-
-QList<qreal> SimulatorCameraSettings::supportedShutterSpeeds() const
-{
- return mSupportedShutterSpeeds;
-}
-
-void SimulatorCameraSettings::setManualShutterSpeed(qreal speed)
-{
- if (speed != mShutterSpeed && supportedShutterSpeeds().contains(speed)) {
- mShutterSpeed = speed;
- emit shutterSpeedChanged();
- }
-}
-
-void SimulatorCameraSettings::setAutoShutterSpeed()
-{
- setManualShutterSpeed(defaultShutterSpeed());
-}
-
-void SimulatorCameraSettings::setExposureCompensation(qreal ev)
-{
- if (ev != mExposureCompensation && ev >= mSupportedExposureCompensations.first()
- && ev <= mSupportedExposureCompensations.last()) {
- mExposureCompensation = ev;
- emit exposureCompensationChanged();
- }
-}
-
-qreal SimulatorCameraSettings::exposureCompensation() const
-{
- return mExposureCompensation;
-}
-
-QList<qreal> SimulatorCameraSettings::supportedExposureCompensationValues() const
-{
- return mSupportedExposureCompensations;
-}
-
-void SimulatorCameraSettings::setAutoExposureCompensation()
-{
- setExposureCompensation(defaultExposureCompensation());
-}
-
-int SimulatorCameraSettings::defaultIsoSensitivity() const
-{
- return 400;
-}
-
-qreal SimulatorCameraSettings::defaultAperture() const
-{
- return 4;
-}
-
-qreal SimulatorCameraSettings::defaultShutterSpeed() const
-{
- return 0.008;
-}
-
-qreal SimulatorCameraSettings::defaultExposureCompensation() const
-{
- return 0;
-}
-
-// End of file
diff --git a/src/plugins/simulator/camera/simulatorcamerasettings.h b/src/plugins/simulator/camera/simulatorcamerasettings.h
deleted file mode 100644
index 30aa44e..0000000
--- a/src/plugins/simulator/camera/simulatorcamerasettings.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORCAMERASETTINGS_H
-#define SIMULATORCAMERASETTINGS_H
-
-#include "qcamera.h"
-
-QT_BEGIN_NAMESPACE
-
-class SimulatorCameraSettings : public QObject
-{
- Q_OBJECT
-
-public:
- SimulatorCameraSettings(QObject *parent);
- ~SimulatorCameraSettings();
-
- // ISO Sensitivity
- int isoSensitivity() const;
- int defaultIsoSensitivity() const;
- void setManualIsoSensitivity(int iso);
- void setAutoIsoSensitivity();
- QList<int> supportedIsoSensitivities() const;
-
- // Aperture
- qreal aperture() const;
- qreal defaultAperture() const;
- void setManualAperture(qreal aperture);
- void setAutoAperture();
- QList<qreal> supportedApertures() const;
-
- // Shutter Speed
- qreal shutterSpeed() const;
- qreal defaultShutterSpeed() const;
- void setManualShutterSpeed(qreal speed);
- void setAutoShutterSpeed();
- QList<qreal> supportedShutterSpeeds() const;
-
- // ExposureCompensation
- qreal exposureCompensation() const;
- qreal defaultExposureCompensation() const;
- void setExposureCompensation(qreal ev);
- void setAutoExposureCompensation();
- QList<qreal> supportedExposureCompensationValues() const;
-
-Q_SIGNALS: // Notifications
- // For QCameraExposureControl
- void flashReady(bool ready);
- void apertureChanged();
- void apertureRangeChanged();
- void shutterSpeedChanged();
- void isoSensitivityChanged();
- void exposureCompensationChanged();
-
- // Errors
- void error(int, const QString&);
-
-private: // Data
- int mIsoSensitivity;
- QList<int> mSupportedIsoSensitivities;
- qreal mAperture;
- QList<qreal> mSupportedApertures;
- qreal mShutterSpeed;
- QList<qreal> mSupportedShutterSpeeds;
- qreal mExposureCompensation;
- QList<qreal> mSupportedExposureCompensations;
-};
-
-QT_END_NAMESPACE
-
-#endif // SIMULATORCAMERASETTINGS_H
diff --git a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp b/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp
deleted file mode 100644
index 95c4e2d..0000000
--- a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorvideoinputdevicecontrol.h"
-
-#include <QtWidgets/QIcon>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-#include <QtCore/QStringList>
-
-using namespace QTM_NAMESPACE;
-QSimulatorVideoInputDeviceControl::QSimulatorVideoInputDeviceControl(QObject *parent)
- : QVideoDeviceControl(parent)
- , mSelectedDevice(-1)
-{
-}
-
-QSimulatorVideoInputDeviceControl::~QSimulatorVideoInputDeviceControl()
-{
-}
-
-int QSimulatorVideoInputDeviceControl::deviceCount() const
-{
- return mDevices.count();
-}
-
-QString QSimulatorVideoInputDeviceControl::deviceName(int index) const
-{
- if (index >= mDevices.count() || index < 0)
- return QString();
- return mDevices.at(index);
-}
-
-QString QSimulatorVideoInputDeviceControl::deviceDescription(int index) const
-{
- if (index >= mDevices.count() || index < 0)
- return QString();
-
- return mDescriptions[index];
-}
-
-QIcon QSimulatorVideoInputDeviceControl::deviceIcon(int index) const
-{
- Q_UNUSED(index);
- return QIcon();
-}
-
-int QSimulatorVideoInputDeviceControl::defaultDevice() const
-{
- if (mDevices.isEmpty())
- return -1;
- return 0;
-}
-
-int QSimulatorVideoInputDeviceControl::selectedDevice() const
-{
- return mSelectedDevice;
-}
-
-
-void QSimulatorVideoInputDeviceControl::setSelectedDevice(int index)
-{
- if (index != mSelectedDevice) {
- mSelectedDevice = index;
- emit selectedDeviceChanged(index);
- emit selectedDeviceChanged(deviceName(index));
- }
-}
-
-void QSimulatorVideoInputDeviceControl::updateDeviceList(const QtMobility::QCameraData &data)
-{
- mDevices.clear();
- mDescriptions.clear();
- QHashIterator<QString, QCameraData::QCameraDetails> iter(data.cameras);
- while(iter.hasNext()) {
- iter.next();
- mDevices.append(iter.key());
- mDescriptions.append(iter.value().description);
- }
- emit devicesChanged();
-}
-
-void QSimulatorVideoInputDeviceControl::addDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
-{
- if (mDevices.contains(name))
- return;
-
- mDevices.append(name);
- mDescriptions.append(details.description);
- emit devicesChanged();
-}
-
-void QSimulatorVideoInputDeviceControl::removeDevice(const QString &name)
-{
- int index = mDevices.indexOf(name);
- if (index == -1)
- return;
-
- mDevices.removeAt(index);
- mDescriptions.removeAt(index);
- if (index == mSelectedDevice)
- setSelectedDevice(defaultDevice());
- emit devicesChanged();
-}
-
-void QSimulatorVideoInputDeviceControl::changeDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details)
-{
- int index = mDevices.indexOf(name);
- if (index == -1)
- return;
-
- if (mDescriptions.at(index) != details.description)
- mDescriptions[index] = details.description;
-}
diff --git a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h b/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h
deleted file mode 100644
index 2d3ddd0..0000000
--- a/src/plugins/simulator/camera/simulatorvideoinputdevicecontrol.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIMULATORVIDEOINPUTDEVICECONTROL_H
-#define QSIMULATORVIDEOINPUTDEVICECONTROL_H
-
-#include <qvideodevicecontrol.h>
-#include <QtCore/qstring.h>
-#include <QtCore/qhash.h>
-
-#include "../qsimulatormultimediaconnection_p.h"
-
-QT_USE_NAMESPACE
-
-class QSimulatorVideoInputDeviceControl : public QVideoDeviceControl
-{
-Q_OBJECT
-public:
- QSimulatorVideoInputDeviceControl(QObject *parent);
- ~QSimulatorVideoInputDeviceControl();
-
- int deviceCount() const;
-
- QString deviceName(int index) const;
- QString deviceDescription(int index) const;
- QIcon deviceIcon(int index) const;
-
- int defaultDevice() const;
- int selectedDevice() const;
-
- void updateDeviceList(const QtMobility::QCameraData &data);
-
-public Q_SLOTS:
- void setSelectedDevice(int index);
- void addDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
- void removeDevice(const QString &name);
- void changeDevice(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
-
-private:
- int mSelectedDevice;
- QList<QString> mDevices;
- QList<QString> mDescriptions;
-};
-
-#endif // QSIMULATORVIDEOINPUTDEVICECONTROL_H
diff --git a/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp b/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp
deleted file mode 100644
index 422d4b8..0000000
--- a/src/plugins/simulator/camera/simulatorvideorenderercontrol.cpp
+++ /dev/null
@@ -1,130 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "simulatorvideorenderercontrol.h"
-#include "simulatorcamerasettings.h"
-#include "simulatorcamerasession.h"
-#include <qabstractvideosurface.h>
-#include <qvideoframe.h>
-#include <qvideosurfaceformat.h>
-#include <QFile>
-#include <QColor>
-#include <QPainter>
-
-SimulatorVideoRendererControl::SimulatorVideoRendererControl(SimulatorCameraSession *session, QObject *parent) :
- QVideoRendererControl(parent)
- , mSession(session)
- , mSurface(0)
- , mRunning(false)
-{
-}
-
-SimulatorVideoRendererControl::~SimulatorVideoRendererControl()
-{
-}
-
-QAbstractVideoSurface *SimulatorVideoRendererControl::surface() const
-{
- return mSurface;
-}
-
-void SimulatorVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-{
- mSurface = surface;
-}
-
-void SimulatorVideoRendererControl::setImagePath(const QString &imagePath)
-{
- if (QFile::exists(imagePath)) {
- mImage = QImage(imagePath);
- } else {
- mImage = QImage(800, 600, QImage::Format_RGB32);
- mImage.fill(qRgb(200, 50, 50));
- QPainter painter(&mImage);
- painter.drawText(0, 0, 800, 600, Qt::AlignCenter, imagePath);
- }
- if (mRunning)
- showImage();
-}
-
-void SimulatorVideoRendererControl::showImage()
-{
- if (!mSurface)
- return;
- stop();
- mShownImage = mImage;
- SimulatorCameraSettings *settings = mSession->settings();
- qreal colorDiff = .0;
- colorDiff += settings->aperture() - settings->defaultAperture();
- colorDiff += (settings->shutterSpeed() - settings->defaultShutterSpeed()) * 400;
- colorDiff += ((qreal)settings->isoSensitivity() - settings->defaultIsoSensitivity()) / 100;
- colorDiff += settings->exposureCompensation();
- int diffToApply = qAbs(colorDiff * 20);
- QPainter painter(&mShownImage);
- if (colorDiff < 0)
- painter.fillRect(mShownImage.rect(), QColor(0, 0, 0, qMin(diffToApply, 255)));
- else
- painter.fillRect(mShownImage.rect(), QColor(255, 255, 255, qMin(diffToApply, 255)));
- QVideoFrame::PixelFormat pixelFormat = QVideoFrame::pixelFormatFromImageFormat(mShownImage.format());
- if (pixelFormat == QVideoFrame::Format_Invalid) {
- mShownImage = mShownImage.convertToFormat(QImage::Format_RGB32);
- pixelFormat = QVideoFrame::Format_RGB32;
- }
- QVideoSurfaceFormat format(mShownImage.size(), pixelFormat);
- mSurface->start(format);
- mSurface->present(mShownImage);
- mRunning = true;
-}
-
-void SimulatorVideoRendererControl::stop()
-{
- if (!mSurface)
- return;
-
- if (mSurface->isActive())
- mSurface->stop();
- mRunning = false;
-}
-
-const QImage * SimulatorVideoRendererControl::image() const
-{
- return &mShownImage;
-}
diff --git a/src/plugins/simulator/camera/simulatorvideorenderercontrol.h b/src/plugins/simulator/camera/simulatorvideorenderercontrol.h
deleted file mode 100644
index ba14e1e..0000000
--- a/src/plugins/simulator/camera/simulatorvideorenderercontrol.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIMULATORVIDEORENDERERCONTROL_H
-#define QSIMULATORVIDEORENDERERCONTROL_H
-
-#include <qvideorenderercontrol.h>
-#include <QtGui/QImage>
-
-
-class SimulatorCameraSession;
-/*
- * Control for QGraphicsVideoItem. Viewfinder frames are streamed to a surface
- * which is drawn to the display by the Qt Graphics Vide Framework.
- */
-class SimulatorVideoRendererControl : public QVideoRendererControl
-{
- Q_OBJECT
-
-public:
- SimulatorVideoRendererControl(SimulatorCameraSession *session, QObject *parent = 0);
- virtual ~SimulatorVideoRendererControl();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- void setImagePath(const QString &imagePath);
- const QImage *image() const;
-
-public slots:
- void showImage();
-
-private slots:
- void stop();
-
-private:
- SimulatorCameraSession *mSession;
- QAbstractVideoSurface *mSurface;
- QImage mImage;
- QImage mShownImage;
- bool mRunning;
-};
-
-#endif // QSIMULATORVIDEORENDERERCONTROL_H
diff --git a/src/plugins/simulator/qsimulatormultimediaconnection.cpp b/src/plugins/simulator/qsimulatormultimediaconnection.cpp
deleted file mode 100644
index 40fd70d..0000000
--- a/src/plugins/simulator/qsimulatormultimediaconnection.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "../qsimulatormultimediaconnection_p.h"
-#include "mobilitysimulatorglobal.h"
-#include <mobilityconnection_p.h>
-
-#include <private/qsimulatordata_p.h>
-
-#include <QtNetwork/QLocalSocket>
-
-QTM_BEGIN_NAMESPACE
-
-using namespace QtSimulatorPrivate;
-
-Q_GLOBAL_STATIC(QCameraData, qtCameraData)
-
-namespace Simulator
-{
- MultimediaConnection::MultimediaConnection(MobilityConnection *mobilityCon)
- : QObject(mobilityCon)
- , mConnection(mobilityCon)
- , mInitialDataReceived(false)
- {
- qt_registerCameraTypes();
- mobilityCon->addMessageHandler(this);
- }
-
- void MultimediaConnection::getInitialData()
- {
- RemoteMetacall<void>::call(mConnection->sendSocket(), NoSync, "setRequestsCameras");
-
- while (!mInitialDataReceived)
- mConnection->receiveSocket()->waitForReadyRead(100);
- }
-
- void MultimediaConnection::initialCameraDataSent()
- {
- mInitialDataReceived = true;
- }
-
- void MultimediaConnection::setCameraData(const QCameraData &data)
- {
- *qtCameraData() = data;
- emit cameraDataChanged(data);
- }
-
- void MultimediaConnection::addCamera(const QString &name, const QCameraData::QCameraDetails &details)
- {
- if (qtCameraData()->cameras.contains(name))
- return;
-
- qtCameraData()->cameras.insert(name, details);
- emit cameraAdded(name, details);
- }
-
- void MultimediaConnection::removeCamera(const QString &name)
- {
- if (!qtCameraData()->cameras.contains(name))
- return;
-
- qtCameraData()->cameras.remove(name);
- emit cameraRemoved(name);
- }
-
- void MultimediaConnection::changeCamera(const QString &name, const QCameraData::QCameraDetails &details)
- {
- if (!qtCameraData()->cameras.contains(name))
- return;
-
- qtCameraData()->cameras[name] = details;
- emit cameraChanged(name, details);
- }
-
-} // namespace
-
-QCameraData get_qtCameraData()
-{
- return *qtCameraData();
-}
-
-#include "moc_qsimulatormultimediaconnection_p.cpp"
-
-QTM_END_NAMESPACE
diff --git a/src/plugins/simulator/qsimulatormultimediaconnection_p.h b/src/plugins/simulator/qsimulatormultimediaconnection_p.h
deleted file mode 100644
index e760f39..0000000
--- a/src/plugins/simulator/qsimulatormultimediaconnection_p.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SIMULATORMULTIMEDIACONNECTION_H
-#define SIMULATORMULTIMEDIACONNECTION_H
-
-#include "qsimulatormultimediadata_p.h"
-
-QT_BEGIN_HEADER
-
-QTM_BEGIN_NAMESPACE
-
-namespace Simulator
-{
- class MobilityConnection;
-
- class MultimediaConnection : public QObject
- {
- Q_OBJECT
- public:
- MultimediaConnection (MobilityConnection *mobilityCon);
- virtual ~MultimediaConnection () {}
-
- void getInitialData();
-
- private slots:
- void setCameraData(const QtMobility::QCameraData &);
- void addCamera(const QString &, const QtMobility::QCameraData::QCameraDetails &);
- void removeCamera(const QString &);
- void changeCamera(const QString &, const QtMobility::QCameraData::QCameraDetails &);
- void initialCameraDataSent();
-
- private:
- MobilityConnection *mConnection;
- bool mInitialDataReceived;
-
- signals:
- void cameraDataChanged(const QtMobility::QCameraData &data);
- void cameraAdded(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
- void cameraRemoved(const QString &name);
- void cameraChanged(const QString &name, const QtMobility::QCameraData::QCameraDetails &details);
- };
-} // end namespace Simulator
-
-QCameraData get_qtCameraData();
-
-QTM_END_NAMESPACE
-QT_END_HEADER
-
-#endif
-
diff --git a/src/plugins/simulator/qsimulatormultimediadata.cpp b/src/plugins/simulator/qsimulatormultimediadata.cpp
deleted file mode 100644
index 494f0a6..0000000
--- a/src/plugins/simulator/qsimulatormultimediadata.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qsimulatormultimediadata_p.h"
-
-#include <QtCore/QDataStream>
-
-QTM_BEGIN_NAMESPACE
-
-void qt_registerCameraTypes()
-{
- qRegisterMetaTypeStreamOperators<QCameraData::QCameraDetails>("QtMobility::QCameraData::QCameraDetails");
- qRegisterMetaTypeStreamOperators<QCameraData>("QtMobility::QCameraData");
-}
-
-QDataStream &operator<<(QDataStream &out, const QCameraData &s)
-{
- out << s.cameras;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QCameraData &s)
-{
- in >> s.cameras;
- return in;
-}
-
-QDataStream &operator<<(QDataStream &out, const QCameraData::QCameraDetails &s)
-{
- out << s.description << s.imagePath;
- return out;
-}
-
-QDataStream &operator>>(QDataStream &in, QCameraData::QCameraDetails &s)
-{
- in >> s.description >> s.imagePath;
- return in;
-}
-
-QTM_END_NAMESPACE
diff --git a/src/plugins/simulator/qsimulatormultimediadata_p.h b/src/plugins/simulator/qsimulatormultimediadata_p.h
deleted file mode 100644
index b814f5c..0000000
--- a/src/plugins/simulator/qsimulatormultimediadata_p.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QSIMULATORMULTIMEDIADATA_P_H
-#define QSIMULATORMULTIMEDIADATA_P_H
-
-//
-// W A R N I N G
-// -------------
-//
-// This file is not part of the Qt API. It exists purely as an
-// implementation detail. This header file may change from version to
-// version without notice, or even be removed.
-//
-// We mean it.
-//
-
-#include "qtmultimediadefs.h"
-#include <QtCore/QMetaType>
-#include <QtCore/QDateTime>
-#include <qcamera.h>
-
-QT_BEGIN_HEADER
-QTM_BEGIN_NAMESPACE
-
-struct QCameraData {
- struct QCameraDetails {
- QString description;
- QString imagePath;
- };
- QHash<QString, QCameraDetails> cameras;
-};
-
-void qt_registerCameraTypes();
-
-QTM_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QtMobility::QCameraData)
-Q_DECLARE_METATYPE(QtMobility::QCameraData::QCameraDetails)
-
-QT_END_HEADER
-
-#endif // QMULTIMEDIADATA_SIMULATOR_P_H
diff --git a/src/plugins/simulator/qsimulatorserviceplugin.cpp b/src/plugins/simulator/qsimulatorserviceplugin.cpp
deleted file mode 100644
index e0e6d12..0000000
--- a/src/plugins/simulator/qsimulatorserviceplugin.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtWidgets/QIcon>
-#include <QtCore/QDir>
-#include <QtCore/QDebug>
-
-#include "qsimulatorserviceplugin.h"
-#include <mobilityconnection_p.h>
-
-#include "simulatorcameraservice.h"
-
-#include <qmediaserviceprovider.h>
-
-#include <fcntl.h>
-#include <errno.h>
-#include <string.h>
-#include <stdlib.h>
-
-QTM_USE_NAMESPACE
-
-Simulator::MultimediaConnection *QSimulatorServicePlugin::mMultimediaConnection = 0;
-
-QSimulatorServicePlugin::QSimulatorServicePlugin()
-{
- ensureSimulatorConnection();
-}
-
-QStringList QSimulatorServicePlugin::keys() const
-{
- QStringList retList;
- retList << QLatin1String(Q_MEDIASERVICE_CAMERA);
- return retList;
-}
-
-QMediaService* QSimulatorServicePlugin::create(const QString &key)
-{
- if (key == QLatin1String(Q_MEDIASERVICE_CAMERA))
- return new SimulatorCameraService(key, mMultimediaConnection);
-
- qWarning() << "Simulator service plugin: unsupported key:" << key;
- return 0;
-}
-
-void QSimulatorServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QList<QByteArray> QSimulatorServicePlugin::devices(const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_CAMERA) {
- QCameraData cams = get_qtCameraData();
- QList<QByteArray> returnList;
- foreach(const QString &key, cams.cameras.keys())
- returnList.append(key.toAscii());
- return returnList;
- }
-
- return QList<QByteArray>();
-}
-
-QString QSimulatorServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
-{
- if (service == Q_MEDIASERVICE_CAMERA) {
- QCameraData cams = get_qtCameraData();
- return cams.cameras.value(device).description;
- }
-
- return QString();
-}
-
-void QSimulatorServicePlugin::ensureSimulatorConnection()
-{
- using namespace QtMobility::Simulator;
-
- static bool connected = false;
- if (connected)
- return;
-
- connected = true;
- MobilityConnection *connection = MobilityConnection::instance();
- mMultimediaConnection = new MultimediaConnection(connection);
- mMultimediaConnection->getInitialData();
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_simulatorengine, QSimulatorServicePlugin);
diff --git a/src/plugins/simulator/qsimulatorserviceplugin.h b/src/plugins/simulator/qsimulatorserviceplugin.h
deleted file mode 100644
index 75c6aa2..0000000
--- a/src/plugins/simulator/qsimulatorserviceplugin.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef QSIMULATORSERVICEPLUGIN_H
-#define QSIMULATORSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-#include "qsimulatormultimediaconnection_p.h"
-
-QT_USE_NAMESPACE
-
-class QSimulatorServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QSimulatorServicePlugin();
-
- // QMediaServiceProviderPlugin
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- // QMediaServiceSupportedDevicesInterface
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
-
-private:
- static void ensureSimulatorConnection();
- static QTM_PREPEND_NAMESPACE(Simulator::MultimediaConnection) *mMultimediaConnection;
-
-signals:
- void cameraDataChanged();
-};
-
-#endif // QSIMULATORSERVICEPLUGIN_H
diff --git a/src/plugins/simulator/simulator.pro b/src/plugins/simulator/simulator.pro
deleted file mode 100644
index 81117ca..0000000
--- a/src/plugins/simulator/simulator.pro
+++ /dev/null
@@ -1,28 +0,0 @@
-TEMPLATE = lib
-CONFIG += plugin
-TARGET = $$qtLibraryTarget(qsimulatorengine)
-PLUGIN_TYPE=mediaservice
-
-include(../../../common.pri)
-INCLUDEPATH+=$${SOURCE_DIR}/src/multimedia \
- $${SOURCE_DIR}/src/multimedia/video \
- $${SOURCE_DIR}/src/multimedia/audio \
- $${SOURCE_DIR}/src/mobilitysimulator
-
-CONFIG += mobility
-MOBILITY = multimedia
-
-DEPENDPATH += .
-
-# Input
-HEADERS += \
- qsimulatormultimediaconnection_p.h \
- qsimulatormultimediadata_p.h \
- qsimulatorserviceplugin.h
-
-SOURCES += \
- qsimulatormultimediaconnection.cpp \
- qsimulatormultimediadata.cpp \
- qsimulatorserviceplugin.cpp \
-
-include(camera/simulatorcamera.pri)
diff --git a/src/plugins/v4l/radio/radio.pri b/src/plugins/v4l/radio/radio.pri
deleted file mode 100644
index b8a9f75..0000000
--- a/src/plugins/v4l/radio/radio.pri
+++ /dev/null
@@ -1,9 +0,0 @@
-INCLUDEPATH += $$PWD
-
-HEADERS += \
- $$PWD/v4lradiocontrol.h \
- $$PWD/v4lradioservice.h
-
-SOURCES += \
- $$PWD/v4lradiocontrol.cpp \
- $$PWD/v4lradioservice.cpp
diff --git a/src/plugins/v4l/radio/v4lradiocontrol.cpp b/src/plugins/v4l/radio/v4lradiocontrol.cpp
deleted file mode 100644
index 49182d5..0000000
--- a/src/plugins/v4l/radio/v4lradiocontrol.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "v4lradiocontrol.h"
-#include "v4lradioservice.h"
-
-#include <QtCore/qdebug.h>
-
-#include <fcntl.h>
-
-#include <sys/ioctl.h>
-#include "linux/videodev2.h"
-
-#include <sys/soundcard.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/ioctl.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-V4LRadioControl::V4LRadioControl(QObject *parent)
- :QRadioTunerControl(parent)
-{
- fd = -1;
- initRadio();
- muted = false;
- stereo = false;
- m_error = false;
- sig = 0;
- currentBand = QRadioTuner::FM;
- step = 100000;
- scanning = false;
- playTime.restart();
- timer = new QTimer(this);
- timer->setInterval(200);
- connect(timer,SIGNAL(timeout()),this,SLOT(search()));
- timer->start();
-}
-
-V4LRadioControl::~V4LRadioControl()
-{
- timer->stop();
-
- if(fd > 0)
- ::close(fd);
-}
-
-bool V4LRadioControl::isAvailable() const
-{
- return available;
-}
-
-QtMultimedia::AvailabilityError V4LRadioControl::availabilityError() const
-{
- if (fd > 0)
- return QtMultimedia::NoError;
- else
- return QtMultimedia::ResourceError;
-}
-
-QRadioTuner::State V4LRadioControl::state() const
-{
- return fd > 0 ? QRadioTuner::ActiveState : QRadioTuner::StoppedState;
-}
-
-QRadioTuner::Band V4LRadioControl::band() const
-{
- return currentBand;
-}
-
-bool V4LRadioControl::isBandSupported(QRadioTuner::Band b) const
-{
- QRadioTuner::Band bnd = (QRadioTuner::Band)b;
- switch(bnd) {
- case QRadioTuner::FM:
- if(freqMin <= 87500000 && freqMax >= 108000000)
- return true;
- break;
- case QRadioTuner::LW:
- if(freqMin <= 148500 && freqMax >= 283500)
- return true;
- case QRadioTuner::AM:
- if(freqMin <= 520000 && freqMax >= 1610000)
- return true;
- default:
- if(freqMin <= 1711000 && freqMax >= 30000000)
- return true;
- }
-
- return false;
-}
-
-void V4LRadioControl::setBand(QRadioTuner::Band b)
-{
- if(freqMin <= 87500000 && freqMax >= 108000000 && b == QRadioTuner::FM) {
- // FM 87.5 to 108.0 MHz, except Japan 76-90 MHz
- currentBand = (QRadioTuner::Band)b;
- step = 100000; // 100kHz steps
- emit bandChanged(currentBand);
-
- } else if(freqMin <= 148500 && freqMax >= 283500 && b == QRadioTuner::LW) {
- // LW 148.5 to 283.5 kHz, 9kHz channel spacing (Europe, Africa, Asia)
- currentBand = (QRadioTuner::Band)b;
- step = 1000; // 1kHz steps
- emit bandChanged(currentBand);
-
- } else if(freqMin <= 520000 && freqMax >= 1610000 && b == QRadioTuner::AM) {
- // AM 520 to 1610 kHz, 9 or 10kHz channel spacing, extended 1610 to 1710 kHz
- currentBand = (QRadioTuner::Band)b;
- step = 1000; // 1kHz steps
- emit bandChanged(currentBand);
-
- } else if(freqMin <= 1711000 && freqMax >= 30000000 && b == QRadioTuner::SW) {
- // SW 1.711 to 30.0 MHz, divided into 15 bands. 5kHz channel spacing
- currentBand = (QRadioTuner::Band)b;
- step = 500; // 500Hz steps
- emit bandChanged(currentBand);
- }
- playTime.restart();
-}
-
-int V4LRadioControl::frequency() const
-{
- return currentFreq;
-}
-
-int V4LRadioControl::frequencyStep(QRadioTuner::Band b) const
-{
- int step = 0;
-
- if(b == QRadioTuner::FM)
- step = 100000; // 100kHz steps
- else if(b == QRadioTuner::LW)
- step = 1000; // 1kHz steps
- else if(b == QRadioTuner::AM)
- step = 1000; // 1kHz steps
- else if(b == QRadioTuner::SW)
- step = 500; // 500Hz steps
-
- return step;
-}
-
-QPair<int,int> V4LRadioControl::frequencyRange(QRadioTuner::Band b) const
-{
- if(b == QRadioTuner::AM)
- return qMakePair<int,int>(520000,1710000);
- else if(b == QRadioTuner::FM)
- return qMakePair<int,int>(87500000,108000000);
- else if(b == QRadioTuner::SW)
- return qMakePair<int,int>(1711111,30000000);
- else if(b == QRadioTuner::LW)
- return qMakePair<int,int>(148500,283500);
-
- return qMakePair<int,int>(0,0);
-}
-
-void V4LRadioControl::setFrequency(int frequency)
-{
- qint64 f = frequency;
-
- v4l2_frequency freq;
-
- if(frequency < freqMin)
- f = freqMax;
- if(frequency > freqMax)
- f = freqMin;
-
- if(fd > 0) {
- memset( &freq, 0, sizeof( freq ) );
- // Use the first tuner
- freq.tuner = 0;
- if ( ioctl( fd, VIDIOC_G_FREQUENCY, &freq ) >= 0 ) {
- if(low) {
- // For low, freq in units of 62.5Hz, so convert from Hz to units.
- freq.frequency = (int)(f/62.5);
- } else {
- // For high, freq in units of 62.5kHz, so convert from Hz to units.
- freq.frequency = (int)(f/62500);
- }
- ioctl( fd, VIDIOC_S_FREQUENCY, &freq );
- currentFreq = f;
- playTime.restart();
- emit frequencyChanged(currentFreq);
- }
- }
- playTime.restart();
-}
-
-bool V4LRadioControl::isStereo() const
-{
- return stereo;
-}
-
-QRadioTuner::StereoMode V4LRadioControl::stereoMode() const
-{
- return QRadioTuner::Auto;
-}
-
-void V4LRadioControl::setStereoMode(QRadioTuner::StereoMode mode)
-{
- bool stereo = true;
-
- if(mode == QRadioTuner::ForceMono)
- stereo = false;
-
- v4l2_tuner tuner;
-
- memset( &tuner, 0, sizeof( tuner ) );
-
- if ( ioctl( fd, VIDIOC_G_TUNER, &tuner ) >= 0 ) {
- if(stereo)
- tuner.audmode = V4L2_TUNER_MODE_STEREO;
- else
- tuner.audmode = V4L2_TUNER_MODE_MONO;
-
- if ( ioctl( fd, VIDIOC_S_TUNER, &tuner ) >= 0 ) {
- emit stereoStatusChanged(stereo);
- }
- }
-}
-
-int V4LRadioControl::signalStrength() const
-{
- v4l2_tuner tuner;
-
- // Return the first tuner founds signal strength.
- for ( int index = 0; index < tuners; ++index ) {
- memset( &tuner, 0, sizeof( tuner ) );
- tuner.index = index;
- if ( ioctl( fd, VIDIOC_G_TUNER, &tuner ) < 0 )
- continue;
- if ( tuner.type != V4L2_TUNER_RADIO )
- continue;
- // percentage signal strength
- return tuner.signal*100/65535;
- }
-
- return 0;
-}
-
-int V4LRadioControl::volume() const
-{
- v4l2_queryctrl queryctrl;
-
- if(fd > 0) {
- memset( &queryctrl, 0, sizeof( queryctrl ) );
- queryctrl.id = V4L2_CID_AUDIO_VOLUME;
- if ( ioctl( fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 ) {
- if(queryctrl.maximum == 0) {
- return vol;
- } else {
- // percentage volume returned
- return queryctrl.default_value*100/queryctrl.maximum;
- }
- }
- }
- return 0;
-}
-
-void V4LRadioControl::setVolume(int volume)
-{
- v4l2_queryctrl queryctrl;
-
- if(fd > 0) {
- memset( &queryctrl, 0, sizeof( queryctrl ) );
- queryctrl.id = V4L2_CID_AUDIO_VOLUME;
- if ( ioctl( fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 ) {
- v4l2_control control;
-
- if(queryctrl.maximum > 0) {
- memset( &control, 0, sizeof( control ) );
- control.id = V4L2_CID_AUDIO_VOLUME;
- control.value = volume*queryctrl.maximum/100;
- ioctl( fd, VIDIOC_S_CTRL, &control );
- } else {
- setVol(volume);
- }
- emit volumeChanged(volume);
- }
- }
-}
-
-bool V4LRadioControl::isMuted() const
-{
- return muted;
-}
-
-void V4LRadioControl::setMuted(bool muted)
-{
- v4l2_queryctrl queryctrl;
-
- if(fd > 0) {
- memset( &queryctrl, 0, sizeof( queryctrl ) );
- queryctrl.id = V4L2_CID_AUDIO_MUTE;
- if ( ioctl( fd, VIDIOC_QUERYCTRL, &queryctrl ) >= 0 ) {
- v4l2_control control;
- memset( &control, 0, sizeof( control ) );
- control.id = V4L2_CID_AUDIO_MUTE;
- control.value = (muted ? queryctrl.maximum : queryctrl.minimum );
- ioctl( fd, VIDIOC_S_CTRL, &control );
- this->muted = muted;
- emit mutedChanged(muted);
- }
- }
-}
-
-bool V4LRadioControl::isSearching() const
-{
- return scanning;
-}
-
-void V4LRadioControl::cancelSearch()
-{
- scanning = false;
- timer->stop();
-}
-
-void V4LRadioControl::searchForward()
-{
- // Scan up
- if(scanning) {
- cancelSearch();
- return;
- }
- scanning = true;
- forward = true;
- timer->start();
-}
-
-void V4LRadioControl::searchBackward()
-{
- // Scan down
- if(scanning) {
- cancelSearch();
- return;
- }
- scanning = true;
- forward = false;
- timer->start();
-}
-
-void V4LRadioControl::start()
-{
-}
-
-void V4LRadioControl::stop()
-{
-}
-
-QRadioTuner::Error V4LRadioControl::error() const
-{
- if(m_error)
- return QRadioTuner::OpenError;
-
- return QRadioTuner::NoError;
-}
-
-QString V4LRadioControl::errorString() const
-{
- return QString();
-}
-
-void V4LRadioControl::search()
-{
- int signal = signalStrength();
- if(sig != signal) {
- sig = signal;
- emit signalStrengthChanged(sig);
- }
-
- if(!scanning) return;
-
- if (signal > 25) {
- cancelSearch();
- return;
- }
-
- if(forward) {
- setFrequency(currentFreq+step);
- } else {
- setFrequency(currentFreq-step);
- }
-}
-
-bool V4LRadioControl::initRadio()
-{
- v4l2_tuner tuner;
- v4l2_input input;
- v4l2_frequency freq;
- v4l2_capability cap;
-
- low = false;
- available = false;
- freqMin = freqMax = currentFreq = 0;
-
- fd = ::open("/dev/radio0", O_RDWR);
-
- if(fd != -1) {
- // Capabilities
- memset( &cap, 0, sizeof( cap ) );
- if(::ioctl(fd, VIDIOC_QUERYCAP, &cap ) >= 0) {
- if(((cap.capabilities & V4L2_CAP_RADIO) == 0) && ((cap.capabilities & V4L2_CAP_AUDIO) == 0))
- available = true;
- }
-
- // Tuners
- memset( &input, 0, sizeof( input ) );
- tuners = 0;
- for ( ;; ) {
- memset( &input, 0, sizeof( input ) );
- input.index = tuners;
- if ( ioctl( fd, VIDIOC_ENUMINPUT, &input ) < 0 )
- break;
- ++tuners;
- }
-
- // Freq bands
- for ( int index = 0; index < tuners; ++index ) {
- memset( &tuner, 0, sizeof( tuner ) );
- tuner.index = index;
- if ( ioctl( fd, VIDIOC_G_TUNER, &tuner ) < 0 )
- continue;
- if ( tuner.type != V4L2_TUNER_RADIO )
- continue;
- if ( ( tuner.capability & V4L2_TUNER_CAP_LOW ) != 0 ) {
- // Units are 1/16th of a kHz.
- low = true;
- }
- if(low) {
- freqMin = tuner.rangelow * 62.5;
- freqMax = tuner.rangehigh * 62.5;
- } else {
- freqMin = tuner.rangelow * 62500;
- freqMax = tuner.rangehigh * 62500;
- }
- }
-
- // frequency
- memset( &freq, 0, sizeof( freq ) );
- if(::ioctl(fd, VIDIOC_G_FREQUENCY, &freq ) >= 0) {
- if ( ((int)freq.frequency) != -1 ) { // -1 means not set.
- if(low)
- currentFreq = freq.frequency * 62.5;
- else
- currentFreq = freq.frequency * 62500;
- }
- }
-
- // stereo
- bool stereo = false;
- memset( &tuner, 0, sizeof( tuner ) );
- if ( ioctl( fd, VIDIOC_G_TUNER, &tuner ) >= 0 ) {
- if((tuner.rxsubchans & V4L2_TUNER_SUB_STEREO) != 0)
- stereo = true;
- }
-
- vol = getVol();
-
- return true;
- }
- m_error = true;
- emit error();
-
- return false;
-}
-
-void V4LRadioControl::setVol(int v)
-{
- int fd = ::open( "/dev/mixer", O_RDWR, 0 );
- if ( fd < 0 )
- return;
- int volume = v;
- if ( volume < 0 )
- volume = 0;
- else if ( volume > 100 )
- volume = 100;
- vol = volume;
- volume += volume << 8;
- ::ioctl( fd, MIXER_WRITE(SOUND_MIXER_VOLUME), &volume );
- ::close( fd );
-}
-
-int V4LRadioControl::getVol()
-{
- int fd = ::open( "/dev/mixer", O_RDWR, 0 );
- if ( fd >= 0 ) {
- int volume = 0;
- ::ioctl( fd, MIXER_READ(SOUND_MIXER_VOLUME), &volume );
- int left = ( volume & 0xFF );
- int right = ( ( volume >> 8 ) & 0xFF );
- if ( left > right )
- vol = left;
- else
- vol = right;
- ::close( fd );
- return vol;
- }
- return 0;
-}
-
diff --git a/src/plugins/v4l/radio/v4lradiocontrol.h b/src/plugins/v4l/radio/v4lradiocontrol.h
deleted file mode 100644
index 4e9f6eb..0000000
--- a/src/plugins/v4l/radio/v4lradiocontrol.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LRADIOCONTROL_H
-#define V4LRADIOCONTROL_H
-
-#include <QtCore/qobject.h>
-#include <QtCore/qtimer.h>
-#include <QtCore/qdatetime.h>
-
-#include <qradiotunercontrol.h>
-
-#include <linux/types.h>
-#include <sys/time.h>
-#include <sys/ioctl.h>
-#include <linux/videodev2.h>
-
-QT_USE_NAMESPACE
-
-class V4LRadioService;
-
-class V4LRadioControl : public QRadioTunerControl
-{
- Q_OBJECT
-public:
- V4LRadioControl(QObject *parent = 0);
- ~V4LRadioControl();
-
- bool isAvailable() const;
- QtMultimedia::AvailabilityError availabilityError() const;
-
- QRadioTuner::State state() const;
-
- QRadioTuner::Band band() const;
- void setBand(QRadioTuner::Band b);
- bool isBandSupported(QRadioTuner::Band b) const;
-
- int frequency() const;
- int frequencyStep(QRadioTuner::Band b) const;
- QPair<int,int> frequencyRange(QRadioTuner::Band b) const;
- void setFrequency(int frequency);
-
- bool isStereo() const;
- QRadioTuner::StereoMode stereoMode() const;
- void setStereoMode(QRadioTuner::StereoMode mode);
-
- int signalStrength() const;
-
- int volume() const;
- void setVolume(int volume);
-
- bool isMuted() const;
- void setMuted(bool muted);
-
- bool isSearching() const;
- void cancelSearch();
-
- void searchForward();
- void searchBackward();
-
- void start();
- void stop();
-
- QRadioTuner::Error error() const;
- QString errorString() const;
-
-private slots:
- void search();
-
-private:
- bool initRadio();
- void setVol(int v);
- int getVol();
-
- int fd;
-
- bool m_error;
- bool muted;
- bool stereo;
- bool low;
- bool available;
- int tuners;
- int step;
- int vol;
- int sig;
- bool scanning;
- bool forward;
- QTimer* timer;
- QRadioTuner::Band currentBand;
- qint64 freqMin;
- qint64 freqMax;
- qint64 currentFreq;
- QTime playTime;
-};
-
-#endif
diff --git a/src/plugins/v4l/radio/v4lradioservice.cpp b/src/plugins/v4l/radio/v4lradioservice.cpp
deleted file mode 100644
index 1d9ad2f..0000000
--- a/src/plugins/v4l/radio/v4lradioservice.cpp
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qvariant.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtWidgets/qwidget.h>
-
-#include "v4lradioservice.h"
-#include "v4lradiocontrol.h"
-
-V4LRadioService::V4LRadioService(QObject *parent):
- QMediaService(parent)
-{
- m_control = new V4LRadioControl(this);
-}
-
-V4LRadioService::~V4LRadioService()
-{
-}
-
-QMediaControl *V4LRadioService::requestControl(const char* name)
-{
- if (qstrcmp(name,QRadioTunerControl_iid) == 0)
- return m_control;
-
- return 0;
-}
-
-
-void V4LRadioService::releaseControl(QMediaControl *)
-{
-}
diff --git a/src/plugins/v4l/radio/v4lradioservice.h b/src/plugins/v4l/radio/v4lradioservice.h
deleted file mode 100644
index 896e587..0000000
--- a/src/plugins/v4l/radio/v4lradioservice.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef V4LRADIOSERVICE_H
-#define V4LRADIOSERVICE_H
-
-#include <QtCore/qobject.h>
-
-#include <qmediaservice.h>
-QT_USE_NAMESPACE
-
-class V4LRadioControl;
-
-class V4LRadioService : public QMediaService
-{
- Q_OBJECT
-
-public:
- V4LRadioService(QObject *parent = 0);
- ~V4LRadioService();
-
- QMediaControl *requestControl(const char* name);
- void releaseControl(QMediaControl *);
-
-private:
- V4LRadioControl *m_control;
-};
-
-#endif
diff --git a/src/plugins/v4l/v4l.pro b/src/plugins/v4l/v4l.pro
deleted file mode 100644
index bc5c3d4..0000000
--- a/src/plugins/v4l/v4l.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-load(qt_module)
-
-TARGET = qtmedia_v4lengine
-QT += multimedia-private
-PLUGIN_TYPE = mediaservice
-
-load(qt_plugin)
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-HEADERS += v4lserviceplugin.h
-SOURCES += v4lserviceplugin.cpp
-
-include(radio/radio.pri)
-
-target.path += $$[QT_INSTALL_PLUGINS]/$${PLUGIN_TYPE}
-INSTALLS += target
diff --git a/src/plugins/v4l/v4lserviceplugin.cpp b/src/plugins/v4l/v4lserviceplugin.cpp
deleted file mode 100644
index b946836..0000000
--- a/src/plugins/v4l/v4lserviceplugin.cpp
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qdir.h>
-
-#include "v4lserviceplugin.h"
-#include "v4lradioservice.h"
-
-#include <qmediaserviceprovider.h>
-
-
-QStringList V4LServicePlugin::keys() const
-{
- return QStringList() <<
- QLatin1String(Q_MEDIASERVICE_RADIO);
-}
-
-QMediaService* V4LServicePlugin::create(QString const& key)
-{
- if (key == QLatin1String(Q_MEDIASERVICE_RADIO))
- return new V4LRadioService;
-
- return 0;
-}
-
-void V4LServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QList<QByteArray> V4LServicePlugin::devices(const QByteArray &service) const
-{
- return QList<QByteArray>();
-}
-
-QString V4LServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
-{
- return QString();
-}
-
-
-Q_EXPORT_PLUGIN2(qtmedia_v4lengine, V4LServicePlugin);
-
diff --git a/src/plugins/v4l/v4lserviceplugin.h b/src/plugins/v4l/v4lserviceplugin.h
deleted file mode 100644
index fb50aba..0000000
--- a/src/plugins/v4l/v4lserviceplugin.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-
-#ifndef V4LSERVICEPLUGIN_H
-#define V4LSERVICEPLUGIN_H
-
-#include <qmediaserviceproviderplugin.h>
-
-QT_USE_NAMESPACE
-
-class V4LServicePlugin : public QMediaServiceProviderPlugin, public QMediaServiceSupportedDevicesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
-public:
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
-};
-
-#endif // V4LSERVICEPLUGIN_H
diff --git a/src/plugins/wmf/player/evr9videowindowcontrol.cpp b/src/plugins/wmf/player/evr9videowindowcontrol.cpp
deleted file mode 100644
index e653dd9..0000000
--- a/src/plugins/wmf/player/evr9videowindowcontrol.cpp
+++ /dev/null
@@ -1,351 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "evr9videowindowcontrol.h"
-#include <QtCore/qdebug.h>
-#include <QtCore/qglobal.h>
-
-Evr9VideoWindowControl::Evr9VideoWindowControl(QObject *parent)
- : QVideoWindowControl(parent)
- , m_windowId(0)
- , m_dirtyValues(0)
- , m_aspectRatioMode(Qt::KeepAspectRatio)
- , m_brightness(0)
- , m_contrast(0)
- , m_hue(0)
- , m_saturation(0)
- , m_fullScreen(false)
- , m_currentActivate(0)
- , m_evrSink(0)
- , m_displayControl(0)
-{
- if (FAILED(MFCreateVideoRendererActivate(0, &m_currentActivate))) {
- qWarning() << "Failed to create evr video renderer activate!";
- return;
- }
- if (FAILED(m_currentActivate->ActivateObject(IID_IMFMediaSink, (LPVOID*)(&m_evrSink)))) {
- qWarning() << "Failed to activate evr media sink!";
- return;
- }
- if (FAILED(MFGetService(m_evrSink, MR_VIDEO_RENDER_SERVICE, IID_PPV_ARGS(&m_displayControl)))) {
- qWarning() << "Failed to get display control from evr media sink!";
- return;
- }
- if (FAILED(MFGetService(m_evrSink, MR_VIDEO_MIXER_SERVICE, IID_PPV_ARGS(&m_processor)))) {
- qWarning() << "Failed to get video processor from evr media sink!";
- return;
- }
-}
-
-Evr9VideoWindowControl::~Evr9VideoWindowControl()
-{
- if (m_processor)
- m_processor->Release();
- if (m_displayControl)
- m_displayControl->Release();
- if (m_evrSink)
- m_evrSink->Release();
- if (m_currentActivate) {
- m_currentActivate->ShutdownObject();
- m_currentActivate->Release();
- }
-}
-
-
-WId Evr9VideoWindowControl::winId() const
-{
- return m_windowId;
-}
-
-void Evr9VideoWindowControl::setWinId(WId id)
-{
- m_windowId = id;
-
- if (QWidget *widget = QWidget::find(m_windowId)) {
- const QColor color = widget->palette().color(QPalette::Window);
-
- m_windowColor = RGB(color.red(), color.green(), color.blue());
- }
-
- if (m_displayControl) {
- m_displayControl->SetVideoWindow(m_windowId);
- }
-}
-
-QRect Evr9VideoWindowControl::displayRect() const
-{
- return m_displayRect;
-}
-
-void Evr9VideoWindowControl::setDisplayRect(const QRect &rect)
-{
- m_displayRect = rect;
-
- if (m_displayControl) {
- RECT displayRect = { rect.left(), rect.top(), rect.right() + 1, rect.bottom() + 1 };
- QSize sourceSize = nativeSize();
-
- RECT sourceRect = { 0, 0, sourceSize.width(), sourceSize.height() };
-
- if (m_aspectRatioMode == Qt::KeepAspectRatioByExpanding) {
- QSize clippedSize = rect.size();
- clippedSize.scale(sourceRect.right, sourceRect.bottom, Qt::KeepAspectRatio);
-
- sourceRect.left = (sourceRect.right - clippedSize.width()) / 2;
- sourceRect.top = (sourceRect.bottom - clippedSize.height()) / 2;
- sourceRect.right = sourceRect.left + clippedSize.width();
- sourceRect.bottom = sourceRect.top + clippedSize.height();
- }
-
- if (sourceSize.width() > 0 && sourceSize.height() > 0) {
- MFVideoNormalizedRect sourceNormRect;
- sourceNormRect.left = float(sourceRect.left) / float(sourceRect.right);
- sourceNormRect.top = float(sourceRect.top) / float(sourceRect.bottom);
- sourceNormRect.right = float(sourceRect.right) / float(sourceRect.right);
- sourceNormRect.bottom = float(sourceRect.bottom) / float(sourceRect.bottom);
- m_displayControl->SetVideoPosition(&sourceNormRect, &displayRect);
- } else {
- m_displayControl->SetVideoPosition(NULL, &displayRect);
- }
- }
-}
-
-bool Evr9VideoWindowControl::isFullScreen() const
-{
- return m_fullScreen;
-}
-
-void Evr9VideoWindowControl::setFullScreen(bool fullScreen)
-{
- if (m_fullScreen == fullScreen)
- return;
- emit fullScreenChanged(m_fullScreen = fullScreen);
-}
-
-void Evr9VideoWindowControl::repaint()
-{
- QSize size = nativeSize();
- if (size.width() > 0 && size.height() > 0
- && m_displayControl
- && SUCCEEDED(m_displayControl->RepaintVideo())) {
- return;
- }
-
- PAINTSTRUCT paint;
- if (HDC dc = ::BeginPaint(m_windowId, &paint)) {
- HPEN pen = ::CreatePen(PS_SOLID, 1, m_windowColor);
- HBRUSH brush = ::CreateSolidBrush(m_windowColor);
- ::SelectObject(dc, pen);
- ::SelectObject(dc, brush);
-
- ::Rectangle(
- dc,
- m_displayRect.left(),
- m_displayRect.top(),
- m_displayRect.right() + 1,
- m_displayRect.bottom() + 1);
-
- ::DeleteObject(pen);
- ::DeleteObject(brush);
- ::EndPaint(m_windowId, &paint);
- }
-}
-
-QSize Evr9VideoWindowControl::nativeSize() const
-{
- QSize size;
- if (m_displayControl) {
- SIZE sourceSize;
- if (SUCCEEDED(m_displayControl->GetNativeVideoSize(&sourceSize, 0)))
- size = QSize(sourceSize.cx, sourceSize.cy);
- }
- return size;
-}
-
-Qt::AspectRatioMode Evr9VideoWindowControl::aspectRatioMode() const
-{
- return m_aspectRatioMode;
-}
-
-void Evr9VideoWindowControl::setAspectRatioMode(Qt::AspectRatioMode mode)
-{
- m_aspectRatioMode = mode;
-
- if (m_displayControl) {
- switch (mode) {
- case Qt::IgnoreAspectRatio:
- //comment from MSDN: Do not maintain the aspect ratio of the video. Stretch the video to fit the output rectangle.
- m_displayControl->SetAspectRatioMode(MFVideoARMode_None);
- break;
- case Qt::KeepAspectRatio:
- //comment from MSDN: Preserve the aspect ratio of the video by letterboxing or within the output rectangle.
- m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture);
- break;
- case Qt::KeepAspectRatioByExpanding:
- //for this mode, more adjustment will be done in setDisplayRect
- m_displayControl->SetAspectRatioMode(MFVideoARMode_PreservePicture);
- break;
- default:
- break;
- }
- setDisplayRect(m_displayRect);
- }
-}
-
-int Evr9VideoWindowControl::brightness() const
-{
- return m_brightness;
-}
-
-void Evr9VideoWindowControl::setBrightness(int brightness)
-{
- if (m_brightness == brightness)
- return;
-
- m_brightness = brightness;
-
- m_dirtyValues |= DXVA2_ProcAmp_Brightness;
-
- setProcAmpValues();
-
- emit brightnessChanged(brightness);
-}
-
-int Evr9VideoWindowControl::contrast() const
-{
- return m_contrast;
-}
-
-void Evr9VideoWindowControl::setContrast(int contrast)
-{
- if (m_contrast == contrast)
- return;
-
- m_contrast = contrast;
-
- m_dirtyValues |= DXVA2_ProcAmp_Contrast;
-
- setProcAmpValues();
-
- emit contrastChanged(contrast);
-}
-
-int Evr9VideoWindowControl::hue() const
-{
- return m_hue;
-}
-
-void Evr9VideoWindowControl::setHue(int hue)
-{
- if (m_hue == hue)
- return;
-
- m_hue = hue;
-
- m_dirtyValues |= DXVA2_ProcAmp_Hue;
-
- setProcAmpValues();
-
- emit hueChanged(hue);
-}
-
-int Evr9VideoWindowControl::saturation() const
-{
- return m_saturation;
-}
-
-void Evr9VideoWindowControl::setSaturation(int saturation)
-{
- if (m_saturation == saturation)
- return;
-
- m_saturation = saturation;
-
- m_dirtyValues |= DXVA2_ProcAmp_Saturation;
-
- setProcAmpValues();
-
- emit saturationChanged(saturation);
-}
-
-IMFActivate* Evr9VideoWindowControl::currentActivate() const
-{
- return m_currentActivate;
-}
-
-void Evr9VideoWindowControl::setProcAmpValues()
-{
- if (m_processor) {
- DXVA2_ProcAmpValues values;
- if (m_dirtyValues & DXVA2_ProcAmp_Brightness) {
- values.Brightness = scaleProcAmpValue(DXVA2_ProcAmp_Brightness, m_brightness);
- }
- if (m_dirtyValues & DXVA2_ProcAmp_Contrast) {
- values.Contrast = scaleProcAmpValue(DXVA2_ProcAmp_Contrast, m_contrast);
- }
- if (m_dirtyValues & DXVA2_ProcAmp_Hue) {
- values.Hue = scaleProcAmpValue(DXVA2_ProcAmp_Hue, m_hue);
- }
- if (m_dirtyValues & DXVA2_ProcAmp_Saturation) {
- values.Saturation = scaleProcAmpValue(DXVA2_ProcAmp_Saturation, m_saturation);
- }
-
- if (SUCCEEDED(m_processor->SetProcAmpValues(0, &values))) {
- m_dirtyValues = 0;
- }
- }
-}
-
-DXVA2_Fixed32 Evr9VideoWindowControl::scaleProcAmpValue(DWORD prop, int value) const
-{
- float scaledValue = 0.0;
-
- DXVA2_ValueRange range;
- if (SUCCEEDED(m_processor->GetProcAmpRange(prop, &range))) {
- scaledValue = DXVA2FixedToFloat(range.DefaultValue);
- if (value > 0)
- scaledValue += float(value) * (DXVA2FixedToFloat(range.MaxValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100;
- else if (value < 0)
- scaledValue -= float(value) * (DXVA2FixedToFloat(range.MinValue) - DXVA2FixedToFloat(range.DefaultValue)) / 100;
- }
-
- return DXVA2FloatToFixed(scaledValue);
-}
diff --git a/src/plugins/wmf/player/evr9videowindowcontrol.h b/src/plugins/wmf/player/evr9videowindowcontrol.h
deleted file mode 100644
index a415243..0000000
--- a/src/plugins/wmf/player/evr9videowindowcontrol.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef EVR9VIDEOWINDOWCONTROL_H
-#define EVR9VIDEOWINDOWCONTROL_H
-
-#include "../../src/multimedia/qvideowindowcontrol.h"
-
-#include <Mfidl.h>
-#include <d3d9.h>
-#include <Evr9.h>
-
-QT_USE_NAMESPACE
-
-class Evr9VideoWindowControl : public QVideoWindowControl
-{
- Q_OBJECT
-public:
- Evr9VideoWindowControl(QObject *parent = 0);
- ~Evr9VideoWindowControl();
-
- WId winId() const;
- void setWinId(WId id);
-
- QRect displayRect() const;
- void setDisplayRect(const QRect &rect);
-
- bool isFullScreen() const;
- void setFullScreen(bool fullScreen);
-
- void repaint();
-
- QSize nativeSize() const;
-
- Qt::AspectRatioMode aspectRatioMode() const;
- void setAspectRatioMode(Qt::AspectRatioMode mode);
-
- int brightness() const;
- void setBrightness(int brightness);
-
- int contrast() const;
- void setContrast(int contrast);
-
- int hue() const;
- void setHue(int hue);
-
- int saturation() const;
- void setSaturation(int saturation);
-
- IMFActivate* currentActivate() const;
-
-private:
- void setProcAmpValues();
- DXVA2_Fixed32 scaleProcAmpValue(DWORD prop, int value) const;
-
- WId m_windowId;
- COLORREF m_windowColor;
- DWORD m_dirtyValues;
- Qt::AspectRatioMode m_aspectRatioMode;
- QRect m_displayRect;
- int m_brightness;
- int m_contrast;
- int m_hue;
- int m_saturation;
- bool m_fullScreen;
-
- IMFActivate *m_currentActivate;
- IMFMediaSink *m_evrSink;
- IMFVideoDisplayControl *m_displayControl;
- IMFVideoProcessor *m_processor;
-};
-
-#endif
diff --git a/src/plugins/wmf/player/mfaudioendpointcontrol.cpp b/src/plugins/wmf/player/mfaudioendpointcontrol.cpp
deleted file mode 100644
index 290afe5..0000000
--- a/src/plugins/wmf/player/mfaudioendpointcontrol.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "QtCore/qdebug.h"
-#include "mfaudioendpointcontrol.h"
-
-MFAudioEndpointControl::MFAudioEndpointControl(QObject *parent)
- : QAudioEndpointSelector(parent)
- , m_currentActivate(0)
-{
- updateEndpoints();
- setActiveEndpoint(m_defaultEndpoint);
-}
-
-MFAudioEndpointControl::~MFAudioEndpointControl()
-{
- foreach (LPWSTR wstrID, m_devices)
- CoTaskMemFree(wstrID);
-
- if (m_currentActivate)
- m_currentActivate->Release();
-}
-
-QList<QString> MFAudioEndpointControl::availableEndpoints() const
-{
- return m_devices.keys();
-}
-
-QString MFAudioEndpointControl::endpointDescription(const QString &name) const
-{
- return name.section(QLatin1Char('\\'), -1);
-}
-
-QString MFAudioEndpointControl::defaultEndpoint() const
-{
- return m_defaultEndpoint;
-}
-
-QString MFAudioEndpointControl::activeEndpoint() const
-{
- return m_activeEndpoint;
-}
-
-void MFAudioEndpointControl::setActiveEndpoint(const QString &name)
-{
- if (m_activeEndpoint == name)
- return;
- QMap<QString, LPWSTR>::iterator it = m_devices.find(name);
- if (it == m_devices.end())
- return;
-
- LPWSTR wstrID = *it;
- IMFActivate *activate = NULL;
- HRESULT hr = MFCreateAudioRendererActivate(&activate);
- if (FAILED(hr)) {
- qWarning() << "Failed to create audio renderer activate";
- return;
- }
-
- if (wstrID) {
- hr = activate->SetString(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ID, wstrID);
- } else {
- //This is the default one that has been inserted in updateEndpoints(),
- //so give the activate a hint that we want to use the device for multimedia playback
- //then the media foundation will choose an appropriate one.
-
- //from MSDN:
- //The ERole enumeration defines constants that indicate the role that the system has assigned to an audio endpoint device.
- //eMultimedia: Music, movies, narration, and live music recording.
- hr = activate->SetUINT32(MF_AUDIO_RENDERER_ATTRIBUTE_ENDPOINT_ROLE, eMultimedia);
- }
-
- if (FAILED(hr)) {
- qWarning() << "Failed to set attribute for audio device" << name;
- return;
- }
-
- if (m_currentActivate)
- m_currentActivate->Release();
- m_currentActivate = activate;
- m_activeEndpoint = name;
-}
-
-IMFActivate* MFAudioEndpointControl::currentActivate() const
-{
- return m_currentActivate;
-}
-
-void MFAudioEndpointControl::updateEndpoints()
-{
- m_defaultEndpoint = QString::fromLatin1("Default");
- m_devices.insert(m_defaultEndpoint, NULL);
-
- IMMDeviceEnumerator *pEnum = NULL;
- HRESULT hr = CoCreateInstance(__uuidof(MMDeviceEnumerator),
- NULL, CLSCTX_ALL,
- __uuidof(IMMDeviceEnumerator),
- (void**)&pEnum);
- if (SUCCEEDED(hr)) {
- IMMDeviceCollection *pDevices = NULL;
- hr = pEnum->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &pDevices);
- if (SUCCEEDED(hr)) {
- UINT count;
- hr = pDevices->GetCount(&count);
- if (SUCCEEDED(hr)) {
- for (UINT i = 0; i < count; ++i) {
- IMMDevice *pDevice = NULL;
- hr = pDevices->Item(i, &pDevice);
- if (SUCCEEDED(hr)) {
- LPWSTR wstrID = NULL;
- hr = pDevice->GetId(&wstrID);
- if (SUCCEEDED(hr)) {
- QString deviceId = QString::fromWCharArray(wstrID);
- m_devices.insert(deviceId, wstrID);
- }
- pDevice->Release();
- }
- }
- }
- pDevices->Release();
- }
- pEnum->Release();
- }
-}
diff --git a/src/plugins/wmf/player/mfaudioendpointcontrol.h b/src/plugins/wmf/player/mfaudioendpointcontrol.h
deleted file mode 100644
index 67f7756..0000000
--- a/src/plugins/wmf/player/mfaudioendpointcontrol.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFAUDIOENDPOINTCONTROL_H
-#define MFAUDIOENDPOINTCONTROL_H
-
-#include <mfapi.h>
-#include <mfidl.h>
-#include <mmdeviceapi.h>
-
-#include "../../src/multimedia/qaudioendpointselector.h"
-
-class MFPlayerService;
-
-QT_USE_NAMESPACE
-
-class MFAudioEndpointControl : public QAudioEndpointSelector
-{
- Q_OBJECT
-public:
- MFAudioEndpointControl(QObject *parent = 0);
- ~MFAudioEndpointControl();
-
- QList<QString> availableEndpoints() const;
-
- QString endpointDescription(const QString &name) const;
-
- QString defaultEndpoint() const;
- QString activeEndpoint() const;
-
- void setActiveEndpoint(const QString& name);
-
- IMFActivate* currentActivate() const;
-
-private:
- void updateEndpoints();
-
- QString m_defaultEndpoint;
- QString m_activeEndpoint;
- QMap<QString, LPWSTR> m_devices;
- IMFActivate *m_currentActivate;
-
-};
-
-#endif
-
diff --git a/src/plugins/wmf/player/mfmetadatacontrol.cpp b/src/plugins/wmf/player/mfmetadatacontrol.cpp
deleted file mode 100644
index 4e62706..0000000
--- a/src/plugins/wmf/player/mfmetadatacontrol.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mfmetadatacontrol.h"
-#include "mfplayerservice.h"
-#include "Propkey.h"
-
-//#define DEBUG_MEDIAFOUNDATION
-
-MFMetaDataControl::MFMetaDataControl(QObject *parent)
- : QMetaDataReaderControl(parent)
- , m_metaData(0)
- , m_content(0)
-{
-}
-
-MFMetaDataControl::~MFMetaDataControl()
-{
- if (m_metaData)
- m_metaData->Release();
- if (m_content)
- m_content->Release();
-}
-
-bool MFMetaDataControl::isMetaDataAvailable() const
-{
- return m_content || m_metaData;
-}
-
-QVariant MFMetaDataControl::metaData(QtMultimedia::MetaData key) const
-{
- QVariant value;
- if (!isMetaDataAvailable())
- return value;
-
- int index = m_availableMetaDatas.indexOf(key);
- if (index < 0)
- return value;
-
- PROPVARIANT var;
- PropVariantInit(&var);
- HRESULT hr = S_FALSE;
- if (m_content)
- hr = m_content->GetValue(m_commonKeys[index], &var);
- else if (m_metaData)
- hr = m_metaData->GetProperty(m_commonNames[index].utf16(), &var);
-
- if (SUCCEEDED(hr))
- value = convertValue(var);
-
- PropVariantClear(&var);
- return value;
-}
-
-QVariant MFMetaDataControl::convertValue(const PROPVARIANT& var) const
-{
- QVariant value;
- //form MSDN: http://msdn.microsoft.com/en-us/library/ff384862%28v=VS.85%29.aspx
- //it seems that those 4 types are enough for media foundation metadata
- //add more later if necessary
- switch (var.vt) {
- case VT_LPWSTR:
- value = QString::fromUtf16(var.pwszVal);
- break;
- case VT_UI4:
- value = uint(var.ulVal);
- break;
- case VT_UI8:
- value = qulonglong(var.uhVal.QuadPart);
- break;
- case VT_BOOL:
- value = bool(var.boolVal);
- break;
- }
- return value;
-}
-
-QList<QtMultimedia::MetaData> MFMetaDataControl::availableMetaData() const
-{
- return m_availableMetaDatas;
-}
-
-QVariant MFMetaDataControl::extendedMetaData(const QString &key) const
-{
- QVariant value;
- HRESULT hr = S_FALSE;
- PROPVARIANT var;
- PropVariantInit(&var);
- if (m_content) {
- int index = m_extendedMetaDatas.indexOf(key);
- if (index >= 0) {
- hr = m_content->GetValue(m_extendedKeys[index], &var);
- }
- } else if (m_metaData) {
- hr = m_metaData->GetProperty(key.utf16(), &var);
- }
-
- if (SUCCEEDED(hr))
- value = convertValue(var);
-
- PropVariantClear(&var);
- return value;
-}
-
-QStringList MFMetaDataControl::availableExtendedMetaData() const
-{
- return m_extendedMetaDatas;
-}
-
-void MFMetaDataControl::updateSource(IMFPresentationDescriptor* sourcePD, IMFMediaSource* mediaSource)
-{
- if (m_metaData) {
- m_metaData->Release();
- m_metaData = 0;
- }
-
- if (m_content) {
- m_content->Release();
- m_content = 0;
- }
-
- m_availableMetaDatas.clear();
- m_commonKeys.clear();
- m_commonNames.clear();
- m_extendedMetaDatas.clear();
- m_extendedKeys.clear();
-
- if (SUCCEEDED(MFGetService(mediaSource, MF_PROPERTY_HANDLER_SERVICE, IID_PPV_ARGS(&m_content)))) {
- DWORD cProps;
- if (SUCCEEDED(m_content->GetCount(&cProps))) {
- for (DWORD i = 0; i < cProps; i++)
- {
- PROPERTYKEY key;
- if (FAILED(m_content->GetAt(i, &key)))
- continue;
- bool common = true;
- if (key == PKEY_Author) {
- m_availableMetaDatas.push_back(QtMultimedia::Author);
- } else if (key == PKEY_Title) {
- m_availableMetaDatas.push_back(QtMultimedia::Title);
- } else if (key == PKEY_ParentalRating) {
- m_availableMetaDatas.push_back(QtMultimedia::ParentalRating);
- } else if (key == PKEY_Comment) {
- m_availableMetaDatas.push_back(QtMultimedia::Description);
- } else if (key == PKEY_Copyright) {
- m_availableMetaDatas.push_back(QtMultimedia::Copyright);
- //TODO: add more common keys
- } else {
- common = false;
- //TODO: add more extended keys
- }
- if (common)
- m_commonKeys.push_back(key);
- }
- } else {
- m_content->Release();
- m_content = NULL;
- }
- }
-
- if (!m_content) {
- //fallback to Vista approach
- IMFMetadataProvider *provider = NULL;
- if (SUCCEEDED(MFGetService(mediaSource, MF_METADATA_PROVIDER_SERVICE, IID_PPV_ARGS(&provider)))) {
- if (SUCCEEDED(provider->GetMFMetadata(sourcePD, 0, 0, &m_metaData))) {
- PROPVARIANT varNames;
- PropVariantInit(&varNames);
- if (SUCCEEDED(m_metaData->GetAllPropertyNames(&varNames)) && varNames.vt == (VT_VECTOR | VT_LPWSTR)) {
- ULONG cElements = varNames.calpwstr.cElems;
- for (ULONG i = 0; i < cElements; i++)
- {
- const WCHAR* sName = varNames.calpwstr.pElems[i];
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "metadata: " << QString::fromUtf16(sName);
-#endif
- bool common = true;
- if (wcscmp(sName, L"Author") == 0) {
- m_availableMetaDatas.push_back(QtMultimedia::Author);
- } else if (wcscmp(sName, L"Title") == 0) {
- m_availableMetaDatas.push_back(QtMultimedia::Title);
- } else if (wcscmp(sName, L"Rating") == 0) {
- m_availableMetaDatas.push_back(QtMultimedia::ParentalRating);
- } else if (wcscmp(sName, L"Description") == 0) {
- m_availableMetaDatas.push_back(QtMultimedia::Description);
- } else if (wcscmp(sName, L"Copyright") == 0) {
- m_availableMetaDatas.push_back(QtMultimedia::Copyright);
- //TODO: add more common keys
- } else {
- common = false;
- m_extendedMetaDatas.push_back(QString::fromUtf16(sName));
- }
- if (common)
- m_commonNames.push_back(QString::fromUtf16(sName));
- }
- }
- PropVariantClear(&varNames);
- } else {
- qWarning("Failed to get IMFMetadata");
- }
- provider->Release();
- } else {
- qWarning("Failed to get IMFMetadataProvider from source");
- }
- }
-
- emit metaDataChanged();
- emit metaDataAvailableChanged(m_metaData || m_content);
-}
diff --git a/src/plugins/wmf/player/mfmetadatacontrol.h b/src/plugins/wmf/player/mfmetadatacontrol.h
deleted file mode 100644
index a73b778..0000000
--- a/src/plugins/wmf/player/mfmetadatacontrol.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFMETADATACONTROL_H
-#define MFMETADATACONTROL_H
-
-#include <qmetadatareadercontrol.h>
-#include "Mfidl.h"
-
-QT_USE_NAMESPACE
-
-class MFMetaDataControl : public QMetaDataReaderControl
-{
- Q_OBJECT
-public:
- MFMetaDataControl(QObject *parent = 0);
- ~MFMetaDataControl();
-
- bool isMetaDataAvailable() const;
-
- QVariant metaData(QtMultimedia::MetaData key) const;
- QList<QtMultimedia::MetaData> availableMetaData() const;
-
- QVariant extendedMetaData(const QString &key) const;
- QStringList availableExtendedMetaData() const;
-
- void updateSource(IMFPresentationDescriptor* sourcePD, IMFMediaSource* mediaSource);
-
-private:
- QVariant convertValue(const PROPVARIANT& var) const;
- IPropertyStore *m_content; //for Windows7
- IMFMetadata *m_metaData; //for Vista
-
- QList<QtMultimedia::MetaData> m_availableMetaDatas;
- QList<PROPERTYKEY> m_commonKeys; //for Windows7
- QStringList m_commonNames; //for Vista
-
- QStringList m_extendedMetaDatas;
- QList<PROPERTYKEY> m_extendedKeys; //for Windows7
-};
-
-#endif
diff --git a/src/plugins/wmf/player/mfplayercontrol.cpp b/src/plugins/wmf/player/mfplayercontrol.cpp
deleted file mode 100644
index e3a3d80..0000000
--- a/src/plugins/wmf/player/mfplayercontrol.cpp
+++ /dev/null
@@ -1,317 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mfplayercontrol.h"
-#include <qtcore/qdebug.h>
-
-//#define DEBUG_MEDIAFOUNDATION
-
-MFPlayerControl::MFPlayerControl(MFPlayerSession *session)
-: QMediaPlayerControl(session)
-, m_state(QMediaPlayer::StoppedState)
-, m_videoAvailable(false)
-, m_audioAvailable(false)
-, m_duration(-1)
-, m_seekable(false)
-, m_session(session)
-{
- QObject::connect(m_session, SIGNAL(statusChanged()), this, SLOT(handleStatusChanged()));
- QObject::connect(m_session, SIGNAL(videoAvailable()), this, SLOT(handleVideoAvailable()));
- QObject::connect(m_session, SIGNAL(audioAvailable()), this, SLOT(handleAudioAvailable()));
- QObject::connect(m_session, SIGNAL(durationUpdate(qint64)), this, SLOT(handleDurationUpdate(qint64)));
- QObject::connect(m_session, SIGNAL(seekableUpdate(bool)), this, SLOT(handleSeekableUpdate(bool)));
- QObject::connect(m_session, SIGNAL(error(QMediaPlayer::Error, QString, bool)), this, SLOT(handleError(QMediaPlayer::Error, QString, bool)));
- QObject::connect(m_session, SIGNAL(positionChanged(qint64)), this, SIGNAL(positionChanged(qint64)));
- QObject::connect(m_session, SIGNAL(volumeChanged(int)), this, SIGNAL(volumeChanged(int)));
- QObject::connect(m_session, SIGNAL(mutedChanged(bool)), this, SIGNAL(mutedChanged(bool)));
- QObject::connect(m_session, SIGNAL(playbackRateChanged(qreal)), this, SIGNAL(playbackRateChanged(qreal)));
- QObject::connect(m_session, SIGNAL(bufferStatusChanged(int)), this, SIGNAL(bufferStatusChanged(int)));
-}
-
-MFPlayerControl::~MFPlayerControl()
-{
-}
-
-void MFPlayerControl::setMedia(const QMediaContent &media, QIODevice *stream)
-{
- if (m_state != QMediaPlayer::StoppedState) {
- changeState(QMediaPlayer::StoppedState);
- m_session->stop(true);
- refreshState();
- }
-
- m_media = media;
- m_stream = stream;
- resetAudioVideoAvailable();
- handleDurationUpdate(-1);
- handleSeekableUpdate(false);
- m_session->load(media, stream);
- emit mediaChanged(m_media);
-}
-
-void MFPlayerControl::play()
-{
- if (m_state == QMediaPlayer::PlayingState)
- return;
- if (QMediaPlayer::InvalidMedia == m_session->status())
- m_session->load(m_media, m_stream);
-
- switch (m_session->status()) {
- case QMediaPlayer::UnknownMediaStatus:
- case QMediaPlayer::NoMedia:
- case QMediaPlayer::InvalidMedia:
- return;
- case QMediaPlayer::LoadedMedia:
- case QMediaPlayer::BufferingMedia:
- case QMediaPlayer::BufferedMedia:
- case QMediaPlayer::EndOfMedia:
- changeState(QMediaPlayer::PlayingState);
- m_session->start();
- break;
- default: //Loading/Stalled
- changeState(QMediaPlayer::PlayingState);
- break;
- }
- refreshState();
-}
-
-void MFPlayerControl::pause()
-{
- if (m_state != QMediaPlayer::PlayingState)
- return;
- changeState(QMediaPlayer::PausedState);
- m_session->pause();
- refreshState();
-}
-
-void MFPlayerControl::stop()
-{
- if (m_state == QMediaPlayer::StoppedState)
- return;
- changeState(QMediaPlayer::StoppedState);
- m_session->stop();
- refreshState();
-}
-
-void MFPlayerControl::changeState(QMediaPlayer::State state)
-{
- if (m_state == state)
- return;
- m_state = state;
- m_stateDirty = true;
-}
-
-void MFPlayerControl::refreshState()
-{
- if (!m_stateDirty)
- return;
- m_stateDirty = false;
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MFPlayerControl::emit stateChanged" << m_state;
-#endif
- emit stateChanged(m_state);
-}
-
-void MFPlayerControl::handleStatusChanged()
-{
- QMediaPlayer::MediaStatus status = m_session->status();
- switch (status) {
- case QMediaPlayer::EndOfMedia:
- changeState(QMediaPlayer::StoppedState);
- break;
- case QMediaPlayer::InvalidMedia:
- break;
- case QMediaPlayer::LoadedMedia:
- case QMediaPlayer::BufferingMedia:
- case QMediaPlayer::BufferedMedia:
- if (m_state == QMediaPlayer::PlayingState)
- m_session->start();
- break;
- }
- emit mediaStatusChanged(m_session->status());
- refreshState();
-}
-
-void MFPlayerControl::handleVideoAvailable()
-{
- if (m_videoAvailable)
- return;
- m_videoAvailable = true;
- emit videoAvailableChanged(m_videoAvailable);
-}
-
-void MFPlayerControl::handleAudioAvailable()
-{
- if (m_audioAvailable)
- return;
- m_audioAvailable = true;
- emit audioAvailableChanged(m_audioAvailable);
-}
-
-void MFPlayerControl::resetAudioVideoAvailable()
-{
- bool videoDirty = false;
- if (m_videoAvailable) {
- m_videoAvailable = false;
- videoDirty = true;
- }
- if (m_audioAvailable) {
- m_audioAvailable = false;
- emit audioAvailableChanged(m_audioAvailable);
- }
- if (videoDirty)
- emit videoAvailableChanged(m_videoAvailable);
-}
-
-void MFPlayerControl::handleDurationUpdate(qint64 duration)
-{
- if (m_duration == duration)
- return;
- m_duration = duration;
- emit durationChanged(m_duration);
-}
-
-void MFPlayerControl::handleSeekableUpdate(bool seekable)
-{
- if (m_seekable == seekable)
- return;
- m_seekable = seekable;
- emit seekableChanged(m_seekable);
-}
-
-QMediaPlayer::State MFPlayerControl::state() const
-{
- return m_state;
-}
-
-QMediaPlayer::MediaStatus MFPlayerControl::mediaStatus() const
-{
- return m_session->status();
-}
-
-qint64 MFPlayerControl::duration() const
-{
- return m_duration;
-}
-
-qint64 MFPlayerControl::position() const
-{
- return m_session->position();
-}
-
-void MFPlayerControl::setPosition(qint64 position)
-{
- if (!m_seekable || position == m_session->position())
- return;
- m_session->setPosition(position);
-}
-
-int MFPlayerControl::volume() const
-{
- return m_session->volume();
-}
-
-void MFPlayerControl::setVolume(int volume)
-{
- m_session->setVolume(volume);
-}
-
-bool MFPlayerControl::isMuted() const
-{
- return m_session->isMuted();
-}
-
-void MFPlayerControl::setMuted(bool muted)
-{
- m_session->setMuted(muted);
-}
-
-int MFPlayerControl::bufferStatus() const
-{
- return m_session->bufferStatus();
-}
-
-bool MFPlayerControl::isAudioAvailable() const
-{
- return m_audioAvailable;
-}
-
-bool MFPlayerControl::isVideoAvailable() const
-{
- return m_videoAvailable;
-}
-
-bool MFPlayerControl::isSeekable() const
-{
- return m_seekable;
-}
-
-QMediaTimeRange MFPlayerControl::availablePlaybackRanges() const
-{
- return m_session->availablePlaybackRanges();
-}
-
-qreal MFPlayerControl::playbackRate() const
-{
- return m_session->playbackRate();
-}
-
-void MFPlayerControl::setPlaybackRate(qreal rate)
-{
- m_session->setPlaybackRate(rate);
-}
-
-QMediaContent MFPlayerControl::media() const
-{
- return m_media;
-}
-
-const QIODevice* MFPlayerControl::mediaStream() const
-{
- return m_stream;
-}
-
-void MFPlayerControl::handleError(QMediaPlayer::Error errorCode, const QString& errorString, bool isFatal)
-{
- if (isFatal)
- stop();
- emit error(int(errorCode), errorString);
-}
diff --git a/src/plugins/wmf/player/mfplayercontrol.h b/src/plugins/wmf/player/mfplayercontrol.h
deleted file mode 100644
index 0256b89..0000000
--- a/src/plugins/wmf/player/mfplayercontrol.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFPLAYERCONTROL_H
-#define MFPLAYERCONTROL_H
-
-#include "qmediacontent.h"
-#include "qmediaplayercontrol.h"
-
-#include <QtCore/qcoreevent.h>
-
-#include "mfplayersession.h"
-
-QT_USE_NAMESPACE
-
-class MFPlayerControl : public QMediaPlayerControl
-{
- Q_OBJECT
-public:
- MFPlayerControl(MFPlayerSession *session);
- ~MFPlayerControl();
-
- QMediaPlayer::State state() const;
-
- QMediaPlayer::MediaStatus mediaStatus() const;
-
- qint64 duration() const;
-
- qint64 position() const;
- void setPosition(qint64 position);
-
- int volume() const;
- void setVolume(int volume);
-
- bool isMuted() const;
- void setMuted(bool muted);
-
- int bufferStatus() const;
-
- bool isAudioAvailable() const;
- bool isVideoAvailable() const;
-
- bool isSeekable() const;
-
- QMediaTimeRange availablePlaybackRanges() const;
-
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
-
- QMediaContent media() const;
- const QIODevice *mediaStream() const;
- void setMedia(const QMediaContent &media, QIODevice *stream);
-
- void play();
- void pause();
- void stop();
-
-private Q_SLOTS:
- void handleStatusChanged();
- void handleVideoAvailable();
- void handleAudioAvailable();
- void handleDurationUpdate(qint64 duration);
- void handleSeekableUpdate(bool seekable);
- void handleError(QMediaPlayer::Error errorCode, const QString& errorString, bool isFatal);
-
-private:
- void changeState(QMediaPlayer::State state);
- void resetAudioVideoAvailable();
- void refreshState();
-
- QMediaPlayer::State m_state;
- bool m_stateDirty;
- QMediaPlayer::MediaStatus m_status;
- QMediaPlayer::Error m_error;
-
- bool m_videoAvailable;
- bool m_audioAvailable;
- qint64 m_duration;
- bool m_seekable;
-
- QIODevice *m_stream;
- QMediaContent m_media;
- MFPlayerSession *m_session;
-};
-
-#endif
diff --git a/src/plugins/wmf/player/mfplayerservice.cpp b/src/plugins/wmf/player/mfplayerservice.cpp
deleted file mode 100644
index bda86a3..0000000
--- a/src/plugins/wmf/player/mfplayerservice.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediacontent.h"
-
-#include <QtCore/qdebug.h>
-
-#include "mfplayercontrol.h"
-#ifndef Q_WS_SIMULATOR
-#include "evr9videowindowcontrol.h"
-#endif
-#include "mfvideorenderercontrol.h"
-#include "mfaudioendpointcontrol.h"
-#include "mfplayerservice.h"
-#include "mfplayersession.h"
-#include "mfmetadatacontrol.h"
-
-MFPlayerService::MFPlayerService(QObject *parent)
- : QMediaService(parent)
- , m_session(0)
-#ifndef Q_WS_SIMULATOR
- , m_videoWindowControl(0)
-#endif
- , m_videoRendererControl(0)
-{
- CoInitialize(NULL);
- MFStartup(MF_VERSION);
- m_session = new MFPlayerSession(this);
- m_player = new MFPlayerControl(m_session);
- m_audioEndpointControl = new MFAudioEndpointControl(this);
- m_metaDataControl = new MFMetaDataControl(this);
-}
-
-MFPlayerService::~MFPlayerService()
-{
-
-#ifndef Q_WS_SIMULATOR
- if (m_videoWindowControl)
- delete m_videoWindowControl;
-#endif
-
- if (m_videoRendererControl)
- delete m_videoRendererControl;
-
- delete m_session;
-
- MFShutdown();
- CoUninitialize();
-}
-
-QMediaControl* MFPlayerService::requestControl(const char *name)
-{
- if (qstrcmp(name, QMediaPlayerControl_iid) == 0) {
- return m_player;
- } else if (qstrcmp(name, QAudioEndpointSelector_iid) == 0) {
- return m_audioEndpointControl;
- } else if (qstrcmp(name, QMetaDataReaderControl_iid) == 0) {
- return m_metaDataControl;
- } else if (qstrcmp(name, QVideoRendererControl_iid) == 0) {
-#ifndef Q_WS_SIMULATOR
- if (!m_videoRendererControl && !m_videoWindowControl) {
-#else
- if (!m_videoRendererControl) {
-#endif
- m_videoRendererControl = new MFVideoRendererControl;
- return m_videoRendererControl;
- }
-#ifndef Q_WS_SIMULATOR
- } else if (qstrcmp(name, QVideoWindowControl_iid) == 0) {
- if (!m_videoRendererControl && !m_videoWindowControl) {
- m_videoWindowControl = new Evr9VideoWindowControl;
- return m_videoWindowControl;
- }
-#endif
- }
-
- return 0;
-}
-
-void MFPlayerService::releaseControl(QMediaControl *control)
-{
- if (!control) {
- qWarning("QMediaService::releaseControl():"
- " Attempted release of null control");
- } else if (control == m_videoRendererControl) {
- m_videoRendererControl->setSurface(0);
- delete m_videoRendererControl;
- m_videoRendererControl = 0;
-#ifndef Q_WS_SIMULATOR
- } else if (control == m_videoWindowControl) {
- delete m_videoWindowControl;
- m_videoWindowControl = 0;
-#endif
- }
-}
-
-MFAudioEndpointControl* MFPlayerService::audioEndpointControl() const
-{
- return m_audioEndpointControl;
-}
-
-MFVideoRendererControl* MFPlayerService::videoRendererControl() const
-{
- return m_videoRendererControl;
-}
-
-#ifndef Q_WS_SIMULATOR
-Evr9VideoWindowControl* MFPlayerService::videoWindowControl() const
-{
- return m_videoWindowControl;
-}
-#endif
-
-MFMetaDataControl* MFPlayerService::metaDataControl() const
-{
- return m_metaDataControl;
-}
diff --git a/src/plugins/wmf/player/mfplayerservice.h b/src/plugins/wmf/player/mfplayerservice.h
deleted file mode 100644
index 1e8a617..0000000
--- a/src/plugins/wmf/player/mfplayerservice.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFPLAYERSERVICE_H
-#define MFPLAYERSERVICE_H
-
-#include <mfapi.h>
-#include <mfidl.h>
-
-#include "qmediaplayer.h"
-#include "qmediaresource.h"
-#include "qmediaservice.h"
-#include "qmediatimerange.h"
-
-QT_BEGIN_NAMESPACE
-class QMediaContent;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-#ifndef Q_WS_SIMULATOR
-class Evr9VideoWindowControl;
-#endif
-class MFAudioEndpointControl;
-class MFVideoRendererControl;
-class MFPlayerControl;
-class MFMetaDataControl;
-class MFPlayerSession;
-
-class MFPlayerService : public QMediaService
-{
- Q_OBJECT
-public:
- MFPlayerService(QObject *parent = 0);
- ~MFPlayerService();
-
- QMediaControl* requestControl(const char *name);
- void releaseControl(QMediaControl *control);
-
- MFAudioEndpointControl* audioEndpointControl() const;
- MFVideoRendererControl* videoRendererControl() const;
-#ifndef Q_WS_SIMULATOR
- Evr9VideoWindowControl* videoWindowControl() const;
-#endif
- MFMetaDataControl* metaDataControl() const;
-
-private:
- MFPlayerSession *m_session;
- MFVideoRendererControl *m_videoRendererControl;
- MFAudioEndpointControl *m_audioEndpointControl;
-#ifndef Q_WS_SIMULATOR
- Evr9VideoWindowControl *m_videoWindowControl;
-#endif
- MFPlayerControl *m_player;
- MFMetaDataControl *m_metaDataControl;
-};
-
-#endif
diff --git a/src/plugins/wmf/player/mfplayersession.cpp b/src/plugins/wmf/player/mfplayersession.cpp
deleted file mode 100644
index afe91da..0000000
--- a/src/plugins/wmf/player/mfplayersession.cpp
+++ /dev/null
@@ -1,1393 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qmediacontent.h"
-#include "qmediaplayercontrol.h"
-
-#include <QtCore/qcoreapplication.h>
-#include <QtCore/qdatetime.h>
-#include <QtCore/qthread.h>
-#include <QtCore/qvarlengtharray.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/qfile.h>
-#include <QtCore/qbuffer.h>
-
-#include "mfplayercontrol.h"
-#ifndef Q_WS_SIMULATOR
-#include "evr9videowindowcontrol.h"
-#endif
-#include "mfvideorenderercontrol.h"
-#include "mfaudioendpointcontrol.h"
-
-#include "mfplayersession.h"
-#include "mfplayerservice.h"
-#include "mfmetadatacontrol.h"
-#include <Mferror.h>
-#include <nserror.h>
-#include <sourceresolver.h>
-
-//#define DEBUG_MEDIAFOUNDATION
-//#define TEST_STREAMING
-
-namespace
-{
- //MFStream is added for supporting QIODevice type of media source.
- //It is used to delegate invocations from media foundation(through IMFByteStream) to QIODevice.
- class MFStream : public QObject, public IMFByteStream
- {
- Q_OBJECT
- public:
- MFStream(QIODevice *stream, bool ownStream)
- : m_cRef(1)
- , m_stream(stream)
- , m_ownStream(ownStream)
- , m_currentReadResult(0)
- {
- //Move to the thread of the stream object
- //to make sure invocations on stream
- //are happened in the same thread of stream object
- this->moveToThread(stream->thread());
- connect(stream, SIGNAL(readyRead()), this, SLOT(handleReadyRead()));
- }
-
- ~MFStream()
- {
- if (m_currentReadResult)
- m_currentReadResult->Release();
- if (m_ownStream)
- m_stream->deleteLater();
- }
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject)
- {
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFByteStream) {
- *ppvObject = static_cast<IMFByteStream*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release(void)
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0) {
- this->deleteLater();
- }
- return cRef;
- }
-
-
- //from IMFByteStream
- STDMETHODIMP GetCapabilities(DWORD *pdwCapabilities)
- {
- if (!pdwCapabilities)
- return E_INVALIDARG;
- *pdwCapabilities = MFBYTESTREAM_IS_READABLE;
- if (!m_stream->isSequential())
- *pdwCapabilities |= MFBYTESTREAM_IS_SEEKABLE;
- return S_OK;
- }
-
- STDMETHODIMP GetLength(QWORD *pqwLength)
- {
- if (!pqwLength)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pqwLength = QWORD(m_stream->size());
- return S_OK;
- }
-
- STDMETHODIMP SetLength(QWORD)
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP GetCurrentPosition(QWORD *pqwPosition)
- {
- if (!pqwPosition)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pqwPosition = m_stream->pos();
- return S_OK;
- }
-
- STDMETHODIMP SetCurrentPosition(QWORD qwPosition)
- {
- QMutexLocker locker(&m_mutex);
- //SetCurrentPosition may happend during the BeginRead/EndRead pair,
- //refusing to execute SetCurrentPosition during that time seems to be
- //the simplest workable solution
- if (m_currentReadResult)
- return S_FALSE;
-
- bool seekOK = m_stream->seek(qint64(qwPosition));
- if (seekOK)
- return S_OK;
- else
- return S_FALSE;
- }
-
- STDMETHODIMP IsEndOfStream(BOOL *pfEndOfStream)
- {
- if (!pfEndOfStream)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pfEndOfStream = m_stream->atEnd() ? TRUE : FALSE;
- return S_OK;
- }
-
- STDMETHODIMP Read(BYTE *pb, ULONG cb, ULONG *pcbRead)
- {
- QMutexLocker locker(&m_mutex);
- qint64 read = m_stream->read((char*)(pb), qint64(cb));
- if (pcbRead)
- *pcbRead = ULONG(read);
- return S_OK;
- }
-
- STDMETHODIMP BeginRead(BYTE *pb, ULONG cb, IMFAsyncCallback *pCallback,
- IUnknown *punkState)
- {
- if (!pCallback || !pb)
- return E_INVALIDARG;
-
- Q_ASSERT(m_currentReadResult == NULL);
-
- AsyncReadState *state = new (std::nothrow) AsyncReadState(pb, cb);
- if (state == NULL)
- return E_OUTOFMEMORY;
-
- HRESULT hr = MFCreateAsyncResult(state, pCallback, punkState, &m_currentReadResult);
- state->Release();
- if (FAILED(hr))
- return hr;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- return hr;
- }
-
- STDMETHODIMP EndRead(IMFAsyncResult* pResult, ULONG *pcbRead)
- {
- if (!pcbRead)
- return E_INVALIDARG;
- IUnknown *pUnk;
- pResult->GetObject(&pUnk);
- AsyncReadState *state = static_cast<AsyncReadState*>(pUnk);
- *pcbRead = state->bytesRead();
- pUnk->Release();
-
- m_currentReadResult->Release();
- m_currentReadResult = NULL;
-
- return S_OK;
- }
-
- STDMETHODIMP Write(const BYTE *, ULONG, ULONG *)
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP BeginWrite(const BYTE *, ULONG ,
- IMFAsyncCallback *,
- IUnknown *)
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP EndWrite(IMFAsyncResult *,
- ULONG *)
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP Seek(
- MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
- LONGLONG llSeekOffset,
- DWORD,
- QWORD *pqwCurrentPosition)
- {
- QMutexLocker locker(&m_mutex);
- if (m_currentReadResult)
- return S_FALSE;
-
- qint64 pos = qint64(llSeekOffset);
- switch (SeekOrigin) {
- case msoCurrent:
- pos += m_stream->pos();
- break;
- }
- bool seekOK = m_stream->seek(pos);
- if (*pqwCurrentPosition)
- *pqwCurrentPosition = pos;
- if (seekOK)
- return S_OK;
- else
- return S_FALSE;
- }
-
- STDMETHODIMP Flush()
- {
- return E_NOTIMPL;
- }
-
- STDMETHODIMP Close()
- {
- QMutexLocker locker(&m_mutex);
- if (m_ownStream)
- m_stream->close();
- return S_OK;
- }
-
- private:
- //AsyncReadState is a helper class used in BeginRead for asynchronous operation
- //to record some BeginRead parameters, so these parameters could be
- //used later when actually executing the read operation in another thread.
- class AsyncReadState : public IUnknown
- {
- public:
- AsyncReadState(BYTE *pb, ULONG cb)
- : m_cRef(1)
- , m_pb(pb)
- , m_cb(cb)
- , m_cbRead(0)
- {
- }
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject)
- {
- if (!ppvObject)
- return E_POINTER;
-
- if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release(void)
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
- }
-
- BYTE* pb() const { return m_pb; }
- ULONG cb() const { return m_cb; }
- ULONG bytesRead() const { return m_cbRead; }
-
- void setBytesRead(ULONG cbRead) { m_cbRead = cbRead; }
-
- private:
- long m_cRef;
- BYTE *m_pb;
- ULONG m_cb;
- ULONG m_cbRead;
- };
-
- long m_cRef;
- QIODevice *m_stream;
- bool m_ownStream;
- DWORD m_workQueueId;
- QMutex m_mutex;
-
- void doRead()
- {
- bool readDone = true;
- IUnknown *pUnk = NULL;
- HRESULT hr = m_currentReadResult->GetObject(&pUnk);
- if (SUCCEEDED(hr)) {
- //do actual read
- AsyncReadState *state = static_cast<AsyncReadState*>(pUnk);
- ULONG cbRead;
- Read(state->pb(), state->cb() - state->bytesRead(), &cbRead);
- pUnk->Release();
-
- state->setBytesRead(cbRead + state->bytesRead());
- if (state->cb() > state->bytesRead() && !m_stream->atEnd()) {
- readDone = false;
- }
- }
-
- if (readDone) {
- //now inform the original caller
- m_currentReadResult->SetStatus(hr);
- MFInvokeCallback(m_currentReadResult);
- }
- }
-
-
- private Q_SLOTS:
- void handleReadyRead()
- {
- doRead();
- }
-
- protected:
- void customEvent(QEvent *event)
- {
- if (event->type() != QEvent::User) {
- QObject::customEvent(event);
- return;
- }
- doRead();
- }
- IMFAsyncResult *m_currentReadResult;
- };
-}
-
-
-MFPlayerSession::MFPlayerSession(QObject *parent)
- : QObject(parent)
- , m_session(0)
- , m_presentationClock(0)
- , m_rateControl(0)
- , m_rateSupport(0)
- , m_volumeControl(0)
- , m_netsourceStatistics(0)
- , m_hCloseEvent(0)
- , m_pendingRate(1)
- , m_volume(1)
- , m_muted(false)
- , m_status(QMediaPlayer::NoMedia)
- , m_scrubbing(false)
- , m_restoreRate(1)
- , m_mediaTypes(0)
-{
- m_hCloseEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
- m_sourceResolver = new SourceResolver(this);
- QObject::connect(m_sourceResolver, SIGNAL(mediaSourceReady()), this, SLOT(handleMediaSourceReady()));
- QObject::connect(m_sourceResolver, SIGNAL(error(long)), this, SLOT(handleSourceError(long)));
- QObject::connect(this, SIGNAL(sessionEvent(IMFMediaEvent *)), this, SLOT(handleSessionEvent(IMFMediaEvent *)));
-
- m_pendingState = NoPending;
- ZeroMemory(&m_state, sizeof(m_state));
- m_state.command = CmdStop;
- m_state.prevCmd = CmdNone;
- m_state.rate = 1.0f;
- ZeroMemory(&m_request, sizeof(m_request));
- m_request.command = CmdNone;
- m_request.prevCmd = CmdNone;
- m_request.rate = 1.0f;
-
- createSession();
- PropVariantInit(&m_varStart);
- m_varStart.vt = VT_I8;
- m_varStart.uhVal.QuadPart = 0;
-}
-
-MFPlayerSession::~MFPlayerSession()
-{
- m_sourceResolver->Release();
- clear();
- HRESULT hr = S_OK;
- if (m_session) {
- hr = m_session->Close();
- if (SUCCEEDED(hr)) {
- DWORD dwWaitResult = WaitForSingleObject(m_hCloseEvent, 5000);
- if (dwWaitResult == WAIT_TIMEOUT) {
- qWarning() << "session close time out!";
- }
- }
- }
-
- if (SUCCEEDED(hr)) {
- m_sourceResolver->shutdown();
- if (m_session)
- m_session->Shutdown();
- }
-
- if (m_session)
- m_session->Release();
-
- CloseHandle(m_hCloseEvent);
-}
-
-
-void MFPlayerSession::load(const QMediaContent &media, QIODevice *stream)
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "load";
-#endif
- clear();
- QMediaResourceList resources = media.resources();
-
- if (m_status == QMediaPlayer::LoadingMedia)
- m_sourceResolver->cancel();
-
- if (resources.isEmpty() && !stream) {
- changeStatus(QMediaPlayer::NoMedia);
- } else if (stream && (!stream->isReadable())) {
- changeStatus(QMediaPlayer::InvalidMedia);
- emit error(QMediaPlayer::ResourceError, tr("Invalid stream source!"), true);
- } else {
- changeStatus(QMediaPlayer::LoadingMedia);
- m_sourceResolver->load(resources, stream);
- }
- emit positionChanged(position());
-}
-
-void MFPlayerSession::handleSourceError(long hr)
-{
- QString errorString;
- QMediaPlayer::Error errorCode = QMediaPlayer::ResourceError;
- switch (hr) {
- case QMediaPlayer::FormatError:
- errorCode = QMediaPlayer::FormatError;
- errorString = tr("Attempting to play invalid Qt resource");
- break;
- case NS_E_FILE_NOT_FOUND:
- errorString = tr("The system cannot find the file specified.");
- break;
- case NS_E_SERVER_NOT_FOUND:
- errorString = tr("The specified server could not be found.");
- break;
- default:
- errorString = tr("Failed to load source.");
- break;
- }
- changeStatus(QMediaPlayer::InvalidMedia);
- emit error(errorCode, errorString, true);
-}
-
-void MFPlayerSession::handleMediaSourceReady()
-{
- if (QMediaPlayer::LoadingMedia != m_status)
- return;
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "handleMediaSourceReady";
-#endif
- HRESULT hr = S_OK;
- IMFPresentationDescriptor* sourcePD;
- IMFMediaSource* mediaSource = m_sourceResolver->mediaSource();
- hr = mediaSource->CreatePresentationDescriptor(&sourcePD);
- if (SUCCEEDED(hr)) {
- m_duration = 0;
- static_cast<MFPlayerService*>(this->parent())->metaDataControl()->updateSource(sourcePD, mediaSource);
- sourcePD->GetUINT64(MF_PD_DURATION, &m_duration);
- //convert from 100 nanosecond to milisecond
- emit durationUpdate(qint64(m_duration / 10000));
- setupPlaybackTopology(mediaSource, sourcePD);
- } else {
- changeStatus(QMediaPlayer::InvalidMedia);
- emit error(QMediaPlayer::ResourceError, tr("Can't create presentation descriptor!"), true);
- }
-}
-
-void MFPlayerSession::setupPlaybackTopology(IMFMediaSource *source, IMFPresentationDescriptor *sourcePD)
-{
- HRESULT hr = S_OK;
- // Get the number of streams in the media source.
- DWORD cSourceStreams = 0;
- hr = sourcePD->GetStreamDescriptorCount(&cSourceStreams);
- if (FAILED(hr)) {
- changeStatus(QMediaPlayer::UnknownMediaStatus);
- emit error(QMediaPlayer::ResourceError, tr("Failed to get stream count"), true);
- return;
- }
-
- IMFTopology *topology;
- hr = MFCreateTopology(&topology);
- if (FAILED(hr)) {
- changeStatus(QMediaPlayer::UnknownMediaStatus);
- emit error(QMediaPlayer::ResourceError, tr("Failed to create topology!"), true);
- return;
- }
-
- // For each stream, create the topology nodes and add them to the topology.
- DWORD succeededCount = 0;
- for (DWORD i = 0; i < cSourceStreams; i++)
- {
- BOOL fSelected = FALSE;
- IMFStreamDescriptor *streamDesc = NULL;
-
- HRESULT hr = sourcePD->GetStreamDescriptorByIndex(i, &fSelected, &streamDesc);
- if (SUCCEEDED(hr)) {
- MediaType mediaType = Unknown;
- IMFTopologyNode *sourceNode = addSourceNode(topology, source, sourcePD, streamDesc);
- if (sourceNode) {
- IMFTopologyNode *outputNode = addOutputNode(streamDesc, mediaType, topology, 0);
- if (outputNode) {
- hr = sourceNode->ConnectOutput(0, outputNode, 0);
- if (FAILED(hr)) {
- emit error(QMediaPlayer::FormatError, tr("Unable to play some stream"), false);
- }
- else {
- succeededCount++;
- m_mediaTypes |= mediaType;
- switch (mediaType) {
- case Audio:
- emit audioAvailable();
- break;
- case Video:
- emit videoAvailable();
- break;
- }
- }
- }
- sourceNode->Release();
- }
- streamDesc->Release();
- }
- }
-
- if (succeededCount == 0) {
- changeStatus(QMediaPlayer::InvalidMedia);
- emit error(QMediaPlayer::ResourceError, tr("Unable to play"), true);
- } else {
- hr = m_session->SetTopology(MFSESSION_SETTOPOLOGY_IMMEDIATE, topology);
- if (FAILED(hr)) {
- changeStatus(QMediaPlayer::UnknownMediaStatus);
- emit error(QMediaPlayer::ResourceError, tr("Failed to set topology!"), true);
- }
- }
- topology->Release();
-}
-
-IMFTopologyNode* MFPlayerSession::addSourceNode(IMFTopology* topology, IMFMediaSource* source,
- IMFPresentationDescriptor* presentationDesc, IMFStreamDescriptor *streamDesc)
-{
- IMFTopologyNode *node = NULL;
- HRESULT hr = MFCreateTopologyNode(MF_TOPOLOGY_SOURCESTREAM_NODE, &node);
- if (SUCCEEDED(hr)) {
- hr = node->SetUnknown(MF_TOPONODE_SOURCE, source);
- if (SUCCEEDED(hr)) {
- hr = node->SetUnknown(MF_TOPONODE_PRESENTATION_DESCRIPTOR, presentationDesc);
- if (SUCCEEDED(hr)) {
- hr = node->SetUnknown(MF_TOPONODE_STREAM_DESCRIPTOR, streamDesc);
- if (SUCCEEDED(hr)) {
- hr = topology->AddNode(node);
- if (SUCCEEDED(hr))
- return node;
- }
- }
- }
- node->Release();
- }
- return NULL;
-}
-
-IMFTopologyNode* MFPlayerSession::addOutputNode(IMFStreamDescriptor *streamDesc, MediaType& mediaType, IMFTopology* topology, DWORD sinkID)
-{
- IMFTopologyNode *node = NULL;
- HRESULT hr = MFCreateTopologyNode(MF_TOPOLOGY_OUTPUT_NODE, &node);
- if (FAILED(hr))
- return NULL;
- node->SetUINT32(MF_TOPONODE_NOSHUTDOWN_ON_REMOVE, FALSE);
-
- mediaType = Unknown;
- IMFMediaTypeHandler *handler = NULL;
- hr = streamDesc->GetMediaTypeHandler(&handler);
- if (SUCCEEDED(hr)) {
- GUID guidMajorType;
- hr = handler->GetMajorType(&guidMajorType);
- if (SUCCEEDED(hr)) {
- IMFActivate *activate = NULL;
- MFPlayerService *service = static_cast<MFPlayerService*>(this->parent());
- if (MFMediaType_Audio == guidMajorType) {
- mediaType = Audio;
- activate = service->audioEndpointControl()->currentActivate();
- } else if (MFMediaType_Video == guidMajorType) {
- mediaType = Video;
- if (service->videoRendererControl()) {
- activate = service->videoRendererControl()->currentActivate();
-#ifndef Q_WS_SIMULATOR
- } else if (service->videoWindowControl()) {
- activate = service->videoWindowControl()->currentActivate();
-#endif
- } else {
- qWarning() << "no videoWindowControl or videoRendererControl, unable to add output node for video data";
- }
- } else {
- // Unknown stream type.
- emit error(QMediaPlayer::FormatError, tr("Unknown stream type"), false);
- }
-
- if (activate) {
- hr = node->SetObject(activate);
- if (SUCCEEDED(hr)) {
- hr = node->SetUINT32(MF_TOPONODE_STREAMID, sinkID);
- if (SUCCEEDED(hr)) {
- if (SUCCEEDED(topology->AddNode(node)))
- return node;
- }
- }
- }
- }
- }
- node->Release();
- return NULL;
-}
-
-void MFPlayerSession::stop(bool immediate)
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "stop";
-#endif
- if (!immediate && m_pendingState != NoPending) {
- m_request.setCommand(CmdStop);
- } else {
- if (m_state.command == CmdStop)
- return;
-
- if (m_scrubbing)
- scrub(false);
-
- if (SUCCEEDED(m_session->Stop())) {
- m_state.setCommand(CmdStop);
- m_pendingState = CmdPending;
- if (m_status != QMediaPlayer::EndOfMedia) {
- m_varStart.vt = VT_I8;
- m_varStart.hVal.QuadPart = 0;
- }
- } else {
- emit error(QMediaPlayer::ResourceError, tr("failed to stop"), true);
- }
- }
-}
-
-void MFPlayerSession::start()
-{
- switch (m_status) {
- case QMediaPlayer::EndOfMedia:
- m_varStart.hVal.QuadPart = 0;
- //since it must be loaded already, just fallthrough
- case QMediaPlayer::LoadedMedia:
- changeStatus(QMediaPlayer::BufferedMedia);
- return;
- }
-
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "start";
-#endif
-
- if (m_pendingState != NoPending) {
- m_request.setCommand(CmdStart);
- } else {
- if (m_state.command == CmdStart)
- return;
-
- if (m_scrubbing)
- scrub(false);
-
- if (SUCCEEDED(m_session->Start(&GUID_NULL, &m_varStart))) {
- m_state.setCommand(CmdStart);
- m_pendingState = CmdPending;
- PropVariantInit(&m_varStart);
- } else {
- emit error(QMediaPlayer::ResourceError, tr("failed to start playback"), true);
- }
- }
-}
-
-void MFPlayerSession::pause()
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "pause";
-#endif
- if (m_pendingState != NoPending) {
- m_request.setCommand(CmdPause);
- } else {
- if (m_state.command == CmdPause)
- return;
- if (SUCCEEDED(m_session->Pause())) {
- m_state.setCommand(CmdPause);
- m_pendingState = CmdPending;
- } else {
- emit error(QMediaPlayer::ResourceError, tr("failed to pause"), false);
- }
- }
-}
-
-void MFPlayerSession::changeStatus(QMediaPlayer::MediaStatus newStatus)
-{
- if (m_status == newStatus)
- return;
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MFPlayerSession::changeStatus" << newStatus;
-#endif
- m_status = newStatus;
- emit statusChanged();
-}
-
-QMediaPlayer::MediaStatus MFPlayerSession::status() const
-{
- return m_status;
-}
-
-void MFPlayerSession::createSession()
-{
- Q_ASSERT(m_session == NULL);
- HRESULT hr = MFCreateMediaSession(NULL, &m_session);
- if (FAILED(hr)) {
- changeStatus(QMediaPlayer::UnknownMediaStatus);
- emit error(QMediaPlayer::ResourceError, tr("Unable to create mediasession"), true);
- }
-
- hr = m_session->BeginGetEvent(this, m_session);
-
- if (FAILED(hr)) {
- changeStatus(QMediaPlayer::UnknownMediaStatus);
- emit error(QMediaPlayer::ResourceError, tr("Unable to pulling session events"), false);
- }
-}
-
-qint64 MFPlayerSession::position()
-{
- if (m_request.command == CmdSeek || m_request.command == CmdSeekResume)
- return m_request.start;
-
- if (m_pendingState == SeekPending)
- return m_state.start;
-
- if (m_state.command == CmdStop)
- return qint64(m_varStart.hVal.QuadPart / 10000);
-
- if (m_presentationClock) {
- MFTIME time, sysTime;
- if (FAILED(m_presentationClock->GetCorrelatedTime(0, &time, &sysTime)))
- return 0;
- return qint64(time / 10000);
- }
- return 0;
-}
-
-void MFPlayerSession::setPosition(qint64 position)
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "setPosition";
-#endif
- if (m_pendingState != NoPending) {
- m_request.setCommand(CmdSeek);
- m_request.start = position;
- } else {
- setPositionInternal(position, CmdNone);
- }
-}
-
-void MFPlayerSession::setPositionInternal(qint64 position, Command requestCmd)
-{
- if (m_status == QMediaPlayer::EndOfMedia)
- changeStatus(QMediaPlayer::LoadedMedia);
- if (m_state.command == CmdStop && requestCmd != CmdSeekResume) {
- m_varStart.vt = VT_I8;
- m_varStart.hVal.QuadPart = LONGLONG(position * 10000);
- return;
- }
-
- if (m_state.command == CmdPause)
- scrub(true);
-
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "setPositionInternal";
-#endif
-
- PROPVARIANT varStart;
- varStart.vt = VT_I8;
- varStart.hVal.QuadPart = LONGLONG(position * 10000);
- if (SUCCEEDED(m_session->Start(NULL, &varStart)))
- {
- PropVariantInit(&m_varStart);
- // Store the pending state.
- m_state.setCommand(CmdStart);
- m_state.start = position;
- m_pendingState = SeekPending;
- } else {
- emit error(QMediaPlayer::ResourceError, tr("failed to seek"), true);
- }
-}
-
-qreal MFPlayerSession::playbackRate() const
-{
- if (m_pendingState != NoPending)
- return m_request.rate;
- return m_state.rate;
-}
-
-void MFPlayerSession::setPlaybackRate(qreal rate)
-{
- if (m_scrubbing) {
- m_restoreRate = rate;
- return;
- }
- setPlaybackRateInternal(rate);
-}
-
-void MFPlayerSession::setPlaybackRateInternal(qreal rate)
-{
- if (rate == m_request.rate)
- return;
-
- m_pendingRate = rate;
- if (!m_rateSupport)
- return;
-
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "setPlaybackRate";
-#endif
- BOOL isThin = FALSE;
-
- //from MSDN http://msdn.microsoft.com/en-us/library/aa965220%28v=vs.85%29.aspx
- //Thinning applies primarily to video streams.
- //In thinned mode, the source drops delta frames and deliver only key frames.
- //At very high playback rates, the source might skip some key frames (for example, deliver every other key frame).
-
- if (FAILED(m_rateSupport->IsRateSupported(FALSE, rate, NULL))) {
- isThin = TRUE;
- if (FAILED(m_rateSupport->IsRateSupported(isThin, rate, NULL))) {
- qWarning() << "unable to set playbackrate = " << rate;
- }
- }
- if (m_pendingState != NoPending) {
- m_request.rate = rate;
- m_request.isThin = isThin;
- // Remember the current transport state (play, paused, etc), so that we
- // can restore it after the rate change, if necessary. However, if
- // anothercommand is already pending, that one takes precedent.
- if (m_request.command == CmdNone)
- m_request.setCommand(m_state.command);
- } else {
- //No pending operation. Commit the new rate.
- commitRateChange(rate, isThin);
- }
-}
-
-void MFPlayerSession::commitRateChange(qreal rate, BOOL isThin)
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "commitRateChange";
-#endif
- Q_ASSERT(m_pendingState == NoPending);
- MFTIME hnsSystemTime = 0;
- MFTIME hnsClockTime = 0;
- Command cmdNow = m_state.command;
- // Allowed rate transitions:
- // Positive <-> negative: Stopped
- // Negative <-> zero: Stopped
- // Postive <-> zero: Paused or stopped
- if ((rate > 0 && m_state.rate <= 0) || (rate < 0 && m_state.rate >= 0)) {
- // Transition to stopped.
- if (cmdNow == CmdStart) {
- // Get the current clock position. This will be the restart time.
- m_presentationClock->GetCorrelatedTime(0, &hnsClockTime, &hnsSystemTime);
- Q_ASSERT(hnsSystemTime != 0);
-
- // Stop and set the rate
- stop();
-
- //Cache Request: Restart from stop.
- m_request.setCommand(CmdSeekResume);
- m_request.start = hnsClockTime / 10000;
- } else if (cmdNow == CmdPause) {
- // The current state is paused.
- // For this rate change, the session must be stopped. However, the
- // session cannot transition back from stopped to paused.
- // Therefore, this rate transition is not supported while paused.
- if (rate < 0 || m_state.rate < 0) {
- qWarning() << "Unable to change rate from positive to negative or vice versa in paused state";
- return;
- }
- }
- } else if (rate == 0 && m_state.rate != 0) {
- if (cmdNow != CmdPause) {
- // Transition to paused.
- // This transisition requires the paused state.
- // Pause and set the rate.
- pause();
-
- // Request: Switch back to current state.
- m_request.setCommand(cmdNow);
- }
- }
-
- // Set the rate.
- if (FAILED(m_rateControl->SetRate(isThin, rate))) {
- qWarning() << "failed to set playbackrate = " << rate;
- return;
- }
-
- // Adjust our current rate and requested rate.
- m_pendingRate = m_request.rate = m_state.rate = rate;
-
-}
-
-void MFPlayerSession::scrub(bool enableScrub)
-{
- if (m_scrubbing == enableScrub)
- return;
-
- m_scrubbing = enableScrub;
-
- if (!canScrub()) {
- if (!enableScrub)
- m_pendingRate = m_restoreRate;
- return;
- }
-
- if (enableScrub) {
- // Enter scrubbing mode. Cache the rate.
- m_restoreRate = m_request.rate;
- setPlaybackRateInternal(0.0f);
- } else {
- // Leaving scrubbing mode. Restore the old rate.
- setPlaybackRateInternal(m_restoreRate);
- }
-}
-
-int MFPlayerSession::volume() const
-{
- return m_volume;
-}
-
-void MFPlayerSession::setVolume(int volume)
-{
- if (m_volume == volume)
- return;
- m_volume = volume;
- if (m_volumeControl)
- m_volumeControl->SetMasterVolume(m_volume * 0.01f);
- emit volumeChanged(m_volume);
-}
-
-bool MFPlayerSession::isMuted() const
-{
- return m_muted;
-}
-
-void MFPlayerSession::setMuted(bool muted)
-{
- if (m_muted == muted)
- return;
- m_muted = muted;
- if (m_volumeControl)
- m_volumeControl->SetMute(BOOL(m_muted));
- emit mutedChanged(m_muted);
-}
-
-int MFPlayerSession::bufferStatus()
-{
- if (!m_netsourceStatistics)
- return 0;
- PROPVARIANT var;
- PROPERTYKEY key;
- key.fmtid = MFNETSOURCE_STATISTICS;
- key.pid = MFNETSOURCE_BUFFERPROGRESS_ID;
- int progress = -1;
- if (SUCCEEDED(m_netsourceStatistics->GetValue(key, &var))) {
- progress = var.lVal;
- }
- PropVariantClear(&var);
-
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "bufferStatus: progress = " << progress;
-#endif
-
- return progress;
-}
-
-QMediaTimeRange MFPlayerSession::availablePlaybackRanges()
-{
- if (!m_netsourceStatistics)
- return QMediaTimeRange();
-
- qint64 start = 0, end = 0;
- PROPVARIANT var;
- PROPERTYKEY key;
- key.fmtid = MFNETSOURCE_STATISTICS;
- key.pid = MFNETSOURCE_SEEKRANGESTART_ID;
- if (SUCCEEDED(m_netsourceStatistics->GetValue(key, &var))) {
- start = qint64(var.uhVal.QuadPart / 10000);
- key.pid = MFNETSOURCE_SEEKRANGEEND_ID;
- if (SUCCEEDED(m_netsourceStatistics->GetValue(key, &var))) {
- end = qint64(var.uhVal.QuadPart / 10000);
- }
- }
- PropVariantClear(&var);
- return QMediaTimeRange(start, end);
-}
-
-HRESULT MFPlayerSession::QueryInterface(REFIID riid, void** ppvObject)
-{
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFAsyncCallback) {
- *ppvObject = static_cast<IMFAsyncCallback*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- return S_OK;
-}
-
-ULONG MFPlayerSession::AddRef(void)
-{
- return 1;
-}
-
-ULONG MFPlayerSession::Release(void)
-{
- return 1;
-}
-
-HRESULT MFPlayerSession::Invoke(IMFAsyncResult *pResult)
-{
- if (pResult->GetStateNoAddRef() != m_session)
- return S_OK;
-
- IMFMediaEvent *pEvent = NULL;
- // Get the event from the event queue.
- HRESULT hr = m_session->EndGetEvent(pResult, &pEvent);
- if (FAILED(hr)) {
- return S_OK;
- }
-
- MediaEventType meType = MEUnknown;
- hr = pEvent->GetType(&meType);
- if (FAILED(hr)) {
- pEvent->Release();
- return S_OK;
- }
-
- if (meType == MESessionClosed) {
- SetEvent(m_hCloseEvent);
- return S_OK;
- } else {
- hr = m_session->BeginGetEvent(this, m_session);
- if (FAILED(hr)) {
- pEvent->Release();
- return S_OK;
- }
- }
-
- emit sessionEvent(pEvent);
- return S_OK;
-}
-
-void MFPlayerSession::handleSessionEvent(IMFMediaEvent *sessionEvent)
-{
- HRESULT hrStatus = S_OK;
- HRESULT hr = sessionEvent->GetStatus(&hrStatus);
- if (FAILED(hr)) {
- sessionEvent->Release();
- return;
- }
-
- MediaEventType meType = MEUnknown;
- hr = sessionEvent->GetType(&meType);
-
-#ifdef DEBUG_MEDIAFOUNDATION
- if (FAILED(hrStatus))
- qDebug() << "handleSessionEvent: MediaEventType = " << meType << "Failed";
- else
- qDebug() << "handleSessionEvent: MediaEventType = " << meType;
-#endif
-
- switch (meType) {
- case MENonFatalError: {
- PROPVARIANT var;
- PropVariantInit(&var);
- sessionEvent->GetValue(&var);
- qWarning() << "handleSessionEvent: non fatal error = " << var.ulVal;
- PropVariantClear(&var);
- emit error(QMediaPlayer::ResourceError, tr("media session non-fatal error!"), false);
- }
- break;
- case MESourceUnknown:
- changeStatus(QMediaPlayer::InvalidMedia);
- case MEError:
- qWarning() << "handleSessionEvent: serious error = " << hrStatus;
- emit error(QMediaPlayer::ResourceError, tr("media session serious error!"), true);
- break;
- case MESessionRateChanged:
- // If the rate change succeeded, we've already got the rate
- // cached. If it failed, try to get the actual rate.
- if (FAILED(hrStatus)) {
- PROPVARIANT var;
- PropVariantInit(&var);
- if (SUCCEEDED(sessionEvent->GetValue(&var)) && (var.vt == VT_R4)) {
- m_state.rate = var.fltVal;
- }
- emit playbackRateChanged(playbackRate());
- }
- break;
- case MESessionScrubSampleComplete :
- if (m_scrubbing)
- updatePendingCommands(CmdStart);
- break;
- case MESessionStarted:
- if (!m_scrubbing)
- updatePendingCommands(CmdStart);
- break;
- case MESessionStopped:
- if (m_status != QMediaPlayer::EndOfMedia) {
- m_varStart.vt = VT_I8;
- m_varStart.hVal.QuadPart = 0;
-
- //only change to loadedMedia when not loading a new media source
- if (m_status != QMediaPlayer::LoadingMedia) {
- changeStatus(QMediaPlayer::LoadedMedia);
- }
- }
- updatePendingCommands(CmdStop);
- break;
- case MESessionPaused:
- updatePendingCommands(CmdPause);
- break;
- case MEReconnectStart:
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MEReconnectStart" << ((hrStatus == S_OK) ? "OK" : "Failed");
-#endif
- break;
- case MEReconnectEnd:
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MEReconnectEnd" << ((hrStatus == S_OK) ? "OK" : "Failed");
-#endif
- break;
- }
-
- if (FAILED(hrStatus)) {
- sessionEvent->Release();
- return;
- }
-
- switch (meType) {
- case MEBufferingStarted:
- changeStatus(QMediaPlayer::StalledMedia);
- emit bufferStatusChanged(bufferStatus());
- break;
- case MEBufferingStopped:
- changeStatus(QMediaPlayer::BufferedMedia);
- emit bufferStatusChanged(bufferStatus());
- break;
- case MEEndOfPresentation:
- stop();
- changeStatus(QMediaPlayer::EndOfMedia);
- m_varStart.vt = VT_I8;
- //keep reporting the final position after end of media
- m_varStart.hVal.QuadPart = m_duration;
- break;
- case MESessionEnded:
- m_pendingState = NoPending;
- m_state.command = CmdStop;
- m_state.prevCmd = CmdNone;
- m_request.command = CmdNone;
- m_request.prevCmd = CmdNone;
- break;
- case MEEndOfPresentationSegment:
- break;
- case MEAudioSessionVolumeChanged:
- if (m_volumeControl) {
- float currentVolume = 1;
- if (SUCCEEDED(m_volumeControl->GetMasterVolume(&currentVolume))) {
- if (currentVolume != m_volume) {
- m_volume = currentVolume;
- emit volumeChanged(int(m_volume * 100));
- }
- }
- BOOL currentMuted = FALSE;
- if (SUCCEEDED(m_volumeControl->GetMute(&currentMuted))) {
- if (currentMuted != BOOL(m_muted)) {
- m_muted = bool(currentMuted);
- emit mutedChanged(m_muted);
- }
- }
- }
- break;
- case MESessionTopologySet: {
- if (SUCCEEDED(MFGetService(m_session, MR_POLICY_VOLUME_SERVICE, IID_PPV_ARGS(&m_volumeControl)))) {
- m_volumeControl->SetMasterVolume(m_volume);
- m_volumeControl->SetMute(m_muted);
- }
- DWORD dwCharacteristics = 0;
- m_sourceResolver->mediaSource()->GetCharacteristics(&dwCharacteristics);
- emit seekableUpdate(MFMEDIASOURCE_CAN_SEEK & dwCharacteristics);
- changeStatus(QMediaPlayer::LoadedMedia);
- }
- break;
- case MESessionTopologyStatus: {
- UINT32 status;
- if (SUCCEEDED(sessionEvent->GetUINT32(MF_EVENT_TOPOLOGY_STATUS, &status))) {
- if (status == MF_TOPOSTATUS_READY) {
- IMFClock* clock;
- if (SUCCEEDED(m_session->GetClock(&clock))) {
- clock->QueryInterface(IID_IMFPresentationClock, (void**)(&m_presentationClock));
- clock->Release();
- }
-
- if (SUCCEEDED(MFGetService(m_session, MF_RATE_CONTROL_SERVICE, IID_PPV_ARGS(&m_rateControl)))) {
- if (SUCCEEDED(MFGetService(m_session, MF_RATE_CONTROL_SERVICE, IID_PPV_ARGS(&m_rateSupport)))) {
- if ((m_mediaTypes & Video) == Video
- && SUCCEEDED(m_rateSupport->IsRateSupported(TRUE, 0, NULL)))
- m_canScrub = true;
- }
- BOOL isThin = FALSE;
- float rate = 1;
- if (SUCCEEDED(m_rateControl->GetRate(&isThin, &rate))) {
- if (m_pendingRate != rate) {
- m_state.rate = m_request.rate = rate;
- setPlaybackRate(m_pendingRate);
- }
- }
- }
- MFGetService(m_session, MFNETSOURCE_STATISTICS_SERVICE, IID_PPV_ARGS(&m_netsourceStatistics));
- }
- }
- }
- break;
- }
-
- sessionEvent->Release();
-}
-
-void MFPlayerSession::updatePendingCommands(Command command)
-{
- emit positionChanged(position());
- if (m_state.command != command || m_pendingState == NoPending)
- return;
-
- // The current pending command has completed.
- if (m_pendingState == SeekPending && m_state.prevCmd == CmdPause) {
- m_pendingState = NoPending;
- //if we have pending seek request,
- //then we just keep current state to paused and continue the seek request,
- //otherwise we will restore to pause state
- if (m_request.command == CmdSeek) {
- m_state.setCommand(CmdPause);
- } else {
- pause();
- return;
- }
- }
-
- m_pendingState = NoPending;
-
- //First look for rate changes.
- if (m_request.rate != m_state.rate) {
- commitRateChange(m_request.rate, m_request.isThin);
- }
-
- // Now look for new requests.
- if (m_pendingState == NoPending) {
- switch (m_request.command) {
- case CmdStart:
- start();
- break;
- case CmdPause:
- pause();
- break;
- case CmdStop:
- stop();
- break;
- case CmdSeek:
- case CmdSeekResume:
- setPositionInternal(m_request.start, m_request.command);
- }
- m_request.setCommand(CmdNone);
- }
-
-}
-
-bool MFPlayerSession::canScrub() const
-{
- return m_canScrub && m_rateSupport && m_rateControl;
-}
-
-void MFPlayerSession::clear()
-{
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MFPlayerSession::clear";
-#endif
- m_mediaTypes = 0;
- m_canScrub = false;
-
- m_pendingState = NoPending;
- m_state.command = CmdStop;
- m_state.prevCmd = CmdNone;
- m_request.command = CmdNone;
- m_request.prevCmd = CmdNone;
-
- if (m_presentationClock) {
- m_presentationClock->Release();
- m_presentationClock = NULL;
- }
- if (m_rateControl) {
- m_rateControl->Release();
- m_rateControl = NULL;
- }
- if (m_rateSupport) {
- m_rateSupport->Release();
- m_rateSupport = NULL;
- }
- if (m_volumeControl) {
- m_volumeControl->Release();
- m_volumeControl = NULL;
- }
- if (m_netsourceStatistics) {
- m_netsourceStatistics->Release();
- m_netsourceStatistics = NULL;
- }
-}
diff --git a/src/plugins/wmf/player/mfplayersession.h b/src/plugins/wmf/player/mfplayersession.h
deleted file mode 100644
index 169a404..0000000
--- a/src/plugins/wmf/player/mfplayersession.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFPLAYERSESSION_H
-#define MFPLAYERSESSION_H
-
-#include <mfapi.h>
-#include <mfidl.h>
-
-#include "qmediaplayer.h"
-#include "qmediaresource.h"
-#include "qmediaservice.h"
-#include "qmediatimerange.h"
-
-#include <QtCore/qcoreevent.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qurl.h>
-#include <QtCore/qwaitcondition.h>
-
-QT_BEGIN_NAMESPACE
-class QMediaContent;
-QT_END_NAMESPACE
-
-QT_USE_NAMESPACE
-
-class SourceResolver;
-#ifndef Q_WS_SIMULATOR
-class Evr9VideoWindowControl;
-#endif
-class MFAudioEndpointControl;
-class MFVideoRendererControl;
-class MFPlayerControl;
-class MFMetaDataControl;
-
-class MFPlayerSession : public QObject, public IMFAsyncCallback
-{
- Q_OBJECT
- friend class SourceResolver;
-public:
- MFPlayerSession(QObject *parent = 0);
- ~MFPlayerSession();
-
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
-
- STDMETHODIMP_(ULONG) AddRef(void);
-
- STDMETHODIMP_(ULONG) Release(void);
-
- STDMETHODIMP Invoke(IMFAsyncResult *pResult);
-
- STDMETHODIMP GetParameters(DWORD *pdwFlags, DWORD *pdwQueue)
- {
- Q_UNUSED(pdwFlags);
- Q_UNUSED(pdwQueue);
- return E_NOTIMPL;
- }
-
- void load(const QMediaContent &media, QIODevice *stream);
- void stop(bool immediate = false);
- void start();
- void pause();
-
- QMediaPlayer::MediaStatus status() const;
- qint64 position();
- void setPosition(qint64 position);
- qreal playbackRate() const;
- void setPlaybackRate(qreal rate);
- int volume() const;
- void setVolume(int volume);
- bool isMuted() const;
- void setMuted(bool muted);
- int bufferStatus();
- QMediaTimeRange availablePlaybackRanges();
-
- void changeStatus(QMediaPlayer::MediaStatus newStatus);
-
-Q_SIGNALS:
- void error(QMediaPlayer::Error error, QString errorString, bool isFatal);
- void sessionEvent(IMFMediaEvent *sessionEvent);
- void statusChanged();
- void audioAvailable();
- void videoAvailable();
- void durationUpdate(qint64 duration);
- void seekableUpdate(bool seekable);
- void positionChanged(qint64 position);
- void playbackRateChanged(qreal rate);
- void volumeChanged(int volume);
- void mutedChanged(bool muted);
- void bufferStatusChanged(int percentFilled);
-
-private Q_SLOTS:
- void handleMediaSourceReady();
- void handleSessionEvent(IMFMediaEvent *sessionEvent);
- void handleSourceError(long hr);
-
-private:
- IMFMediaSession *m_session;
- IMFPresentationClock *m_presentationClock;
- IMFRateControl *m_rateControl;
- IMFRateSupport *m_rateSupport;
- IMFSimpleAudioVolume *m_volumeControl;
- IPropertyStore *m_netsourceStatistics;
- PROPVARIANT m_varStart;
- UINT64 m_duration;
-
- enum Command
- {
- CmdNone = 0,
- CmdStop,
- CmdStart,
- CmdPause,
- CmdSeek,
- CmdSeekResume,
- };
-
- void clear();
- void setPositionInternal(qint64 position, Command requestCmd);
- void setPlaybackRateInternal(qreal rate);
- void commitRateChange(qreal rate, BOOL isThin);
- bool canScrub() const;
- void scrub(bool enableScrub);
- bool m_scrubbing;
- float m_restoreRate;
-
- SourceResolver *m_sourceResolver;
- HANDLE m_hCloseEvent;
-
- enum MediaType
- {
- Unknown = 0,
- Audio = 1,
- Video = 2,
- };
- DWORD m_mediaTypes;
-
- enum PendingState
- {
- NoPending = 0,
- CmdPending,
- SeekPending,
- };
-
- struct SeekState
- {
- void setCommand(Command cmd) {
- prevCmd = command;
- command = cmd;
- }
- Command command;
- Command prevCmd;
- float rate; // Playback rate
- BOOL isThin; // Thinned playback?
- qint64 start; // Start position
- };
- SeekState m_state; // Current nominal state.
- SeekState m_request; // Pending request.
- PendingState m_pendingState;
- float m_pendingRate;
- void updatePendingCommands(Command command);
-
- QMediaPlayer::MediaStatus m_status;
- bool m_canScrub;
- int m_volume;
- bool m_muted;
-
- void createSession();
- void setupPlaybackTopology(IMFMediaSource *source, IMFPresentationDescriptor *sourcePD);
- IMFTopologyNode* addSourceNode(IMFTopology* topology, IMFMediaSource* source,
- IMFPresentationDescriptor* presentationDesc, IMFStreamDescriptor *streamDesc);
- IMFTopologyNode* addOutputNode(IMFStreamDescriptor *streamDesc, MediaType& mediaType, IMFTopology* topology, DWORD sinkID);
-};
-
-
-#endif
diff --git a/src/plugins/wmf/player/mfstream.cpp b/src/plugins/wmf/player/mfstream.cpp
deleted file mode 100644
index be91175..0000000
--- a/src/plugins/wmf/player/mfstream.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mfstream.h"
-#include <QtCore/qcoreapplication.h>
-
-//MFStream is added for supporting QIODevice type of media source.
-//It is used to delegate invocations from media foundation(through IMFByteStream) to QIODevice.
-
-MFStream::MFStream(QIODevice *stream, bool ownStream)
- : m_cRef(1)
- , m_stream(stream)
- , m_ownStream(ownStream)
- , m_currentReadResult(0)
-{
- //Move to the thread of the stream object
- //to make sure invocations on stream
- //are happened in the same thread of stream object
- this->moveToThread(stream->thread());
- connect(stream, SIGNAL(readyRead()), this, SLOT(handleReadyRead()));
-}
-
-MFStream::~MFStream()
-{
- if (m_currentReadResult)
- m_currentReadResult->Release();
- if (m_ownStream)
- m_stream->deleteLater();
-}
-
-//from IUnknown
-STDMETHODIMP MFStream::QueryInterface(REFIID riid, LPVOID *ppvObject)
-{
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFByteStream) {
- *ppvObject = static_cast<IMFByteStream*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
-}
-
-STDMETHODIMP_(ULONG) MFStream::AddRef(void)
-{
- return InterlockedIncrement(&m_cRef);
-}
-
-STDMETHODIMP_(ULONG) MFStream::Release(void)
-{
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0) {
- this->deleteLater();
- }
- return cRef;
-}
-
-
-//from IMFByteStream
-STDMETHODIMP MFStream::GetCapabilities(DWORD *pdwCapabilities)
-{
- if (!pdwCapabilities)
- return E_INVALIDARG;
- *pdwCapabilities = MFBYTESTREAM_IS_READABLE;
- if (!m_stream->isSequential())
- *pdwCapabilities |= MFBYTESTREAM_IS_SEEKABLE;
- return S_OK;
-}
-
-STDMETHODIMP MFStream::GetLength(QWORD *pqwLength)
-{
- if (!pqwLength)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pqwLength = QWORD(m_stream->size());
- return S_OK;
-}
-
-STDMETHODIMP MFStream::SetLength(QWORD)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP MFStream::GetCurrentPosition(QWORD *pqwPosition)
-{
- if (!pqwPosition)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pqwPosition = m_stream->pos();
- return S_OK;
-}
-
-STDMETHODIMP MFStream::SetCurrentPosition(QWORD qwPosition)
-{
- QMutexLocker locker(&m_mutex);
- //SetCurrentPosition may happend during the BeginRead/EndRead pair,
- //refusing to execute SetCurrentPosition during that time seems to be
- //the simplest workable solution
- if (m_currentReadResult)
- return S_FALSE;
-
- bool seekOK = m_stream->seek(qint64(qwPosition));
- if (seekOK)
- return S_OK;
- else
- return S_FALSE;
-}
-
-STDMETHODIMP MFStream::IsEndOfStream(BOOL *pfEndOfStream)
-{
- if (!pfEndOfStream)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pfEndOfStream = m_stream->atEnd() ? TRUE : FALSE;
- return S_OK;
-}
-
-STDMETHODIMP MFStream::Read(BYTE *pb, ULONG cb, ULONG *pcbRead)
-{
- QMutexLocker locker(&m_mutex);
- qint64 read = m_stream->read((char*)(pb), qint64(cb));
- if (pcbRead)
- *pcbRead = ULONG(read);
- return S_OK;
-}
-
-STDMETHODIMP MFStream::BeginRead(BYTE *pb, ULONG cb, IMFAsyncCallback *pCallback,
- IUnknown *punkState)
-{
- if (!pCallback || !pb)
- return E_INVALIDARG;
-
- Q_ASSERT(m_currentReadResult == NULL);
-
- AsyncReadState *state = new (std::nothrow) AsyncReadState(pb, cb);
- if (state == NULL)
- return E_OUTOFMEMORY;
-
- HRESULT hr = MFCreateAsyncResult(state, pCallback, punkState, &m_currentReadResult);
- state->Release();
- if (FAILED(hr))
- return hr;
-
- QCoreApplication::postEvent(this, new QEvent(QEvent::User));
- return hr;
-}
-
-STDMETHODIMP MFStream::EndRead(IMFAsyncResult* pResult, ULONG *pcbRead)
-{
- if (!pcbRead)
- return E_INVALIDARG;
- IUnknown *pUnk;
- pResult->GetObject(&pUnk);
- AsyncReadState *state = static_cast<AsyncReadState*>(pUnk);
- *pcbRead = state->bytesRead();
- pUnk->Release();
-
- m_currentReadResult->Release();
- m_currentReadResult = NULL;
-
- return S_OK;
-}
-
-STDMETHODIMP MFStream::Write(const BYTE *, ULONG, ULONG *)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP MFStream::BeginWrite(const BYTE *, ULONG ,
- IMFAsyncCallback *,
- IUnknown *)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP MFStream::EndWrite(IMFAsyncResult *,
- ULONG *)
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP MFStream::Seek(
- MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
- LONGLONG llSeekOffset,
- DWORD,
- QWORD *pqwCurrentPosition)
-{
- QMutexLocker locker(&m_mutex);
- if (m_currentReadResult)
- return S_FALSE;
-
- qint64 pos = qint64(llSeekOffset);
- switch (SeekOrigin) {
- case msoCurrent:
- pos += m_stream->pos();
- break;
- }
- bool seekOK = m_stream->seek(pos);
- if (*pqwCurrentPosition)
- *pqwCurrentPosition = pos;
- if (seekOK)
- return S_OK;
- else
- return S_FALSE;
-}
-
-STDMETHODIMP MFStream::Flush()
-{
- return E_NOTIMPL;
-}
-
-STDMETHODIMP MFStream::Close()
-{
- QMutexLocker locker(&m_mutex);
- if (m_ownStream)
- m_stream->close();
- return S_OK;
-}
-
-void MFStream::doRead()
-{
- bool readDone = true;
- IUnknown *pUnk = NULL;
- HRESULT hr = m_currentReadResult->GetObject(&pUnk);
- if (SUCCEEDED(hr)) {
- //do actual read
- AsyncReadState *state = static_cast<AsyncReadState*>(pUnk);
- ULONG cbRead;
- Read(state->pb(), state->cb() - state->bytesRead(), &cbRead);
- pUnk->Release();
-
- state->setBytesRead(cbRead + state->bytesRead());
- if (state->cb() > state->bytesRead() && !m_stream->atEnd()) {
- readDone = false;
- }
- }
-
- if (readDone) {
- //now inform the original caller
- m_currentReadResult->SetStatus(hr);
- MFInvokeCallback(m_currentReadResult);
- }
-}
-
-
-void MFStream::handleReadyRead()
-{
- doRead();
-}
-
-void MFStream::customEvent(QEvent *event)
-{
- if (event->type() != QEvent::User) {
- QObject::customEvent(event);
- return;
- }
- doRead();
-}
-
-//AsyncReadState is a helper class used in BeginRead for asynchronous operation
-//to record some BeginRead parameters, so these parameters could be
-//used later when actually executing the read operation in another thread.
-MFStream::AsyncReadState::AsyncReadState(BYTE *pb, ULONG cb)
- : m_cRef(1)
- , m_pb(pb)
- , m_cb(cb)
- , m_cbRead(0)
-{
-}
-
-//from IUnknown
-STDMETHODIMP MFStream::AsyncReadState::QueryInterface(REFIID riid, LPVOID *ppvObject)
-{
- if (!ppvObject)
- return E_POINTER;
-
- if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
-}
-
-STDMETHODIMP_(ULONG) MFStream::AsyncReadState::AddRef(void)
-{
- return InterlockedIncrement(&m_cRef);
-}
-
-STDMETHODIMP_(ULONG) MFStream::AsyncReadState::Release(void)
-{
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
-}
-
-BYTE* MFStream::AsyncReadState::pb() const
-{
- return m_pb;
-}
-
-ULONG MFStream::AsyncReadState::cb() const
-{
- return m_cb;
-}
-
-ULONG MFStream::AsyncReadState::bytesRead() const
-{
- return m_cbRead;
-}
-
-void MFStream::AsyncReadState::setBytesRead(ULONG cbRead)
-{
- m_cbRead = cbRead;
-}
diff --git a/src/plugins/wmf/player/mfstream.h b/src/plugins/wmf/player/mfstream.h
deleted file mode 100644
index 226bda9..0000000
--- a/src/plugins/wmf/player/mfstream.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFSTREAM_H
-#define MFSTREAM_H
-
-#include <mfapi.h>
-#include <mfidl.h>
-#include <QtCore/qmutex.h>
-#include <QtCore/qiodevice.h>
-#include <QtCore/qcoreevent.h>
-
-QT_USE_NAMESPACE
-
-class MFStream : public QObject, public IMFByteStream
-{
- Q_OBJECT
-public:
- MFStream(QIODevice *stream, bool ownStream);
-
- ~MFStream();
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
-
- STDMETHODIMP_(ULONG) AddRef(void);
-
- STDMETHODIMP_(ULONG) Release(void);
-
-
- //from IMFByteStream
- STDMETHODIMP GetCapabilities(DWORD *pdwCapabilities);
-
- STDMETHODIMP GetLength(QWORD *pqwLength);
-
- STDMETHODIMP SetLength(QWORD);
-
- STDMETHODIMP GetCurrentPosition(QWORD *pqwPosition);
-
- STDMETHODIMP SetCurrentPosition(QWORD qwPosition);
-
- STDMETHODIMP IsEndOfStream(BOOL *pfEndOfStream);
-
- STDMETHODIMP Read(BYTE *pb, ULONG cb, ULONG *pcbRead);
-
- STDMETHODIMP BeginRead(BYTE *pb, ULONG cb, IMFAsyncCallback *pCallback,
- IUnknown *punkState);
-
- STDMETHODIMP EndRead(IMFAsyncResult* pResult, ULONG *pcbRead);
-
- STDMETHODIMP Write(const BYTE *, ULONG, ULONG *);
-
- STDMETHODIMP BeginWrite(const BYTE *, ULONG ,
- IMFAsyncCallback *,
- IUnknown *);
-
- STDMETHODIMP EndWrite(IMFAsyncResult *,
- ULONG *);
-
- STDMETHODIMP Seek(
- MFBYTESTREAM_SEEK_ORIGIN SeekOrigin,
- LONGLONG llSeekOffset,
- DWORD,
- QWORD *pqwCurrentPosition);
-
- STDMETHODIMP Flush();
-
- STDMETHODIMP Close();
-
-private:
- class AsyncReadState : public IUnknown
- {
- public:
- AsyncReadState(BYTE *pb, ULONG cb);
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
-
- STDMETHODIMP_(ULONG) AddRef(void);
-
- STDMETHODIMP_(ULONG) Release(void);
-
- BYTE* pb() const;
- ULONG cb() const;
- ULONG bytesRead() const;
-
- void setBytesRead(ULONG cbRead);
-
- private:
- long m_cRef;
- BYTE *m_pb;
- ULONG m_cb;
- ULONG m_cbRead;
- };
-
- long m_cRef;
- QIODevice *m_stream;
- bool m_ownStream;
- DWORD m_workQueueId;
- QMutex m_mutex;
-
- void doRead();
-
-private Q_SLOTS:
- void handleReadyRead();
-
-protected:
- void customEvent(QEvent *event);
- IMFAsyncResult *m_currentReadResult;
-};
-
-#endif
diff --git a/src/plugins/wmf/player/mfvideorenderercontrol.cpp b/src/plugins/wmf/player/mfvideorenderercontrol.cpp
deleted file mode 100644
index a879d0e..0000000
--- a/src/plugins/wmf/player/mfvideorenderercontrol.cpp
+++ /dev/null
@@ -1,2200 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mfvideorenderercontrol.h"
-#include <mferror.h>
-#include <qabstractvideosurface.h>
-#include <qvideosurfaceformat.h>
-#include <qtcore/qtimer.h>
-#include <qtcore/qmutex.h>
-#include <qtcore/qcoreevent.h>
-#include <qtcore/qcoreapplication.h>
-#include <qtcore/qthread.h>
-#include "guiddef.h"
-#include <qtcore/qdebug.h>
-
-//#define DEBUG_MEDIAFOUNDATION
-#define PAD_TO_DWORD(x) (((x) + 3) & ~3)
-
-namespace
-{
- class MediaSampleVideoBuffer : public QAbstractVideoBuffer
- {
- public:
- MediaSampleVideoBuffer(IMFMediaBuffer *buffer, int bytesPerLine)
- : QAbstractVideoBuffer(NoHandle)
- , m_buffer(buffer)
- , m_bytesPerLine(bytesPerLine)
- , m_mapMode(NotMapped)
- {
- buffer->AddRef();
- }
-
- ~MediaSampleVideoBuffer()
- {
- m_buffer->Release();
- }
-
- uchar *map(MapMode mode, int *numBytes, int *bytesPerLine)
- {
- if (m_mapMode == NotMapped && mode != NotMapped) {
- BYTE *bytes;
- DWORD length;
- HRESULT hr = m_buffer->Lock(&bytes, NULL, &length);
- if (SUCCEEDED(hr)) {
- if (numBytes)
- *numBytes = int(length);
-
- if (bytesPerLine)
- *bytesPerLine = m_bytesPerLine;
-
- m_mapMode = mode;
- return reinterpret_cast<uchar *>(bytes);
- } else {
- qWarning("Faild to lock mf buffer!");
- }
- }
- return 0;
- }
-
- void unmap()
- {
- if (m_mapMode == NotMapped)
- return;
- m_mapMode = NotMapped;
- m_buffer->Unlock();
- }
-
- MapMode mapMode() const
- {
- return m_mapMode;
- }
-
- private:
- IMFMediaBuffer *m_buffer;
- int m_bytesPerLine;
- MapMode m_mapMode;
- };
-
- template<class T>
- class AsyncCallback : public IMFAsyncCallback
- {
- public:
- typedef HRESULT (T::*InvokeFn)(IMFAsyncResult *pAsyncResult);
-
- AsyncCallback(T *pParent, InvokeFn fn) : m_pParent(pParent), m_pInvokeFn(fn)
- {
- }
-
- // IUnknown
- STDMETHODIMP QueryInterface(REFIID iid, void** ppv)
- {
- if (!ppv)
- {
- return E_POINTER;
- }
- if (iid == __uuidof(IUnknown))
- {
- *ppv = static_cast<IUnknown*>(static_cast<IMFAsyncCallback*>(this));
- }
- else if (iid == __uuidof(IMFAsyncCallback))
- {
- *ppv = static_cast<IMFAsyncCallback*>(this);
- }
- else
- {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
- STDMETHODIMP_(ULONG) AddRef()
- {
- // Delegate to parent class.
- return m_pParent->AddRef();
- }
- STDMETHODIMP_(ULONG) Release()
- {
- // Delegate to parent class.
- return m_pParent->Release();
- }
-
- // IMFAsyncCallback methods
- STDMETHODIMP GetParameters(DWORD*, DWORD*)
- {
- // Implementation of this method is optional.
- return E_NOTIMPL;
- }
-
- STDMETHODIMP Invoke(IMFAsyncResult* pAsyncResult)
- {
- return (m_pParent->*m_pInvokeFn)(pAsyncResult);
- }
-
- T *m_pParent;
- InvokeFn m_pInvokeFn;
- };
-
-
- // Custom interface for handling IMFStreamSink::PlaceMarker calls asynchronously.
- MIDL_INTERFACE("a3ff32de-1031-438a-8b47-82f8acda59b7")
- IMarker : public IUnknown
- {
- virtual STDMETHODIMP GetMarkerType(MFSTREAMSINK_MARKER_TYPE *pType) = 0;
- virtual STDMETHODIMP GetMarkerValue(PROPVARIANT *pvar) = 0;
- virtual STDMETHODIMP GetContext(PROPVARIANT *pvar) = 0;
- };
-
- class Marker : public IMarker
- {
- public:
- static HRESULT Create(
- MFSTREAMSINK_MARKER_TYPE eMarkerType,
- const PROPVARIANT* pvarMarkerValue, // Can be NULL.
- const PROPVARIANT* pvarContextValue, // Can be NULL.
- IMarker **ppMarker)
- {
- if (ppMarker == NULL)
- return E_POINTER;
-
- HRESULT hr = S_OK;
- Marker *pMarker = new Marker(eMarkerType);
- if (pMarker == NULL)
- hr = E_OUTOFMEMORY;
-
- // Copy the marker data.
- if (SUCCEEDED(hr) && pvarMarkerValue)
- hr = PropVariantCopy(&pMarker->m_varMarkerValue, pvarMarkerValue);
-
- if (SUCCEEDED(hr) && pvarContextValue)
- hr = PropVariantCopy(&pMarker->m_varContextValue, pvarContextValue);
-
- if (SUCCEEDED(hr)) {
- *ppMarker = pMarker;
- (*ppMarker)->AddRef();
- }
-
- if (pMarker)
- pMarker->Release();
-
- return hr;
- }
-
- // IUnknown methods.
- STDMETHODIMP QueryInterface(REFIID iid, void** ppv)
- {
- if (!ppv)
- return E_POINTER;
- if (iid == IID_IUnknown) {
- *ppv = static_cast<IUnknown*>(this);
- } else if (iid == __uuidof(IMarker)) {
- *ppv = static_cast<IMarker*>(this);
- } else {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release()
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
- }
-
- STDMETHODIMP GetMarkerType(MFSTREAMSINK_MARKER_TYPE *pType)
- {
- if (pType == NULL)
- return E_POINTER;
- *pType = m_eMarkerType;
- return S_OK;
- }
-
- STDMETHODIMP GetMarkerValue(PROPVARIANT *pvar)
- {
- if (pvar == NULL)
- return E_POINTER;
- return PropVariantCopy(pvar, &m_varMarkerValue);
- }
-
- STDMETHODIMP GetContext(PROPVARIANT *pvar)
- {
- if (pvar == NULL)
- return E_POINTER;
- return PropVariantCopy(pvar, &m_varContextValue);
- }
-
- protected:
- MFSTREAMSINK_MARKER_TYPE m_eMarkerType;
- PROPVARIANT m_varMarkerValue;
- PROPVARIANT m_varContextValue;
-
- private:
- long m_cRef;
-
- Marker(MFSTREAMSINK_MARKER_TYPE eMarkerType) : m_cRef(1), m_eMarkerType(eMarkerType)
- {
- PropVariantInit(&m_varMarkerValue);
- PropVariantInit(&m_varContextValue);
- }
-
- virtual ~Marker()
- {
- PropVariantClear(&m_varMarkerValue);
- PropVariantClear(&m_varContextValue);
- }
- };
-
- class MediaStream : public QObject, public IMFStreamSink, public IMFMediaTypeHandler
- {
- Q_OBJECT
- friend class MFVideoRendererControl;
- public:
- static const DWORD DEFAULT_MEDIA_STREAM_ID = 0x0;
-
- MediaStream(IMFMediaSink *parent, MFVideoRendererControl *rendererControl)
- : m_cRef(1)
- , m_eventQueue(0)
- , m_shutdown(false)
- , m_surface(0)
- , m_state(State_TypeNotSet)
- , m_currentFormatIndex(-1)
- , m_bytesPerLine(0)
- , m_workQueueId(0)
- , m_workQueueCB(this, &MediaStream::onDispatchWorkItem)
- , m_finalizeResult(0)
- , m_scheduledBuffer(0)
- , m_presentationClock(0)
- , m_currentMediaType(0)
- , m_prerolling(false)
- , m_prerollTargetTime(0)
- , m_startTime(0)
- , m_rendererControl(rendererControl)
- {
- m_sink = parent;
-
- if (FAILED(MFCreateEventQueue(&m_eventQueue)))
- qWarning("Failed to create mf event queue!");
- if (FAILED(MFAllocateWorkQueue(&m_workQueueId)))
- qWarning("Failed to allocated mf work queue!");
- }
-
- ~MediaStream()
- {
- Q_ASSERT(m_shutdown);
- }
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject)
- {
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFStreamSink) {
- *ppvObject = static_cast<IMFStreamSink*>(this);
- } else if (riid == IID_IMFMediaEventGenerator) {
- *ppvObject = static_cast<IMFMediaEventGenerator*>(this);
- } else if (riid == IID_IMFMediaTypeHandler) {
- *ppvObject = static_cast<IMFMediaTypeHandler*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(static_cast<IMFStreamSink*>(this));
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release(void)
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
- }
-
- //from IMFMediaEventGenerator
- STDMETHODIMP GetEvent(
- DWORD dwFlags,
- IMFMediaEvent **ppEvent)
- {
- // GetEvent can block indefinitely, so we don't hold the lock.
- // This requires some juggling with the event queue pointer.
- HRESULT hr = S_OK;
- IMFMediaEventQueue *queue = NULL;
-
- m_mutex.lock();
- if (m_shutdown)
- hr = MF_E_SHUTDOWN;
- if (SUCCEEDED(hr)) {
- queue = m_eventQueue;
- queue->AddRef();
- }
- m_mutex.unlock();
-
- // Now get the event.
- if (SUCCEEDED(hr)) {
- hr = queue->GetEvent(dwFlags, ppEvent);
- queue->Release();
- }
-
- return hr;
- }
-
- STDMETHODIMP BeginGetEvent(
- IMFAsyncCallback *pCallback,
- IUnknown *punkState)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_eventQueue->BeginGetEvent(pCallback, punkState);
- }
-
- STDMETHODIMP EndGetEvent(
- IMFAsyncResult *pResult,
- IMFMediaEvent **ppEvent)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_eventQueue->EndGetEvent(pResult, ppEvent);
- }
-
- STDMETHODIMP QueueEvent(
- MediaEventType met,
- REFGUID guidExtendedType,
- HRESULT hrStatus,
- const PROPVARIANT *pvValue)
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::QueueEvent" << met;
-#endif
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_eventQueue->QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue);
- }
-
- //from IMFStreamSink
- STDMETHODIMP GetMediaSink(
- IMFMediaSink **ppMediaSink)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- else if (!ppMediaSink)
- return E_INVALIDARG;
-
- m_sink->AddRef();
- *ppMediaSink = m_sink;
- return S_OK;
- }
-
- STDMETHODIMP GetIdentifier(
- DWORD *pdwIdentifier)
- {
- *pdwIdentifier = MediaStream::DEFAULT_MEDIA_STREAM_ID;
- return S_OK;
- }
-
- STDMETHODIMP GetMediaTypeHandler(
- IMFMediaTypeHandler **ppHandler)
- {
- LPVOID handler = NULL;
- HRESULT hr = QueryInterface(IID_IMFMediaTypeHandler, &handler);
- *ppHandler = (IMFMediaTypeHandler*)(handler);
- return hr;
- }
-
- STDMETHODIMP ProcessSample(
- IMFSample *pSample)
- {
- if (pSample == NULL)
- return E_INVALIDARG;
- HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- if (!m_prerolling) {
- hr = validateOperation(OpProcessSample);
- if (FAILED(hr))
- return hr;
- }
-
- pSample->AddRef();
- m_sampleQueue.push_back(pSample);
-
- // Unless we are paused, start an async operation to dispatch the next sample.
- if (m_state != State_Paused)
- hr = queueAsyncOperation(OpProcessSample);
-
- return hr;
- }
-
- STDMETHODIMP PlaceMarker(
- MFSTREAMSINK_MARKER_TYPE eMarkerType,
- const PROPVARIANT *pvarMarkerValue,
- const PROPVARIANT *pvarContextValue)
- {
- HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
- IMarker *pMarker = NULL;
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- hr = validateOperation(OpPlaceMarker);
- if (FAILED(hr))
- return hr;
-
- // Create a marker object and put it on the sample queue.
- hr = Marker::Create(eMarkerType, pvarMarkerValue, pvarContextValue, &pMarker);
- if (FAILED(hr))
- return hr;
-
- m_sampleQueue.push_back(pMarker);
-
- // Unless we are paused, start an async operation to dispatch the next sample/marker.
- if (m_state != State_Paused)
- hr = queueAsyncOperation(OpPlaceMarker); // Increments ref count on pOp.
- return hr;
- }
-
- STDMETHODIMP Flush( void)
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::Flush";
-#endif
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- // Note: Even though we are flushing data, we still need to send
- // any marker events that were queued.
- clearBufferCache();
- return processSamplesFromQueue(DropSamples);
- }
-
- //from IMFMediaTypeHandler
- STDMETHODIMP IsMediaTypeSupported(
- IMFMediaType *pMediaType,
- IMFMediaType **ppMediaType)
- {
- if (ppMediaType)
- *ppMediaType = NULL;
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- int index = getMediaTypeIndex(pMediaType);
- if (index < 0) {
- if (ppMediaType && m_mediaTypes.size() > 0) {
- *ppMediaType = m_mediaTypes[0];
- (*ppMediaType)->AddRef();
- }
- return MF_E_INVALIDMEDIATYPE;
- }
-
- BOOL compressed = TRUE;
- pMediaType->IsCompressedFormat(&compressed);
- if (compressed) {
- if (ppMediaType && (SUCCEEDED(MFCreateMediaType(ppMediaType)))) {
- (*ppMediaType)->CopyAllItems(pMediaType);
- (*ppMediaType)->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, TRUE);
- (*ppMediaType)->SetUINT32(MF_MT_COMPRESSED, FALSE);
- (*ppMediaType)->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
- }
- return MF_E_INVALIDMEDIATYPE;
- }
-
- return S_OK;
- }
-
- STDMETHODIMP GetMediaTypeCount(
- DWORD *pdwTypeCount)
- {
- if (pdwTypeCount == NULL)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- *pdwTypeCount = DWORD(m_mediaTypes.size());
- return S_OK;
- }
-
- STDMETHODIMP GetMediaTypeByIndex(
- DWORD dwIndex,
- IMFMediaType **ppType)
- {
- if (ppType == NULL)
- return E_INVALIDARG;
- HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- hr = MF_E_SHUTDOWN;
-
- if (SUCCEEDED(hr)) {
- if (dwIndex >= DWORD(m_mediaTypes.size()))
- hr = MF_E_NO_MORE_TYPES;
- }
-
- if (SUCCEEDED(hr)) {
- *ppType = m_mediaTypes[dwIndex];
- (*ppType)->AddRef();
- }
- return hr;
- }
-
- STDMETHODIMP SetCurrentMediaType(
- IMFMediaType *pMediaType)
- {
- HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- DWORD flag = MF_MEDIATYPE_EQUAL_MAJOR_TYPES |
- MF_MEDIATYPE_EQUAL_FORMAT_TYPES |
- MF_MEDIATYPE_EQUAL_FORMAT_DATA;
-
- if (m_currentMediaType && (m_currentMediaType->IsEqual(pMediaType, &flag) == S_OK))
- return S_OK;
-
- hr = validateOperation(OpSetMediaType);
-
- if (SUCCEEDED(hr)) {
- int index = getMediaTypeIndex(pMediaType);
- if (index >= 0) {
- UINT64 size;
- hr = pMediaType->GetUINT64(MF_MT_FRAME_SIZE, &size);
- if (SUCCEEDED(hr)) {
- m_currentFormatIndex = index;
- int width = int(HI32(size));
- int height = int(LO32(size));
- QVideoSurfaceFormat format(QSize(width, height), m_pixelFormats[index]);
- m_surfaceFormat = format;
-
- if (FAILED(pMediaType->GetUINT32(MF_MT_DEFAULT_STRIDE, (UINT32*)&m_bytesPerLine))) {
- m_bytesPerLine = getBytesPerLine(format);
- }
-
- m_state = State_Ready;
- if (m_currentMediaType)
- m_currentMediaType->Release();
- m_currentMediaType = pMediaType;
- pMediaType->AddRef();
- }
- } else {
- hr = MF_E_INVALIDREQUEST;
- }
- }
- return hr;
- }
-
- STDMETHODIMP GetCurrentMediaType(
- IMFMediaType **ppMediaType)
- {
- if (ppMediaType == NULL)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- if (m_currentFormatIndex < 0)
- return MF_E_NOT_INITIALIZED;
- *ppMediaType = m_currentMediaType;
- (*ppMediaType)->AddRef();
- return S_OK;
- }
-
- STDMETHODIMP GetMajorType(
- GUID *pguidMajorType)
- {
- if (pguidMajorType == NULL)
- return E_INVALIDARG;
- *pguidMajorType = MFMediaType_Video;
- return S_OK;
- }
-
- //
- void setSurface(QAbstractVideoSurface *surface)
- {
- m_mutex.lock();
- m_surface = surface;
- m_mutex.unlock();
- supportedFormatsChanged();
- }
-
- void setClock(IMFPresentationClock *presentationClock)
- {
- QMutexLocker locker(&m_mutex);
- if (!m_shutdown) {
- if (m_presentationClock)
- m_presentationClock->Release();
- m_presentationClock = presentationClock;
- if (m_presentationClock)
- m_presentationClock->AddRef();
- }
- }
-
- void shutdown()
- {
- QMutexLocker locker(&m_mutex);
- Q_ASSERT(!m_shutdown);
-
- if (m_currentMediaType) {
- m_currentMediaType->Release();
- m_currentMediaType = NULL;
- m_currentFormatIndex = -1;
- }
-
- if (m_eventQueue)
- m_eventQueue->Shutdown();
-
- MFUnlockWorkQueue(m_workQueueId);
-
- if (m_presentationClock) {
- m_presentationClock->Release();
- m_presentationClock = NULL;
- }
-
- if (m_scheduledBuffer) {
- m_scheduledBuffer->Release();
- m_scheduledBuffer = NULL;
- }
-
- clearMediaTypes();
- clearSampleQueue();
- clearBufferCache();
-
- if (m_eventQueue) {
- m_eventQueue->Release();
- m_eventQueue = NULL;
- }
-
- m_shutdown = true;
- }
-
- HRESULT startPreroll(MFTIME hnsUpcomingStartTime)
- {
- QMutexLocker locker(&m_mutex);
- HRESULT hr = validateOperation(OpPreroll);
- if (SUCCEEDED(hr)) {
- m_prerollTargetTime = hnsUpcomingStartTime;
- hr = queueAsyncOperation(OpPreroll);
- }
- return hr;
- }
-
- HRESULT finalize(IMFAsyncCallback *pCallback, IUnknown *punkState)
- {
- QMutexLocker locker(&m_mutex);
- HRESULT hr = S_OK;
- hr = validateOperation(OpFinalize);
- if (SUCCEEDED(hr) && m_finalizeResult != NULL)
- hr = MF_E_INVALIDREQUEST; // The operation is already pending.
-
- // Create and store the async result object.
- if (SUCCEEDED(hr))
- hr = MFCreateAsyncResult(NULL, pCallback, punkState, &m_finalizeResult);
-
- if (SUCCEEDED(hr)) {
- m_state = State_Finalized;
- hr = queueAsyncOperation(OpFinalize);
- }
- return hr;
- }
-
- HRESULT start(MFTIME start)
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::start" << start;
-#endif
- HRESULT hr = S_OK;
- QMutexLocker locker(&m_mutex);
- if (m_rate != 0)
- hr = validateOperation(OpStart);
-
- if (SUCCEEDED(hr)) {
- MFTIME sysTime;
- if (start != PRESENTATION_CURRENT_POSITION)
- m_startTime = start; // Cache the start time.
- else
- m_presentationClock->GetCorrelatedTime(0, &m_startTime, &sysTime);
- m_state = State_Started;
- hr = queueAsyncOperation(OpStart);
- }
- return hr;
- }
-
- HRESULT restart()
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::restart";
-#endif
- QMutexLocker locker(&m_mutex);
- HRESULT hr = validateOperation(OpRestart);
- if (SUCCEEDED(hr)) {
- m_state = State_Started;
- hr = queueAsyncOperation(OpRestart);
- }
- return hr;
- }
-
- HRESULT stop()
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::stop";
-#endif
- QMutexLocker locker(&m_mutex);
- HRESULT hr = validateOperation(OpStop);
- if (SUCCEEDED(hr)) {
- m_state = State_Stopped;
- hr = queueAsyncOperation(OpStop);
- }
- return hr;
- }
-
- HRESULT pause()
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::pause";
-#endif
- QMutexLocker locker(&m_mutex);
- HRESULT hr = validateOperation(OpPause);
- if (SUCCEEDED(hr)) {
- m_state = State_Paused;
- hr = queueAsyncOperation(OpPause);
- }
- return hr;
- }
-
- HRESULT setRate(float rate)
- {
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "MediaStream::setRate" << rate;
-#endif
- QMutexLocker locker(&m_mutex);
- m_rate = rate;
- queueEvent(MEStreamSinkRateChanged, GUID_NULL, S_OK, NULL);
- return S_OK;
- }
-
- void supportedFormatsChanged()
- {
- QMutexLocker locker(&m_mutex);
- m_pixelFormats.clear();
- clearMediaTypes();
- QList<QVideoFrame::PixelFormat> formats = m_surface->supportedPixelFormats();
- foreach (QVideoFrame::PixelFormat format, formats) {
- IMFMediaType *mediaType;
- if (FAILED(MFCreateMediaType(&mediaType))) {
- qWarning("Failed to create mf media type!");
- continue;
- }
- mediaType->SetUINT32(MF_MT_FIXED_SIZE_SAMPLES, TRUE);
- mediaType->SetUINT32(MF_MT_COMPRESSED, FALSE);
- mediaType->SetUINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE);
- mediaType->SetGUID(MF_MT_MAJOR_TYPE, MFMediaType_Video);
- switch (format) {
- case QVideoFrame::Format_ARGB32:
- case QVideoFrame::Format_ARGB32_Premultiplied:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_ARGB32);
- break;
- case QVideoFrame::Format_RGB32:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32);
- break;
- case QVideoFrame::Format_RGB24:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB24);
- break;
- case QVideoFrame::Format_RGB565:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB565);
- break;
- case QVideoFrame::Format_RGB555:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_RGB555);
- break;
- case QVideoFrame::Format_AYUV444:
- case QVideoFrame::Format_AYUV444_Premultiplied:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_AYUV);
- break;
- case QVideoFrame::Format_YUV420P:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_I420);
- break;
- case QVideoFrame::Format_UYVY:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_UYVY);
- break;
- case QVideoFrame::Format_YV12:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_YV12);
- break;
- case QVideoFrame::Format_NV12:
- mediaType->SetGUID(MF_MT_SUBTYPE, MFVideoFormat_NV12);
- break;
- default:
- mediaType->Release();
- continue;
- }
- m_pixelFormats.push_back(format);
- m_mediaTypes.push_back(mediaType);
- }
- }
-
- void present()
- {
- QMutexLocker locker(&m_mutex);
- if (!m_scheduledBuffer)
- return;
- m_surface->present(QVideoFrame(
- new MediaSampleVideoBuffer(m_scheduledBuffer, m_bytesPerLine),
- m_surfaceFormat.frameSize(),
- m_surfaceFormat.pixelFormat()));
- m_scheduledBuffer->Release();
- m_scheduledBuffer = NULL;
- if (m_rate != 0)
- schedulePresentation(true);
- }
-
- enum
- {
- StartSurface = QEvent::User,
- StopSurface,
- FlushSurface,
- PresentSurface
- };
-
- class PresentEvent : public QEvent
- {
- public:
- PresentEvent(MFTIME targetTime)
- : QEvent(QEvent::Type(PresentSurface))
- , m_time(targetTime)
- {
- }
-
- int targetTime()
- {
- return m_time;
- }
-
- private:
- MFTIME m_time;
- };
-
- protected:
- void customEvent(QEvent *event)
- {
- QMutexLocker locker(&m_mutex);
- if (event->type() == StartSurface) {
- if (m_state == State_WaitForSurfaceStart) {
- m_startResult = startSurface();
- queueAsyncOperation(OpStart);
- }
- } else if (event->type() == StopSurface) {
- stopSurface();
- } else {
- QObject::customEvent(event);
- }
- }
- HRESULT m_startResult;
-
- private:
- HRESULT startSurface()
- {
- if (!m_surface->isFormatSupported(m_surfaceFormat))
- return S_FALSE;
- if (!m_surface->start(m_surfaceFormat))
- return S_FALSE;
- return S_OK;
- }
-
- void stopSurface()
- {
- m_surface->stop();
- }
-
- enum FlushState
- {
- DropSamples = 0,
- WriteSamples
- };
-
- // State enum: Defines the current state of the stream.
- enum State
- {
- State_TypeNotSet = 0, // No media type is set
- State_Ready, // Media type is set, Start has never been called.
- State_Started,
- State_Paused,
- State_Stopped,
- State_WaitForSurfaceStart,
- State_Finalized,
- State_Count = State_Finalized + 1 // Number of states
- };
-
- // StreamOperation: Defines various operations that can be performed on the stream.
- enum StreamOperation
- {
- OpSetMediaType = 0,
- OpPreroll,
- OpStart,
- OpRestart,
- OpPause,
- OpStop,
- OpSetRate,
- OpProcessSample,
- OpPlaceMarker,
- OpFinalize,
-
- Op_Count = OpFinalize + 1 // Number of operations
- };
-
- // AsyncOperation:
- // Used to queue asynchronous operations. When we call MFPutWorkItem, we use this
- // object for the callback state (pState). Then, when the callback is invoked,
- // we can use the object to determine which asynchronous operation to perform.
- class AsyncOperation : public IUnknown
- {
- public:
- AsyncOperation(StreamOperation op)
- :m_cRef(1), m_op(op)
- {
- }
-
- StreamOperation m_op; // The operation to perform.
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID iid, void** ppv)
- {
- if (!ppv)
- return E_POINTER;
- if (iid == IID_IUnknown) {
- *ppv = static_cast<IUnknown*>(this);
- } else {
- *ppv = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
- STDMETHODIMP_(ULONG) AddRef()
- {
- return InterlockedIncrement(&m_cRef);
- }
- STDMETHODIMP_(ULONG) Release()
- {
- ULONG uCount = InterlockedDecrement(&m_cRef);
- if (uCount == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return uCount;
- }
-
- private:
- long m_cRef;
- virtual ~AsyncOperation()
- {
- Q_ASSERT(m_cRef == 0);
- }
- };
-
- // ValidStateMatrix: Defines a look-up table that says which operations
- // are valid from which states.
- static BOOL ValidStateMatrix[State_Count][Op_Count];
-
- long m_cRef;
- QMutex m_mutex;
-
- IMFMediaType *m_currentMediaType;
- State m_state;
- IMFMediaSink *m_sink;
- IMFMediaEventQueue *m_eventQueue;
- DWORD m_workQueueId;
- AsyncCallback<MediaStream> m_workQueueCB;
- QList<IUnknown*> m_sampleQueue;
- IMFAsyncResult *m_finalizeResult; // Result object for Finalize operation.
- MFTIME m_startTime; // Presentation time when the clock started.
-
- bool m_shutdown;
- QList<IMFMediaType*> m_mediaTypes;
- QList<QVideoFrame::PixelFormat> m_pixelFormats;
- int m_currentFormatIndex;
- int m_bytesPerLine;
- QVideoSurfaceFormat m_surfaceFormat;
- QAbstractVideoSurface* m_surface;
- MFVideoRendererControl *m_rendererControl;
-
- void clearMediaTypes()
- {
- foreach (IMFMediaType* mediaType, m_mediaTypes)
- mediaType->Release();
- m_mediaTypes.clear();
- }
-
- int getMediaTypeIndex(IMFMediaType *mt)
- {
- GUID majorType;
- if (FAILED(mt->GetMajorType(&majorType)))
- return -1;
- if (majorType != MFMediaType_Video)
- return -1;
-
- GUID subType;
- if (FAILED(mt->GetGUID(MF_MT_SUBTYPE, &subType)))
- return -1;
-
- for (int index = 0; index < m_mediaTypes.size(); ++index) {
- GUID st;
- m_mediaTypes[index]->GetGUID(MF_MT_SUBTYPE, &st);
- if (st == subType)
- return index;
- }
- return -1;
- }
-
- int getBytesPerLine(const QVideoSurfaceFormat &format)
- {
- switch (format.pixelFormat()) {
- // 32 bpp packed formats.
- case QVideoFrame::Format_RGB32:
- case QVideoFrame::Format_AYUV444:
- return format.frameWidth() * 4;
- // 24 bpp packed formats.
- case QVideoFrame::Format_RGB24:
- return PAD_TO_DWORD(format.frameWidth() * 3);
- // 16 bpp packed formats.
- case QVideoFrame::Format_RGB565:
- case QVideoFrame::Format_RGB555:
- case QVideoFrame::Format_YUYV:
- case QVideoFrame::Format_UYVY:
- return PAD_TO_DWORD(format.frameWidth() * 2);
- // Planar formats.
- case QVideoFrame::Format_IMC1:
- case QVideoFrame::Format_IMC2:
- case QVideoFrame::Format_IMC3:
- case QVideoFrame::Format_IMC4:
- case QVideoFrame::Format_YV12:
- case QVideoFrame::Format_NV12:
- case QVideoFrame::Format_YUV420P:
- return PAD_TO_DWORD(format.frameWidth());
- default:
- return 0;
- }
- }
-
- // Callback for MFPutWorkItem.
- HRESULT onDispatchWorkItem(IMFAsyncResult* pAsyncResult)
- {
- QMutexLocker locker(&m_mutex);
- HRESULT hr = S_OK;
- IUnknown *pState = NULL;
- hr = pAsyncResult->GetState(&pState);
- if (SUCCEEDED(hr)) {
- // The state object is an AsncOperation object.
- AsyncOperation *pOp = (AsyncOperation*)pState;
- StreamOperation op = pOp->m_op;
- switch (op) {
- case OpStart:
- endPreroll(S_FALSE);
- if (m_state == State_WaitForSurfaceStart) {
- hr = m_startResult;
- m_state = State_Started;
- } else if (!m_surface->isActive()) {
- if (thread() == QThread::currentThread()) {
- hr = startSurface();
- }
- else {
- m_state = State_WaitForSurfaceStart;
- QCoreApplication::postEvent(m_rendererControl, new QChildEvent(QEvent::Type(StartSurface), this));
- break;
- }
- }
- case OpRestart:
- endPreroll(S_FALSE);
- if (SUCCEEDED(hr)) {
- // Send MEStreamSinkStarted.
- hr = queueEvent(MEStreamSinkStarted, GUID_NULL, hr, NULL);
- // Kick things off by requesting samples...
- schedulePresentation(true);
- // There might be samples queue from earlier (ie, while paused).
- if (SUCCEEDED(hr))
- hr = processSamplesFromQueue(WriteSamples);
- }
- break;
- case OpPreroll:
- beginPreroll();
- break;
- case OpStop:
- // Drop samples from queue.
- hr = processSamplesFromQueue(DropSamples);
- if (m_scheduledBuffer) {
- m_scheduledBuffer->Release();
- m_scheduledBuffer = NULL;
- }
- // Send the event even if the previous call failed.
- hr = queueEvent(MEStreamSinkStopped, GUID_NULL, hr, NULL);
- if (m_surface->isActive()) {
- if (thread() == QThread::currentThread()) {
- stopSurface();
- }
- else {
- QCoreApplication::postEvent(m_rendererControl, new QChildEvent(QEvent::Type(StopSurface), this));
- }
- }
- break;
- case OpPause:
- hr = queueEvent(MEStreamSinkPaused, GUID_NULL, hr, NULL);
- break;
- case OpSetRate:
- //TODO:
- break;
- case OpProcessSample:
- case OpPlaceMarker:
- hr = dispatchProcessSample(pOp);
- break;
- case OpFinalize:
- endPreroll(S_FALSE);
- hr = dispatchFinalize(pOp);
- break;
- }
- }
-
- if (pState)
- pState->Release();
- return hr;
- }
-
-
- HRESULT queueEvent(MediaEventType met, REFGUID guidExtendedType, HRESULT hrStatus, const PROPVARIANT* pvValue)
- {
- HRESULT hr = S_OK;
- if (m_shutdown)
- hr = MF_E_SHUTDOWN;
- if (SUCCEEDED(hr))
- hr = m_eventQueue->QueueEventParamVar(met, guidExtendedType, hrStatus, pvValue);
- return hr;
- }
-
- HRESULT validateOperation(StreamOperation op)
- {
- Q_ASSERT(!m_shutdown);
- if (ValidStateMatrix[m_state][op])
- return S_OK;
- else
- return MF_E_INVALIDREQUEST;
- }
-
- HRESULT queueAsyncOperation(StreamOperation op)
- {
- HRESULT hr = S_OK;
- AsyncOperation *asyncOp = new AsyncOperation(op);
- if (asyncOp == NULL)
- hr = E_OUTOFMEMORY;
-
- if (SUCCEEDED(hr))
- hr = MFPutWorkItem(m_workQueueId, &m_workQueueCB, asyncOp);
-
- if (asyncOp)
- asyncOp->Release();
-
- return hr;
- }
-
- HRESULT processSamplesFromQueue(FlushState bFlushData)
- {
- HRESULT hr = S_OK;
- QList<IUnknown*>::Iterator pos = m_sampleQueue.begin();
- // Enumerate all of the samples/markers in the queue.
- while (pos != m_sampleQueue.end()) {
- IUnknown *pUnk = NULL;
- IMarker *pMarker = NULL;
- IMFSample *pSample = NULL;
- pUnk = *pos;
- // Figure out if this is a marker or a sample.
- if (SUCCEEDED(hr)) {
- hr = pUnk->QueryInterface(__uuidof(IMarker), (void**)&pMarker);
- if (hr == E_NOINTERFACE)
- hr = pUnk->QueryInterface(IID_IMFSample, (void**)&pSample);
- }
-
- // Now handle the sample/marker appropriately.
- if (SUCCEEDED(hr)) {
- if (pMarker) {
- hr = sendMarkerEvent(pMarker, bFlushData);
- } else {
- Q_ASSERT(pSample != NULL); // Not a marker, must be a sample
- if (bFlushData == WriteSamples)
- hr = processSampleData(pSample);
- }
- }
- if (pMarker)
- pMarker->Release();
- if (pSample)
- pSample->Release();
-
- if (FAILED(hr))
- break;
-
- pos++;
- }
-
- clearSampleQueue();
- return hr;
- }
-
- void beginPreroll()
- {
- if (m_prerolling)
- return;
- m_prerolling = true;
- clearSampleQueue();
- clearBufferCache();
- queueEvent(MEStreamSinkRequestSample, GUID_NULL, S_OK, NULL);
- }
-
- void endPreroll(HRESULT hrStatus)
- {
- if (!m_prerolling)
- return;
- m_prerolling = false;
- queueEvent(MEStreamSinkPrerolled, GUID_NULL, hrStatus, NULL);
- }
- MFTIME m_prerollTargetTime;
- bool m_prerolling;
-
- void clearSampleQueue() {
- foreach (IUnknown* sample, m_sampleQueue)
- sample->Release();
- m_sampleQueue.clear();
- }
-
- HRESULT sendMarkerEvent(IMarker *pMarker, FlushState FlushState)
- {
- HRESULT hr = S_OK;
- HRESULT hrStatus = S_OK; // Status code for marker event.
- if (FlushState == DropSamples)
- hrStatus = E_ABORT;
-
- PROPVARIANT var;
- PropVariantInit(&var);
-
- // Get the context data.
- hr = pMarker->GetContext(&var);
-
- if (SUCCEEDED(hr))
- hr = queueEvent(MEStreamSinkMarker, GUID_NULL, hrStatus, &var);
-
- PropVariantClear(&var);
- return hr;
- }
-
- HRESULT dispatchProcessSample(AsyncOperation* pOp)
- {
- HRESULT hr = S_OK;
- Q_ASSERT(pOp != NULL);
- hr = processSamplesFromQueue(WriteSamples);
- // We are in the middle of an asynchronous operation, so if something failed, send an error.
- if (FAILED(hr))
- hr = queueEvent(MEError, GUID_NULL, hr, NULL);
-
- return hr;
- }
-
- HRESULT dispatchFinalize(AsyncOperation*)
- {
- HRESULT hr = S_OK;
- // Write any samples left in the queue...
- hr = processSamplesFromQueue(WriteSamples);
-
- // Set the async status and invoke the callback.
- m_finalizeResult->SetStatus(hr);
- hr = MFInvokeCallback(m_finalizeResult);
- return hr;
- }
-
- HRESULT processSampleData(IMFSample *pSample)
- {
- LONGLONG time;
- HRESULT hr = pSample->GetSampleTime(&time);
-
- if (m_prerolling) {
- if (SUCCEEDED(hr) && time >= m_prerollTargetTime) {
- IMFMediaBuffer *pBuffer = NULL;
- hr = pSample->ConvertToContiguousBuffer(&pBuffer);
- if (SUCCEEDED(hr)) {
- SampleBuffer sb;
- sb.m_buffer = pBuffer;
- sb.m_time = time;
- m_bufferCache.push_back(sb);
- endPreroll(S_OK);
- }
- } else {
- queueEvent(MEStreamSinkRequestSample, GUID_NULL, S_OK, NULL);
- }
- } else {
- bool requestSample = true;
- // If the time stamp is too early, just discard this sample.
- if (SUCCEEDED(hr) && time >= m_startTime) {
- IMFMediaBuffer *pBuffer = NULL;
- hr = pSample->ConvertToContiguousBuffer(&pBuffer);
- if (SUCCEEDED(hr)) {
- SampleBuffer sb;
- sb.m_buffer = pBuffer;
- sb.m_time = time;
- m_bufferCache.push_back(sb);
- }
- if (m_rate == 0)
- requestSample = false;
- }
- schedulePresentation(requestSample);
- }
- return hr;
- }
-
- class SampleBuffer
- {
- public:
- IMFMediaBuffer *m_buffer;
- LONGLONG m_time;
- };
- QList<SampleBuffer> m_bufferCache;
- static const int BUFFER_CACHE_SIZE = 2;
-
- void clearBufferCache()
- {
- foreach (SampleBuffer sb, m_bufferCache)
- sb.m_buffer->Release();
- m_bufferCache.clear();
- }
-
- void schedulePresentation(bool requestSample)
- {
- if (m_state == State_Paused)
- return;
- if (!m_scheduledBuffer) {
- //get time from presentation time
- MFTIME currentTime = m_startTime, sysTime;
- bool timeOK = true;
- if (m_rate != 0) {
- if (FAILED(m_presentationClock->GetCorrelatedTime(0, &currentTime, &sysTime)))
- timeOK = false;
- }
- while (!m_bufferCache.isEmpty()) {
- SampleBuffer sb = m_bufferCache.first();
- m_bufferCache.pop_front();
- if (timeOK && currentTime > sb.m_time) {
- sb.m_buffer->Release();
- qDebug() << "currentPresentTime =" << float(currentTime / 10000) * 0.001f << " and sampleTime is" << float(sb.m_time / 10000) * 0.001f;
- continue;
- }
- m_scheduledBuffer = sb.m_buffer;
- QCoreApplication::postEvent(m_rendererControl, new PresentEvent(sb.m_time));
- if (m_rate == 0)
- queueEvent(MEStreamSinkScrubSampleComplete, GUID_NULL, S_OK, NULL);
- break;
- }
- }
- if (requestSample && m_bufferCache.size() < BUFFER_CACHE_SIZE)
- queueEvent(MEStreamSinkRequestSample, GUID_NULL, S_OK, NULL);
- }
- IMFMediaBuffer *m_scheduledBuffer;
- IMFPresentationClock *m_presentationClock;
- float m_rate;
- };
-
- BOOL MediaStream::ValidStateMatrix[MediaStream::State_Count][MediaStream::Op_Count] =
- {
- // States: Operations:
- // SetType Start Preroll, Restart Pause Stop SetRate Sample Marker Finalize
- /* NotSet */ TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE,
-
- /* Ready */ TRUE, TRUE, TRUE, FALSE, TRUE, TRUE, TRUE, FALSE, TRUE, TRUE,
-
- /* Start */ FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
-
- /* Pause */ FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
-
- /* Stop */ FALSE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, TRUE, TRUE,
-
- /*WaitForSurfaceStart*/ FALSE, FALSE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE, FALSE, TRUE,
-
- /* Final */ FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE
-
- // Note about states:
- // 1. OnClockRestart should only be called from paused state.
- // 2. While paused, the sink accepts samples but does not process them.
- };
-
- class MediaSink : public IMFFinalizableMediaSink, public IMFClockStateSink, public IMFMediaSinkPreroll
- {
- public:
- MediaSink(MFVideoRendererControl *rendererControl)
- : m_cRef(1)
- , m_shutdown(false)
- , m_presentationClock(0)
- , m_playRate(1)
- {
- m_stream = new MediaStream(this, rendererControl);
- }
-
- ~MediaSink()
- {
- Q_ASSERT(m_shutdown);
- }
-
- void setSurface(QAbstractVideoSurface *surface)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return;
- m_stream->setSurface(surface);
- }
-
- void supportedFormatsChanged()
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return;
- m_stream->supportedFormatsChanged();
- }
-
- void present()
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return;
- m_stream->present();
- }
-
- MFTIME getTime()
- {
- QMutexLocker locker(&m_mutex);
- if (!m_presentationClock)
- return 0;
- MFTIME time, sysTime;
- m_presentationClock->GetCorrelatedTime(0, &time, &sysTime);
- return time;
- }
-
- float getPlayRate()
- {
- QMutexLocker locker(&m_mutex);
- return m_playRate;
- }
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject)
- {
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFMediaSink) {
- *ppvObject = static_cast<IMFMediaSink*>(this);
- } else if (riid == IID_IMFMediaSinkPreroll) {
- *ppvObject = static_cast<IMFMediaSinkPreroll*>(this);
- } else if (riid == IID_IMFClockStateSink) {
- *ppvObject = static_cast<IMFClockStateSink*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(static_cast<IMFFinalizableMediaSink*>(this));
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release(void)
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
- }
-
-
-
- //IMFMediaSinkPreroll
- STDMETHODIMP NotifyPreroll(MFTIME hnsUpcomingStartTime)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->startPreroll(hnsUpcomingStartTime);
- }
-
- //from IMFFinalizableMediaSink
- STDMETHODIMP BeginFinalize(IMFAsyncCallback *pCallback, IUnknown *punkState)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->finalize(pCallback, punkState);
- }
-
- STDMETHODIMP EndFinalize(IMFAsyncResult *pResult)
- {
- HRESULT hr = S_OK;
- // Return the status code from the async result.
- if (pResult == NULL)
- hr = E_INVALIDARG;
- else
- hr = pResult->GetStatus();
- return hr;
- }
-
- //from IMFMediaSink
- STDMETHODIMP GetCharacteristics(
- DWORD *pdwCharacteristics)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- *pdwCharacteristics = MEDIASINK_FIXED_STREAMS | MEDIASINK_CAN_PREROLL;
- return S_OK;
- }
-
- STDMETHODIMP AddStreamSink(
- DWORD,
- IMFMediaType *,
- IMFStreamSink **)
- {
- QMutexLocker locker(&m_mutex);
- return m_shutdown ? MF_E_SHUTDOWN : MF_E_STREAMSINKS_FIXED;
- }
-
- STDMETHODIMP RemoveStreamSink(
- DWORD)
- {
- QMutexLocker locker(&m_mutex);
- return m_shutdown ? MF_E_SHUTDOWN : MF_E_STREAMSINKS_FIXED;
- }
-
- STDMETHODIMP GetStreamSinkCount(
- DWORD *pcStreamSinkCount)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- *pcStreamSinkCount = 1;
- return S_OK;
- }
-
- STDMETHODIMP GetStreamSinkByIndex(
- DWORD dwIndex,
- IMFStreamSink **ppStreamSink)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- if (dwIndex != 0)
- return MF_E_INVALIDINDEX;
-
- *ppStreamSink = m_stream;
- m_stream->AddRef();
- return S_OK;
- }
-
- STDMETHODIMP GetStreamSinkById(
- DWORD dwStreamSinkIdentifier,
- IMFStreamSink **ppStreamSink)
- {
- if (ppStreamSink == NULL)
- return E_INVALIDARG;
- if (dwStreamSinkIdentifier != MediaStream::DEFAULT_MEDIA_STREAM_ID)
- return MF_E_INVALIDSTREAMNUMBER;
-
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- *ppStreamSink = m_stream;
- m_stream->AddRef();
- return S_OK;
- }
-
- STDMETHODIMP SetPresentationClock(
- IMFPresentationClock *pPresentationClock)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- if (m_presentationClock) {
- m_presentationClock->RemoveClockStateSink(this);
- m_presentationClock->Release();
- }
- m_presentationClock = pPresentationClock;
- if (m_presentationClock) {
- m_presentationClock->AddRef();
- m_presentationClock->AddClockStateSink(this);
- }
- m_stream->setClock(m_presentationClock);
- return S_OK;
- }
-
- STDMETHODIMP GetPresentationClock(
- IMFPresentationClock **ppPresentationClock)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- *ppPresentationClock = m_presentationClock;
- if (m_presentationClock) {
- m_presentationClock->AddRef();
- return S_OK;
- }
- return MF_E_NO_CLOCK;
- }
-
- STDMETHODIMP Shutdown(void)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
-
- m_stream->shutdown();
- if (m_presentationClock) {
- m_presentationClock->Release();
- m_presentationClock = NULL;
- }
- m_stream->Release();
- m_stream = NULL;
- m_shutdown = true;
- return S_OK;
- }
-
- // IMFClockStateSink methods
- STDMETHODIMP OnClockStart(MFTIME, LONGLONG llClockStartOffset)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->start(llClockStartOffset);
- }
-
- STDMETHODIMP OnClockStop(MFTIME)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->stop();
- }
-
- STDMETHODIMP OnClockPause(MFTIME)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->pause();
- }
-
- STDMETHODIMP OnClockRestart(MFTIME)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- return m_stream->restart();
- }
-
- STDMETHODIMP OnClockSetRate(MFTIME, float flRate)
- {
- QMutexLocker locker(&m_mutex);
- if (m_shutdown)
- return MF_E_SHUTDOWN;
- m_playRate = flRate;
- return m_stream->setRate(flRate);
- }
-
- private:
- long m_cRef;
- QMutex m_mutex;
- bool m_shutdown;
- IMFPresentationClock *m_presentationClock;
- MediaStream *m_stream;
- float m_playRate;
- };
-
- class VideoRendererActivate : public IMFActivate
- {
- public:
- VideoRendererActivate(MFVideoRendererControl *rendererControl)
- : m_cRef(1)
- , m_sink(0)
- , m_rendererControl(rendererControl)
- , m_attributes(0)
- {
- MFCreateAttributes(&m_attributes, 0);
- m_sink = new MediaSink(rendererControl);
- }
-
- ~VideoRendererActivate()
- {
- m_attributes->Release();
- }
-
- //from IUnknown
- STDMETHODIMP QueryInterface(REFIID riid, void** ppvObject)
- {
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IMFActivate) {
- *ppvObject = static_cast<IMFActivate*>(this);
- } else if (riid == IID_IMFAttributes) {
- *ppvObject = static_cast<IMFAttributes*>(this);
- } else if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(static_cast<IMFActivate*>(this));
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
- }
-
- STDMETHODIMP_(ULONG) AddRef(void)
- {
- return InterlockedIncrement(&m_cRef);
- }
-
- STDMETHODIMP_(ULONG) Release(void)
- {
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
- }
-
- //from IMFActivate
- STDMETHODIMP ActivateObject(REFIID riid, void **ppv)
- {
- if (!ppv)
- return E_INVALIDARG;
- QMutexLocker locker(&m_mutex);
- if (!m_sink) {
- m_sink = new MediaSink(m_rendererControl);
- if (m_surface)
- m_sink->setSurface(m_surface);
- }
- return m_sink->QueryInterface(riid, ppv);
- }
-
- STDMETHODIMP ShutdownObject(void)
- {
- QMutexLocker locker(&m_mutex);
- HRESULT hr = S_OK;
- if (m_sink) {
- hr = m_sink->Shutdown();
- m_sink->Release();
- m_sink = NULL;
- }
- return hr;
- }
-
- STDMETHODIMP DetachObject(void)
- {
- QMutexLocker locker(&m_mutex);
- if (m_sink) {
- m_sink->Release();
- m_sink = NULL;
- }
- return S_OK;
- }
-
- //from IMFAttributes
- STDMETHODIMP GetItem(
- REFGUID guidKey,
- PROPVARIANT *pValue)
- {
- return m_attributes->GetItem(guidKey, pValue);
- }
-
- STDMETHODIMP GetItemType(
- REFGUID guidKey,
- MF_ATTRIBUTE_TYPE *pType)
- {
- return m_attributes->GetItemType(guidKey, pType);
- }
-
- STDMETHODIMP CompareItem(
- REFGUID guidKey,
- REFPROPVARIANT Value,
- BOOL *pbResult)
- {
- return m_attributes->CompareItem(guidKey, Value, pbResult);
- }
-
- STDMETHODIMP Compare(
- IMFAttributes *pTheirs,
- MF_ATTRIBUTES_MATCH_TYPE MatchType,
- BOOL *pbResult)
- {
- return m_attributes->Compare(pTheirs, MatchType, pbResult);
- }
-
- STDMETHODIMP GetUINT32(
- REFGUID guidKey,
- UINT32 *punValue)
- {
- return m_attributes->GetUINT32(guidKey, punValue);
- }
-
- STDMETHODIMP GetUINT64(
- REFGUID guidKey,
- UINT64 *punValue)
- {
- return m_attributes->GetUINT64(guidKey, punValue);
- }
-
- STDMETHODIMP GetDouble(
- REFGUID guidKey,
- double *pfValue)
- {
- return m_attributes->GetDouble(guidKey, pfValue);
- }
-
- STDMETHODIMP GetGUID(
- REFGUID guidKey,
- GUID *pguidValue)
- {
- return m_attributes->GetGUID(guidKey, pguidValue);
- }
-
- STDMETHODIMP GetStringLength(
- REFGUID guidKey,
- UINT32 *pcchLength)
- {
- return m_attributes->GetStringLength(guidKey, pcchLength);
- }
-
- STDMETHODIMP GetString(
- REFGUID guidKey,
- LPWSTR pwszValue,
- UINT32 cchBufSize,
- UINT32 *pcchLength)
- {
- return m_attributes->GetString(guidKey, pwszValue, cchBufSize, pcchLength);
- }
-
- STDMETHODIMP GetAllocatedString(
- REFGUID guidKey,
- LPWSTR *ppwszValue,
- UINT32 *pcchLength)
- {
- return m_attributes->GetAllocatedString(guidKey, ppwszValue, pcchLength);
- }
-
- STDMETHODIMP GetBlobSize(
- REFGUID guidKey,
- UINT32 *pcbBlobSize)
- {
- return m_attributes->GetBlobSize(guidKey, pcbBlobSize);
- }
-
- STDMETHODIMP GetBlob(
- REFGUID guidKey,
- UINT8 *pBuf,
- UINT32 cbBufSize,
- UINT32 *pcbBlobSize)
- {
- return m_attributes->GetBlob(guidKey, pBuf, cbBufSize, pcbBlobSize);
- }
-
- STDMETHODIMP GetAllocatedBlob(
- REFGUID guidKey,
- UINT8 **ppBuf,
- UINT32 *pcbSize)
- {
- return m_attributes->GetAllocatedBlob(guidKey, ppBuf, pcbSize);
- }
-
- STDMETHODIMP GetUnknown(
- REFGUID guidKey,
- REFIID riid,
- LPVOID *ppv)
- {
- return m_attributes->GetUnknown(guidKey, riid, ppv);
- }
-
- STDMETHODIMP SetItem(
- REFGUID guidKey,
- REFPROPVARIANT Value)
- {
- return m_attributes->SetItem(guidKey, Value);
- }
-
- STDMETHODIMP DeleteItem(
- REFGUID guidKey)
- {
- return m_attributes->DeleteItem(guidKey);
- }
-
- STDMETHODIMP DeleteAllItems(void)
- {
- return m_attributes->DeleteAllItems();
- }
-
- STDMETHODIMP SetUINT32(
- REFGUID guidKey,
- UINT32 unValue)
- {
- return m_attributes->SetUINT32(guidKey, unValue);
- }
-
- STDMETHODIMP SetUINT64(
- REFGUID guidKey,
- UINT64 unValue)
- {
- return m_attributes->SetUINT64(guidKey, unValue);
- }
-
- STDMETHODIMP SetDouble(
- REFGUID guidKey,
- double fValue)
- {
- return m_attributes->SetDouble(guidKey, fValue);
- }
-
- STDMETHODIMP SetGUID(
- REFGUID guidKey,
- REFGUID guidValue)
- {
- return m_attributes->SetGUID(guidKey, guidValue);
- }
-
- STDMETHODIMP SetString(
- REFGUID guidKey,
- LPCWSTR wszValue)
- {
- return m_attributes->SetString(guidKey, wszValue);
- }
-
- STDMETHODIMP SetBlob(
- REFGUID guidKey,
- const UINT8 *pBuf,
- UINT32 cbBufSize)
- {
- return m_attributes->SetBlob(guidKey, pBuf, cbBufSize);
- }
-
- STDMETHODIMP SetUnknown(
- REFGUID guidKey,
- IUnknown *pUnknown)
- {
- return m_attributes->SetUnknown(guidKey, pUnknown);
- }
-
- STDMETHODIMP LockStore(void)
- {
- return m_attributes->LockStore();
- }
-
- STDMETHODIMP UnlockStore(void)
- {
- return m_attributes->UnlockStore();
- }
-
- STDMETHODIMP GetCount(
- UINT32 *pcItems)
- {
- return m_attributes->GetCount(pcItems);
- }
-
- STDMETHODIMP GetItemByIndex(
- UINT32 unIndex,
- GUID *pguidKey,
- PROPVARIANT *pValue)
- {
- return m_attributes->GetItemByIndex(unIndex, pguidKey, pValue);
- }
-
- STDMETHODIMP CopyAllItems(
- IMFAttributes *pDest)
- {
- return m_attributes->CopyAllItems(pDest);
- }
-
- /////////////////////////////////
- void setSurface(QAbstractVideoSurface *surface)
- {
- QMutexLocker locker(&m_mutex);
- if (m_surface == surface)
- return;
-
- m_surface = surface;
-
- if (!m_sink)
- return;
- m_sink->setSurface(m_surface);
- }
-
- void supportedFormatsChanged()
- {
- QMutexLocker locker(&m_mutex);
- if (!m_sink)
- return;
- m_sink->supportedFormatsChanged();
- }
-
- void present()
- {
- QMutexLocker locker(&m_mutex);
- if (!m_sink)
- return;
- m_sink->present();
- }
-
- MFTIME getTime()
- {
- if (m_sink)
- return m_sink->getTime();
- return 0;
- }
-
- float getPlayRate()
- {
- if (m_sink)
- return m_sink->getPlayRate();
- return 1;
- }
-
- private:
- long m_cRef;
- bool m_shutdown;
- MediaSink *m_sink;
- MFVideoRendererControl *m_rendererControl;
- IMFAttributes *m_attributes;
- QAbstractVideoSurface *m_surface;
- QMutex m_mutex;
- };
-}
-
-MFVideoRendererControl::MFVideoRendererControl(QObject *parent)
- : QVideoRendererControl(parent)
- , m_surface(0)
- , m_callback(0)
-{
- m_currentActivate = new VideoRendererActivate(this);
-}
-
-MFVideoRendererControl::~MFVideoRendererControl()
-{
- if (m_currentActivate) {
- m_currentActivate->ShutdownObject();
- m_currentActivate->Release();
- }
-}
-
-QAbstractVideoSurface *MFVideoRendererControl::surface() const
-{
- return m_surface;
-}
-
-void MFVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
-{
- if (m_surface == surface)
- return;
-
- if (m_surface)
- disconnect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(supportedFormatsChanged()));
- m_surface = surface;
-
- if (m_surface) {
- connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(supportedFormatsChanged()));
- }
- static_cast<VideoRendererActivate*>(m_currentActivate)->setSurface(m_surface);
-}
-
-void MFVideoRendererControl::customEvent(QEvent *event)
-{
- if (event->type() == MediaStream::PresentSurface) {
- MFTIME targetTime = static_cast<MediaStream::PresentEvent*>(event)->targetTime();
- MFTIME currentTime = static_cast<VideoRendererActivate*>(m_currentActivate)->getTime();
- float playRate = static_cast<VideoRendererActivate*>(m_currentActivate)->getPlayRate();
- if (playRate > 0.0001f && targetTime > currentTime)
- QTimer::singleShot(int((float)((targetTime - currentTime) / 10000) / playRate), this, SLOT(present()));
- else
- present();
- return;
- }
- QChildEvent *childEvent = dynamic_cast<QChildEvent*>(event);
- if (!childEvent) {
- QObject::customEvent(event);
- return;
- }
- static_cast<MediaStream*>(childEvent->child())->customEvent(event);
-}
-
-void MFVideoRendererControl::supportedFormatsChanged()
-{
- static_cast<VideoRendererActivate*>(m_currentActivate)->supportedFormatsChanged();
-}
-
-void MFVideoRendererControl::present()
-{
- static_cast<VideoRendererActivate*>(m_currentActivate)->present();
-}
-
-IMFActivate* MFVideoRendererControl::currentActivate() const
-{
- return m_currentActivate;
-}
-
-#include "moc_mfvideorenderercontrol.cpp"
-#include "mfvideorenderercontrol.moc"
diff --git a/src/plugins/wmf/player/mfvideorenderercontrol.h b/src/plugins/wmf/player/mfvideorenderercontrol.h
deleted file mode 100644
index ad02772..0000000
--- a/src/plugins/wmf/player/mfvideorenderercontrol.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef MFVIDEORENDERERCONTROL_H
-#define MFVIDEORENDERERCONTROL_H
-
-#include "../../src/multimedia/qvideorenderercontrol.h"
-#include <mfapi.h>
-#include <mfidl.h>
-
-QT_USE_NAMESPACE
-
-class MFVideoRendererControl : public QVideoRendererControl
-{
- Q_OBJECT
-public:
- MFVideoRendererControl(QObject *parent = 0);
- ~MFVideoRendererControl();
-
- QAbstractVideoSurface *surface() const;
- void setSurface(QAbstractVideoSurface *surface);
-
- IMFActivate* currentActivate() const;
-
-protected:
- void customEvent(QEvent *event);
-
-private Q_SLOTS:
- void supportedFormatsChanged();
- void present();
-
-private:
- QAbstractVideoSurface *m_surface;
- IMFActivate *m_currentActivate;
- IMFSampleGrabberSinkCallback *m_callback;
-};
-
-#endif
diff --git a/src/plugins/wmf/player/player.pri b/src/plugins/wmf/player/player.pri
deleted file mode 100644
index 58375ba..0000000
--- a/src/plugins/wmf/player/player.pri
+++ /dev/null
@@ -1,30 +0,0 @@
-INCLUDEPATH += $$PWD
-
-LIBS += -lstrmiids -ldmoguids -luuid -lmsdmo -lole32 -loleaut32 -lMf -lMfuuid -lMfplat -lPropsys
-
-DEFINES += QMEDIA_MEDIAFOUNDATION_PLAYER
-
-HEADERS += \
- $$PWD/mfplayerservice.h \
- $$PWD/mfplayersession.h \
- $$PWD/mfstream.h \
- $$PWD/sourceresolver.h \
- $$PWD/mfplayercontrol.h \
- $$PWD/mfvideorenderercontrol.h \
- $$PWD/mfaudioendpointcontrol.h \
- $$PWD/mfmetadatacontrol.h
-
-SOURCES += \
- $$PWD/mfplayerservice.cpp \
- $$PWD/mfplayersession.cpp \
- $$PWD/mfstream.cpp \
- $$PWD/sourceresolver.cpp \
- $$PWD/mfplayercontrol.cpp \
- $$PWD/mfvideorenderercontrol.cpp \
- $$PWD/mfaudioendpointcontrol.cpp \
- $$PWD/mfmetadatacontrol.cpp
-
-!simulator {
- HEADERS += $$PWD/evr9videowindowcontrol.h
- SOURCES += $$PWD/evr9videowindowcontrol.cpp
-}
diff --git a/src/plugins/wmf/player/sourceresolver.cpp b/src/plugins/wmf/player/sourceresolver.cpp
deleted file mode 100644
index 9c62fa8..0000000
--- a/src/plugins/wmf/player/sourceresolver.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "mfplayersession.h"
-#include "mfstream.h"
-#include "sourceresolver.h"
-#include <Mferror.h>
-#include <nserror.h>
-#include <QtCore/qfile.h>
-
-/*
- SourceResolver is separated from MFPlayerSession to handle the work of resolving a media source
- asynchronously. You call SourceResolver::load to request resolving a media source asynchronously,
- and it will emit mediaSourceReady() when resolving is done. You can call SourceResolver::cancel to
- stop the previous load operation if there is any.
-*/
-
-SourceResolver::SourceResolver(QObject *parent)
- : QObject(parent)
- , m_cRef(1)
- , m_cancelCookie(0)
- , m_sourceResolver(0)
- , m_mediaSource(0)
- , m_stream(0)
-{
-}
-
-SourceResolver::~SourceResolver()
-{
- shutdown();
- if (m_cancelCookie)
- m_cancelCookie->Release();
- if (m_sourceResolver)
- m_sourceResolver->Release();
-}
-
-STDMETHODIMP SourceResolver::QueryInterface(REFIID riid, LPVOID *ppvObject)
-{
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else if (riid == IID_IMFAsyncCallback) {
- *ppvObject = static_cast<IMFAsyncCallback*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
-}
-
-STDMETHODIMP_(ULONG) SourceResolver::AddRef(void)
-{
- return InterlockedIncrement(&m_cRef);
-}
-
-STDMETHODIMP_(ULONG) SourceResolver::Release(void)
-{
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- this->deleteLater();
- return cRef;
-}
-
-HRESULT STDMETHODCALLTYPE SourceResolver::Invoke(IMFAsyncResult *pAsyncResult)
-{
- QMutexLocker locker(&m_mutex);
- MF_OBJECT_TYPE ObjectType = MF_OBJECT_INVALID;
- IUnknown* pSource = NULL;
- State *state = static_cast<State*>(pAsyncResult->GetStateNoAddRef());
-
- HRESULT hr = S_OK;
- if (state->fromStream())
- hr = m_sourceResolver->EndCreateObjectFromByteStream(pAsyncResult, &ObjectType, &pSource);
- else
- hr = m_sourceResolver->EndCreateObjectFromURL(pAsyncResult, &ObjectType, &pSource);
-
- if (state->sourceResolver() != m_sourceResolver) {
- //This is a cancelled one
- return S_OK;
- }
-
- if (m_cancelCookie) {
- m_cancelCookie->Release();
- m_cancelCookie = NULL;
- }
-
- if (FAILED(hr)) {
- emit error(hr);
- return S_OK;
- }
-
- if (m_mediaSource) {
- m_mediaSource->Release();
- m_mediaSource = NULL;
- }
-
- hr = pSource->QueryInterface(IID_PPV_ARGS(&m_mediaSource));
- if (FAILED(hr)) {
- emit error(hr);
- return S_OK;
- }
-
- emit mediaSourceReady();
-
- return S_OK;
-}
-
-HRESULT STDMETHODCALLTYPE SourceResolver::GetParameters(DWORD*, DWORD*)
-{
- return E_NOTIMPL;
-}
-
-void SourceResolver::load(QMediaResourceList& resources, QIODevice* stream)
-{
- QMutexLocker locker(&m_mutex);
- HRESULT hr = S_OK;
- if (!m_sourceResolver)
- hr = MFCreateSourceResolver(&m_sourceResolver);
-
- if (m_stream) {
- m_stream->Release();
- m_stream = NULL;
- }
-
- if (FAILED(hr)) {
- qWarning() << "Failed to create Source Resolver!";
- emit error(hr);
- } else if (stream) {
- if (resources.count() > 0) {
- QMediaResource resource = resources.takeFirst();
- QUrl url = resource.url();
- m_stream = new MFStream(stream, false);
- hr = m_sourceResolver->BeginCreateObjectFromByteStream(m_stream, reinterpret_cast<const OLECHAR *>(url.toString().utf16()),
- MF_RESOLUTION_MEDIASOURCE, NULL, &m_cancelCookie, this, new State(m_sourceResolver, true));
- if (FAILED(hr)) {
- qWarning() << "Unsupported stream!";
- emit error(hr);
- }
- } else {
- hr = MF_E_UNSUPPORTED_BYTESTREAM_TYPE;
- qWarning() << "Can't load stream without a hint of MIME type in a url";
- emit error(hr);
- }
- } else {
- QMediaResource resource = resources.takeFirst();
- QUrl url = resource.url();
-#ifdef DEBUG_MEDIAFOUNDATION
- qDebug() << "loading :" << url;
- qDebug() << "url path =" << url.path().mid(1);
-#endif
-#ifdef TEST_STREAMING
- //Testing stream function
- if (url.scheme() == QLatin1String("file")) {
- stream = new QFile(url.path().mid(1), this);
- if (stream->open(QIODevice::ReadOnly)) {
- m_stream = new MFStream(stream, true);
- hr = m_sourceResolver->BeginCreateObjectFromByteStream(m_stream, reinterpret_cast<const OLECHAR *>(url.toString().utf16()),
- MF_RESOLUTION_MEDIASOURCE, NULL, &m_cancelCookie, this, new State(m_sourceResolver, true));
- if (FAILED(hr)) {
- qWarning() << "Unsupported stream!";
- emit error(hr);
- }
- } else {
- delete stream;
- emit error(QMediaPlayer::FormatError);
- }
- } else
-#endif
- if (url.scheme() == QLatin1String("qrc")) {
- // If the canonical URL refers to a Qt resource, open with QFile and use
- // the stream playback capability to play.
- stream = new QFile(QLatin1Char(':') + url.path(), this);
- if (stream->open(QIODevice::ReadOnly)) {
- m_stream = new MFStream(stream, true);
- hr = m_sourceResolver->BeginCreateObjectFromByteStream(m_stream, reinterpret_cast<const OLECHAR *>(url.toString().utf16()),
- MF_RESOLUTION_MEDIASOURCE, NULL, &m_cancelCookie, this, new State(m_sourceResolver, true));
- if (FAILED(hr)) {
- qWarning() << "Unsupported stream!";
- emit error(hr);
- }
- } else {
- delete stream;
- emit error(QMediaPlayer::FormatError);
- }
- } else {
- hr = m_sourceResolver->BeginCreateObjectFromURL(reinterpret_cast<const OLECHAR *>(url.toString().utf16()),
- MF_RESOLUTION_MEDIASOURCE, NULL, &m_cancelCookie, this, new State(m_sourceResolver, false));
- if (FAILED(hr)) {
- qWarning() << "Unsupported url scheme!";
- emit error(hr);
- }
- }
- }
-}
-
-void SourceResolver::cancel()
-{
- QMutexLocker locker(&m_mutex);
- if (m_cancelCookie) {
- m_sourceResolver->CancelObjectCreation(m_cancelCookie);
- m_cancelCookie->Release();
- m_cancelCookie = NULL;
- m_sourceResolver->Release();
- m_sourceResolver = NULL;
- }
-}
-
-void SourceResolver::shutdown()
-{
- if (m_mediaSource) {
- m_mediaSource->Shutdown();
- m_mediaSource->Release();
- m_mediaSource = NULL;
- }
-
- if (m_stream) {
- m_stream->Release();
- m_stream = NULL;
- }
-}
-
-IMFMediaSource* SourceResolver::mediaSource() const
-{
- return m_mediaSource;
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-SourceResolver::State::State(IMFSourceResolver *sourceResolver, bool fromStream)
- : m_cRef(1)
- , m_sourceResolver(sourceResolver)
- , m_fromStream(fromStream)
-{
- sourceResolver->AddRef();
-}
-
-SourceResolver::State::~State()
-{
- m_sourceResolver->Release();
-}
-
-STDMETHODIMP SourceResolver::State::QueryInterface(REFIID riid, LPVOID *ppvObject)
-{
- if (!ppvObject)
- return E_POINTER;
- if (riid == IID_IUnknown) {
- *ppvObject = static_cast<IUnknown*>(this);
- } else {
- *ppvObject = NULL;
- return E_NOINTERFACE;
- }
- AddRef();
- return S_OK;
-}
-
-STDMETHODIMP_(ULONG) SourceResolver::State::AddRef(void)
-{
- return InterlockedIncrement(&m_cRef);
-}
-
-STDMETHODIMP_(ULONG) SourceResolver::State::Release(void)
-{
- LONG cRef = InterlockedDecrement(&m_cRef);
- if (cRef == 0)
- delete this;
- // For thread safety, return a temporary variable.
- return cRef;
-}
-
-IMFSourceResolver* SourceResolver::State::sourceResolver() const
-{
- return m_sourceResolver;
-}
-
-bool SourceResolver::State::fromStream() const
-{
- return m_fromStream;
-}
-
diff --git a/src/plugins/wmf/player/sourceresolver.h b/src/plugins/wmf/player/sourceresolver.h
deleted file mode 100644
index 18eb737..0000000
--- a/src/plugins/wmf/player/sourceresolver.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef SOURCERESOLVER_H
-#define SOURCERESOLVER_H
-
-#include "mfstream.h"
-#include "qmediaresource.h"
-
-class SourceResolver: public QObject, public IMFAsyncCallback
-{
- Q_OBJECT
-public:
- SourceResolver(QObject *parent);
-
- ~SourceResolver();
-
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
- STDMETHODIMP_(ULONG) AddRef(void);
- STDMETHODIMP_(ULONG) Release(void);
-
- HRESULT STDMETHODCALLTYPE Invoke(IMFAsyncResult *pAsyncResult);
-
- HRESULT STDMETHODCALLTYPE GetParameters(DWORD*, DWORD*);
-
- void load(QMediaResourceList& resources, QIODevice* stream);
-
- void cancel();
-
- void shutdown();
-
- IMFMediaSource* mediaSource() const;
-
-Q_SIGNALS:
- void error(long hr);
- void mediaSourceReady();
-
-private:
- class State : public IUnknown
- {
- public:
- State(IMFSourceResolver *sourceResolver, bool fromStream);
- ~State();
-
- STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObject);
-
- STDMETHODIMP_(ULONG) AddRef(void);
-
- STDMETHODIMP_(ULONG) Release(void);
-
- IMFSourceResolver* sourceResolver() const;
- bool fromStream() const;
-
- private:
- long m_cRef;
- IMFSourceResolver *m_sourceResolver;
- bool m_fromStream;
- };
-
- long m_cRef;
- IUnknown *m_cancelCookie;
- IMFSourceResolver *m_sourceResolver;
- IMFMediaSource *m_mediaSource;
- MFStream *m_stream;
- QMutex m_mutex;
-};
-
-#endif
diff --git a/src/plugins/wmf/wmf.pro b/src/plugins/wmf/wmf.pro
deleted file mode 100644
index d0b4ec3..0000000
--- a/src/plugins/wmf/wmf.pro
+++ /dev/null
@@ -1,16 +0,0 @@
-load(qt_module)
-
-TARGET = wmfengine
-QT += multimedia-private network multimediawidgets-private
-PLUGIN_TYPE=mediaservice
-
-load(qt_plugin)
-
-DESTDIR = $$QT.multimedia.plugins/$${PLUGIN_TYPE}
-
-DEPENDPATH += .
-
-HEADERS += wmfserviceplugin.h
-SOURCES += wmfserviceplugin.cpp
-
-include (player/player.pri)
diff --git a/src/plugins/wmf/wmfserviceplugin.cpp b/src/plugins/wmf/wmfserviceplugin.cpp
deleted file mode 100644
index ccc4ada..0000000
--- a/src/plugins/wmf/wmfserviceplugin.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include <QtCore/qstring.h>
-#include <QtCore/qdebug.h>
-#include <QtCore/QFile>
-
-#include "wmfserviceplugin.h"
-#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER
-#include "mfplayerservice.h"
-#endif
-#include <qmediaserviceprovider.h>
-
-QStringList WMFServicePlugin::keys() const
-{
- return QStringList()
-#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER
- << QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER)
-#endif
- ;
-}
-
-QMediaService* WMFServicePlugin::create(QString const& key)
-{
-#ifdef QMEDIA_MEDIAFOUNDATION_PLAYER
- if (key == QLatin1String(Q_MEDIASERVICE_MEDIAPLAYER))
- return new MFPlayerService;
-#endif
-
- //qDebug() << "unsupported key:" << key;
- return 0;
-}
-
-void WMFServicePlugin::release(QMediaService *service)
-{
- delete service;
-}
-
-QMediaServiceProviderHint::Features WMFServicePlugin::supportedFeatures(
- const QByteArray &service) const
-{
- if (service == Q_MEDIASERVICE_MEDIAPLAYER)
- return QMediaServiceProviderHint::StreamPlayback;
- else
- return QMediaServiceProviderHint::Features();
-}
-
-QList<QByteArray> WMFServicePlugin::devices(const QByteArray &service) const
-{
- return QList<QByteArray>();
-}
-
-QString WMFServicePlugin::deviceDescription(const QByteArray &service, const QByteArray &device)
-{
- return QString();
-}
-
-Q_EXPORT_PLUGIN2(qtmedia_wmfengine, WMFServicePlugin);
-
diff --git a/src/plugins/wmf/wmfserviceplugin.h b/src/plugins/wmf/wmfserviceplugin.h
deleted file mode 100644
index 9bcffaf..0000000
--- a/src/plugins/wmf/wmfserviceplugin.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the Qt Mobility Components.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef WMFSERVICEPLUGIN_H
-#define WMFSERVICEPLUGIN_H
-
-#include "qmediaserviceproviderplugin.h"
-
-QT_USE_NAMESPACE
-
-class WMFServicePlugin
- : public QMediaServiceProviderPlugin
- , public QMediaServiceSupportedDevicesInterface
- , public QMediaServiceFeaturesInterface
-{
- Q_OBJECT
- Q_INTERFACES(QMediaServiceSupportedDevicesInterface)
- Q_INTERFACES(QMediaServiceFeaturesInterface)
-public:
- QStringList keys() const;
- QMediaService* create(QString const& key);
- void release(QMediaService *service);
-
- QMediaServiceProviderHint::Features supportedFeatures(const QByteArray &service) const;
-
- QList<QByteArray> devices(const QByteArray &service) const;
- QString deviceDescription(const QByteArray &service, const QByteArray &device);
-};
-
-#endif // DSSERVICEPLUGIN_H
diff --git a/src/src.pro b/src/src.pro
deleted file mode 100644
index f29fb11..0000000
--- a/src/src.pro
+++ /dev/null
@@ -1,19 +0,0 @@
-TEMPLATE = subdirs
-CONFIG += ordered
-
-library_qgsttools.subdir = $$IN_PWD/gsttools
-library_qgsttools.depends = multimedia
-
-library_qtmmwidgets.subdir = $$IN_PWD/multimediawidgets
-library_qtmmwidgets.depends = multimedia
-
-SUBDIRS += multimedia
-
-contains(config_test_gstreamer, yes) {
- SUBDIRS += library_qgsttools
-}
-
-SUBDIRS += library_qtmmwidgets
-SUBDIRS += imports
-SUBDIRS += plugins
-